2011-03-25 258 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