为什么AjaxControlToolkit无法找到WebFormsBundle?

时间:2013-07-22 15:35:53

标签: asp.net webforms ajaxcontroltoolkit

我一直在尝试发布一个小型Intranet WebForms应用程序(.NET 4.0)几天,并且一直在跟踪已经结束的脚本错误的痕迹痕迹。最初脚本管理器抱怨没有找到我的Site.Master文件中引用的'MsAjaxBundle'。一些搜索引导我this page。我按照这些指示安装了AjaxControlToolkit并相应地修改了我的Web.config。

该网站现在抛出此错误:

程序集'AjaxControlToolkit,Version = 4.1.60919.0,Culture = neutral,PublicKeyToken = 28f01b0e84b6d53e'不包含名为'WebFormsBundle'的Web资源。

如果我注释掉WebFormsBundle引用,那么该网站至少会中途呈现,但不会将数据从SQL中提取到我的jqGrid中。

我已经尝试了2012年9月版本的工具包以及最新版本,每个版本都会抛出此错误。这让我很生气,因为当然,这个网站在本地建造和运行时工作正常。

堆栈跟踪以供进一步参考:

[InvalidOperationException: The assembly 'AjaxControlToolkit, Version=4.1.60919.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' does not contain a Web resource that has the name 'WebFormsBundle'. Make sure that the resource name is spelled correctly. Make sure that the application references the correct version of an ASP.NET AJAX Framework assembly.]
System.Web.UI.WebResourceUtil.VerifyAssemblyContainsReleaseWebResource(Assembly assembly, String releaseResourceName, Assembly currentAjaxAssembly) +305
System.Web.UI.ScriptReference.ShouldUseDebugScript(String releaseName, Assembly assembly, Boolean isDebuggingEnabled, Assembly currentAjaxAssembly) +91
System.Web.UI.ScriptReference.DetermineResourceNameAndAssembly(ScriptManager scriptManager, Boolean isDebuggingEnabled, String& resourceName, Assembly& assembly) +101
System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +105
System.Web.UI.ScriptReference.GetUrlInternal(ScriptManager scriptManager, Boolean zip) +601
System.Web.UI.ScriptReference.GetUrl(ScriptManager scriptManager, Boolean zip) +206
System.Web.UI.ScriptManager.RegisterUniqueScripts(List`1 uniqueScripts) +204
System.Web.UI.ScriptManager.RegisterScripts() +449
System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +125
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +113
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8167

工具包声明:

<ajaxToolkit:ToolkitScriptManager runat="server">
    <Scripts>
        <%--Framework Scripts--%>
        <%--<asp:ScriptReference Name="jquery" />
        <asp:ScriptReference Name="jquery.ui.combined" />
        <asp:ScriptReference Name="WebForms.js"  Path="~/Scripts/WebForms/WebForms.js" />
        <asp:ScriptReference Name="WebUIValidation.js"  Path="~/Scripts/WebForms/WebUIValidation.js" />
        <asp:ScriptReference Name="MenuStandards.js"  Path="~/Scripts/WebForms/MenuStandards.js" />
        <asp:ScriptReference Name="GridView.js"  Path="~/Scripts/WebForms/GridView.js" />
        <asp:ScriptReference Name="DetailsView.js"  Path="~/Scripts/WebForms/DetailsView.js" />
        <asp:ScriptReference Name="TreeView.js"  Path="~/Scripts/WebForms/TreeView.js" />
        <asp:ScriptReference Name="WebParts.js"  Path="~/Scripts/WebForms/WebParts.js" />
        <asp:ScriptReference Name="Focus.js"  Path="~/Scripts/WebForms/Focus.js" />
        <asp:ScriptReference Name="WebFormsBundle" />--%>
        <asp:ScriptReference Name="jquery" />
        <asp:ScriptReference Name="jquery.ui.combined" />
        <asp:ScriptReference Path="~/Scripts/WebForms/WebForms.js" />
        <asp:ScriptReference Path="~/Scripts/WebForms/WebUIValidation.js" />
        <asp:ScriptReference Path="~/Scripts/WebForms/MenuStandards.js" />
        <asp:ScriptReference Path="~/Scripts/WebForms/GridView.js" />
        <asp:ScriptReference Path="~/Scripts/WebForms/DetailsView.js" />
        <asp:ScriptReference Path="~/Scripts/WebForms/TreeView.js" />
        <asp:ScriptReference Path="~/Scripts/WebForms/WebParts.js" />
        <asp:ScriptReference Path="~/Scripts/WebForms/Focus.js" />
        <asp:ScriptReference Name="WebFormsBundle" />
        <%--Site Scripts--%>
    </Scripts>
</ajaxToolkit:ToolkitScriptManager>

删除具有相对路径的脚本的Name属性修复了使用它们的问题,因此这些行已被注释掉。

1 个答案:

答案 0 :(得分:0)

您引用的文章中介绍了此问题。如果您使用AjaxControlToolkit,则应使用ToolkitScriptManager代替ScriptManager。只需替换ScriptManager标记即可。