196

Configuring servers is not my strong suit by any means. I'm trying to move a development project to Windows 7. One of the things that I need to run the application is to select ASP.NET v4.0 as the application pool within IIS.

I went through the directions in the following link to make sure that the proper Application Development Options were selected:

http://www.gotknowhow.com/articles/how-to-install-iis7-and-enable-aspnet

From within the IIS Manager, I select Application Pools and only see
- Classic .NET AppPool
- DefaultAppPool

I need to also be able to select from
- ASP.NET v4.0
- ASP.NET v4.0 Classic

How can I add these to the list of available application pools?

Marcel Gosselin
  • 4,610
  • 2
  • 31
  • 54
Burferd
  • 2,481
  • 7
  • 24
  • 24
  • 6
    If the answer isn't acceptable, maybe throw out a clue so someone knows what's missing. Otherwise, it sure looks like a winner to me. – D. Lambert Sep 19 '12 at 19:44

5 Answers5

460

Chances are you need to install .NET 4 (Which will also create a new AppPool for you)

First make sure you have IIS installed then perform the following steps:

  1. Open your command prompt (Windows + R) and type cmd and press ENTER
    You may need to start this as an administrator if you have UAC enabled.
    To do so, locate the exe (usually you can start typing with Start Menu open), right click and select "Run as Administrator"
  2. Type cd C:\Windows\Microsoft.NET\Framework\v4.0.30319\ and press ENTER.
  3. Type aspnet_regiis.exe -ir and press ENTER again.
    • If this is a fresh version of IIS (no other sites running on it) or you're not worried about the hosted sites breaking with a framework change you can use -i instead of -ir. This will change their AppPools for you and steps 5-on shouldn't be necessary.
    • at this point you will see it begin working on installing .NET's framework in to IIS for you
  4. Close the DOS prompt, re-open your start menu and right click Computer and select Manage
  5. Expand the left-hand side (Services and Applications) and select Internet Information Services
    • You'll now have a new applet within the content window exclusively for IIS.
  6. Expand out your computer and locate the Application Pools node, and select it. (You should now see ASP.NET v4.0 listed)
  7. Expand out your Sites node and locate the site you want to modify (select it)
  8. To the right you'll notice Basic Settings... just below the Edit Site text. Click this, and a new window should appear
  9. Select the .NET 4 AppPool using the Select... button and click ok.
  10. Restart the site, and you should be good-to-go.

(You can repeat steps 7-on for every site you want to apply .NET 4 on as well).


Additional References:

  1. .NET 4 Framework
    The framework for those that don't already have it.
  2. How do I run a command with elevated privileges?
    Directions on how to run the command prompt with Administrator rights.
  3. aspnet_regiis.exe options
    For those that might want to know what -ir or -i does (or the difference between them) or what other options are available. (I typically use -ir to prevent any older sites currently running from breaking on a framework change but that's up to you.)
Brad Christie
  • 100,477
  • 16
  • 156
  • 200
  • 21
    Just make sure to run the cmd prompt with Administrative rights – Ahmad Mar 07 '11 at 10:19
  • Thanks for this - setup a new web server installed everything from web PI, latest framework updates and what do you know? IIS isn't even aware of ASP.NET ... this has happened too many times before, Microsoft, you really need to great rid of the clowns responsible for this. – Dalbir Singh Feb 27 '12 at 21:19
  • @Brad I didn't get a new app pool. The log file from running regiis, shows .NET 4 was successfully installed, and now I can select .NET 4 as the "ASP.NET version" for a site. But it seems I still have to manually create a new app pool(since I can't mix v2 apps with v4 apps in the same pool). – AaronLS Mar 06 '12 at 21:08
  • @AaronLS: So your site now has .NET 4 visible, but no .NET 4 AppPool to select from? – Brad Christie Mar 06 '12 at 21:11
  • Yes, correct. The App Pools node doesn't have anything new, and from the site there is no new pool to select. I can select .NET 4 as the "ASP.NET Version", but if it is in the default app pool with the .NET 2 apps, then it won't run and Event Log shows the error about different .NET versions running in the same app pool. This is IIS 6 if that is relevant. So I manually created a new app pool to put my new .NET 4 application in. – AaronLS Mar 06 '12 at 22:03
  • @AaronLS: Have you checked out this post: http://weblogs.asp.net/albertpascual/archive/2010/07/01/installing-asp-net-4-in-iis-6.aspx Your project framework needs to match the site's framework. – Brad Christie Mar 07 '12 at 01:23
  • @Brad Thanks,Brad. Both the project and the site are 4.0. It is working fine. My only point was that the 4.0 App Pool was not created automatically after running the v4 `aspnet_regiis.exe -ir`. – AaronLS Mar 07 '12 at 16:13
  • @Brad that blog post is actually quite misleading as well, because it suggest 4.0 will not work on IIS6 and recommends downgrading to 3.5. It works fine you just have to have an app pool for 1.1 apps, 2.0-3.5 apps, and another for 4.0 apps. Anyway, I still gave you +1 because all the other steps in your post got things working for me. – AaronLS Mar 07 '12 at 16:16
  • if you already have .NET 4 running, you only need to follow from step 6 – testpattern Apr 03 '13 at 14:53
  • I already had the full .NET 4 installed, but was only seeing .NET 2.0 classic & integrated available in IIS 7.5; that aspnet_regiis step took care of it and now I have .NET 4 classic & integrated in the app pool. :) – East of Nowhere Apr 04 '13 at 15:21
  • I've just installed .net 4.5 and it asked for restart. I clicked restart later. in app pool net 4.0 doesn't appear still. Is restart mandatory? – levi May 21 '13 at 09:46
  • @levi: not that i recall. A restart is required after installing the framework itself, so that may play a part. Did you install 4.5 without a restart then attempt to attach it to IIS? – Brad Christie May 21 '13 at 14:34
  • yes, I tried so. but made no sense. I had to restart finally, and everything went ok. – levi May 21 '13 at 16:21
  • Good answer, but I needed this article http://msdn.microsoft.com/en-us/library/ms181052(v=vs.80).aspx for enable mi iis :p – cmujica Jun 19 '13 at 12:38
  • @cmujica: I'll prepend that to the post, thanks for the reference and glad it worked out for you. ;-) – Brad Christie Jun 19 '13 at 12:43
  • Under Windows 10 / IIS 8 this is no longer the procedure. You can do it from Control Panel > Programs > Turn Windows features on/off > Internet Information Services > World Wide Web Services > Application Development Features > ASP.NET 4.7 – StuartN Oct 30 '17 at 16:44
15

In the top level of the IIS Manager (above Sites), you should see the Application Pools tree node. Right click on "Application Pools", choose "Add Application Pool".

Give it a name, choose .NET Framework 4.0 and either Integrated or Classic mode.

When you add or edit a web site, your new application pools will now show up in the list.

Scott
  • 13,735
  • 20
  • 94
  • 152
13

Open a windows command line. Switch directories to C:\Windows\Microsoft.Net\Framework\v4.0.xxxx where the x's are the build number. Type aspnet_regiis -ir and hit enter. This should register .Net v4.0 and create the application pools by default. If it doesn't, you will need to create them manually by right-clicking the Application Pools folder in IIS and choosing Add Application Pool.

Edit: As a reference, please refer to the section of the linked document referring to the -i argument.

http://msdn.microsoft.com/en-us/library/k6h9cz8h.aspx

Joel Etherton
  • 37,325
  • 10
  • 89
  • 104
3

I just encountered this and whilst we already had .NET 4.0 installed on the server it turns out we only had the "Client Profile" version and not the "Full" version. Installing the latter fixed the problem.

Chris Simpson
  • 7,821
  • 10
  • 48
  • 68
0

Installing framework 4.0 redistributable is also enough to create application pool. You can download it from here.

Pranav Labhe
  • 1,943
  • 1
  • 19
  • 24