简体   繁体   English

如何在 IIS 7、Windows 7 上将 ASP.NET 4.0 添加为应用程序池

[英]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.我正在尝试将开发项目移至 Windows 7。运行该应用程序所需的一件事是选择 ASP.NET v4.0 作为 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 http://www.gotknowhow.com/articles/how-to-install-iis7-and-enable-aspnet

From within the IIS Manager , I select Application Pools and only seeIIS Manager 中,我选择Application Pools并且只看到
- Classic .NET AppPool -经典的.NET AppPool
- DefaultAppPool -默认应用程序池

I need to also be able to select from我还需要能够从中选择
- ASP.NET v4.0 - ASP.NET v4.0
- ASP.NET v4.0 Classic - ASP.NET v4.0 经典版

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)您可能需要安装 .NET 4(这也会为您创建一个新的 AppPool)

First make sure you have IIS installed then perform the following steps:首先确保您已 安装 IIS,然后执行以下步骤:

  1. Open your command prompt ( Windows + R ) and type cmd and press ENTER打开命令提示符( Windows + R )并键入cmd并按ENTER
    You may need to start this as an administrator if you have UAC enabled.如果您启用了 UAC,您可能需要以管理员身份启动。
    To do so, locate the exe (usually you can start typing with Start Menu open), right click and select "Run as Administrator"为此,找到 exe(通常您可以在开始菜单打开的情况下开始输入),右键单击并选择“以管理员身份运行”
  2. Type cd C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\ and press ENTER .键入cd C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\并按ENTER
  3. Type aspnet_regiis.exe -ir and press ENTER again.键入aspnet_regiis.exe -ir并再次按ENTER
    • 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 .如果这是 IIS 的新版本(没有其他站点在其上运行),或者您不担心托管站点因框架更改而中断,则可以使用-i而不是-ir This will change their AppPools for you and steps 5-on shouldn't be necessary.这将为您更改他们的 AppPools,并且不需要第 5 步。
    • at this point you will see it begin working on installing .NET's framework in to IIS for you此时您将看到它开始为您安装 .NET 的框架到 IIS 中
  4. Close the DOS prompt, re-open your start menu and right click Computer and select Manage关闭 DOS 提示符,重新打开开始菜单并右键单击计算机并选择管理
  5. Expand the left-hand side (Services and Applications) and select Internet Information Services展开左侧(服务和应用程序)并选择Internet Information Services
    • You'll now have a new applet within the content window exclusively for IIS.您现在将在内容窗口中拥有一个专用于 IIS 的新小程序。
  6. Expand out your computer and locate the Application Pools node, and select it.展开您的计算机并找到Application Pools节点,然后选择它。 (You should now see ASP.NET v4.0 listed) (您现在应该会看到列出的ASP.NET v4.0
  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.使用“选择...”按钮选择 .NET 4 AppPool,然后单击“确定”。
  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). (您也可以对要应用 .NET 4 的每个站点重复第 7 步)。


Additional References:其他参考资料:

  1. .NET 4 Framework.NET 4 框架
    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 aspnet_regiis.exe 选项
    For those that might want to know what -ir or -i does (or the difference between them) or what other options are available.对于那些可能想知道-ir-i作用(或它们之间的区别)或其他可用选项的人。 (I typically use -ir to prevent any older sites currently running from breaking on a framework change but that's up to you.) (我通常使用-ir来防止当前运行的任何旧站点因框架更改而中断,但这取决于您。)

In the top level of the IIS Manager (above Sites), you should see the Application Pools tree node.在 IIS 管理器的顶层(站点上方),您应该会看到应用程序池树节点。 Right click on "Application Pools", choose "Add Application Pool".右键单击“应用程序池”,选择“添加应用程序池”。

Give it a name, choose .NET Framework 4.0 and either Integrated or Classic mode.为其命名,选择 .NET Framework 4.0 和集成或经典模式。

When you add or edit a web site, your new application pools will now show up in the list.当您添加或编辑网站时,您的新应用程序池现在将显示在列表中。

Open a windows command line.打开 Windows 命令行。 Switch directories to C:\\Windows\\Microsoft.Net\\Framework\\v4.0.xxxx where the x's are the build number.将目录切换到C:\\Windows\\Microsoft.Net\\Framework\\v4.0.xxxx ,其中 x 是内部版本号。 Type aspnet_regiis -ir and hit enter.输入aspnet_regiis -ir并按回车键。 This should register .Net v4.0 and create the application pools by default.这应该注册 .Net v4.0 并默认创建应用程序池。 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 .如果没有,您需要通过右键单击 IIS 中的Application Pools文件夹并选择Add Application Pool来手动创建它们。

Edit: As a reference, please refer to the section of the linked document referring to the -i argument.编辑:作为参考,请参阅链接文档中引用 -i 参数的部分。

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

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.我刚刚遇到了这个问题,虽然我们已经在服务器上安装了 .NET 4.0,但结果我们只有“客户端配置文件”版本而不是“完整”版本。 Installing the latter fixed the problem.安装后者解决了这个问题。

Installing framework 4.0 redistributable is also enough to create application pool.安装 framework 4.0 Redistributable 也足以创建应用程序池。 You can download it from here .你可以从 这里 下载

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM