ASP.NET multi-Tenant Application

南楼画角 提交于 2019-12-31 16:28:45

问题


I have an Asp.net application 3.5. I want to be able to allow multiple/ different clients to access the same application but using different URL's. I have already managed to configure the database to allow this. So here's the main part. I want to host my application in a domain say...

wwww.myapplication.com

then allow different client to access the same application using

1) www.clientOne.myapplication.com
2) www.clientTwo.myapplication.com

  • Also the client subdomains i.e(clientone.myapplication.com and clienttwo.myapplication.com) should be autocreated by the client upon registration.

How can I achieve this..Your help will be greatly appreciated

A good example of how I want my application to work is www.quickschools.com


回答1:


hi Guys i finally found out the solution that i wanted, so i thought i would share with you my finding. It turns out i needed to create a web application from another running Asp.net web application (From C# Code)

This tutorial by Robbe Morris was really helpful if you need to get started on this

Another article you might want to check out is this one

Thanks for all the help.




回答2:


To have different url's using the same application, i would use "301 redirect" subdomains. I'm not really sure how to have a webapp create these subdomains.




回答3:


I think the way to do this is to make the website the default website on the server i.e. configure so all requests to the servers IP hit this website (unless the header matches another website that explicitly looks for it). You do this just by not specifying a header on the IIS settings (only an IP address and a port number) - you can only do this for one site per IP address/port combination on the server.

Then look at the request url in the website to determine which domain was requested.

This way there is no need to 'create' subdomains... but you do need to reject all request to a domain that you don't want to recognize.

If you can't do this then you would need to adjust the IIS metabase from the application - not impossible - but a very risky and probably a bad idea.




回答4:


The common case is that you'll have to configure a new virtual site for each of your new tenants during account provisioning. See Creating a New Virtual Server on how to achieve this programatically. Some though argue (with convincing arguments...) that spinning up an appdomain for each tenant is a waste of resources and one should use routing in the application that inspect the HOST header, see Multi-tenant ASP.NET MVC – Introduction.

Configuring IIS/ASP to respond to your tenant sub-dmains is the easy part. The real problem will be to configure DNS for your tenants, and that depends on your DNS solution.



来源:https://stackoverflow.com/questions/4100463/asp-net-multi-tenant-application

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