未调用 WCF 方法
我有一个非常奇怪的问题。我有一个 WCF 服务和一个调用其中一些方法的控制台应用程序。在某些时候,它无法再调用其中之一。它只是调用该方法,但从未进入该方法。它只是等啊等……什么也没有发生。
我应该以某种方式刷新服务客户端吗?我尝试创建一个新的服务客户端对象
QueryingServiceClient queryingClient = new QueryingServiceClient();
,然后再次调用该方法,但它不起作用。只是补充一下,在该方法停止工作之前,我多次调用该方法和其他几个方法。
有什么想法吗?
谢谢。
I have a very strange problem. I have a WCF service and a console application that invokes some of it methods. At some point, it can't invoke one of them any more. It just calls the method, but it never enters it. It just waits and waits.. and nothing ever happens.
Should I maybe somehow refresh the service client? I tried creating a new service client object
QueryingServiceClient queryingClient = new QueryingServiceClient();
and then to call the method again, but it didn't work. Just to add that I call that method and several other ones few times before it stops working.
Any ideas?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
假设:
问题可能是您耗尽了服务器上的可用槽数(在这种情况下是会话数),以至于达到了最大并发会话数。然后,您的客户端将根据定义的超时等待服务端关闭会话(在这种情况下显然永远不会发生)。
建议的修复:
编辑:
Assumptions:
The problem is probably that you are depleting the number of available slots (sessions in that case) on the server to the point where you are reaching the maximum number of concurrent sessions. Then your client will wait depending on the defined timeout for a session to be closed on the service side (which obviously will never happen in that case).
Suggested fixes:
EDIT:
停止前的次数是否相同?您是否已达到连接限制?
您的 WCF 服务是如何实例化的?
单例、会话、PerCall?
您可以发布您的客户端和服务器端点的配置部分吗?
如果您使用 WcfClient 工具,它的工作是否一致?
Is it the same number of times before it stops? Are you reaching a connection limit perhaps?
How is your WCF service instanced?
Singleton, Session, PerCall?
Could you post the config section for your client and server endpoint?
Does it work consistently if you use the WcfClient tool?
这很奇怪,它不会一直等下去。您应该收到 WCF 超时异常。 app.config 中的超时值是多少?
如果您没有收到任何超时异常,则可能是您没有调用该服务方法。我知道这很明显,但有时名称很长的方法可能会相互混淆。不过,如果您也在调试客户端,那么您一定已经排除了这种可能性。
That's strange, it wouldn't wait and wait forever. You should be getting a WCF timeout exception. What is the timeout value in your app.config?
If you aren't getting any timeout exceptions, then it might be the case you aren't calling that service method. I know it's obvious but sometimes methods with long names can be confused for each other. If you are debugging the client too, you must have ruled that out, though.
感谢您的回复。
这不是永远,我没有正确表达自己。一段时间后,我得到以下异常:
这是一个单例。这是 app.config 的一部分:
在提供者方面:
Thanks for your replies.
It's not forever, I didn't express myself correctly. After some time I get the following exception:
It's a singleton. This is part of the app.config:
On the provider side: