Client found response content type of 'text/html', but expected 'text/xml'.

EYIDev
EYIDev used Ask the Experts™
on
I developed a web service to spin thru a dataset of email
addresses and send out an email with a weekly newsletter attached as a pdf attachment.   I'm using the built-in SMTP in the .NET framework to do this.   I'm running XP Pro and IIS on my dev box and the web service resides at localhost\appname as you might expect.    I have built a WinBased.exe as a consumer to call the web service, also sitting on my C: drive.

When I invoke the service (function as boolean) from the VS IDE it runs to completion fine and returns an xml page in the browser as TRUE.   When I call the service from the consumer it gets to around the 2000th or so record in the dataset as it loops thru sending out emails and then the debug option pops up telling me the client (consumer) received invalid input (see below) and would I like to debug.   The web service never hits the CATCH statements and appears to be happily in the middle of the loop at the time the web server sends the message back to the consumer.   The error message from the debugger is below:

An unhandled exception of type 'System.InvalidOperationException' occurred in system.web.services.dll

Additional information: Client found response content type of 'text/html', but expected 'text/xml'.
The request failed with the error message:
--
<html>
   <head>
      <title>Server Unavailable
</title>
   </head>
   <body>
      <h1><font face=Verdana color=#ff3300>Server Application Unavailable
</font></h1>
      <p>
      <font face=Verdana>
        The web application you are attempting to access on this web server is currently unavailable.&nbsp; Please hit the "Refresh" button in your web browser to retry your request.
</p>
   <p>
   <b>Administrator Note:
</b> An error message detailing the cause of this specific request failure can be found in the system event log of the web server.  Please review this log entry to discover what caused this error to occur.
 </p>
   </body>
</html>

--.

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Seems like the webservice is taking too much time for your consumers likings and thus quits. You can send it in parts (like only 1000 each time).

Author

Commented:
The call timeout is set to 1 hr for the test but the problem occurs about 5 minutes into the call.   Unfortunately,  I cannot call it it increments, It may be required to perform several broadcasts (from large recordsets) over a few hours in production conditions.
But thank you for your input in any case.  My guess at the moment is that there is some server parameter I am unaware of but need to set.   I already tried unchecking the "friendly messages" thing in explorer but the issue remains.


Commented:
Did you try placing breakpoints to find the part of the code that is causing the trouble? Can you show code?
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Author

Commented:

The consumer appname.exe is calling the ws.dll so when the debugger comes up it takes me to the invoke statement in the proxy code.  The only error information visible
at this point is the "Client found response content type" thing as I mentioned.   I can't actually walk thru the web service code execution at this time (can I?) I added a statement in the CATCH handling of the web service to dump any errors in the db so I can examine them but, as far as I can tell, the CATCH handling statements never execute.   Rather, I believe the error is sent to the consumer from the web server and no error occurs internally in the web service.   I could be way off here but that is my interpretation at this point.

Commented:
You can debug webservices and the executable at the same time. Just put it in the debug part of your projects properties. then you can also step through the webservice code.

Author

Commented:
That would be great.  Do I modify the properties of the consumer project and what do I change.  I looked at it already but it's not obvious how to set it.
I had these exact symptoms and it was because IIS thought the ASPNET_WP.EXE process was deadlocked and so IIS killed it.  Check the system event log on your web server and look for a event with the subject of ASPNET_WP.EXE.  You may find an event something like "the ASPNET_WP.EXE process was killed due to a deadlock" or something like that.

Anyway, if you see the event in the event log, you can increase the timeout by editing the Machine.Config file on your web server.  Its located in \WINNT\System32\Microsoft .Net\Framwork\<version>\Config

Increase the responseDeadlockInterval setting.  It defaults to 3 minutes (see below).  What this means is that, if your web service takes longer than 3 minutes, IIS is going to kill it and your client will get the error you're seeing.  This happens because IIS doesn't "like" long-running web requests.  

sample processModel entry from Machine.Config file:

        <processModel enable="true" timeout="Infinite" idleTimeout="Infinite" shutdownTimeout="0:00:05" requestLimit="Infinite" requestQueueLimit="5000" restartQueueLimit="10" memoryLimit="60" webGarden="false" cpuMask="0xffffffff" userName="SYSTEM" password="AutoGenerate"  logLevel="Errors" clientConnectedCheck="0:00:05" comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate" responseRestartDeadlockInterval="00:09:00" responseDeadlockInterval="00:03:00" maxWorkerThreads="25" maxIoThreads="25"/>

Author

Commented:
wile,

thanks alot bud, that worked.  No such log messages but that was the issue alright.

Like I said "My guess at the moment is that there is some server parameter I am unaware of but need to set".

Also thanks to CJ S for all the fine advice which I can use elsewhere.

 

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial