DDi*_*ita 5 wcf iis-6 .net-3.5
这是我的回复信封:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring xml:lang="en-US">The creator of this fault did not specify a Reason.</faultstring>
<detail>
<ServiceFault xmlns="http://schemas.datacontract.org/2004/07/Zagat.Services.FaultException" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ReasonCollection xmlns:a="http://schemas.datacontract.org/2004/07/Zagat.Enterprise.Domain"/>
<ReasonMessage>Credentials are not valid</ReasonMessage>
</ServiceFault>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
enter code here
Run Code Online (Sandbox Code Playgroud)
这是我的标题:
HTTP/1.1 500 Internal Server Error
Date: Wed, 01 Jul 2009 17:55:33 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 564
Run Code Online (Sandbox Code Playgroud)
如何让IIS返回200而不是500?我的代码在服务器上运行,我只是向客户端发送故障进行处理.
丹尼尔
您可以轻松自定义WCF的错误处理.请参阅Nicholas Allen的Indigo博客修改HTTP错误代码,第1部分和第2部分 ; WCF:通过Andre de Cavaignac的WebHttpBinding抛出异常 ; 和Brajendra Singh 在WCF Web服务中的异常处理.
归档时间: |
|
查看次数: |
6537 次 |
最近记录: |