What exception is thrown if a web service I'm using times out?

别来无恙 提交于 2019-12-04 09:59:42

This kind of depends on which "version" of web services you are using.

Using WCF, you will actually get a TimeoutException. You should generally also handle CommunicationException if you are attempting to handle timeouts. Sometimes I've also seen FaultException, although that technically shouldn't happen (but it does anyway once in a while). FaultException is a descendant of CommunicationException so you don't need to handle it separately, it's just useful to know that it might occur.

In ASMX, you will usually get a wrapped SoapException for which you need to check the InnerException property to see what really went wrong.

Using WSE, you'll see yet another exception, ResponseProcessingException, for which again you must check the InnerException for details.

You should be looking for a TimeoutException:

The exception that is thrown when the time allotted for a process or operation has expired.

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