larry*wei 2009-07-18 11:41 采纳率: 0%
浏览 21

WCF和Javascript:找不到

this occured when I called my WCF Service

as follows:

  1. hosted WCF Service in IIS in name testWCF.
  2. web application name is 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);
}

it results as follows:

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.
  • 写回答

4条回答 默认 最新

  • 妄徒之命 2009-07-18 11:51
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?