Windows authentication for WCF web services error

时间:2022-08-24 08:23:40

WCF Web服务的Windows身份验证在部署到IIS时,默认网站添加应用程序的方式。浏览运行.svc文件报错。

错误代码:

The authentication schemes configured on the host ('IntegratedWindowsAuthentication') do not allow those configured on the binding 'BasicHttpBinding' ('Anonymous').  Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly.  Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the <serviceAuthenticationManager> element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement. 

解释:
主机上配置的身份验证方案(“integratedWindowsAuthentication”)不允许在绑定“basichttpbinding”(“anonymous”)上配置这些方案。请确保SecurityMode设置为Transport或TransportCredentially。此外,还可以通过以下方法解决此问题:通过IIS管理工具、通过应用程序配置文件中的servicehost.authentication.authentication schemes属性(位于<serviceauthenticationmanager>元素)更改此应用程序的身份验证方案,方法是更新绑定上的ClientCredentialType属性,或通过调整httpTransportBindingElement上的AuthenticationScheme属性。

 

解决办法一:

IIS中选择刚才新建的应用程序,右侧功能视窗中找到 身份认证,点进去 开启匿名身份验证。

再次浏览运行,svc文件,ok了。