我在Asp.Net应用程序中托管了一些WCF服务,这些服务用于通过Ajax返回数据。 IIS(6.0)已启用Windows身份验证并关闭匿名访问。我已经在web.config的服务模型部分尝试了各种设置组合,但似乎无法获得正确的组合。我一直得到的错误是:
此服务的安全设置需要“匿名”身份验证,但不会为承载此服务的IIS应用程序启用此功能。
这是我的web.config
<configuration> <system.web> <authentication mode="Windows"/> </system.web>
<location path="~/Services">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web> </location>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<bindings>
<webHttpBinding>
<binding name="default">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="Windows"/>
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="AspNetAjaxBehavior">
<enableWebScript />
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="defaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="WFS.SIG.Client.USM.Web.Services.Desks">
<endpoint address="" behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" contract="WFS.SIG.Client.USM.Web.Services.Desks"/>
</service>
</services>
</system.serviceModel>
</configuration>
澄清这个问题的任何帮助都会很棒。
答案 0 :(得分:0)
您在web.config中的安全设置仅为仅传输:
<security mode="TransportCredentialOnly">
这意味着它在传输过程中已加密,但请求是匿名的。因此,您必须在IIS中启用匿名身份验证。
答案 1 :(得分:0)
@Shiraz Bhaiji - 如果您查看web.config,它将使用“TransportCredentialOnly”作为模式。事实证明,如果您启用了Windows身份验证并禁用了匿名,则需要将clientCredentialType更改为“Ntlm”。