ASP.NET Ajax:“PageMethods 未定义” 生产服务器上的脚本错误(在本地主机上工作)

发布于 2024-07-13 19:33:10 字数 389 浏览 14 评论 0原文

在 javascript 文件中,我调用 ASP.NET Ajax PageMethod (ASP.NET 3.5),它使用 WebMethod 属性在页面类中正确定义了静态方法。 这适用于我的开发计算机,但在生产服务器上,当调用我的 javascript 函数(单击按钮)时,PageMethod 对象未定义

一些调试信息:

  • Firefox 和 Internet Explorer 上出现错误
  • 根据 Firebug 的网络选项卡,所有外部资源均已正确加载
  • 我在同一页面上使用 jQuery
  • 应用程序是使用 Web 部署项目部署的

知道是什么导致了问题吗?

In a javascript file I'm calling an ASP.NET Ajax PageMethod (ASP.NET 3.5), correctly defined in the page class a static method using the WebMethod attribute. This works on my development machine, but on the production server the PageMethod object is undefined when my javascript function is called (clicking a button).

Some debugging info:

  • Error on Firefox and Internet Explorer
  • According to Firebug's network tab all external resources are correctly loaded
  • I'm using jQuery on the same page
  • The application is deployed using a Web Deployment project

Any idea what's causing the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初见你 2024-07-20 19:33:10

写完问题后我找到了问题的解决方案。 我正在做 肮脏的伎俩,以避免将 aspx 占位符文件(Web 部署项目)复制到服务器:在 IIS 中,我取消选中了 .aspx ISAPI 扩展选项“验证该文件存在” ”。

这似乎是 ASP.NET Ajax 的一个问题。 所以我创建了一个空的 aspx 占位符文件......现在它也可以在生产服务器上运行。 我会在上面链接的问题/答案上放置一个警告标志。

I found the solution to the problem after having written the question. I'm doing a dirty trick in order to avoid copying the aspx placeholder files (Web Deployment Project) to the server: in IIS I've unchecked the .aspx ISAPI extension option "Verify that file exists".

That seems to be a problem for ASP.NET Ajax. So I created an empty aspx placeholder file and ... now it's working on the production server too. I'll put a warning sign on the question/answer I linked above.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文