Asp.net MVC5 WebRole部署到Azure的云后,打破了上@ Scripts.Render [英] Asp.net MVC5 WebRole after deployed to Azure Cloud, breaks on @Scripts.Render

查看:313
本文介绍了Asp.net MVC5 WebRole部署到Azure的云后,打破了上@ Scripts.Render的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Asp.Net MVC 5 Web角色和Azure的SDK 2.3针对4.5.1框架云服务;该网站完全在本地。
但是,当我将其部署到Azure的云服务,我有经典的空引用错误:

I have a cloud service with an Asp.Net MVC 5 Web Role and Azure SDK 2.3 targeting 4.5.1 framework; The website works perfectly in Local. But when I deploy it to Azure Cloud service, I have the classic null reference error:

对象引用未设置到对象的实例。
异常详细信息:System.NullReferenceException:未将对象引用设置到对象的实例

Object reference not set to an instance of an object. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

源错误:

Line 9:      @Scripts.Render("~/bundles/jquery")

我BundleConfig.cs很简单:

My BundleConfig.cs is simple:

    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                     "~/Scripts/jquery-{version}.js",
                     "~/Scripts/knockout-{version}.js",
                     "~/Scripts/jquery.signalR-{version}.js",
                     "~/Scripts/modernizr-{version}.js"
                    ));

在WebRole使用的IntelliTrace日志,我可以看到这个错误:

Using Intellitrace Logs on the WebRole I can see this error:

有关文件监控E无效文件名:\\ sitesroot \\ 0 \\脚本

invalid file name for file monitoring 'E:\sitesroot\0\Scripts

在实例中的远程输入我看到该文件夹​​的脚本正是在这条道路。

Entering remotely in the instance I see that the folder Scripts is exactly in that path.

拆卸@ Script.Render页面加载正常。
在同一页上的@ Style.Render工作。

Removing the @Script.Render the page load normally. The @Style.Render on the same page works.

我试图在调试模式下部署和发布模式,无论是在升级。

I tried to deploy in Debug mode, and Release mode, both in Staging.

也试过在Web.config中更改

Also tried to change in Web.config the

compilation debug="true" and false

没有成功。
任何想法,为什么会发生呢?
谢谢

with no success. Any ideas why could happen this? Thanks

推荐答案

在测试的日子里,我发现问题是WEBGREASE包。更新就会造成即使是在一个全新的项目的问题。现在卸载它并重新安装previous版本解决了这个问题。

After days of tests I discovered that the problem is the WEBGREASE package. Updating it will cause the problem even on a fresh new project. For now uninstalling it and reinstalling the previous version solved the problem.

这篇关于Asp.net MVC5 WebRole部署到Azure的云后,打破了上@ Scripts.Render的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆