InfoLearner
InfoLearner

Reputation: 15608

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?

e.g.

 <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?

Upvotes: 1

Views: 247

Answers (1)

bbaia
bbaia

Reputation: 1183

Tim's solution works:

((System.ServiceModel.ICommunicationObject)context["ShoppingService"]).Abort();

Upvotes: 1

Related Questions