WCF/WF - 405 method not found error in consuming wcf rest service in cross domain using jquery ajax

Asked By meena damwani on 08-Mar-13 07:05 AM

I have created wcf service and consume it in html page in website in same solution.

I have used jquery ajax to call wcf service   in html page which return response in json format...  it works fine in IE browser but gives an  "405 method not found" error in firefox  and crome..

My code to call service as below:

 function CallMyService()

//            jQuery.support.cors = true;
                type: "GET",
                url: "http://localhost:49868/RestService.svc/GetEmployeeList",
                data: '{}',
                contentType: "application/json;charset-uf8", // content type sent to server
                success: ServiceSucceeded,
                datatype :'json',
                error: ServiceFailed

Yuri Kasan replied to meena damwani on 12-Mar-13 12:14 PM
That is security problem, why not use JSONP instead of AJAX?
Very good article on how to do this published by Peter Bromberg and located here http://www.eggheadcafe.com/tutorials/asp-net/346046ca-d54b-4ab3-b9f1-ccdf4262bcfb/handling-jsonp-requests-in-aspnet-mvc-3.aspx