ASP.NET 4.5 Ajax 在本地运行良好,但在 Web 服务器中托管时 Ajax 客户端框架无法加载 [英] ASP.NET 4.5 Ajax works fine on local but Ajax client-side framework failed to load when hosted in a web server

查看:35
本文介绍了ASP.NET 4.5 Ajax 在本地运行良好,但在 Web 服务器中托管时 Ajax 客户端框架无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站中使用 ScriptManager 和 UpdatePanel,当它从 Visual Studio 2012 调试时,一切都在本地机器上运行,但是当它托管在 Web 服务器中时,它给出了几个错误:

I am using ScriptManager and UpdatePanel in my website and every thing works in local machines when it was debugged from visual studio 2012 but when its hosted in web server it gives couple of erros:

未捕获的错误:ASP.NET Ajax 客户端框架加载失败.未捕获的引用错误:未定义 Sys

Uncaught Error: ASP.NET Ajax client-side framework failed to load. Uncaught Reference Error: Sys is not defined

而且它也不会加载 scriptresources.axd 文件,因为它说 500 内部服务器错误

and also it doesn't load scriptresources.axd file as it was saying 500 Internal Server Error

推荐答案

我已将我的 web.config 文件更改为以下内容

I have changed my web.config file to the one as below

<modules>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule" />
    </modules>
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <remove name="ScriptHandlerFactory"/>
        <remove name="ScriptHandlerFactoryAppServices"/>
        <remove name="ScriptResource"/>
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" name="ASPxHttpHandlerModule" preCondition="integratedMode" />
    </handlers>
  </system.webServer>

这篇关于ASP.NET 4.5 Ajax 在本地运行良好,但在 Web 服务器中托管时 Ajax 客户端框架无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆