MessageBox确认服务已收到消息时,WCF服务超时(控制台输出正常) [英] WCF Service timeout when MessageBox confirmes that service received a message (consoleoutput works))

查看:80
本文介绍了MessageBox确认服务已收到消息时,WCF服务超时(控制台输出正常)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

晚上好,
我刚刚遇到了一个我无法理解的奇怪问题.
我有一个WCF服务,可以接收消息(字符串).非常简单,就在书中.
客户端将消息发送到可以正常工作的服务.

这是奇怪的部分:
我在承载该服务的窗体中添加了一个MessageBox,该服务弹出并显示收到的消息(简单字符串).
一切似乎都像魅力一样.
然后,我将收到的超时减少到5秒.并意外打开了消息框(抓着新鲜的咖啡),这导致客户端在5秒钟后抛出超时异常.
我只是从未注意到这一点,因为超时时间是60秒之前,而且我从未将MessageBox打开那么长时间.

当我写到控制台而不是打开消息框时,一切都再次发生,就像从未发生过一样...

这是怎么回事... MessageBox是否会以某种方式阻止客户端发送消息或类似的消息(我希望我不要留下完全愚蠢的伪装* LG *)?
我只是好奇这里发生了什么,也许有人可以这么客气,并向我解释一下;)

我知道MessageBox会阻止该应用程序,但是当服务主机显示该消息时,我并不希望它导致客户端超时.

祝您度过一个愉快的夜晚
Andy

Good evening,
I just experienced a strange problem that I just can not understand.
I have a WCF service that can receive messages (string). Very simple, right out of the book.
The client sends the message to the service which works fine.

Here comes the strange part:
I added a MessageBox to the form hosting the service that pops up and displays the received message(simple string).
Everything seems to work like a charm.
Then I reduced the received timeout to 5 sec. and left the messagebox accidentally open (grabbing fresh coffee), which caused the client to throw a timeout exception after 5 sec.
I just never noticed this, because the timeout was 60sec before and I never left the MessageBox open that long.

When I write to the console instead of opening the messagebox everything works again like it never happened...

What is happening here... does the MessageBox somehow blocks the client sending the message or something like that(I hope I do not leave a totally stupid implression *LG*)?
I am just curious whats going on here, maybe someone can be so kind and explain this to me ;)

I know that a MessageBox blocks the application, but I didn''t expected it to cause a timeout on the client when shown by the service-host.

have a great evening and best regards
Andy

推荐答案

如果您将MessageBox添加到服务中,当然会失败! MessageBox是一个阻塞调用,在关闭该对话框之前,甚至服务代码都不会执行任何代码.
If you added a MessageBox to the service, of course it''s going to fail! MessageBox is a blocking call and won''t let any code execute until the dialog is dismissed, even the service code.


只是因为该服务不返回任何值,所以不会"这表示它无法返回通话完成"状态.
Just because the service doesn''t return a value doesn''t mean that it can''t return a "call complete" status.


这篇关于MessageBox确认服务已收到消息时,WCF服务超时(控制台输出正常)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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