WCF Raw Answer in .NET 4.5

I am working on a client application to use the SOAP web service. SOAP web services added as a service reference. It connects to the IBM server, and the server requires basic WS-Security authentication.

Called with default settings and received an error (no authentication header)

The modified code looks like this:

    var service = new RealTimeOnlineClient();
    service.ClientCredentials.UserName.UserName = "xxxxx";
    service.ClientCredentials.UserName.Password = "yyyyy";

Now, when I look at the answer in Fiddler - it works correctly (I get the expected envelope from the server), I get the correct envelope.

However, I get an exception from WCF:

Security processor was unable to find a security header in the message. This might be because the message is an unsecured fault or because there is a binding mismatch between the communicating parties. This can occur if the service is configured for security and the client is not using security.

SO HotFix Microsoft, EnableUnsecuredResponse. , , . security web.config ( ).

, .NET 3.5 2009-2010 . 4.5 , ? ?

+3
1

, "EnableUnsecureResponse"

var service = new RealTimeOnlineClient();
service.ClientCredentials.UserName.UserName = "xxxxx";
service.ClientCredentials.UserName.Password = "yyyyy";

var elements = service.Endpoint.Binding.CreateBindingElements();
elements.Find<SecurityBindingElement>().EnableUnsecuredResponse = true;
service.Endpoint.Binding = new CustomBinding(elements);
+8

All Articles