2011-10-20 33 views
1

在IIS7上擁有託管的WCF服務,.net 3.5sp1以及運行應用程序池的域帳戶。我想要Windows身份驗證,wsHttpBinding和匿名關閉。刪除MEX終結點,設置郵件的安全性,但仍然得到:wsHttp綁定IIS7上的WCF服務(僅限Windows驗證)

此服務的安全設置需要「匿名」身份驗證,但它沒有爲承載此服務的IIS應用程序啓用。

我嘗試了大約50個不同的web.config配置,但沒有喜悅。

當前的web.config:

<system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="PressReleaseService.PRBehavior"> 
       <serviceMetadata httpGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="true" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service behaviorConfiguration="PressReleaseService.PRBehavior" name="PressReleaseService.PR"> 
      <endpoint address="" binding="wsHttpBinding" contract="PressReleaseService.IPR"> 
       <identity> 
        <dns value="localhost"/> 
       </identity> 
      </endpoint> 
     </service> 
    </services> 
    <bindings> 
     <wsHttpBinding> 
      <binding name="WSHttpBinding_IPR" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 
      transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
      textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       <reliableSession ordered="true" inactivityTimeout="00:10:00" 
       enabled="false" /> 
       <security mode="Message"> 
        <message clientCredentialType="Windows" negotiateServiceCredential="false" 
        algorithmSuite="Default" establishSecurityContext="true" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 
</system.serviceModel> 

此外,還有相同的應用程序池下運行的其他服務,它已經墨西哥,有WsHttpBinding的主要終點,而它只有在啓用Windows身份驗證IIS。

任何線索?

回答

2

在IIS7的解決方案:

在web.config文件中的以下行:

<serviceMetadata httpGetEnabled="true" /> 

要求匿名訪問給予HTTP訪問.svc文件。要授予此權限,請打開IIS管理器並禁用匿名身份驗證,並在應用程序的頂部啓用Windows身份驗證。然後,進入'內容視圖'選項卡並右鍵單擊您的.svc文件。選擇'切換到功能視圖'。這會導致.svc文件被添加到左側的目錄樹中。從那裏,您可以在IIS下轉到'身份驗證',並將匿名身份驗證設置爲啓用。現在,您可以匿名訪問mex端點(我將其添加回),但在其他地方都有Windows身份驗證。這樣做的結果是看起來像這樣的c:\ Windows \ System32 \ inetsrv \ config \ applicationHost.config文件中的更改:

<location path="Default Web Site/PRService_Dev"> 
    <system.webServer> 
     <security> 
      <authentication> 
       <anonymousAuthentication enabled="false" /> 
       <windowsAuthentication enabled="true" /> 
      </authentication> 
     </security> 
    </system.webServer> 
</location> 
<location path="Default Web Site/PRService_Dev/PR.svc"> 
    <system.webServer> 
     <security> 
      <authentication> 
       <anonymousAuthentication enabled="true" /> 
      </authentication> 
     </security> 
    </system.webServer> 
</location> 
0

您必須使用傳輸安全性將身份驗證委派給IIS,並使用您在IIS中配置的設置。 Windows身份驗證在這種情況下。

<安全模式= 「運輸」 > <運輸clientCredentialType =的 「Windows」/ > < /安全>

與clientCredentialType消息認證意味着你要使用Kerberos消息安全所以只能匿名應該啓用在IIS上。