ASP.NET 应用程序:AJAX PageMethods 返回有关“index.php”的内部服务器错误仅在生产服务器上
我有一个 ASP.NET 应用程序在两个几乎相同的 Virtual Windows Server 2003 上运行。第一个是我的开发和测试服务器。我已经在那里安装了 .NET WebExtensions for Framework 2.0 并且该应用程序运行良好。现在,我尝试在第二台服务器(我们称其为生产服务器)上发布相同的应用程序,并在那里安装 .NET WebExtensions,并运行编译和数据库访问以及完整的 APS.NET 应用程序。除了通过 JavaScript AJAX 调用来调用静态 PageMethods 之外。我使用IE8的开发者工具调试了JavaScript,发现它的工作原理是一样的。尽管如此,WebMethods 的所有调用都会返回内部服务器错误(错误代码 500),并显示“未知的 Web 方法 index.php”。
有谁知道生产服务器可能有什么问题或者需要更改哪些配置?
两个服务器之间的主要区别在于,生产服务器使用.NET .../Framework64/v2.0.50727/aspnet_isapi.dll,而测试服务器使用.../Framework/v2.0.50727/aspnet_isapi.dll。
更多细节:
- 所有 PageMethod 都是静态的,返回一个字符串并具有 WebMethod 属性。
- 在两台服务器上,JavaScript 使用解析的 URL“http://myDomain/myPage.aspx/myWebMethod< /a>”和“Content-Type”标头“application/json charset=”utf-8”以及主体包含 PageMethods 参数的正确 JSON 定义
- 当然,所有使用 AJAX PageMethods 的 ASPX 页面。确实有一个 ASPX-ScriptManager 将 EnablePageMethods 属性设置为“True”。
I have an ASP.NET application running on two almost identical Virtual Windows Server 2003. The first one is my develop and test server. I have installed the .NET WebExtensions for Framework 2.0 there and the application runs well. Now I tried to publish the same application on a second server (lets call him the production server) and also installed the .NET WebExtensions there and compiling and database access runs as well as the complete APS.NET application. Except for calling the static PageMethods through JavaScript AJAX calls. I have used the developer tools of the IE8 to debug into the JavaScript and found that it works identically. Still, all calls of the WebMethods return and internal server error (error code 500) saying "Unknown web method index.php".
Does anybody know what might be wrong with the production server or which configuration need to be changed?
The main difference between the two servers is that the production server uses .NET .../Framework64/v2.0.50727/aspnet_isapi.dll, while the test server uses .../Framework/v2.0.50727/aspnet_isapi.dll.
Some more details:
- All PageMethods are static, return a string and have the WebMethod-Attribute.
- On both servers the JavaScript creates an XmlHttpRequest object using the resolved URL "http://myDomain/myPage.aspx/myWebMethod" and the "Content-Type"-Header "application/json charset="utf-8" and the bodies contain the correct JSON definition of the parameters for the PageMethods.
- Of course all ASPX-pages that use the AJAX PageMethods do have an ASPX-ScriptManager hving the EnablePageMethods-attribute set to "True".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经解决了我的问题。生产服务器上有一个 ISAPI_ewrite,配置为在所有网站上全局工作。对于那些需要使用该重写的网站,我将该设置更改为网站单独的 ISAPI_Rewrite 后,AJAX XmlHttpRequests 就可以工作了。
I have solved my problem. There was an ISAPI_ewrite on the production server configured to work globally on all websites. After I have changed that setup to website individual ISAPI_Rewrite for those websites that need to use that rewrite, the AJAX XmlHttpRequests work.