如何禁用soap web服务的详细错误消息?

问题描述

如何禁用soap web服务的详细错误消息?

我有一个带有一些段落的网络方法。

示例请求:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <Body>
        <GenerateTestRequest xmlns="http://tempuri.org/">
            <sId>1@!aB</sId>
            <mobileNum>12345678</mobileNum>
            <srcType>1</srcType>
        </GenerateTestRequest>
    </Body>
</Envelope>
    

当意外的输入被提供给 sId para 而不是 Int32 时,Web 服务在响应内容中返回了一个异常。

示例资源:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode>
            <faultstring xml:lang="en-SG">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:sId. The InnerException message was 'There was an error deserializing the object of type System.Int32. The value '1@!aB' cannot be parsed as the type 'Int32'.'.  Please see InnerException for more details.</faultstring>
        </s:Fault>
    </s:Body>
</s:Envelope>

我不想显示异常消息的响应内容。有没有办法关闭堆栈跟踪或异常详细信息?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)