是否有可能在动态.NET 4中创建的路线? [英] Is it possible to create routes dynamically in .NET 4?

查看:112
本文介绍了是否有可能在动态.NET 4中创建的路线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用中使用新的.NET 4的路由系统路由某些请求到网站的其他部分。我们只允许发布我们网站的code,在傍晚,这意味着我们必须熬夜工作发表任何code的变化。我们经常有必要创建定制的路线,以支持传统的链接,旧的内容,并将其路由到新的内容。这些通常需要马上和作为我们的路线是在编译Global.asax的定义,我们陷入僵局的时候,我们需要立即将这些活,但不能做code推。

In our application we use the new .NET 4 routing system to route certain requests to other parts of the site. We are only allowed to publish our site code in late evenings which means we have to stay late at work to publish any code changes. We frequently have the need to create custom routes to support legacy links to old content and route them to the new content. These are often needed right away and as our routes are defined in compiled global.asax we reach an impasse when we need these live immediately but cannot do a code push.

有没有办法,我们可以在某种配置文件定义路由,并有现场看他们在编程,无需重新启动应用程序?一个方法

Is there a way that we could define routes in some sort of configuration file and have the site read them in programmatically without restarting the application?

推荐答案

菲尔哈克给出了动态注册途径解决此处的 http://haacked.com/archive/2010/01/17/editable-routes.aspx

Phil Haack gives a solution for dynamically registering routes here: http://haacked.com/archive/2010/01/17/editable-routes.aspx

我认为,涵盖了你想要的,包括不具有整个Web应用程序重新启动。

I think that covers what you want, including not having the whole Web App restart.

这篇关于是否有可能在动态.NET 4中创建的路线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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