Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Castle windsor WCF设施:控制服务生活方式_Castle Windsor_Wcffacility - Fatal编程技术网

Castle windsor WCF设施:控制服务生活方式

Castle windsor WCF设施:控制服务生活方式,castle-windsor,wcffacility,Castle Windsor,Wcffacility,注册示例: container.Register(Component.For<IFooService>().ImplementedBy<FooService>().AsWcfService<IFooService>(new DefaultServiceModel().Hosted()).LifestyleTransient()); container.Register(Component.For().ImplementedBy().AsWcf

注册示例:

        container.Register(Component.For<IFooService>().ImplementedBy<FooService>().AsWcfService<IFooService>(new DefaultServiceModel().Hosted()).LifestyleTransient());
container.Register(Component.For().ImplementedBy().AsWcfService(newdefaultservicemodel().Hosted()).LifestyleTransient());
.svc:



WCF托管在IIS中,当我使用WcfStorm访问端点时,不会在每次请求时调用ctor。如果重新生成客户端代理,将再次调用ctor。服务生命周期如何耦合到客户端代理?

Transient的行为将与Transient的行为类似,这意味着Castle.Windsor将根据请求创建一个新的服务实例。这种混乱源于这样一个事实,即并非每次点击服务时都会发生这种情况。原因是WCF堆栈有自己的服务生命周期概念,由默认为“PerSession”的“InstanceContextMode”定义。如果我将InstanceContextMode更改为“PerCall”,Castle将按照(I)的预期对服务进行委托/解除委托

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class FooService : IFooService { .. }

通常,服务生命周期与客户端代理无关。这不是远程处理。我当然理解这一点,但这并不能澄清我观察到的行为
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class FooService : IFooService { .. }