角资源被误认为是C#MVC控制器 [英] angular resource is mistaken as C# MVC controller

查看:74
本文介绍了角资源被误认为是C#MVC控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直从ELMAH收到此错误

I keep getting this error from ELMAH

System.Web.HttpException:找不到路径'/bundles/angular-resource.min.js.map'的控制器或未实现IController.

System.Web.HttpException: The controller for path '/bundles/angular-resource.min.js.map' was not found or does not implement IController.

但是bundleConfig.cs

But the bundleConfig.cs

//angular framework
bundles.Add(new ScriptBundle("~/bundles/angular").Include(
  "~/Scripts/angular.min.js",
  "~/Scripts/angular-resource.min.js"));

〜/Scripts文件夹具有angular-resource.min.js.map文件.没人知道发生了什么吗?谢谢.

The ~/Scripts folder has angular-resource.min.js.map file. Doesn't anyone know what is going on? Thanks.

推荐答案

如果您看不起会找到的min文件

IF you will look down of your min files you will find

//# sourceMappingURL=

因此,当您加载浏览器时,将尝试加载源地图.由于您的bandle路径为〜/bundles/angular" ,浏览器将尝试加载 bundles 网址而不是脚本文件夹. 您可以代替

So when you load browser will try to load source map. Since your bandle path is "~/bundles/angular" browser will try to load against bundles url and not scripts folders. What you can do instead of

"~/Scripts/angular.min.js",
"~/Scripts/angular-resource.min.js"

删除分钟

"~/Scripts/angular.js",
"~/Scripts/angular-resource.js"

Bundler应该从原始资源中压缩脚本

Bundler should minify your scripts from original sources

对我来说,最后一个奇怪的原因是为什么您使用包来缩小文件,作为选择,您还可以使用

Lastly for me its a bit strange why you use bundle to minify minified files, as an option you can also just include scripts using

 <script src="/Scripts/angular.min.js"></script>
 <script src="/Scripts/angular-resource.min.js"></script>

这篇关于角资源被误认为是C#MVC控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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