我可以部署MVC区域内的javascript文件? [英] Can I deploy a javascript file within MVC areas?

查看:186
本文介绍了我可以部署MVC区域内的javascript文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的js区里面的文件,我不能访问它们。当我移动它们MVC区域以外话,我可以访问。

I have my js files inside areas and I cannot access them. When I move them outside the MVC areas then I can access.

我曾尝试以下内容:


  • 的js文件不同的命名 - 不能解决问题

  • 检查,看看是否存在于服务器上 - 他们做

  • 访问直接从IIS管理器中的服务器上的文件 - 他们将不会打开,返回未找到

  • 访问同一文件从IIS管理器中直接在服务器上,但是当文件在脚本目录 - 他们浏览器中打开

  • 使用的路由检查 - 当我试图访问它不打开文件路径的调试,而是只是说404

本作品:

<script src="@Url.Content("~/Scripts/jquery/_Roles.js")" type="text/javascript"></script>

这不工作:

<script src="@Url.Content("~/Areas/Administration/Scripts/Roles/_Roles.js")" type="text/javascript"></script>

莫不是不同有关文件的东西下的区域文件夹,阻止脚本?

Could there be something different about files under the Areas folder that blocks scripts?

推荐答案

为什么把你的脚本在地区部分?我有一个地区一个MVC网站为好,但我还是保持我的脚本脚本文件夹中。

Why put your scripts in the Areas section? I have an mvc site with an area as well, but I still keep my scripts in the Scripts folder.

我的建议是重新考虑你组织你的内容的方式的原因,并考虑所有外部.js文件移动到Scripts文件夹。

My suggestion is to rethink the reason you're organizing your content that way and consider moving all external .js files to the Scripts folder.

这篇关于我可以部署MVC区域内的javascript文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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