问题描述
一个是由多个组织(医疗行为,律师事务所共享应用程序..)和每一个组织,反过来,有它自己的用户。他们都登录一个集中的环境。
A multitenancy application is an app that is shared by multiple organizations (medical practices, law offices..) and each organization, in turn, has it's own users. They all log on a centralized environment.
要在应用程序中确定,该组织必须在URL pssed前$ P $。有针对两种主要形式的URL。子域和文件夹:
To be identified within the application, the organization must be expressed in the URL. There are two major URL forms for that. Subdomains and folders:
-
[tenancy_name] .appname.com /项目/视图/ 123
-
www.appname.com/ [tenancy_name] /项目/视图/ 123
[tenancy_name].appname.com/projects/view/123
www.appname.com/[tenancy_name]/projects/view/123
一开始我尝试第二次,因为这种解决方案并不涉及处理DNSS。但随后的问题:每当开发者需要前preSS的URL( @ Html.Action
或 @ Url.Action
)有明确传递 [tenancy_name]
。这增加了不必要的开销的发展。一个可能的解决方法是实施这些HTML辅助自动考虑到租约名的自定义版本。我正在考虑这个选项,但寻找的东西更多straitghtforward。我也意识到ASP.NET MVC自动传递路线值传出的URL,但只有当控制器和动作相同的电流。这将是很好,如果路由值总是通过。
At first I tried the second because this solution does not involve dealing with DNSs. But then the problem: Everytime the developer needs to express an url (@Html.Action
or @Url.Action
) it has to explicitly pass the [tenancy_name]
. This adds an unwanted overhead to the development. A possible workaround would be to implement custom versions of these HTML helpers that automatically take into account the tenancy name. I'm considering this option but looking for something more straitghtforward. I also realized ASP.NET MVC automatically passes route values for outgoing URLs but only when the controller and action are the same as the current. It would be nice if route values were always passed.
要实现第一个选项,子域名一个,我想,我需要一些第三方DNS管理器。我听说DynDNS的和它拍了一下,但我认为它目前还不清楚他们是如何工作的只是看着他们的网站。我需要触发一个Web服务,告诉他们要创建另一个子,每次一个新的租约创建?他们是否支持在DNS通配符?难道他们在Windows Azure上或共享hostings工作?
To implement the first option, the subdomain one, I think, I would need some third party DNS manager. I heard of DynDNS and took a look at it but I thought it unclear how they work just looking at their site. Would I need to trigger a web-service to tell them to create another subdomain everytime a new tenancy is created? Do they support wildcards in the DNS? Do they work on Windows Azure or shared hostings?
我在这里寻找方向。我应该走哪条路?
I'm here looking for directions. Which way should I go?
推荐答案
望codePLEX这个项目中,baseRoute也许可以帮助你。
look this project on codeplex, the "baseRoute" maybe can help you.
问候。
这篇关于如何设置使用ASP.NET MVC多租户应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!