System.ServiceModel.ProtocolException是否始终在其消息中包含html代码? [英] Does System.ServiceModel.ProtocolException always have html code in its message?

查看:628
本文介绍了System.ServiceModel.ProtocolException是否始终在其消息中包含html代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

多数民众赞成我的问题,我在我的客户端上捕获了一些WCF异常,而且ProtocolException在其消息中总是有html代码。

我能否认为每次都会发生这种情况?对于我看到真正的好消息来自内部异常,我可以放弃ProtocolException消息并向用户显示来自内部异常的消息吗?

Thats my question, I'm catching a few WCF exceptions on my client and the ProtocolException always has html code in its message.
Could I assume that will happen every time? For what I see the real good message comes in the inner exception, could I just discard the ProtocolException message and show the user the message from the inner exception?

推荐答案

不,它并不总是在消息中包含HTML。通常,如果存在HTML,那是因为您与(或通过)交谈的服务器未理解(或阻止)该请求,并且已回复HTML解释原因。该消息对于解决问题很有用。

No, it doesn't always contain HTML in the message. Generally if there is HTML it's because the server your talking with (or through) hasn't understood (or blocked) the request, and has replied with an HTML explanation as to why. The message is useful for figuring out the problem.

不幸的是,这不是您唯一一次看到ProtocolExceptions,因此您不能认为它总是包含HTML 。

Unfortunately that isn't the only time you'll see ProtocolExceptions, so you can't assume it will always contain HTML.

这篇关于System.ServiceModel.ProtocolException是否始终在其消息中包含html代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆