I have a WCF service with the following binding:
<basicHttpBinding> <binding name="bind" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message algorithmSuite="Default" clientCredentialType="UserName"/> </security> </binding> </basicHttpBinding>
I consume it dynamically in code with this endpoint:
BasicHttpBinding binding = new BasicHttpBinding(); binding.Name = "bind"; binding.MaxBufferSize = int.MaxValue; binding.MaxReceivedMessageSize = int.MaxValue; ServiceEndpoint endPoint = new ServiceEndpoint(ContractDescription.GetContract(typeof(ImyContract)), binding, new EndpointAddress(endPointAddress)); endPoint.Name = name; ChannelFactory<ImyContract> channelFactory = new ChannelFactory<ImyContract>(endPoint);
When I look at the service, everything works exactly as expected, however when connecting through the application I get:
Content Type Text / xml; charset = utf-8 is not supported by the http: //localhost/SynchronizationService/SyncService.svc/DataBinding service . Customer and service relationships may not be compatible.
I understand that this error often occurs because basicHttpBinding using SOAP 1.1 and wsHttpBinding uses 1.2, however I do not use SSL on the server and have a different endpoint that uses streaming, so switching is not an option for me. What am I doing wrong, what prevents me from using the service correctly?
UPDATE:
In addition, I do not use basicHttpBinding by default on the client, but I set the security according to the expected server. I set security using this method:
private static BasicHttpSecurity SetEndpointSecurity() { BasicHttpSecurity security = new BasicHttpSecurity(); HttpTransportSecurity transport = new HttpTransportSecurity(); BasicHttpMessageSecurity message = new BasicHttpMessageSecurity(); security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; transport.ClientCredentialType = HttpClientCredentialType.Windows; transport.ProxyCredentialType = HttpProxyCredentialType.None; transport.Realm = ""; message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; message.AlgorithmSuite = System.ServiceModel.Security.SecurityAlgorithmSuite.Default; security.Transport = transport; security.Message = message; return security; }
source share