While having “Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.” error occurs, there is another cause other than IIS authentication mode mismatch between application configuration file setting and IIS setting. (If hosted in IIS)
In .Net 4.0, each WCF service has its default behavior, if somehow your WCF class name mismatch in your codes and configuration, you applied the default behavior as system cannot retrieve customized behavior.
To check this, first open the .svc file, the definition should be look like this:
<%@ ServiceHost Language="C#" Debug="true" Service="testService.Service" CodeBehind="~/App_Code/Service.cs" %>
Check your WCF service setting in application configuration file,
<services><service name="testService.Service"><endpoint name="myService" address="" binding="basicHttpBinding" contract="testService.IService"></endpoint></service></services>
Check the contract name and .cs file is exactly the same in codes and .config files.
沒有留言:
張貼留言