3

I have one web site in IIS, and I would like to have version 2, 3.5, and 4 applications hosted under the same IIS web site. Is this possible?

Thought it'd be as easy as modifying the web.config. What I have so far is I created an ASP.NET 3.5 site on the root. Then I created a directory underneath and deployed an ASP.NET 2.0 site. So far, when I view the 3.5 site, it views fine. The 2.0 site, however, when I browse to the directory's default.aspx, I get:

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Any thoughts?

Thanks.

UPDATED to show full error (not sure if it helps)

enter image description here

SaltProgrammer
  • 1,045
  • 2
  • 13
  • 29

5 Answers5

6

You can have multiple applications hosted by one website on one IIS. Do the following:

1.) Add a website to your IIS

2.) Go to the physical folders on your harddisk/ftp-server and define the folders, where your applications should live inside the website, for example: [ ] = folder ( ) = file

=====>[root]

==========>(web.config)

==========>[bin]

==========>[sites]

==========>[images]

==========>[application 1]

====================>(web.config) (to clear and overwrite inherited settings)

====================>[bin]

====================>[sites]

====================>[images]

==========>[application 2]

====================>(web.config) (to clear and overwrite inherited settings)

====================>[bin]

====================>[sites]

====================>[images]

3.) Go back to the IIS Manager and choose "Application Pools" and "Add a new application pool". Call it "application 1". Repeat it and call the second "application 2"

4.) Choose your website on the left and browse through the folders, that you have just created. Right click on folder "application 1" and choose "convert into application". Do the same for folder "application 2". Each time you do that, choose the application pool from step 3.)

5.) You are ready. Now, when you put code in the "bin" folder of "application 1" or "application 2" it is seen as a different and seperat application.

6.) Be aware, that all web.config properties from folders above "application 1 or 2" are inherited. You can overwrite them by using your own web.config inside the folder "application 1 or 2", using the "clear" tag or the "remove" and "add" tag. Chances are high, that you have definded a web.config for the root folder of your website. This web.config will be inherited by your applications.

Michael
  • 938
  • 1
  • 10
  • 34
6

You need separate IIS Applications for each web app. Coincidentally, separate apps can have separate App Pools, which in turn can have separate .NET framework versions.

But that's not your issue

In the case of your app, you're having issues with a .NET 2.0 web app and a .NET 3.5 web app, which use the same version of .NET (CLR 2.0). The issue you're seeing is because the sub-app isn't marked as a separate application, so the runtime is looking in the wrong place for the assembly to load your type.

Your site contents probably look something like this:

root (~/)
- bin
  * app.dll
- sub-app
  - bin
    * subapp.dll

When the subapp runs, it's trying to load type Second.Namespa._Default, but the assembly path is to ~/bin (root/bin), which doesn't contain the correct assembly. If you mark sub-app as its own application in IIS, you'll get this:

root (~/)
- bin
  * app.dll
- sub-app (~/ again for anything below)
  - bin
    * subapp.dll

Now loading Second.Namespa._Default will look in the ~/bin (now sub-app/bin), and find the correct assembly and be able to load the type.

Jimmy
  • 27,142
  • 5
  • 87
  • 100
  • @Jimmy: How about if I want the sub app search into the `root/bin` for dll(s) once failed in `sub-app/bin`? – hguser Apr 10 '15 at 00:11
  • @hguser I'm not positive, but I'm guessing that's not allowed. Doing so would basically allow a given IIS application to be configured to search any directory on the machine, which is obviously a big security risk. Remember, there isn't specifically a parent-child relationship; just one isolated app which happens to be under another isolated app. – Jimmy Apr 10 '15 at 07:05
1

Can you post more details about the error?...

Yes...you can do it...you can create an "Application" within a website in IIS ...and this application can use a totally different application pool and can target a different .NET framweork...

NiK
  • 1,827
  • 1
  • 20
  • 37
  • @SaltProgrammer did you deploy all the dlls...required for the .NET 2.0 website and all other websites?... – NiK Mar 27 '12 at 22:14
1

Be sure to choose and configure a seprate app pool for the second site/application.

Steen
  • 2,749
  • 2
  • 20
  • 36
1

You can host all the versions of .NET in one single IIS provided you separate the sites into Application Pools. Within the App Pool each application is run by the same .NET version (set on the pool)

Peter Aron Zentai
  • 11,482
  • 5
  • 41
  • 71