捆绑区域中的虚拟路径

时间:2013-10-28 12:35:31

标签: asp.net-mvc bundling-and-minification system.web.optimization

我想创建一个带有以下虚拟路径的样式包(插件框架):

"~/Areas/Domain.PluginTest.Wui/Bundles/PluginCss"

当我走到那条路时,我收到一条错误,指出该文件不存在。 静态文件处理程序正在尝试查找文件。如何通过捆绑来完成这项工作?

System.Web.HttpException
Message:

File does not exist.
Stack trace:

at System.Web.StaticFileHandler.GetFileInfo(String 
virtualPathWithPathInfo, String physicalPath, HttpResponse response) at 
System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String 
overrideVirtualPath) at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext 
context, AsyncCallback callback, Object state) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.
HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, 
Boolean& completedSynchronously)

1 个答案:

答案 0 :(得分:0)

捆绑程序正在尝试查找不存在的路径~/Areas/Domain.PluginTest.Wui/Bundles/PluginCss。这就是我们通常使用bundles

为包路径添加前缀的原因
bundles.Add(new StyleBundle("~/bundles/Areas/Domain.PluginTest.Wui/Bundles/PluginCss")
       .Include());