【发布时间】:2011-07-15 10:59:02
【问题描述】:
在我的应用程序中,Winform UI 线程同步调用 WCF 方法。 99.99% 的情况下这是可以的,但有时对 WCF 方法的调用会被锁定并且 UI 会冻结。
我知道我可以通过使调用异步来防止 UI 冻结 - 我们的大多数 WCF 调用都是异步的 - 但我们认为让这个特殊的小方法同步并不是那么糟糕。
当 WCF 服务中发生锁定时,其他用户也无法访问该服务。我必须重启 WCF 服务主机(Windows 服务)才能解决问题。
WCF 服务如何被锁定且无法访问?
我想不出一个场景。
我们检查了数据库,它像往常一样运行。
技术细节: 我们在服务代理中使用代理。此服务代理及其代理在应用程序运行时保持活动状态。
[PreserveReferences]
[OperationContract(IsOneWay = false, AsyncPattern = false, Action = "MyMethod")]
MyType MyMethod();
正在使用的绑定:
<wsHttpBinding>
<binding name="AppWsHttpBindingConfig" transactionFlow="true" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="false" enabled="false" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
【问题讨论】:
-
澄清一下,您是自行托管 WCF 服务吗?
-
你有什么样的绑定? wsHttp,nettcp???
-
@Jonathan 我们有一个 Winform 客户端,它调用服务器上的一个方法; WCF 服务托管在此服务器上的 Windows 服务中。
-
@Yiğit wsHttpBinding;我添加了绑定配置。
-
@Gerard 这可能与处理客户端代理有关。有这个代码块用于关闭/中止代理。看看你是否还没有。 social.msdn.microsoft.com/Forums/en-US/wcf/thread/…