I have a website with a lot of traffic, and a lot of webservice calls. All of my webservices work 95% of the time, but a couple of times a day I get this error message in my log:
Request format is unrecognized for URL unexpectedly ending in '/MyWebServiceName'.
I have Googled this problem, and all I find are pages referencing this issue: Request format is unrecognized for URL unexpectedly ending in
But this does not apply to me, since my webservices do work most of the time. I already got that code in my web.config.
Anyone have any idea on what might cause this?
Info:
- Windows Server 2008.
- ASP.NET 2.0 on IIS7.
- Use jQuery to call webservices.
Code examples:
jQuery call
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url: '/MyWebServiceName',
dataType: 'json',开发者_StackOverflow社区
success: function(msg) {
// On success
},
error: function(xhr, textStatus, errorThrown) {
// On error
}
});
Return from webservice:
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">
[{"ID":"GB","Name":"Great Britain"},{"ID":"IT","Name":"Italy"},{"ID":"DE","Name":"Germany"}]
</string>
When I call the webservice through my browser I do get data back (look above), but I wonder why it sometimes fails.
You have dataType: 'json' but the webservice respones as xml.
精彩评论