我不知道我做了什么,但突然我的脚本和内容文件夹为所有项目返回404。MVC2 - 内容和脚本文件夹返回404
我想也许这是文件夹权限,因为我把项目放在“我的文档”下的文件夹中。我以管理员身份运行VS,并且我仍然遇到该风格的问题。
我在调试模式下运行,没有弹出错误。
我的母版页没有任何变化。我试图把它一件一件地拉开,没有这样的运气。
当我导航到任何图像/ css /脚本我得到一个404错误。为了证明我不疯狂,这里是我的路线。
#region Error Friendly Names
routes.MapRoute(
"AccessDenied", // Route name
"Error/AccessDenied", // URL with parameters
new { controller = "Error", action = "Index", code = "403" } // Parameter defaults
);
routes.MapRoute(
"NotFound", // Route name
"Error/NotFound", // URL with parameters
new { controller = "Error", action = "Index", code = "404" } // Parameter defaults
);
routes.MapRoute(
"ServerError", // Route name
"Error/ServerError", // URL with parameters
new { controller = "Error", action = "Index", code = "500" } // Parameter defaults
);
#endregion
#region Redirection
routes.MapRoute(
"Redirection", // Route name
"Redirect/{id}", // URL with parameters
new { controller = "Redirect", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
#endregion
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
//handle all unknown routes with a 404
routes.MapRoute(
"TheOneRouteToRuleThemAll", // Route name
"{*path}", // URL with parameters
new { controller = "Error", action = "Index", id = UrlParameter.Optional, code = "404" } // Parameter defaults
);
在你对我的最后一条路线称呼犯规之前,那是之前的情况,当它工作的很好。我还删除了它作为测试,看看它是否是它,它不是罪魁祸首。
就好像内容和脚本的MVC内部处理已停止工作。
这里是我的头部分
<head><title>My Site</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="robots" content="index, follow" /><meta name="keywords" /><meta name="title" /><meta name="description" /><link href="/Content/style.css" rel="stylesheet" type="text/css" /><link href="/Content/Themes/Green/Green.css" rel="stylesheet" type="text/css" /><link href="/Content/prettyPhoto.css" rel="stylesheet" type="text/css" />
<!--[if IE 7]>
<style>ul#servicesbox li {height: 1%;width: 70px;}</style>
<![endif]-->
<!--[if IE 6 ]>
<link href="/Content/ie.css" rel="stylesheet" type="text/css" />
<![endif]-->
<script src="/Scripts/jquery.js" type="text/javascript" /><script src="/Scripts/ddsmoothmenu.js" type="text/javascript" /><script src="/Scripts/cufon-yui.js" type="text/javascript" /><script src="/Scripts/Fonts/fontin.js" type="text/javascript" /><script src="/Scripts/functions.js" type="text/javascript" /><script src="/Scripts/jcarousellite_1.0.1c4.js" type="text/javascript" /><script src="/Scripts/jquery.prettyPhoto.js" type="text/javascript" />
<!-- PNG transparency fix for IE 6 -->
<!--[if IE 6]>
<script src="/Scripts/pngfix.js" type="text/javascript" />
<script>DD_belatedPNG.fix('#logo img,#slider,#piecemaker_slider,#contentbar,#testibox,#servicesbox li img,.nivo-controlNav a,.nivo-directionNav a,#social-links a img');</script>
<![endif]-->
<script type="text/javascript">
$(function() {
$(".newsticker-jcarousellite").jCarouselLite({
btnPrev: null,
btnNext: null,
btnGo: null,
mouseWheel: false,
easing: null,
vertical: true,
hoverPause: true,
circular: true,
visible: 1,
start: 0,
scroll: 1,
auto: 4000,
speed: 1000,
beforeStart: null,
afterEnd: null
});
});
</script>
</head>
任何想法?
您使用的是VS开发Web服务器还是IIS? – dotariel 2010-11-02 16:12:05
我正在使用VS开发服务器。 – Josh 2010-11-02 16:12:23
我也在2台机器上试过这个 - 它以前都是在这两个机器上工作的。 – Josh 2010-11-02 16:13:25