[英]WCF Windows Authentication Error
我正在嘗試通過WCF控制台應用程序使用服務。 但是我得到的唯一響應是“遠程服務器返回了意外的響應:(400)錯誤的請求。”
該服務配置有以下選項:
<services>
<service name="TryOut.BasicService" behaviorConfiguration="NicksBasicBehavior">
<host>
<baseAddresses>
<add baseAddress="http://192.168.10.67:8000/Service" />
</baseAddresses>
</host>
<endpoint address ="http://192.168.10.67:8000/Service"
name="NicksEndpoint"
binding="basicHttpBinding"
contract="TryOut.IBasicService"
bindingConfiguration="BasicBinding"
/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="NicksBasicBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<binding name="BasicBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows"/>
</security>
</binding>
我的客戶端的配置文件如下:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NicksEndpoint" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.10.67:8000/Service" binding="basicHttpBinding"
bindingConfiguration="NicksEndpoint" contract="ServiceReference1.IBasicService"
name="NicksEndpoint" />
</client>
現在,當我在與服務相同的PC上啟動客戶端時,一切正常。 但是,如果我嘗試在不在服務器PC的域中的計算機上運行客戶端,盡管我在客戶端代碼中提供了登錄信息,但是會收到錯誤消息:
c.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("Nick", "password", "mydomain");
有人知道我在做什么錯嗎,我該如何解決? 感謝你在期待!
您是否嘗試過在客戶端端點的標識元素中指定userPrincipalName?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.