从 WCF Rest 客户端获取 HttpStatus
正如我在主题中提到的。我有 WCF Rest 服务和 ASP.NET MVC3 客户端。在 ASP 的控制器中,我使用它
IMyService serviceClient = new WebChannelFactory<IMyService>().CreateChannel();
来为我的服务创建客户端(通道)。有什么方法可以附加到此通道并获取来自 WebService 的每个响应的 HttpStatusCode 吗?顺便说一句,我应该在每次请求响应后关闭通道吗?或者可以通过 ASP.NET MVC3 应用程序打开它以供下一个最终用户请求?
我通过在 webService 中设置 HttpStatusCode
WebOperationContext.Current.OutgoingResponse.StatusCode = <HttpStatusCode>;
我想在 MVC3 应用程序中检查它并显示正确的提示。
编辑: 没关系。我已经找到答案了。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AnswerLink
AnswerLink