jQuery JSONP call to WCF gets 404 in IIS 5.1
So yeah, this is my second WCF deployment headache of the night (with this being the first).
Basically, from that last problem, I managed to successfully deploy a simple WCF service into a staging server hosted on IIS 5.1. The problem now is, the service endpoints that utilize vanilla SOAP are working, and those that utilize JSONP calls are throwing 404 errors.
I'm using jQuery's raw .ajax()
function to call my .svc
via JSONP with something like:
$.ajax({
type: 'POST',
contentType: 'application/json; charset=utf-8',
url : 'http://localhost/wcf/client.svc/test?mycallback=?',
data : '{}',
dataType: 'jsonp',
success: function (m) {
alert(JSON.stringify(m));
},
error: function (x, s, d) {
alert(d);
}
});
... to call on an endpoint coded like:
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Xml)]
public void test()
{
string callback =
WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["mycallback"];
HttpContext.Current.Response.Write(
callback + "({'foo':'bar'})"
);
}
Apparently, this is working fine on my local dev environment. Once I port all this to the staging server on an IIS 5.1 (i.e. call http://staging:8000/wcf/client.svc/test?mycallback=?
instead), the server throws me back a 404 error.
I really don't know what's up. I can visit http://staging:8000/wcf/client.svc
just fine (and get the distinctive WCF service landing page), so I know the service is there. I开发者_开发技巧'm just thinking that maybe IIS 5.1 is getting confused with parsing the JSONP url? Honestly, I'm not so sure.
Any ideas on this?
精彩评论