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.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题