This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / silverligth+WCF callback 问题。要实现,会有performance impact吗?有两个地方考虑。一是web client <-> web server。虽然是SL,应该是和javascript callback/ajax差不多的原理吧。不知道这在内部是怎么实现的。会给web server造成影响嘛?然后web server <-> MT的wcf callback,web server会hold一个active connection到MT吗?这样会对web server和MT的socket resource有影响吗?
-huaanliu(steve);
2010-8-24
{271}
(#6242521@0)
-
没人问答,我这个半桶水来瞎说说。
-tjhong(啊哈);
2010-8-25
{626}
(#6245015@0)
-
问个问题,这种异步的线程函数怎样强行终止?比如我有这样一个代理Action
main()
{
Action a = ()=>
{
f();
};
a.BeginInvloke(s=>
{
Action x = (Action)s.AsyncStatue;
x.EndInvoke();
},a);
Console.ReadLine();
}
void f() { while(true); }
f()是一个永远不会结束的函数,我想用外力终止这个异步线程,该怎么做?
用普通的多线程我知道可以用About()等等强行终止,但是对于异步调用,我没找到答案
多谢
-binghongcha76(一只大猫);
2010-8-31
{372}
(#6253048@0)
-
简单的方法定义一个全局变量,别的线程修改它,在f()里用它判断是否终止,f()里每做一步还要让它休息一下(Thread.CurrentThread.Sleep(1); ), 以便让别的线程有机会运行。
-tjhong(啊哈);
2010-8-31
(#6253305@0)
-
可是现实是我无法修改f()
-binghongcha76(一只大猫);
2010-8-31
(#6253374@0)
-
把活放BackgroundWorker Class 里,它提供终止的方法。再不行,就关机器。
-tjhong(啊哈);
2010-8-31
{10}
(#6253520@0)
-
^_^ ,我觉得这是异步调用架构的一个缺陷,微软应该提供一个函数强行终止后台线程,而不是单纯的在那里等待线程结束,但愿.Net 5.0能够解决这个问题
-binghongcha76(一只大猫);
2010-8-31
(#6253560@0)
-
这不都在有了BackgroundWorker.CancelAsync Method
Thread.Abort
和前面说的方法
-tjhong(啊哈);
2010-8-31
{66}
(#6253577@0)
-
who designed this? ask him...
-ariso(ariso);
2010-8-31
(#6253537@0)
-
Web is stateless.
web client address is varying over time.
even if the connection isn't closed immediately on the server side, the server has no way to know where the client is in the next second.
pls look at WCF duplex .
-spj(spj);
2010-8-31
(#6253317@0)
-
我想着binginInvoke, 用wsDualHttpBinding是个好方法。
-tjhong(啊哈);
2010-8-31
(#6253525@0)
-
web server <-> MT的wcf callback,要是用nettcpbinding,web server是会hold一个active connection的。当然我想这样也会对web server和MT的socket resource有影响因为每一个callback要用一个socket port嘛。 还没试wsdualhttpbinding。但我想原理应该还是差不多吧。web server总还是要keep an active connection (http connection in this case) open for callback 嘛。
-huaanliu(steve);
2010-9-2
{273}
(#6256224@0)
-
+1. 我猜你是对的,要不然微软不会说"Note that the event-like behavior of duplex services only works within a session. "。
-tjhong(啊哈);
2010-9-2
(#6256362@0)