我如何运行WCF服务的构造函数一次对所有客户端时,它的InstanceContextMode设置为PerSession?它的、设置为、函数、客户端

2023-09-07 15:27:14 作者:有你黑夜不黑暗。

如何运行code在WCF服务的构造函数只有一次当的 ServiceBehaviorAttribute.InstanceContextMode 设置为 PerSession

How can I run the code in the constructor of a WCF Service only once when the ServiceBehaviorAttribute.InstanceContextMode is set to PerSession?

[ServiceBehavior(
    InstanceContextMode = InstanceContextMode.PerSession, 
    ConcurrencyMode = ConcurrencyMode.Single)]
public class SomeService : ISomeService
{
    public SomeService()
    {
        this.RunThisOnceForAllClients();
    }

    private void RunThisOnceForAllClients() { }
}

或者,我怎么能在运行后自动WCF服务的方法运行,但它的只是将所有客户端上运行,一旦调用

请帮忙。先谢谢了。

我用href="http://msdn.microsoft.com/en-us/library/ms733069.aspx" rel="nofollow">托管Windows服务一个

 
精彩推荐
图片推荐