我這裏有一個WCF雙工服務,該requierement是回調到客戶端應該有10秒的超時,爲此服務的我的web.config文件看起來像這樣:更改WCF默認的超時
<bindings>
<basicHttpBinding>
<binding name="simulatorEndpoint" closeTimeout="00:00:10" openTimeout="00:00:10"
receiveTimeout="00:00:10" sendTimeout="00:00:10" 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="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<wsDualHttpBinding>
<binding name="wsdualEndpoint" closeTimeout="00:00:10" openTimeout="00:00:10"
receiveTimeout="00:00:10" sendTimeout="00:00:10" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" clientBaseAddress="http://localhost:1235"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:00:10" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
在客戶端,app.config文件中的綁定與相同的超時值相同。
現在的效果是,如果客戶端向服務器發送請求,超時時間爲10秒。但另一方面,如果服務向客戶端發送回調,則超時爲1分鐘。這很奇怪...顯然超時正確設置在客戶端...但不是在服務...我如何更改服務的超時?
PS:我使用Visual Studio 2010和它與approbiate ASP.NET開發服務器10.0.0.0
當我的這種行爲客戶得到stucked當他試圖第一次調用服務的方法,其他超時(如代碼片段中所示)已經設置。是否有可能以某種方式WCF忽略我的設置並將所有TimeOut值設置回默認值? 有沒有一種方法來設置服務超時以編程方式我讀了一個關於這裏的線程,但解決方案對我來說不是很有吸引力 但是我在我的假設,當服務回調到客戶端..這是超時-duration與客戶端的超時設置無關嗎? – 2010-02-11 12:16:36
這似乎是從https://msdn.microsoft.com/zh-CN/library/hh924831(v=vs.110).aspx逐字採取的。當您從在線來源複製逐字記錄時,您必須引用來源。我已經爲你修好了。 – 2015-06-30 08:37:28