我有一个简单的服务,在wcf 3.5上有两个端点。一个是使用wshttpBinding的Web服务,而另一个是公开休息服务(webHttpbinding)。 它们工作正常,但现在我想将web身份验证添加到Web服务。我创建了一个配置文件,如下所示:
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="restBinding">
</binding>
</webHttpBinding>
<wsHttpBinding>
<binding name="wsBinding">
<security mode="Message">
<transport clientCredentialType="Windows"/>
<message clientCredentialType="Windows"
negotiateServiceCredential="true"
algorithmSuite="Default"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WcfRestService3.WsServiceHostBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="restBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="WcfRestService3.WsServiceHostBehavior" name="WcfRestService3.ServiceImpl">
<endpoint name="wsConnection" address="ws" binding="wsHttpBinding" bindingConfiguration="wsBinding" contract="WcfRestService3.IService" />
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
<endpoint name="restConnection" address="rest" binding="webHttpBinding" bindingConfiguration="restBinding" behaviorConfiguration="restBehavior" contract="WcfRestService3.IService" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
在IIS上我启用了Windows身份验证和匿名身份验证:我可以自由访问该服务。 当我禁用匿名身份验证时,我收到以下错误:
Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.
有什么想法吗?