How can I create and manage a multi-tenant ASP MVC application

拈花ヽ惹草 提交于 2020-01-12 09:55:47

问题


I want to create a multi-tenant application that uses the hostname to determine the customer.

For example:

CustomerOne.myapp.com AnotherCo.myapp.com AndOneMore.myapp.com ...

I can do the database and security side with no problems, I can also get the hostname from the URL, but what I am struggling to find out is how to create the basic plumbing that would allow a new customer to sign up online, provide their company name, and for the application to create the new URL, ready to be used straight away.

Can anyone help?

Thanks,

Rob.


回答1:


I can't answer this exactly, but I can break it down a little bit.

To set up a new generic subdomain something.myapp.com you'll need to do two things:

1) Programmatically add some new DNS entries via your ISP so that something.myapp.com points to your web server.

2) Programmatically set the local bindings in IIS so that something.myapp.com gets directed to the right website/virtual directory/application

There is some discussion of setting IIS binding programmatically here, which also links through to this forum post here, which mentions that appcmd.exe can be used to set IIS config at run time.

Hope this points you in the right direction ...



来源:https://stackoverflow.com/questions/2593224/how-can-i-create-and-manage-a-multi-tenant-asp-mvc-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!