Search code examples
restwcf-clienthttp-status-codeswcf-rest

Getting HttpStatus from WCF Rest Client


As i've mentioned in topic. I have WCF Rest Service, and ASP.NET MVC3 client. In ASP's controller i'm using

IMyService serviceClient = new WebChannelFactory<IMyService>().CreateChannel();

to create client (channel) for my service. Is there any way to attach to this channel and get HttpStatusCode for each response from WebService? Btw should I close channel after each request-response? or it could be opened for next EndUser requests via ASP.NET MVC3 app?

I'm setting HttpStatusCode in webService through

WebOperationContext.Current.OutgoingResponse.StatusCode = <HttpStatusCode>;

And i'd like to check it in MVC3 app and show proper hint.

EDIT: Nevermind. I've found answers.

http://msdn.microsoft.com/en-us/magazine/cc163302.aspx


Solution

  • AnswerLink