部署后Ajax url无法正常工作

时间:2015-02-17 09:02:13

标签: asp.net .net ajax url webforms

我从aspx页面调用了一个webmethod,它按照预期正常工作:

 $.ajax({
         type: "post",
         url: "MyPage.aspx/GetName",

.CS

 [System.Web.Services.WebMethod]
    public static string GetName()
    {
      ... Some Logic ....
    }
  

Localhost Url:http://localhost:56286/MyPage.aspx

现在,当我部署此Url不起作用且ajax调用显示错误

  部署后的

网址:http://localhost:802/MyPage.aspx

我做错了什么?我试过了:

但它们都没有奏效。有什么建议吗?

修改

当我做了//myPage.aspx//GetName时,我在控制台中出现了以下错误

  

阻止跨源请求:同源策略禁止在http://MyPage.aspx//GetName读取远程资源。这可以通过将资源移动到同一域或启用CORS

来解决

我不知道这意味着什么,但它可以帮助您理解这个问题。

0 个答案:

没有答案
相关问题