故障排除和QUOT;资源无法找到&QUOT。错误 [英] Troubleshooting "The resource cannot be found." Error

查看:122
本文介绍了故障排除和QUOT;资源无法找到&QUOT。错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MVC 3应用程序内置到它的几个地区,领域之一是我的网站我的管理部分。一切都工作得很好。我想尝试MvcContrib便携式领域,使我的应用程序更加模块化,所以我安装MvcContrib和一些试验和错误后,我有一对夫妇便携式领域的启动和运行。

I have an MVC 3 App with a few Areas built into it, one of the areas is my Admin section of my site. Everything was working just fine. I wanted to try MvcContrib Portable Areas to make my app more modular, so I installed MvcContrib and after some trial and error I got a couple Portable areas up and running.

然后,我决定了我的移动管理区变成一台便携式领域,所以我创建了新的项目,并掐灭我联系便携领域。我不得不重新命名我的本地管理区,使其不会发生冲突。虽然移动约code到管理PA我决定,我不希望将所有的Telerik的和其他的东西我已经连接到了我的管理区的头痛。让我感动的事情回落到主体工程区和删除管理员PA。

Then I decided to move my Admin area up into a portable area, so i created the new project and stubbed out my Admin portable area. I had to rename my local Admin Area so that it would not conflict. While moving some code up to the Admin PA I decided that I did not want the headache of moving all the Telerik and other things I had wired up to my Admin area. SO I moved things back down to the main project Area and deleted the Admin PA.

我重新布线我的管理区回来,走到参与建立一个区域的一切。现在对于我的生活我不能让我的任何地区在我的主要项目加载。我不断收到资源无法找到。错误消息。

I rewired my Admin Area back in and went over everything involved in setting up an Area. Now for the life of me I cannot get any of my areas in my main project to load. I keep getting the "The resource cannot be found." error message.

我甚至竟然去掉了参考MvcContrib和便携式领域,但仍然没有运气。我在我的绳子结束,因为我不知道该如何调试此。我已经使用了自定义路由处理程序以及一瞥,但也不是当错误被抛出非常有用的。

I even went as far as removing the reference to MvcContrib and Portable Areas but still no luck. I am at the end of my rope as I do not know how to debug this. I have used a custom route handler as well as Glimpse but neither are very useful when the error is thrown.

下面是我的Global.asax路线

Here is the route in my global.asax

routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
            null,
            new string[] { "CoolProject.Web.Controllers" }
        );

下面是我在管理区域注册文件的路径

here is the route in my admin area registration file

context.MapRoute(
            "Admin_default",
            "Admin/{controller}/{action}/{id}",
            new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            new string[] { "CoolProject.Web.Areas.Admin.Contollers" }
        );

这是我的Global.asax

here is my Global.asax

public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
            new string[] { "CoolProject.Web.Controllers" }
        );

    }

    protected void Application_Start() 
    {

        AreaRegistration.RegisterAllAreas();
        RegisterGlobalFilters(GlobalFilters.Filters);
        RegisterRoutes(RouteTable.Routes);
        InitializeContainer();
        AppStart_Structuremap.Start();

        SiteMapManager.SiteMaps.Register<XmlSiteMap>("AdminNavigation", sitemap => sitemap.LoadFrom("/Areas/Admin/AdminNavigation.sitemap"));

    }

我检查我的设置对类似的工作现场,一切都与命名空间和类的例外是相同的。

I have checked my setup against a similar working site and everything is the same with the exception of namespaces and classes.

我在Win 7研发IIS7.5

I am developing on Win 7 IIS7.5

使用一瞥路线插件我可以看到的路由存在,但问题是,在我的Global.axas文件的路径是接管所有的请求的区域。

Using Glimpse Routes plugin I can see that the routes exist but the problem is that the route in my Global.axas file is taking over all the requests to the areas.

我需要做什么与我的路线做允许核心应用程序和地区相处?有趣的是,我使用的作品就好地区另一个生产应用。

What do I need to do with my routes to allow for the core app and the areas to get along? The funny thing is I have another production app using areas that works just fine.

更新....

我创建了一个新的MVC 3项目,增加了名为Admin的一个区域。然后,我编辑的AdminAreaRegistration.cs和Global.asax中的文件包括在图路线声明的命名空间,编译它,它运行完美。我可以没有问题访问区域

I created a new MVC 3 Project, Added a single area named Admin. Then I edited the AdminAreaRegistration.cs and Global.asax files to include the namespaces in the MapRoute statement, compiled it and it runs perfectly. I can access the area with no problem.

然后我比较在Global.asax并在我的破项目中的文件AdminAreaRegistration.cs,它们是相同的。这是不是与我怎么设置我的路线,我觉得是,我没有看到一个问题一个问题。

I then compared the Global.asax and AdminAreaRegistration.cs with the files in my broken project and they are Identical. This is not an issue with how I set up my routes, I think there is another problem that I am not seeing.

推荐答案

你叫

AreaRegistration.RegisterAllAreas();

上的Application_Start在你的Global.asax?您正在使用的服务器的发展卡西尼,IISEx preSS,IIS?

on Application_Start in your Global.asax? What server are you using for development Cassini, IISExpress, IIS?

审查更详细的信息后,编辑。

Edit after reviewing more detailed information.

在你的管理区注册文件,如果你有这样的code

In your Admin Area Registration File if you have this code

context.MapRoute(
        "Admin_default",
        "Admin/{controller}/{action}/{id}",
        new { controller = "Home", action = "Index", id = UrlParameter.Optional },
        new string[] { "CoolProject.Web.Areas.Admin.Contollers" }
    );

我觉得有一个错字在CoolProject.Web.Areas.Admin.Contollers,它应该是CoolProject.Web.Areas.Admin.Controllers?

I think there is a typo in "CoolProject.Web.Areas.Admin.Contollers" and it should be "CoolProject.Web.Areas.Admin.Controllers"?

这篇关于故障排除和QUOT;资源无法找到&QUOT。错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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