【问题标题】:Parse Error while using ScriptManager使用 ScriptManager 时解析错误
【发布时间】:2009-03-06 06:22:42
【问题描述】:

我有一个两天前运行良好的 Web 应用程序。当我将此网站移至另一台机器时,遇到以下问题。

在我的网页中,我将 ScriptManager 声明为:

<asp:ScriptManager ID="scriptMgr" runat="server">
</asp:ScriptManager>

当我访问网页时,我收到此错误:

The base class includes the field 'scriptMgr', but its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager).

在另一个网页上,我收到以下错误:

The base class includes the field 'upProgress', but its type (System.Web.UI.UpdateProgress) is not compatible with the type of control (System.Web.UI.UpdateProgress).

我的 Web 应用程序基于 ASP.NET 2.0 构建,并且我还验证了 System.Web.Extensions.Dll 的正确 (1.0.61025.0) 版本存在于我的应用程序的 bin 文件夹中。

web.config 中 System.Web.Extensions.Dll 的条目是:

<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
  <section name="CSI.OLS.Library.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
  <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
      <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
      <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
      <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
    </sectionGroup>
  </sectionGroup>
</sectionGroup>


似乎这两个错误都与使用 AJAX 功能有关。谁能告诉我,是什么导致了上述错误?

【问题讨论】:

    标签: asp.net-ajax


    【解决方案1】:

    asp.net 2.0 不需要扩展补丁来正确支持 ajax 应用程序吗?

    http://www.asp.net/AJAX/downloads/

    【讨论】:

    • 我已经安装了这个补丁。尽管如此,我仍然面临错误。
    • 那么请发布您的 web.config
    • 我已经添加了web.config条目,请查看这个问题。
    【解决方案2】:

    这似乎是 .NET 2.0 AJAX 1.0 与 .NET 3.5 AJAX 的问题。 (即,AJAX 库直接包含在 .NET 3.5 中,看来您正在尝试使用 .NET 3.5 版本的 AJAX 库。)

    我在应用程序中遇到了同样的问题,发现 this 引用了该问题,并提供了两个解决问题的建议。

    一个建议是在您的项目文件对 System.Web.Extensions.dll 程序集的引用中将 Specific Version 属性设置为 True。由于您明确引用了此程序集的 1.0.61025.0 版本,我怀疑这会解决问题。

    【讨论】:

      【解决方案3】:

      一个迟到的答案 :) 但我在我的产品中遇到了类似的问题,并通过将以下内容添加到 web.config 来解决它

      <runtime>
              <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                  <dependentAssembly>
                      <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
                      <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly>
                  <dependentAssembly>
                      <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
                      <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/></dependentAssembly>
              </assemblyBinding>
      </runtime>
      

      这会重定向程序集绑定以便使用新版本,从而解决冲突

      【讨论】:

        猜你喜欢
        • 2010-09-10
        • 1970-01-01
        • 1970-01-01
        • 2021-09-04
        • 1970-01-01
        • 1970-01-01
        • 2020-02-08
        • 2013-01-08
        • 1970-01-01
        相关资源
        最近更新 更多