gpt4 book ai didi

c# - 如何更改 SOAPException ResponseCode

转载 作者:太空宇宙 更新时间:2023-11-03 11:41:04 26 4
gpt4 key购买 nike

我正在使用 SoapException 来处理无效输入和我的网络服务中的所有其他类型的异常处理。它工作正常,我能够格式化并将正确的信息返回给客户。我正在遵循一种类似于此处解释的方法 http://www.codinghorror.com/blog/2004/08/throwing-better-soap-exceptions.html

现在我想更改它在 SoapException 发生时返回的响应代码(ResponseCode:500 内部服务器错误)。

以下是当 SoapException 发生时,除了我自己的自定义 XML 数据之外,我得到的默认响应代码。我想将 ResponseCode 更改为 200..这可能吗?如何实现?

ResponseCode: 500 (Internal Server Error)  
Connection:Close
Content-Length:494
Cache-Control:private
Content-Type:text/xml; charset=utf-8
Date:Tue, 25 Jan 2011 06:59:30 GMT
Server:ASP.NET Development Server/8.0.0.0
X-AspNet-Version:2.0.50727

最佳答案

根据 WS-I Basic 配置文件,支持 John Sauders 上面的警告:

“如果响应消息是 SOAP 故障,R1126 实例必须使用“500 内部服务器错误”HTTP 状态代码。”

http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#refinement16488480

关于c# - 如何更改 SOAPException ResponseCode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4790857/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com