Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# css的ASP.NET MVC捆绑包在OWIN中为空_C#_Asp.net_Asp.net Mvc 5_Owin_Bundling And Minification - Fatal编程技术网

C# css的ASP.NET MVC捆绑包在OWIN中为空

C# css的ASP.NET MVC捆绑包在OWIN中为空,c#,asp.net,asp.net-mvc-5,owin,bundling-and-minification,C#,Asp.net,Asp.net Mvc 5,Owin,Bundling And Minification,我们最近将ASP.NET 5.2.3应用程序移动到了OWIN 3.0.1,并且出现了捆绑问题。*.js正在进行适当的捆绑,但是*.css捆绑包是空白的 我在哪里可以从捆绑输出中查找更多详细信息以了解发生了什么? 代码结构 Login.cshtml <head> ... @Html.RenderStyles("~/static/css/LoginPage") ... </head> Startup.cs using System.Web.Optimizat

我们最近将ASP.NET 5.2.3应用程序移动到了OWIN 3.0.1,并且出现了捆绑问题。
*.js
正在进行适当的捆绑,但是
*.css
捆绑包是空白的

我在哪里可以从捆绑输出中查找更多详细信息以了解发生了什么?

代码结构
Login.cshtml

<head>
...
    @Html.RenderStyles("~/static/css/LoginPage")
...
</head>

Startup.cs

using System.Web.Optimization;

namespace Foo.bar.Web.Bootstrapper {
  public class BundleConfig {
    public static void RegisterBundles(BundleCollection bundles) {
      bundles.UseCdn = true; //enable CDN support

      bundles
       .Add(new StyleBundle("~/static/css/LoginPage")
       .Include(
         "~/Static/css/login.css", 
         "~/Static/css/chosen.css")
       );
    }
  } 
}
[assembly: OwinStartup(typeof(Startup))]
namespace Foo.Bar.Web.Bootstrapper {
    public class Startup {
        private IContainer container;
        public void Configuration(IAppBuilder app) {
            //Commenting/Uncommenting this makes no difference.
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }
}

Web.config

<modules runAllManagedModulesForAllRequests="true" />

首先要确保您的包名不会与实际文件夹冲突

换句话说,将bundle名称更改为类似于
~/bundle/static/css/LoginPage


首先,在您的
BundleConfig.cs
定义和
Login.cshtml

中,不要让您的bundle名称与实际文件夹冲突。换句话说,在BundleConfig.cs定义和Login.cshtml中,将bundle名称更改为类似于
~/bundle/static/css/LoginPage
。捆绑真的是一件痛苦的事情,你也可以确认你的网络标签上没有404错误。你怎么知道CSS是空的?你是用F12工具看的吗?谢谢!是的,我正在使用chrome开发者工具检查捆绑包。我会尝试改变路径,同时仔细检查网络标签。祝你好运,这真的很痛苦。还要注意,当您处于调试模式时,它会自动关闭绑定。这就是我发现的,当我的网站运行完美时,当我发布它时,它完全失败了,因为捆绑是不正确的。查看她如何强制打开和关闭捆绑:将路径更改为
~/bundles/css/LoginPage
有效!请回复为答案,我会将其标记为答案。谢谢!这样做填充了样式包,但由于样式表中的相对路径,我遇到了许多404_哦,太好了!实际上,我自己在引导中的相对路径方面仍然存在问题——我不能使用图标。