0
votes

I am investigating a problem calling a web service from AJAX, which intermittently faults with the following error:

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

This is similar to the following question, but works most of the time - only failing intermittently.

Request format is unrecognized for URL unexpectedly ending in

The UI polls once every couple of seconds, and works fine until some state changes, and then the same calls fail for around 1 minute and 30 seconds, then they continue working.

The POST-ed data is identical in Firebug for a successful call and failed call:

lastResult=''&lastState=33&random=0.7584943767104781

The following configuration applies to the web service

<location path="TypeService.asmx">
    <system.web>
        <webServices>
            <protocols>
                <add name="HttpPost"/>
            </protocols>
        </webServices>
        <authorization>
            <allow users="*"/>
            <allow users="?"/>
        </authorization>
    </system.web>
</location>

I believe the config is correct, as the calls work for long periods. The polling mechanism doesn't change at any point. Is there any other reason for this error message other than the configuration fix that is noted in the other question?

2

2 Answers

0
votes

After further investigation, we have found that we get this error due to an actual code error in the constructor of the service - so this is one of those hidden errors, where the error message isn't really indicative of the problem.

-1
votes

Make sure in jquery ajax call should be like this,

$.ajax({
    type: "GET",
    url: "/ajax.asmx/YOUR_METHOD",
    data: "{}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (msg) { }
})