asp.net-mvc - 部署到 Azure 服务时出现 MVC5 捆绑问题

标签 asp.net-mvc azure asp.net-bundling

我们有一个 MVC5 项目,有很多脚本文件和样式,我们使用 System.Web.Optimization。

问题是部署到 azure 时出现如下错误:

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 
Line 4:  
Line 5:  @section scripts{
Line 6:      @Scripts.Render("~/bundles/timeApp")
Line 7:      <script>

请注意,它在本地计算机上正常工作。

我们尝试降级“WEBGREASE”但没有成功

谢谢。

最佳答案

在多次遇到此问题时,它与 JavaScript 中的错误有关。注释掉正在加载和测试的所有文件,然后一次取消注释部分并重新测试以查看何时重新引入错误,这将导致您找到根本原因。

关于asp.net-mvc - 部署到 Azure 服务时出现 MVC5 捆绑问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26608072/

相关文章:

c# - "Collection was modified"尝试枚举包中的文件时出错

c# - Asp.net-mvc 将 ViewModel 传递给局部 View

jquery - 将嵌套的复杂 json 传递给 MVC Controller

asp.net-mvc - 尝试实现 RenderPartial

c# - Entity Framework 保存循环中的第一项,但不保存其他项

c# - Visual Studio 2022 中的 Microsoft Identity Platform 依赖项配置

c# - 使用 OAuth2 针对 Azure AD 进行身份验证以调用 WebAPI

json - Azure 数据工厂复制事件

asp.net-mvc - 有没有一种方法可以在运行时动态更新asp.net mvc bundle 内容?

jquery - MVC 与 jquery 捆绑在调试中不起作用