views:

607

answers:

3

Hi,

I have a WCF service deployed on a windows 2003 server. We are using a WPF application to consume this service. The trouble is if we deploy a new version of WCF service or leave the IIS and WPF application idle for sometime and then try to execute a functionality, we are get the following exception:

The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 119 bytes of the response were:'<HEAD><TITLE>500: Server Error [20-0004]</TITLE></HEAD>
<BODY>
<H1>500: Server Error [20-0004]<H1>

</BODY>
</HTML>

Thanks and Regards,

A: 

It looks like you are creating a proxy / connection to the server, then leaving it open and using this proxy when needed.

There are two problems with this:

  • The problem you are getting due to timeout in periods of inactivity.
  • That the connection is maintained when it is not used reduces scalability.

A better way to do it is to create the proxy connection when you require it, then close / dispose of it after it gas been used. Normally I use the using statement for this.

Shiraz Bhaiji
A: 

A 500 error usually means there was an unhandled exception in the service. Look in the Windows event logs to see what happened.

John Saunders