this occured when I called my WCF Service
as follows:
testWCF
.webWCF
.gave scriptreference as: http://localhost/testWCF/mywcf.svc
In JavaScript called the method GetSerivceCharge
as
var x = new thetest.Backoffice.IBackofficeService();
var y = x.GetSerivceCharge(res);
function res(result) {
alert(result);
}
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'GetSerivceCharge' failed with the following error: Not Found
Server Error in '/webWCF' Application.
HTTP Error 404 - Not Found.
Isn't this a cross domain issue? I see that your WCF web service is hosted in IIS and accessible through http://localhost/testWCF/mywcf.svc
while your web application is using the ASP.NET development server which means it is hosted on http://localhost:SOME_PORT/webWCF
.
AFAIK, AJAX is used when you want to invoke a web service from javascript. Due to cross domain restrictions you need to have the web service and the web application hosted on the same domain, or create a some proxy/bridge that will delegate calls to the web service.
Try typing the web service URL directly into your browser's address bar and see what happens.
Maybe it's this dumb: GetSerivceCharge is misspelled. Try GetServiceCharge. And if that's not it, you should post your web method's signature.
I think you need to add a reference to your WCF in your project.
If you are using VS 2008 try adding a reference to your web service: In solution explorer right click on your project. Then select Add Service Reference. Then click on discover in the dialog that pops up and you should be able to find your WCF service.