Does System.ServiceModel.ProtocolException always have html code in its message?

 ̄綄美尐妖づ 提交于 2019-12-24 07:41:17

问题


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?


回答1:


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.

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



来源:https://stackoverflow.com/questions/998065/does-system-servicemodel-protocolexception-always-have-html-code-in-its-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!