ASP.NET Ajax:“PageMethods 未定义” 生产服务器上的脚本错误(在本地主机上工作)
在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
写完问题后我找到了问题的解决方案。 我正在做 肮脏的伎俩,以避免将 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.