Multiple instances of web application

J

Joerg Schrocke

Hello!

Can run multiple instances of a web application in one IIS or could i get
some problems with them?

Many thanks!

Joerg
 
A

Alvin Bruney - ASP.NET MVP

How would you address them via url in a browser?
What are you trying to accomplish?

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
S

S.M. Altaf [MVP]

I really don't think the concept of "instances" applies in the case of ASP.NET applications. Perhaps this is just a bit of bad terminology on your part, when you actually meant something else.

-Altaf
[MVP]



--------------------------------------------------------------------------------

All that glitters has a high refractive index.
www.mendhak.com
"Alvin Bruney - ASP.NET MVP" <www.lulu.com/owc> wrote in message How would you address them via url in a browser?
What are you trying to accomplish?

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
C

CT

Joerg,

I am not sure exactly what you mean. If you mean multiple client (browser)
connections/sessions with a single Web app, then no problem. This is the
"default" setup. If you mean having severeal copies of the same Web app
running on IIS simulteneanously, which I suspect you do, you would at least
a way of "separating" the instances using say a naming convention. I'm not
sure what the purpose is, but perhaps this is related to a Web farm and/or
scalability?
 
C

CT

Joerg,

Yes, this is possible. The only question is if you want all of the URLs to
point to the same physical folder, or if you want a copy of the Web app in a
seperate folder for each URL?
 
J

Joerg Schrocke

I want have a folder for each web app. For example:

...inetpub/wwwroot/webapp1
...inetpub/wwwroot/webapp2
...inetpub/wwwroot/webapp3

Joerg
 
C

CT

Okay, so you want this URL, http://servername/webapp1 to point to the
\inetpub\wwwroot\webapp1 physical folder on disk, http://servername/webapp2
to point to the \inetpub\wwwroot\webapp2 folder, and
http://servername/webapp3 to point to the \inetpub\wwwroot\webapp3 folder,
right? Now, you then need a copy of your code in each of these folders, and
I guess this is where your original question is very valid; can this be
problematic. Yes, it can, depening on which resources your application
accesses. If you access a database, your code should handle concurrency
issues, and you might want to go with optimistic concurrency. Having said
that, any Web application needs to handle concurrency issues as you can have
multiple users online simulteanously. In fact, just about all applications
need to cater for concurrency issues these days. :)

Now, the problem with the suggested setup is if you have any application
wide settings saved to application state, as this isn't possible across your
different Web apps. Well, at least it isn't possible without some quirks, if
you know what I mean. If you happen to save to a file on disk there are also
potential problems, because of locking issues.

I'm sure there are other things to look out for, but to keep it short, your
idea can work. Now that's out of the way, can you possibly tell me why you
want to do it this way?
 
J

Joerg Schrocke

We need this, because we want to use the webApp for different projects. Each
project should have its own webApp with the own web.config, where for
example the connection string is stored. Each wepApp has its own database.

Joerg
 
J

Jim Underwood

Joe,
What you are suggesting is basically 3 different web sites, running 3
different applications. Sure, they may be using the same code, but as far
as IIS goes they are as different as any 3 other websites. Just think of it
as setting up 3 different web sites in IIS, regardless of the code that runs
in each.
 
M

manger22

It seems to me like this really the hard way of going about things.

It sounds like you have one web application but you have thre
different databases (one for each project). I assume that over tim
you'll add more projects, at which point you'll create a new databas
and add another copy of your web app to the web server.

Wouldn't it be easier and more maintainable to only have one copy o
your application running on the IIS box, but use different host header
to access it?

In IIS you can configure just about as many host-headers as you wish
assigning a name and an IP address to each.

So, it'd look something like this.

IIS:
IP: Some IP Host Header: project1.yourdomain.com
IP: Some IP Host Header: project2.yourdomain.com

Then slap some keys in your web.config file for each project...

Something like this...
<add key="HostHeader.Project1" value="project1.yourdomain.com"/>
<add key="HostHeader.Project2" value="project2.yourdomain.com"/>

You'll need to put a connection string property in your web.config fo
each of those keys as well...

When you get to the point where you would normally grab the connectio
string from the config, first grab the host header, here is the cod
for that...

string strHostHeader
HttpContext.Current.Request.ServerVariables["HTTP_HOST"].ToLower().Trim();

Then just grab the connection string for that host header...

I just finished reading what I wrote, that got pretty long, boring da
at work...

Mik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top