Search code examples
c#.netiismulti-tenantasp-net-mvc-1

Aspnet mvc multi-tenant multiple instance issue


My Asp.net MVC 5 web application on IIS server cannot load multiple instances for different customers based on URL application name parameter. In other words, we cannot login two applications at the same time as the application name in the different databases.

I set the application link pass the different application name as a parameter to the controller and use it to dynamically connect to the different database with the same schema for different instances. I use ASP.NET Membership's application name to identify the different instances in the controller.

For example:I use different browsers to login following two url with the same demo credential(username: user; password: pass), only one instance can show each time. I can login both and refresh the previous login one.It will change to the later login instance.

https://localhost.test.info/CM/Account/Login?app=c1

https://localhost.test.info/CM/Account/Login?app=c2


Solution

  • I experienced an issue like this when part of our code used "static" types. IIS would create a new instance of the webapp for each browser session but the static code was shared across them. A second idea is confirm your user identity code isn't using a application variable (in contrast to a session variable).