2013-04-09 51 views
0

我正在嘗試編寫將通過Active Directory服務進行搜索的WCF服務。我想設置此服務使用我的固定憑據,所以我的密碼不會過期。WCF服務 - 模擬Web配置中的固定帳戶

這是我web.config看起來像:

<?xml version="1.0"?> 
<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    <authorization> 
     <allow users="?"/> 
    </authorization> 
    <authentication mode="Windows"/> 
    <identity impersonate="true" userName="mylogin" password="mypass" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="Mochrie.MyService" behaviorConfiguration="asdf"> 
     <endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpBinding" contract="Mochrie.IMyService" /> 
     </service> 
    </services> 


    <bindings> 
     <basicHttpBinding> 
     <binding name="httpBinding"> 
      <security mode="TransportCredentialOnly"> 
      <transport clientCredentialType="Basic" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 


    <behaviors> 
     <serviceBehaviors> 
     <behavior name="asdf"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 

不幸的是我收到著名的錯誤,並通過幾天它掙扎。 雖然試圖以瀏覽:http://localhost/Mochrie/MyService.svc?wsdl

The authentication schemes configured on the host ('IntegratedWindowsAuthentication') do not allow those configured on the binding 'BasicHttpBinding' ('Basic'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly. Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the <serviceAuthenticationManager> element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.

沒有任何人有機會來解決這個問題並正確設置WCF服務?

回答

0

嘗試

<binding name="MyBinding"> 

    <security mode="TransportCredentialOnly"> 

    <transport clientCredentialType="Windows" /> 

    </security> 

</binding> 

<binding name="MyBinding"> 

    <security mode="TransportCredentialOnly"> 

    <transport clientCredentialType="Ntlm" /> 

    </security> 

</binding> 

注意:您可以關閉模​​擬,但更改IIS AppPool(或WinService帳戶)標識代替

相關問題