WCF - Security Negotiation Exception

I was recently presented by with an interesting WCF exception - SecurityNegotiationException was caught

The exception was occurring in a web solution that was trying to communicate with a WCF service I had previously developed and deployed.

The junior developer had consumed the service following documentation I had published. At that point all was well - the web solution was able to communicate with the service and the expected response was received. It was days after this that the error began occurring.

The WCF had not changed. Thus I knew issue must be with the web solution.

It transpired that the developer was running the website under the context of a user. As such the user credentials were being passed to the WCF service as security credentials. On the service side, being an internal WCF service and returning no sensitive data, the security mode of the binding was set to none.

So the immediate issue was quickly resolved by adding the following security node to the client binding:

<binding name="WSHttpBinding_IStockService">
	<security mode="None" />
</binding>