【发布时间】:2011-01-29 14:43:42
【问题描述】:
一种愚蠢的错误,但是当我想通过服务器端服务(WCF Duplex)调用客户端时发生这种情况:
无法在分配的 wcf 回调超时 00:01:00 内传输消息,可靠通道的传输窗口中没有可用空间
还有mysterious happened too。在登录方法中,当我调用服务时,如果用户名和密码错误,我会找到 sender-callback,然后在发件人上调用GetError 方法以显示诸如“用户错误”之类的逻辑错误。这很好用,但如果用户和密码正确并且可以访问,我会收到该错误(所有其他客户端方法相同 - 在所有这些方法中,我发送的数据比简单字符串多,我发送的是 geterror)!
编辑 2: 正如我在大多数回调方法中所说,我发送的数据类似于数据上下文 (LINQ to SQL) 数据类(列表或单行)。所以这可能是我的问题!
(但这不是我第一次使用 WCF-duplex,还使用回调方法中的发送数据结构,我太震惊了。)
在那个错误之后我也得到了这个错误,
屏幕无法处理来自服务http://server:15450/service.svc 灾难性故障的请求
编辑 3: 服务配置:
<system.serviceModel>
<services>
<service name="ContactServer.Business.ContactService"
behaviorConfiguration="ServiceBehavior">
<endpoint address=""
binding="wsDualHttpBinding"
contract="ContactServer.Business.IContactService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange"
name="MexBinding"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
和客户端配置
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_ContactService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1408/ContactService.svc"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_ContactService"
contract="ServiceReference.ContactService" name="WSDualHttpBinding_ContactService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
更多信息:我使用 .NET 3.5 和 Visual Studio 2010。在客户端超时后,我仍然遇到同样的错误,with 00:01:00 Time。为什么会这样?
【问题讨论】:
-
@Rev:这个故事很精彩,但我们需要更多关于您的服务的信息——服务和回调行为、服务和回调合同等。还有关于您的客户端应用程序的类型。顺便提一句。不要通过 WCF 发送 DataContext - 它不起作用。
-
也许您在 WPF 或 Silverlight 中有一个著名的问题,您应该在其中指定 ConcurrencyMode=Reentrant。
-
@Ladislav:我不通过服务或回调发送全部数据上下文,只发送一两个数据类(单行或列表
)。 -
您是否尝试过在没有安全模式的情况下调用服务?只需使用标准设置。 ConcurrencyMode 也不应该改变任何东西,找到客户端无法调用服务的确切错误。
-
@Rev 另一个原因可能是序列化。当我发送实体但序列化程序试图序列化所有关系时,我遇到了与 EF 类似的问题。在您的示例中,我将尝试传递一个简单的虚幻对象,如果它没有错误地工作 - 在数据上下文中搜索错误。
标签: c# .net wcf service duplex