[英]How do I call WCF service.Abort() when service was creating using spring.net wcf:channelfactory
I want to catch an exception and then call Abort method on the WCF channel factories which are running but I am not sure how to do that? 我想捕获一个异常,然后在正在运行的WCF通道工厂上调用Abort方法,但是我不确定该怎么做?
eg 例如
<wcf:channelFactory id="ShoppingService"
channelType="solution.TShoppingService, solution"
endpointConfigurationName="ServiceEndPoint" />
The service is in abort state. 服务处于中止状态。
I get the reference of the service as 我得到服务的参考
IApplicationContext context = ContextRegistry.GetContext();
context["TShoppingService]...
but how do I call the abort method? 但是如何调用中止方法呢?
蒂姆的解决方案有效:
((System.ServiceModel.ICommunicationObject)context["ShoppingService"]).Abort();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.