0
我有一個創建我的WCF服務客戶端的類。在關閉超時時創建WCF客戶端的新實例?
是否有可能創建新的實例,每當服務超時?我的意思是每次出,關,開,接。但閉幕對我來說更重要。
如下所示:
public class ServiceClientFactory
{
private static SmartServiceClient _client;
internal SmartServiceClient Client
{
get
{
if (_client is not closed && _client != null) return _client;
_client = new SmartServiceClient();
return _client;
}
}
}
此代碼似乎創建調用服務的客戶端,而不是服務本身 – 2015-02-10 08:48:21
@TomRedfern:你說得對。我實際需要它,我編輯了標題 – 2015-02-10 08:53:09
僅供參考編輯我的答案以簡化代碼 – 2015-02-10 14:40:37