我已经部署了我的服务并将Visual附加到一个Visual实例中的调试过程中,而在另一个实例中,我有一个在调试模式下运行的客户端控制台测试应用程序,我可以看到我在调试器中调用的两个服务方法,但在第二个方法中,我故意抛出异常时,根本没有看到调用ErrorHandlerBehavior中的代码。我的ErrorHandlerBehavior注册不正确吗?
我想知道我是否需要在我的服务配置中对此进行行为扩展?
我的全局异常处理是基于这个示例的
以下是我在服务程序中的容器注册的主要方法:
container.AddFacility<WcfFacility>(f => f.CloseTimeout = TimeSpan.Zero);
container
.Register(Component.For<WcfProtoType.IServiceProtoType>()
.ImplementedBy<WcfProtoType.ProtoTypeService>()
.Named("ProtoTypeService")
.AsWcfService( new DefaultServiceModel()
.AddEndpoints(WcfEndpoint
.BoundTo(new BasicHttpBinding(BasicHttpSecurityMode.None))
.At(baseUrl)
).PublishMetadata(o => o.EnableHttpGet())),Component.For<ServiceBase>().ImplementedBy<MyService>(),
Component.For<ErrorHandlerBehavior>().Attribute("scope").Eq(WcfExtensionScope.Services));发布于 2012-11-16 22:51:21
我查看了温莎城堡源代码,根据我所能知道的,EndPointBehavior需要首先注册,如下所示:
container
.Register(Component.For<ErrorHandlerBehavior>().Attribute("scope").Eq(WcfExtensionScope.Services),
Component.For<WcfProtoType.IServiceProtoType>()
.ImplementedBy<WcfProtoType.ProtoTypeService>()
.Named("ProtoTypeService")
.AsWcfService( new DefaultServiceModel()
.AddEndpoints(WcfEndpoint
.BoundTo(new BasicHttpBinding(BasicHttpSecurityMode.None))
.At(baseUrl)
).PublishMetadata(o => o.EnableHttpGet())),Component.For<ServiceBase>().ImplementedBy<MyService>());https://stackoverflow.com/questions/13421492
复制相似问题