释放服务端WCF服务的连接 [英] Release connection of WCF service at the server side

查看:34
本文介绍了释放服务端WCF服务的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了 WCF 中连接受限的问题.我的 WCF 服务托管在 IIS 中,我的 Windows 窗体应用程序客户端连接到 WCF.在Windows_Closed事件中,我调用client.Close()方法通知WCF服务我退出了",但是在我的客户端崩溃的情况下,我的客户端和WCF服务之间的连接仍然存在一段时间,我模拟了10个崩溃时间然后我的应用程序不再工作了.

I have faced the problem with the connection limited in WCF. My WCF service was hosted in IIS and my windows form application client connects to WCF. In the Windows_Closed event, I call the client.Close() method to notify the WCF service that "I quit" but in cases of my client crashed, the connection between my client and WCF service still exists for a time, I simulated 10 crashed time then my app did not work anymore.

问题是,如何释放 WCF 和崩溃客户端之间的连接?因为服务器的 maxConnections 是有限的,例如等于 10.

And the question is, how to release the connection between WCF and crashed client? because the maxConnections of the server is limited and equal to 10 for example.

谢谢!

推荐答案

如果您使用 ReliableSession,您可以使用 InactivityTimeout,正如 Brijesh 指出的那样.否则,您应该利用基本的 WCF 超时.

You could use the InactivityTimeout as Brijesh points out if you are using ReliableSession. Otherwise you should leverage the basic WCF timeouts.

请参阅超时 WCF 服务,了解每个超时的实现方式.

See Timeouts WCF Services for a description of how each timeout is implemented.

超时对于开发者来说通常是一个烦恼,但这正是它们存在的目的.

Timeouts are often an annoyance for developers, but this is precisely the purpose for which they exist.

这篇关于释放服务端WCF服务的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆