I don't require any sort of authentication, client and service won't be on the same machine and in different domains. When I try to connect to the service I get the following error.
'System.ServiceModel.Security.SecurityNegotiationException' Additional information: The caller was not authenticated by the service.
Hence I tried to turn off the security on service:
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="CustomDualBinding">
<security>
<message clientCredentialType="None" negotiateServiceCredential="false" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="WCFServiceWebRoleStockTrading.Service">
<endpoint address="Service.svc" binding="wsDualHttpBinding" bindingConfiguration="CustomDualBinding"
contract="WCFServiceWebRoleStockTrading.IService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Now when I try to run the service on its own I get this error message:
The service certificate is not provided. Specify a service certificate in ServiceCredentials.
But I don't need any security. Installing a service certificate means that I expect my clients to have installed the same certificate in order to authenticate, correct? This is not what I want though.
I am quite stuck on this, an advice would be really appreciated.
I seem to have found it. I found it difficult, getting it right with the WCF Config editor in Visual Studio. Best is to copy and paste this.
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="CustomDualBinding">
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="WCFServiceWebRoleStockTrading.Service">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="CustomDualBinding"
contract="WCFServiceWebRoleStockTrading.IService" />
</service>
</services>
...
</system.serviceModel>
In the client make sure to have this in your configuration:
Uri baseAddress = new Uri("http://xxx.cloudapp.net/Service.svc");
WSDualHttpBinding wsd = new WSDualHttpBinding();
wsd.Security = new WSDualHttpSecurity() { Mode = WSDualHttpSecurityMode.None, Message = new MessageSecurityOverHttp() { ClientCredentialType = MessageCredentialType.None, NegotiateServiceCredential = false } };
EndpointAddress ea = new EndpointAddress(baseAddress);
InstanceContext site = new InstanceContext(this);
_client = new ServiceClient(site, wsd, ea);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.