My WCF Service uses wsHttpBinding and works fine from the client when the service is gerenated by the client using the default options as follows:
RServiceClient R = new RServiceClient();
However, at some point I’ll need to be able to specify the location of the service, presumably by changing the endpoint address as follows:
RServiceClient R = new RServiceClient(); R.Endpoint.Address = new EndpointAddress(new Uri 'http://xxx.xxxx.xxx:80/RServer/RService.svc'));
However, when I do specify the exact endpoint, I get a SecurityNegotiationException: System.ServiceModel.Security.SecurityNegotiationException was unhandled Message=’The caller was not authenticated by the service.’ Source=’mscorlib’….
The WCF service runs on IIS and has anonymous access enabled under IIS admin. Also, this error occurs when the client is run from the same machine as the service under an admin account – I havn’t got to the scary part of running it over the net yet!
Any Ideas?
By default, wsHttpBinding uses Windows authentication. I’m not sure how hosting in IIS affects that scenario.
If you don’t want security turned on, you can add an element for security and set the mode element to ‘None’ to the config on both ends to turn off the default setting.
I think this may do the trick — I’ve added the section for wsHttpBinding and set the bindingConfiguration of your service to point to the newly added binding properties: