Đây là phong bì trả lời của tôi:Lỗi đánh máy WCF và mã lỗi máy chủ nội bộ 500?
<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
Dưới đây là Tiêu đề của tôi:
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
Làm thế nào tôi có thể nhận được IIS để trả về một 200 thay vì 500? Mã của tôi chạy trên máy chủ, tôi chỉ gửi một lỗi cho khách hàng để xử lý.
Daniel
Bạn có nhận được thông báo đó trong một ProtocolException không? Tôi đã có một vấn đề với những trường hợp ngoại lệ gây ra tôi luôn luôn có mã html trong thông điệp ngoại lệ. Bây giờ tôi chỉ giả định rằng mọi ngoại lệ giao thức đi kèm với mã html này và tôi phân tích nó để nhận được thông điệp thực. http://stackoverflow.com/questions/998065/does-system-servicemodel-protocolexception-always-have-html-code-in-its-message – sebagomez