Sunday, November 9, 2014

Out of Memory exception. Web Service Exception - Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.

Out of Memory exception. Web Service Exception - Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.

Today I faced an error whiling sending a request to web service for a list of detail sale. Everything was fine on client application and server side hosted web service. I debugged and googled but not find any solution, just getting the above error.

Then sudden I checked the response that had been more than 200K rows. Oh I find out the reason behind this exception. My response was too large to accomplish the service. Here I am sharing its solution for you. Keep in mind these points before hosting your web service.


1.       Pick a size that is larger than your largest request. You can set it 2GB but not recommended.

2.       Try to reduce your result set in response.

3.       Defined “maxReceivedMessageSize” in your client application.


4.       Define timeout response while you have larger requests. Default time is 90 second which is more than enough for general purpose.

No comments:

Post a Comment

Search This Blog