我在我的wcf服務上設置TransportWithMessageCredential時遇到問題。TransportWithMessageCredential:Windows憑據未傳遞給WCF服務
使用wcf配置編輯器,我將模式設置爲TransportWithMessageCredential,將transportClientCredentialType設置爲Windows的web.config中的服務以及我的可執行文件的app.config。我在erver上安裝了一個自簽名的證書並配置了IIS以使用它。
當我運行我的測試應用程序時,收到以下錯誤: System.InvalidOperationException:未提供用戶名。在ClientCredentials中指定用戶名。
看來,Windows憑據沒有被傳遞給wcf服務,當我檢查credentialCache.defaultCredentials時,它們爲空。任何線索和/或提示爲什麼這是和如何解決它?在此先感謝
服務器2003 /在活動目錄域上的IIS 6.0。
的web.config服務
<service name="Test.DiagnosticService">
<endpoint binding="basicHttpBinding" bindingConfiguration="WindowsTransportCredentialBinding" name="ClientDiagnosticEndpoint" contract="Test.IDiagnostic" />
</service>
<basicHttpBinding>
<binding name="WindowsTransportCredentialBinding" maxBufferSize="524288"
maxReceivedMessageSize="524288">
<readerQuotas maxDepth="128" maxStringContentLength="1048576" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
的app.config可執行
<client>
<endpoint address="https://U-WM-3vIntegr8/test/Web/Services/Diagnostic.svc"
binding="basicHttpBinding" bindingConfiguration="ClientHttpEndpoint"
contract="Test.IDiagnostic" name="ClientDiagnosticEndpoint" />
</client>
<basicHttpBinding>
<binding name="ClientHttpEndpoint" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:02:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="4194304" maxBufferPoolSize="524288" maxReceivedMessageSize="4194304"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="1048576"
maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Windows" proxyCredentialType="Windows"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
...從客戶端調用
public static IDiagnostic GetDiagnosticService()
{
return new ChannelFactory<IDiagnostic>("ClientDiagnosticEndpoint").CreateChannel();
}