0

当我在 IIS Developer Express 中托管“WCF 4 Rest Service Template”项目(来自模板)时,我得到以下信息:

IIS 指定身份验证方案“IntegratedWindowsAuthentication, Anonymous”,但绑定仅支持指定一个身份验证方案。有效的身份验证方案是 Digest、Negotiate、NTLM、Basic 或 Anonymous。更改 IIS 设置,以便只使用一个身份验证方案。

除了将automaticFormatSelectionEnabled设置为 false 以返回 JSON之外,我没有明确更改任何配置:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <standardEndpoints>
      <webHttpEndpoint>
            <!--Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
            via the attributes on the <standardEndpoint> element below-->
        <standardEndpoint name="" 
                          helpEnabled="true" 
                          automaticFormatSelectionEnabled="false"
                          />
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>

如果未明确设置端点配置是问题,那么我将如何为此类服务执行此操作,以便明确设置服务的身份验证方案以避免 iis developer express 出现此问题?

注意:我在应用程序的 Web 服务项目/bin文件夹中有以下程序集Microsoft.Web.dllMicrosoft.Web.Administration.dll ,如 iss 团队博客上的跳频 WCF 服务的解决方法中所述: http:// blogs.iis.net/vaidyg/archive/2010/07/21/wcf-workaround-for-webmatrix-beta.aspx

4

1 回答 1

2

您将需要禁用不需要的身份验证方案,我猜是 Windows 身份验证。所以:

  1. 启动记事本
  2. 在记事本文件中打开:%userprofile%\Documents\IISExpress8\config\applicationhost.config
  3. 搜索 <windowsAuthentication
  4. 将 enabled 属性从 true 更改为 false
  5. 节省

这将禁用所有站点的 Windows 身份验证,您也可以在文件底部为特定站点(在本例中为 YourSite)的最后 </configuration> 行之前添加一个位置路径添加:

<location path="YourSite" overrideMode="Allow">
    <system.webServer>
        <security>
            <windowsAuthentication enabled="false" />
        </security>
    </system.webServer>
</location>

这只会为特定站点禁用它。

于 2010-08-12T20:53:13.120 回答