System.NotSupportedException: Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.
A Google search shows that this isn't a novel situation, but I couldn't get the configuration and incantation right for Web API. Luckily, after a couple of hours of researching and fiddling with the web.config, I came across this post that revealed the solution to me.
When registering the service route:
var config = new HttpConfiguration();
config.Security = (u, s) => {
s.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Windows;
s.Mode = HttpBindingSecurityMode.TransportCredentialOnly;
};
routes.MapServiceRoute<YourType>("YourRoutePrefix", config);
I hope that this post saves someone some time.
Thank you! I have been trying to figure this out all of yesterday. Works with self hosted HttpServiceHost.
ReplyDeleteThank you! It's work :)
ReplyDelete