Last post Jul 07, 2009 05:37 PM by Amit Sharma
Jun 29, 2009 11:38 AM|aehso|LINK
(Similar problem to http://forums.asp.net/p/1416605/3125648.aspx but no solution advised there)
I have a RESTful WCF service that is run via a custom ServiceHost (which extends WebServiceHost2 from the starter kit) that is constructed by my own factor - I need this arrangement in order to initialize a Unity container when my service is starting up.
It all works fine except for throwing WebProtocolExceptions from within my service impl. Whenever I do this, IIS (6) insists on converting the response status to 200 OK and it embeds the real response code in a HTML response: e.g.
<html version="-//W3C//DTD XHTML 2.0//EN" xml:lang="en" xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><HEAD><TITLE>Request Error</TITLE></HEAD><BODY><DIV id="content"><P class="heading1"><B>Error Status Code:</B> 'Unauthorized'</P><P><B>Details: </B>Unauthorized</P><!-- Padding xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx--></DIV></BODY></html>
I need to disable this behavior - can anyone advise on the magic property on the service host (or via web.config) that will force IIS to return the correct response status code (and do away with this HTML conversion of the body)?
Jul 06, 2009 01:03 PM|Amit Sharma|LINK
please post the contents of your .svc file.
Jul 07, 2009 05:37 PM|Amit Sharma|LINK
this is already resolved here --> http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/e1db4708-8638-42fb-9c32-761bae702b13