MVC2 - 内容和脚本文件夹返回404 [英] MVC2 - Content and scripts folders return 404

查看:88
本文介绍了MVC2 - 内容和脚本文件夹返回404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我做什么,但突然我的剧本和内容文件夹中的所有项目返回404。

I don't know what I did, but suddenly my scripts and content folders return a 404 for all items.

我想也许这是文件夹权限,因为我把项目文件夹中的我的文档。我跑VS作为管理员,我仍然有风格的问题。

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.

当我浏览到任何图像/ CSS /脚本,我得到一个404错误。为了证明我不是疯了,这里是我的路线。

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.

这是因为如果内容和脚本的MVC内部处理已停止工作。

It's as if the MVC internal handling of content and scripts has stopped working.

下面是我的头节

<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>

任何想法?

推荐答案

我开始拉web.config中的大块出来,我发现这个部分:

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>

当我删除,它开始再次合作。我认为它得到了当我试图在IIS6的应用程序运行在粘贴的。

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.

这篇关于MVC2 - 内容和脚本文件夹返回404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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