wpf程式,使用WCF提供服務,服務端有兩個方法:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,ConcurrencyMode = ConcurrencyMode.Multiple)]
public sealed class WcfNamedPipeService : IWcfNamedPipeService
{
public bool test1()
{
Thread.Sleep(10000); //耗時10秒
return true;
}
public bool test2()
{
return false;
}
}
現在,同一個電腦雙開,有兩個客戶端,客戶端A和客戶端B同時進入訪問服務器。客戶端A呼叫test1方法,客戶端B呼叫test2方法。得到的結果是兩個客戶端都需要等待10秒才得到回傳值,可是客戶端B應該瞬間就得到回傳值啊,為什么也是要等10秒呢?
難道服務端執行都是串行的嗎?
uj5u.com熱心網友回復:
wcf都被淘汰了吧,你自己寫個服務,也簡單的很
uj5u.com熱心網友回復:
真的嗎?專案中還能用嗎?替代產品是什么?我自己不會寫呢,對各種協議一點不懂。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/266869.html
標籤:C#
下一篇:https下的POST請求
