my problem is very similar to the one described here.
however, in my case I am getting the 500 Internal Server Error in firebug:
Request format is unrecognized for URL unexpectedly ending in '/HelloWorld'.
my asp.net 4.0 web service call is cross-domain, and from going over a dozen other web sites' advice I believe that I have configured everything in order to allow this to happen correctly, but obviously I have not. what am I doing wrong?
I am using JSONP instead of JSON. the web service works as expected if everything is on the same server. my problem is that the hosting provider for the html page that calls the web service does not allow server-side code, otherwise i'd just put everything in one place and be done with it!
below is my code/markup:
web.config:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed"></httpErrors>
<asp scriptErrorSentToBrowser="true"></asp>
<modules>
<add name="ContentTypeHttpModule"
type="ContentTypeHttpModule.ContentTypeHttpModule, ContentTypeHttpModule" />
</modules>
</system.webServer>
<system.web>
<customErrors mode="Off"></customErrors>
<compilation debug="true" targetFramework="4.0"/>
<trust level="Full"/>
<pages clientIDMode="Static"/>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<!--<httpModules>
<add name="ContentTypeHttpModule"
type="ContentTypeHttpModule.ContentTypeHttpModule, ContentTypeHttpModule" />
</httpModules>-->
</system.web>
</configuration>
html file javascript:
function test() {
$.ajax({
url: 'http://designonlinelettering.com/RenderImage.asmx/HelloWorld',
data: {},
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
success: function (result) {
var data = result.d;
alert(data);
},
error: function (e) {
alert('error: ' + e.d);
}
});
}
web service code:
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public string HelloWorld()
{
return "Hello World";
}
the ContentTypeHttpModule code was taken from this very informative blog, from which I got most of my direction.
thanks for any help...
http://designonlinelettering.com/RenderImage.asmx/HelloWorldand you'll see.