我一直在使用 Castle Windsor 开发 WCF 服务,我可以在设置容器后注册,如下所示:
IWindsorContainer container = new WindsorContainer();
container.AddFacility<WcfFacility>().Register(
Component.For<IActivityLogsRepository>().ImplementedBy<ActivityLogsRepository>(),
Component.For<IActivityLogsService>().ImplementedBy<ActivityLogsService>()
.Named("Company.ServiceImplementation.ActivityLogsService"),
但我的问题从使用 CallbackContract 开始,如此处所述 http://msdn.microsoft.com/en-us/library/ms752254(v=vs.100).aspx
从 Castle 文档中我发现了这个 http://docs.castleproject.org/Windsor.WCF-Facility-Lifestyles.ashx
我做了这样的事情
Component.For<ISampleService>().ImplementedBy<SampleService>()
.LifeStyle.PerWcfSession(),
我的服务器配置文件是
<bindings>
<basicHttpBinding>
<binding name="LargeHttpBinding" closeTimeout="00:10:00" openTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="LargeNetTcpBinding" maxBufferPoolSize="5242880"
maxBufferSize="5242880" maxReceivedMessageSize="5242880" />
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="LargeBehavior" name="MyCompany.ServiceImplementation.SampleService"><endpoint address="net.tcp://localhost:808/MyCompany.WcfServices/SampleService.svc" binding="netTcpBinding" bindingConfiguration="LargeNetTcpBinding"
name="netTcp" contract="MyCompany.ServiceContract.ISampleService" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
name="Mex" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:808/MyCompany.WcfServices/" />
</baseAddresses>
</host>
有人知道是否可以使用回调设置温莎城堡设施,如果可以,如何实现
谢谢