开发者

One application instance for two domain name

开发者 https://www.devze.com 2023-01-03 15:28 出处:网络
I have two web applications in ASP.NET which are quite the same (same business logic, same DAL, same DB scheme but different instance).

I have two web applications in ASP.NET which are quite the same (same business logic, same DAL, same DB scheme but different instance).

The only thing that I need to change is the design (logo, color,...) and the text (global and local resource) to adress two separate business sector. We cannot "sub开发者_高级运维domain" the application because we need the two app "seems to be" independant.

Is it a good idea to run only one instance for the 2 web applications.

For example :

I will have 2 hostnames : mycompagny.com and mycompagny2.com and I will put an HTTP Module which will set a string which will be propagated in my application like 'company' and 'company2'. I will instanciate the dal only once but the connection string will change depending on the string 'company' or 'company2'.

Any pros and cons ? Any other alternatives ?

[Updated] Just for information it is a Multi-Business and Multi-Tenant application because both application will have custom theme for some parts of the application.

For example :

mycompagny.com/Busineess1, mycompagny.com/Busineess2, mycompagny.com/Busineess3,.. and mycompagny2.com/Busineess2, mycompagny2.com/Busineess2, mycompagny2.com/Busineess3,...


It sounds like you are describing a Multi-Tenant application. Here is a nice overview of some of the challenges of working Multi-Tenant in ASP.Net. There is actually quite a lot of information being produced recently on Multi-Tenant ASP.Net MVC applications, so that is also worth a look.


Yes this is done all the time..even for large sites.

In ASP.NET, you can parse the Request.Url and determine which content to display or which data to retrieve, depending on the domain name.

When you're instantiating the DAL, you'll have to specify which db you want to connect to.


So at each request, you check the Request.Url, instanciate the DAL and then process your ressources ? I thought that you should instantiate the DAL at Application.Start()...

So How and "where" do you set the config to prevent passing the Request.Url string? I'm a bit worried because instantiate a DAL is a costly process... so is there a future "performance problem" ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号