2011-03-25 197 views
0


我一直在試圖讓我的WCF使用Windows身份驗證。當匿名打開時,以下工作正常。已經搜索了很多互聯網文章,無法得到這個工作。由於WCF - IIS Windows身份驗證

這裏是我的配置:
IIS
基本身份驗證和Windows身份驗證開啓。
匿名關閉

客戶:

<system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
      <binding name="WSHttpBinding_IEchoService" 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"> 
        <transport clientCredentialType="Windows" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="Windows" negotiateServiceCredential="true" 
         algorithmSuite="Default" establishSecurityContext="true" /> 
       </security> 
      </binding> 

     </wsHttpBinding> 
    </bindings> 

    <client> 
     <endpoint address="http://id.unittest/Services/EchoService.svc" 
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IEchoService" 
      contract="IEchoService" name="WSHttpBinding_IEchoService"> 
      <identity> 
       <servicePrincipalName value="host/mikev-ws" /> 
      </identity> 
     </endpoint> 
    </client> 
</system.serviceModel> 

SERVER:

<system.serviceModel> 

    <behaviors> 
     <serviceBehaviors> 
      <behavior name="MyServiceTypeBehaviors"> 
       <serviceMetadata httpGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="true" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service name="Project.API.Services.EchoService" behaviorConfiguration="MyServiceTypeBehaviors"> 
      <endpoint address="" binding="wsHttpBinding" contract="Project.API.Services.IEchoService" /> 
      <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/> 
     </service> 
    </services> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> 

</system.serviceModel> 
+0

您是否在調用webmethod的同時傳遞憑據... – sajoshi 2011-03-25 02:53:50

回答

0
在以下鏈接

WCF error: The caller was not authenticated by the service

按以下給出的答案Sandip,它的第二個答案。

+0

謝謝您的建議,因爲它幫助我在無盡的搜索中花費了數天時間。我不接近解決方案。我將要問一個包含沙盒項目的新問題。我敢打賭,其他人會發現你鏈接到另一個有用的頁面。 – 2011-03-29 04:56:21