- .NET 4.51 网络表单
- VS2013 更新 1
我从一个全新的 Web 项目开始,选择了 WebForms 和 MVC 支持。在本地工作了几天,没有任何问题。但是现在我在网络上部署它,我收到错误:
类型错误:Sys.WebForms.Res 未定义
阅读其他帖子后,这似乎与 ScriptManager 等有关。所以下面是我的母版页脚本管理器 block :
<asp:ScriptManager runat="server">
<Scripts>
<%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=301884 --%>
<%--Framework Scripts--%>
<%--<asp:ScriptReference Name="jquery" />--%>
<asp:ScriptReference Name="MsAjaxBundle" />
<asp:ScriptReference Name="bootstrap" />
<asp:ScriptReference Name="respond" />
<asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
<asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
<asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
<asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
<asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
<asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
<asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
<asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
<asp:ScriptReference Name="WebFormsBundle" />
<%--Site Scripts--%>
</Scripts>
</asp:ScriptManager>
<div class="container body-content">
<asp:ContentPlaceHolder ID="cphMainWithoutUpdatePanel" runat="server"></asp:ContentPlaceHolder>
<asp:UpdatePanel ID="updMain" runat="server">
<ContentTemplate>
<asp:ContentPlaceHolder ID="cphMain" runat="server"></asp:ContentPlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
</div>
我在头部声明了 jQuery:
<script src="//code.jquery.com/jquery-1.11.0.min.js" type="text/javascript"></script>
web.config 中对 AJAX 的唯一引用:
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<authentication mode="None" />
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="Microsoft.AspNet.Identity" />
</namespaces>
</pages>
除了更新面板之外,我没有使用任何 MS AJAX AFAIK。所以没有AjaxControlToolkit。我的页面中没有自定义 JS 调用。
因此,由于这一切都在本地运行,因此我相信远程服务器上有些东西是不同的。然而,对于我的一生来说,我无法解决这个问题。有人有什么建议吗?
真的需要让它上线,所以任何帮助或建议,无论多么牵强,都会愉快地收到。
最佳答案
我最终解决了这个问题。就我而言,出现此问题的原因是在更新面板中发现的代码/控件中存在其他一些低级异常。
纠正上述错误后,一切正常,Res 错误就消失了。现在,如果我遇到低级错误(例如 EF 问题或类似问题),错误就会再次出现。很烦人,但至少我知道它是什么以及如何处理它。
关于asp.net - Sys.WebForms.Res 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22435225/