我编了一个程序,用到了webservice
<WebMethod()> _
        Public Function CheckAuthentication(ByVal id As String, ByVal pwd As String) As String
.
.
if xx then
       Throw New SoapException("1", SoapException.ServerFaultCode)
end if
...
End function
另外有一个webapplication调用这个method,在那个程序里面调用的时候,我可以对例外进行处理。
现在要单独对这个method进行测试,直接输入localhost/xxx/xxx.asmx,当抛出异常的时候,网页无法显示,怎么样才能让他正常的显示抛出了异常,以便进行测试。

解决方案 »

  1.   

    其实我觉得用另外一个method,把例外的message显示出来就行了。但是领导不让,所以,请大家帮忙,有没有什么方法,让server处理例外。
      

  2.   

    http://community.csdn.net/Expert/topic/3668/3668791.xml?temp=.8182184
    你可以看看
      

  3.   

    http://community.csdn.net/Expert/topic/3543/3543567.xml?temp=.6129877
      

  4.   

    谢谢 hackate(兰花开香入梦境,独思佳人亦飘然!!) 
    那个帖子中有个例子,是用C#写的
    public int TestThrowException(out string ErrorMsg)
                                 ~~~~
    那个out在vb.net中应该怎么写?
      

  5.   

    另外,要是用try catch来把exception的消息显示出来的话,我也可以做。
    领导现在非让我想办法,在service的页面中显示出来出现了例外。目前我觉得好像不能。