HTTP 处理程序在嵌套 Web 应用程序文件夹中找不到 axd 文件:Telerik RadScriptManager 在 ~/admin/ 文件夹中找不到 WebResource.axd
我们有一个带有 2 个 web.config 文件的 Web 应用程序。我在 ASP.NET 页面中使用 telerik:RadScriptManager 控件。该控件需要访问其 ScriptReferences 的 Web 资源文件 (WebResource.axd)。我认为这个 .axd 文件包含 Telerik 控件的 JavaScript 文件。我们所有的 Rad 控件都在名为“admin”的单独 Web 应用程序 (.csproj) 项目中实现。根 Web 应用程序项目 (.csproj) 有一个名为“admin”的文件夹,其中包含所有管理项目文件,包括管理 web.config。我在这里遇到问题的页面也存在于管理项目中。我认为它正在尝试访问根文件夹中的 .axd 文件,而不是“/admin”文件夹。 (在更改 HTTP 处理程序的路径后,问题底部出现另一个错误)。 如何让应用程序读取 ~/admin/Telerik.Web.UI.WebResource.axd 中的 WebResource.axd 文件而不是 ~/Telerik.Web.UI.WebResource.axd?猜测这 3 个 JavaScript 错误是由于此资源问题而导致的,因为当我显式导航到管理文件夹 URL 中的资源时,我可以看到 ASP.NET AJAX Control Toolkit JavaScript 代码。
源代码:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
<%--<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
</Scripts>--%>
</telerik:RadScriptManager>
根应用程序 web.config 中的代码:
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
以下是网站(根)应用程序项目 web.config HTTP 处理程序:
<httpHandlers>
<add path="/services/social.axd" verb="GET,POST" type="Acu.Cms.Modules.Social.PeopleHandler, Acu.Cms.Modules.Social"/>
<add verb="*" path="AcuLanapCaptcha.axd" type="Lanap.BotDetect.AcuCaptchaHandler, Lanap.BotDetect"/>
<add verb="*" path="LanapCaptcha.aspx" type="Lanap.BotDetect.CaptchaHandler, Lanap.BotDetect"/>
<add path="*.cmsx" verb="*" type="Acu.Cms.Web.HttpCmsRequestHandler, Acu.Cms"/>
<add path="image.acux" verb="GET" type="Acu.Web.Imaging.WebImageHandler, Acu.Web.Imaging"/>
<add path="media.acux" verb="GET" type="Acu.Cms.Web.CmsWebMediaHandler, Acu.Cms"/>
<remove verb="*" path="*.asmx" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
</httpHandlers>
以下是管理(虚拟目录)应用程序项目 web.config HTTP 处理程序:
<httpHandlers>
<remove path="LanapCaptcha.aspx" verb="*" />
<remove path="AcuLanapCaptcha.aspx" verb="*" />
<remove verb="*" path="*.asmx" />
<add path="Authenticator.ashx" verb="GET,POST" type="Acu.Cms.Website.Admin.Authenticator, Acu.Cms.Website.Admin" />
<add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" validate="false" />
<add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" validate="false" />
<!--ScriptResourceHandler.axd is the resource handler URL used to serve all of the javascript files found in the Microsoft AJAX Library-->
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
<add verb="*" validate="false" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI" />
</httpHandlers>
JavaScript 错误 #1:
ASP.NET Ajax 客户端框架无法加载。 em>
<script type="text/javascript">
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
JavaScript 错误#2:
Sys 未定义
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('RadScriptManager1', document.getElementById('editorform'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tctl00SU'], [], [], 90);
//]]>
</script>
JavaScript 错误#3:
RadEditorCommandList 未定义
RadEditorCommandList['Edit Link'] = function(commandName, editor, oTool)
{
_editor = editor;
_point = editor.CreateRestorePoint();
var selection = editor.GetSelection();
var pe = selection.GetParentElement();
var id = '';
if (pe && pe.tagName.toLowerCase() == 'a' && pe.attributes['cms:asset_id']) {
id = pe.attributes['cms:asset_id'].value;
}
window.top.InlineLinkEditor.selection = selection.GetText();
window.top.InlineLinkEditor.show('elementid=' + $('__elementId').value + '&xrefid=' + id + '&html=' + encodeURIComponent(selection.GetHtmlText()), editLink, null);
};
============
排除更多故障。 ..
我尝试将管理项目 web.config WebResource HTTP 处理程序的路径更改为“/admin/...”,但随后出现以下新错误。
<add verb="*" path="/admin/Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" validate="false" />
新错误:
Server Error in '/' Application.
'~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: '~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: '~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager]
Telerik.Web.UI.RadScriptManager.OnPreRender(EventArgs e) +169
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618
尝试从本文中获取一些信息:
< strong>还尝试使用它来解决问题..它对我有一些指导,但对于我的特定问题来说并不完整:
http://www.telerik.com/help/aspnet-ajax/introduction-troubleshooting .html
We have a web application with 2 web.config files. I'm using the telerik:RadScriptManager control within an ASP.NET page. There is web resource file (WebResource.axd) that this control needs access to for it's ScriptReferences. I think this .axd file contains the JavaScript files for Telerik's controls. All of our Rad Controls are implemented in a separate web application (.csproj) project called "admin". The root web application project (.csproj) has a folder called "admin" where all of the admin project files live, including the admin web.config. The page I'm having an issue with here also lives in the admin project. I think it's trying to access the .axd file in the root folder, not the "/admin" folder. (another error at the bottom of my question after I change the path of my HTTP Handler). How can I make the application read the WebResource.axd file in ~/admin/Telerik.Web.UI.WebResource.axd and not ~/Telerik.Web.UI.WebResource.axd? I'm guessing those 3 JavaScript errors are resulting because of this resource issue because when I navigate explicitly to the resource in the admin folder URL, I can see the ASP.NET AJAX Control Toolkit JavaScript code.
Source Code:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
<%--<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
</Scripts>--%>
</telerik:RadScriptManager>
Code within the root application web.config:
<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
Here are the website (root) application project web.config HTTP Handlers:
<httpHandlers>
<add path="/services/social.axd" verb="GET,POST" type="Acu.Cms.Modules.Social.PeopleHandler, Acu.Cms.Modules.Social"/>
<add verb="*" path="AcuLanapCaptcha.axd" type="Lanap.BotDetect.AcuCaptchaHandler, Lanap.BotDetect"/>
<add verb="*" path="LanapCaptcha.aspx" type="Lanap.BotDetect.CaptchaHandler, Lanap.BotDetect"/>
<add path="*.cmsx" verb="*" type="Acu.Cms.Web.HttpCmsRequestHandler, Acu.Cms"/>
<add path="image.acux" verb="GET" type="Acu.Web.Imaging.WebImageHandler, Acu.Web.Imaging"/>
<add path="media.acux" verb="GET" type="Acu.Cms.Web.CmsWebMediaHandler, Acu.Cms"/>
<remove verb="*" path="*.asmx" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="true" />
</httpHandlers>
Here are the admin (virtual directory) application project web.config HTTP Handlers:
<httpHandlers>
<remove path="LanapCaptcha.aspx" verb="*" />
<remove path="AcuLanapCaptcha.aspx" verb="*" />
<remove verb="*" path="*.asmx" />
<add path="Authenticator.ashx" verb="GET,POST" type="Acu.Cms.Website.Admin.Authenticator, Acu.Cms.Website.Admin" />
<add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" validate="false" />
<add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" validate="false" />
<!--ScriptResourceHandler.axd is the resource handler URL used to serve all of the javascript files found in the Microsoft AJAX Library-->
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
<add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
<add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
<add verb="*" validate="false" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI" />
</httpHandlers>
JavaScript Error #1:
ASP.NET Ajax client-side framework failed to load.
<script type="text/javascript">
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.');
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
JavaScript Error #2:
Sys is not defined
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('RadScriptManager1', document.getElementById('editorform'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tctl00SU'], [], [], 90);
//]]>
</script>
JavaScript Error #3:
RadEditorCommandList is not defined
RadEditorCommandList['Edit Link'] = function(commandName, editor, oTool)
{
_editor = editor;
_point = editor.CreateRestorePoint();
var selection = editor.GetSelection();
var pe = selection.GetParentElement();
var id = '';
if (pe && pe.tagName.toLowerCase() == 'a' && pe.attributes['cms:asset_id']) {
id = pe.attributes['cms:asset_id'].value;
}
window.top.InlineLinkEditor.selection = selection.GetText();
window.top.InlineLinkEditor.show('elementid=' + $('__elementId').value + '&xrefid=' + id + '&html=' + encodeURIComponent(selection.GetHtmlText()), editLink, null);
};
============
Troubleshooting some more...
I've tried changing the path of my admin project web.config WebResource HTTP Handler to "/admin/..." but then I get the new error below.
<add verb="*" path="/admin/Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" validate="false" />
New Error:
Server Error in '/' Application.
'~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: '~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: '~/Telerik.Web.UI.WebResource.axd' is missing in web.config. RadScriptManager requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information: Controls > RadScriptManager]
Telerik.Web.UI.RadScriptManager.OnPreRender(EventArgs e) +169
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618
Tried to get some information from this article:
Also tried using this to solve the issue.. it helped guide me a little, but was incomplete for my particular issue:
http://www.telerik.com/help/aspnet-ajax/introduction-troubleshooting.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,ASP.NET 首先查看根 web.config 中的 HTTP 处理程序,然后查看虚拟目录 web.config 文件中的 HTTP 处理程序。因此,当它到达下面我标记为“罪魁祸首”的行时,它从未到达虚拟目录 web.config 文件中的行。所以我只是在“罪魁祸首”HTTP 处理程序上方添加了另一行。
根网站文件夹 web.config HTTP 处理程序:
还将其添加到虚拟目录 web.config:
...删除其他处理程序
...另一种选择是添加“ admin/*” 到 web.config 属性路径的开头。如果该处理程序在 RadEditor 或其他控件中使用,则必须正确引用它。
Turns out that ASP.NET looks at the HTTP Handlers in the root web.config first, and then looks at the HTTP Handlers in the virtual directory web.config file. So when it hit the line I marked as "Culprit" below, it never reached the line in the virtual directory web.config file. So I just added another line above the "Culprit" HTTP Handler.
Root website folder web.config HTTP Handlers:
Also added this to the virtual directory web.config:
... removed other handlers
... the other alternative is to add "admin/*" to the beginning of the path web.config attributes. If that handler is used in the RadEditor or other control, you must reference it correctly.