2010-08-12 53 views
0

當我主持在IIS Developer Express公司的「WCF 4 REST服務模板」項目(從模板)我得到以下幾點:WCF 4 REST服務上的IIS Developer Express公司,身份驗證問題

IIS指定的認證方案'IntegratedWindowsAuthentication,Anonymous',但綁定只支持完全一個認證方案的規範。有效的認證方案是摘要,協商,NTLM,基本或匿名。更改IIS設置,以便只使用單個身份驗證方案。

我並沒有改變任何配置明確等,以返回JSON不是設置automaticFormatSelectionEnabled爲false:

<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開發人員表達此問題?

注:我有以下組件Microsoft.Web.dll & Microsoft.Web.Administration.dll在Web服務項目,在這裏hopsting WCF服務的解決方法描述應用程序的/bin中文件夾在問題團隊博客上: http://blogs.iis.net/vaidyg/archive/2010/07/21/wcf-workaround-for-webmatrix-beta.aspx

回答

2

您需要禁用不需要的身份驗證方案,我猜測Windows身份驗證。所以:

  1. 啓動記事本
  2. 用記事本打開文件:%USERPROFILE%\文件\ IISExpress8 \ CONFIG \對ApplicationHost.config
  3. 搜索< windowsAuthentication
  4. 變化從 真到假enabled屬性
  5. 保存

這將禁用所有站點的Windows身份驗證S,你可以或者在文件底部的最後< /配置前添加一個位置路徑>爲特定站點(YourSite在這種情況下)行添加:

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

這隻會禁用的特定的網站。