29

I'm calling a webservice using an Microsoft.XMLHTTP call:

var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "/xxx/Converter.asmx/Convert", false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("conversionFolder=" + escape(conversionFolder));
if (xmlhttp.status == 200) {
  xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.async = "false";
  xmlDoc.loadXML(xmlhttp.responseText);
  ... more stuff ...
  return str;
}
else {
  alert(xmlhttp.statusCode + " - " + xmlhttp.statusText);
}

It all works fine when I remember to add the HttpPost protocol in the local web.config:

<?xml version="1.0"?>
<configuration>
  <appSettings/>
  <connectionStrings/>
  <system.web>
    <webServices>
      <protocols>
        <add name="HttpPost"/>
      </protocols>
    </webServices>
    <compilation debug="false"></compilation>
  </system.web>
  <system.codedom>
  </system.codedom>
  <!--
    The system.webServer section is required for running ASP.NET AJAX under Internet
    Information Services 7.0.  It is not necessary for previous version of IIS.
  -->
  <system.webServer>
  </system.webServer>
</configuration>

But on one production server it fails after running for 1-2 days. It works fine after the asp.net process has been recycled. It works for 1-2 days and then it fails with this:

Exception information:
Exception type: InvalidOperationException
Exception message: Request format is unrecognized for URL unexpectedly ending in '/Convert'.

Request information:
Request URL: https://xxx/xxx/converter.asmx/Convert
Request path: /xxx/converter.asmx/Convert
User host address: 195.50.35.4
User: extranet\kbk
Is authenticated: True
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Thread information:
Thread ID: 14
Thread account name: NT AUTHORITY\NETWORK SERVICE
Is impersonating: False
Stack trace: at System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath)
at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Why does it wait for 2 days before failing? And what can I do to prevent it from failing? Has it something to do with the fact that this server runs in HTTPS mode?

Cid
  • 1,453
  • 1
  • 18
  • 37
Brian Pedersen
  • 371
  • 1
  • 3
  • 6
  • are you sure it's failing after the time lapse and not because of an invalid entry? looking at the error it's showing the URL ending unexpectedly? How do you resolve the issue, can you automate the resolution so you don't incur downtime. – Robert Nov 22 '11 at 14:31
  • Has it something to do with objects not being released properly ? Do you use 'external' objects, such as COM in the service which are not properly released ? – AYK Apr 09 '12 at 08:29
  • I'm afraid I don't have an answer, but I can say that we have the exact same problem. Our ASMX web service just stops working, seemingly randomly, with the same error you're getting. We recycle nightly. It doesn't happen every day, or even every week. I'm here because it just happened again after the system was up for 15 hours. We've been unable to correlate it to any performance counters. – Larry Silverman Jul 10 '12 at 22:22

3 Answers3

1

What is the Dot Net framework? IIS 6 or 7?
Have you tried adding <add name="HttpGet"/> in the protocols section. It seems some people have got over this problem with that fix. (but not for all)
link 1
link 2
Also check where you are deploying your site. Is it at the root level in your web server or a virtual folder. Sometimes it might be inheriting some configuration values from the parent level sites or machine.config file.

Otherwise it could be related to some memory leak in your code. What do you do with the loaded XML. Also I assume you are parsing a valid XML.

Community
  • 1
  • 1
Chinthana
  • 1,567
  • 1
  • 12
  • 11
1

It seems there is an Hotfix available for when recycling the app pool fixxes the problem for a few days: http://support.microsoft.com/kb/2783777/en-us

KdBoer
  • 896
  • 6
  • 3
0

It seems the protocols are disabled by default. There is a similar question already answered in Stackoverflow. Check this link and the relevant question

Community
  • 1
  • 1
Cid
  • 1,453
  • 1
  • 18
  • 37
  • @Brian - Was that the issue in your production env? – Cid Sep 05 '12 at 19:56
  • It is not the same thing. I'm having the exact same problem as described here. I found the question you are referring too and checked if the solution would work, only to find out that the settings suggested were already in place. – Jonathan van de Veen Dec 20 '12 at 13:13