WCF 服务的安全设置需要匿名身份验证

Security setting for WCF service requires anonymous authentication

我正在尝试创建 WCF 服务,但出现以下错误。 错误:此服务的安全服务需要匿名身份验证。 我发现了类似的问题,但他们的解决方案对我不起作用。

 <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="CMSUI.DataServiceAspNetAjaxBehavior">


          <enableWebScript/>
        </behavior>
      </endpointBehaviors>

</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
  <service name="CMSUI.DataService" >
    <endpoint address="" behaviorConfiguration="CMSUI.DataServiceAspNetAjaxBehavior"
      binding="webHttpBinding" contract="CMSUI.DataService" />
  </service>
</services>

感谢您的帮助。

目前我在 iis 中启用了匿名访问并在 web.config 中禁用了匿名访问。它解决了我的问题。

web.config

 <authorization>
    <deny users="?" />
    <allow users="*"/>
 </authorization>