How to add ASP.NET 4.0 as Application Pool on IIS 7, Windows 7

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?


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:

  • 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"
  • Type cd C:WindowsMicrosoft.NETFrameworkv4.0.30319 and press ENTER.
  • 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
  • Close the DOS prompt, re-open your start menu and right click Computer and select Manage
  • 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.
  • Expand out your computer and locate the Application Pools node, and select it. (You should now see ASP.NET v4.0 listed)
  • Expand out your Sites node and locate the site you want to modify (select it)
  • To the right you'll notice Basic Settings... just below the Edit Site text. Click this, and a new window should appear
  • Select the .NET 4 AppPool using the Select... button and click ok.
  • 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:

  • .NET 4 Framework
    The framework for those that don't already have it.
  • How do I run a command with elevated privileges?
    Directions on how to run the command prompt with Administrator rights.
  • 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.)

  • 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.


    Open a windows command line. Switch directories to C:WindowsMicrosoft.NetFrameworkv4.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

    链接地址: http://www.djcxy.com/p/90048.html

    上一篇: 在Linux上开发C#

    下一篇: 如何在IIS 7,Windows 7上将ASP.NET 4.0添加为应用程序池