难道ASP.NET MVC创建区域的默认路由 [英] Does ASP.NET MVC create default routes for areas

查看:165
本文介绍了难道ASP.NET MVC创建区域的默认路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个领域在我的MVC 3应用验证和用户。我使用的菲尔Haacks路线调试工具查看我的路线名单,看看哪一个是基于我的网址被选中。

I have a couple of areas in my MVC 3 application Auth and Users. I am using Phil Haacks Route Debugging tool to view a list of my routes and see which one gets selected based on my url.

然而,有一对夫妇路线present的,我还没有在任何我AreaRegistration文件或Globalasax创建,我不知道在哪里,他们都来自或者如何摆脱他们。该路线将突出显示在下面的黄色。

However there are a couple of routes present that I have not created in either my AreaRegistration file or Globalasax and I don’t know where they have come from or how to get rid of them. The routes are highlighted in yellow below.

您还可以看到,我在验证区域中创建一个默认路由(以绿色高亮显示),它们只是指向我的验证控制器的登录操作。我已经调试的RouteTable,它被添加在AreaRegistration.RegisterAllAreas();方法被调用。但是它不会在AreaRegistration加入已经通过这个也加大。

You can also see that I have created a default route in my Auth area (highlighted in green) which simply points to the Login action of my Auth controller. I have debugged the RouteTable and it gets added when the AreaRegistration.RegisterAllAreas(); method is called. However it does not get added in the AreaRegistration as have stepped through this also.

请问ASP.NET MVC添加此为默认值,如果是这样我可以以某种方式将其删除?

Does ASP.NET MVC add this as a default and if so can I remove it somehow?

推荐答案

我不喜欢回答我的问题,而是试图解决这个问题的前一天,我想我会发布的情况下,任何人有答案同样的问题。

I don’t like to answer my own question but after a day of trying to solve this problem I thought I would post the answer in case anyone else has the same issue.

在最后,我摆脱了从我的应用我的所有领域,并刚做了基本的Global.asax的路由。当我运行的应用程序,我可以在路由调试器路由集合仍被填充从现在不存在的区域路线看。尝试很多事情,比如从我的ASP.NET临时文件删除一切,与IIS AppPools乱搞,并清理浏览器的数据后,我终于通过这个答案来了。

In the end I got rid of all my areas from my application and just had the basic Global.asax routing. When I ran the app I could see in the route debugger that the routing collection was still being populated with the routes from now non existing areas. After trying many things including deleting everything from my ASP.NET temp files, messing around with IIS AppPools and cleaning out browser data I finally came across the answer.

我删除一切从网站bin文件夹,并重建和低不料,路都不见了。我恢复了我区与所描述的配置和一切工作,因为它应该。

I deleted everything from the websites bin folder, did a rebuild and low and behold, the routes were gone. I reinstated my areas with the config described and everything is working as it should.

我不知道为什么我的MVC应用程序被抓着和填充老路线,但只要我的箱子已被清除,新的DLL创造一切工作,因为它应该。如果有人在那里知道为什么这可能是那么我会非常有兴趣。

I have no idea why my MVC app was holding onto and populating the old routes but as soon as my bin was cleared and new dll’s created everything worked as it should. If anybody out there knows why this may be then I would be very interested.

这篇关于难道ASP.NET MVC创建区域的默认路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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