我有一個雙工WCF,它在本地主機(在本地運行時將我的應用程序連接到此WCF)完美工作。WCF雙工 - 客戶端無法在配置的超時內完成安全協商
現在我試圖託管它在我的IIS(服務器2008 R2標準),我創建一個Windows帳戶「神」,並在IIS中使用「神」身份的應用程序輪詢。
我可以從Web瀏覽器訪問從我的電腦本WCF(服務器以外),看看合同的XML,(點擊顯示在頁面內的鏈接)
時,試圖從我的應用程序訪問我得到以下例外:
客戶端無法在 配置的超時(00:00:00)內完成安全協商。目前的談判分支是1 (00:00:00)。
再次當WCF在本地運行我的應用程序工作正常。
我試圖使用跟蹤,但所有我看到的是成功的例外。
我的app.config是:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\log\Traces.svclog"/>
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_I_BridgeWCFService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="256" maxStringContentLength="2147483646"
maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646" />
<reliableSession ordered="true" inactivityTimeout="01:10:00" />
<security mode="Message" />
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://win-jj/_Bridge1/_BridgeWcfService.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_I_BridgeWCFService"
contract="_BridgeWcfServiceReference.I_BridgeWCFService"
name="WSDualHttpBinding_I_BridgeWCFService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
</startup>
</configuration>
我也試圖改變上面標識部分:<userPrincipalName value="GOD" />
,但後來我得到了另一個異常。
我的服務配置文件:web.config中:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_I_BridgeWCFService" closeTimeout="01:01:00" openTimeout="01:01:00" receiveTimeout="01:10:00" sendTimeout="01:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="256" maxStringContentLength="2147483646" maxArrayLength="2147483646" maxBytesPerRead="2147483646" maxNameTableCharCount="2147483646"/>
<reliableSession ordered="true" inactivityTimeout="01:10:00"/>
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default"/>
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="_BridgeNameSpace.Service1Behavior" name="_BridgeNameSpace._BridgeWCFService">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_I_BridgeWCFService" contract="_BridgeNameSpace.I_BridgeWCFService">
<identity>
<userPrincipalName value="GOD" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="_BridgeNameSpace.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
我也試圖改變上面標識部分:<dns value="localhost"/>
,但沒有改變
我連接到我的服務我的應用程序如下:
MyServiceClientProxy Proxy = null;
MyCallbackProxy myCallbackProxy = null;
myCallbackProxy = new MyCallbackProxy();
InstanceContext cntx = new InstanceContext(myCallbackProxy);
Proxy = new MyServiceClientProxy(cntx, "WSDualHttpBinding_I_BridgeWCFService");
Proxy.ClientCredentials.Windows.ClientCredential.UserName = "GOD";
Proxy.ClientCredentials.Windows.ClientCredential.Password = "yy";
try
{
Proxy.Open();
}
catch { return; }
BTW,試圖改變安全「何時」得到了以下異常(枯萎或不使用ClientCredential.Username &密碼爲上面的代碼):
The open operation did not complete within the allotted timeout of 00:00:59.1689524. The time allotted to this operation may have been a portion of a longer timeout.
任何想法,請幫助!
首先非常感謝雙工消息更簡單對於這個偉大的提示,所有的時間,我試圖與服務器玩,而我的本地PC(我只是關閉我的電腦firwale)問題,它的工作原理。 現在我有2個問題:1。我只需要在到之間更改配置文件中的文本,或者需要更多... 2.根據您的文章,您說如果服務器只允許端口80(這是我們的情況服務器),我將不得不繼續使用wsDualhttpBinding>,在這種情況下,我應該怎麼做才能讓應用程序獲得連接? –
Joseph
1。您需要更改端點使用的綁定,並且如果您希望允許大型消息將綁定配置從wsDualHttpBinding更改爲netTcpBinding - 您可以使用傳輸安全性而不是消息安全性。您是否可以不要求爲您的溝通打開額外的端口?如果沒有,你將不得不看看使用輪詢機制,如輪詢雙工綁定http://www.codeproject.com/Articles/43518/Silverlight-WCF-example-using-polling-duplex-with –
我沒有理解「你不能請求爲你的通信打開額外的端口?」,這意味着什麼,如果是的話,如果是的話,如果我不需要回電話,我會使用basicHttpBinding。 – Joseph