下面是一个示例代码什么时候执行WCF服务中Service.svc的默认构造函数?
[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
public class Service : IService
{
public Service()
{
// here I am getting value from web.config
// using configurationManager which will be
// changing frequently
}
//Method1
....
//Method2
.....
}
当将是我服务的构造函数将被执行? 在第一次请求或每次请求期间?
每当消费者创建服务实例时,它都会被调用。 –