WCF IServiceBehavior

时间:2011-10-03 17:48:12

标签: wcf

我有一个像这样的ServiceBehavior属性:

AdhocAuthenticationAndAuthorisation : IServiceBehavior
{
    public AdhocAuthenticationAndAuthorisation(string systemName, string serviceName)
    {
        //Some code here.
    }
    public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
    {
    }
    //+ Other interface members.
}

这用于一些身份验证和授权,Attribute用于引导稍后使用的一些上下文信息,上下文在Validate方法中设置,并且当我仅在一个服务上使用Attribute时工作正常相同的apppool。但是,在同一个apppool中的第二个服务(不同的服务接口)上,如果我同时实例化第二个服务,则永远不会运行第二个Attribute的Validate方法。如果我实例化第一个服务并等待5秒并实例化另一个服务,则调用validate方法。

已在不同的绑定上测试,并且aspNetCompatibilityEnabled = on或off。服务在.net和iis 7.5上运行

有人知道如何解决这个问题吗?

0 个答案:

没有答案