Reputation: 16567
I don't know what I did, but suddenly my scripts and content folders return a 404 for all items.
I thought maybe it was folder permissions, since I put the project in a folder under "my documents". I ran VS as an administrator and I still have an issue with the style.
I ran in debug mode and there are no errors popping up.
Nothing changed in my master pages. I tried pulling it apart piece by piece with no such luck.
When I navigate to any images/css/scripts I get a 404 error. to prove I'm not crazy, here are my routes.
#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
);
Before you call foul on my last route, That was there before when it worked just fine. I also deleted it as a test to see if it was it, and it isn't the culprit.
It's as if the MVC internal handling of content and scripts has stopped working.
Here is my head section
<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>
Any ideas?
Upvotes: 1
Views: 1443
Reputation: 16567
I started pulling chunks of the web.config out and I found this section:
<httpHandlers>
<add verb="*" path="*" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpHandlers>
when I removed that, it started working again. I think it got pasted in when I was trying to make the application run in IIS6.
Upvotes: 2
Reputation: 1061
perhaps something to do with this:?
//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
);
comment this out and test.
EDIT: my bad. OP states that he has already tried commenting the TheOneRouteToRuleThemAll.
Have you tried setting some ignores for your static files?
routes.IgnoreRoute("{file}.js");
routes.IgnoreRoute("{file}.html");
It looks like the following route might map to your static location
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Upvotes: 1