无法将 .net 3.5 网站添加到 IIS Express
因此,我的问题是我有一个相当大的 ASP.NET 3.5 项目,我尝试使用 IIS Express 安装在本地运行该项目。我是团队中使用 IIS Express 运行此项目和其他项目的众多开发人员之一,实际上我每天都运行一个 .NET 4.0 站点(配有本地 SSL),没有出现任何问题。作为参考,我的计算机运行 Windows 7 Ultimate 64 位和 Microsoft Visual Studio 2010,并且我是本地计算机的管理员。 Visual Studio 以管理权限运行,并且我已确保 inetmgr 中列出的所有应用程序池都在运行。
以下是我尝试在本地运行项目时得到的工作流程:
- 当我第一次运行项目时,或者如果我删除 Microsoft WebMatrix(IIS Express 的配置实用程序,类似于 inetmgr)中列出的任何站点,我会得到以下结果消息序列:
(1) Microsoft Visual Studio 中的“是-否”对话框指出,
本地 IIS URL http://localhost:2000/site/path/ 尚未配置。为了打开该项目,需要配置虚拟目录。您想立即创建虚拟目录吗?
(2) 此时,我单击“是”。 VS 会弹出一个带有加载栏的中间窗口,达到大约 50%,然后 VS 会弹出一个警告对话框,内容如下:
Configuring Web http://localhost:2000/ 失败。您必须为 ASP.NET 3.5 手动配置此站点才能使该站点正确运行。 Visual Studio 无法检测此虚拟根是否已配置为与 ASP.NET 2.0 一起使用。可能的原因是您没有足够的权限来访问 IIS 元数据库。您可能需要为 ASP.NET 2.0 手动配置此站点,以便您的站点正确运行。
(3) 此时我只能单击“确定”或“帮助”,因此我单击“确定”继续。它继续对我的解决方案中配置为在 IIS Express 中本地运行的任何其他项目执行相同的过程。
- 当我尝试通过按 CTRL-F5 在本地运行该站点时,我收到一个错误对话框,其中显示:
。无法启动 IIS Express Web服务器
- 当我尝试在 Microsoft Web Matrix 中查看有关该站点的详细信息时,我从 WebMatrix 收到一条错误消息,内容如下:
错误导致 WebMatrix 关闭错误消息:应用程序池名称无效
。 > - 此错误消息是正确的,除非我查看
部分,每个应用程序有一个
标记,仅指定了path
属性,未指定applicationPool
属性。 (相反,在 IISExpress 上运行的 4.0 应用程序已指定此属性)。 - 将
applicationPool
属性添加到站点后,我可以在 WebMatrix 中打开/查看/编辑其详细信息,但仍然无法在本地运行它。
那么,我做错了什么,或者我的机器上的哪些配置不正确,导致我无法运行,但其他具有相同代码的开发人员却无法运行?
So, my issue is that I have a fairly large ASP.NET 3.5 project that I am trying to run locally using an IIS Express installation. I am one of many developers on my team who run this and other projects using IIS Express, and I actually run a .NET 4.0 site (complete with local SSL) on a daily basis with no issues. For reference, my machine runs Windows 7 Ultimate 64-bit with Microsoft Visual Studio 2010, and I am the administrator on the local machine. Visual Studio runs with administrative rights, and I have made sure that all of the App Pools listed in inetmgr are running.
Here's the workflow that I get when attempting to run the project locally:
- When I run my project for the first time, or if I remove any sites listed in Microsoft WebMatrix (the config utility for IIS Express, similar to inetmgr), I get this sequence of messages:
(1) A Yes-No dialog from Microsoft Visual Studio that states,
The local IIS URL http://localhost:2000/site/path/ specified for Web project My.Web.Project has not been configured. In order to open this project the virtual directory needs to be configured. Would you like to create the virtual directory now?
(2) At this point, I click "Yes". An intermediate window from VS pops up with a loading bar, gets to about 50%, and then a Warning dialog from VS pops up, reading:
Configuring Web http://localhost:2000/ for ASP.NET 3.5 failed. You must manually configure this site for ASP.NET 3.5 in order for the site to run correctly. Visual Studio cannot detect whether this virtual root has been configured for use with ASP.NET 2.0 The likely cause is that you do not have sufficient privileges to access the IIS metabase. You may need to manually configure this site for ASP.NET 2.0 in order for your site to run correctly.
(3) At this point I can only click "Ok" or "Help, so I click OK to continue. It proceeds to do this same process for any other projects in my solution that are configured to run in IIS Express locally.
- When I attempt to run the site locally by hitting CTRL-F5, I get an error dialog box that reads,
Unable to launch the IIS Express Web Server
- When I attempt to view details about said site in Microsoft Web Matrix, I get an error message from WebMatrix that reads:
An error caused WebMatrix to shut down. Error message: Invalid application pool name
- This error message is correct, except when I look at the IIS Express configuration file (C:\%User Dir%\My Documents\IISExpress\config\applicationhost.config), in the
<sites>
section, each application has an<application>
tag with only apath
attribute specified, noapplicationPool
attribute specified. (Conversely, the 4.0 app that does work on IISExpress has this attribute specified). - Once I add an
applicationPool
attribute to a site, I can open/see/edit its details in WebMatrix, but still am unable to run it locally.
So, what am I doing wrong or what configuration is incorrect on my machine that is stopping me from running, but not any other developers with the same code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于应用程序,如果未明确指定应用程序池,则将使用默认应用程序池。在 IIS Express 中,默认应用程序池是 Clr4IntegratedAppPool
。如果您的应用程序不是 .net 4.0 应用程序,请进行相应的设置。如果您的应用程序是 2.0 应用程序,则将 appPool 设置为“Clr2IntegratedAppPool”。
下面给出的是 IIS Express 配置中预定义的应用程序池。
For an application, if the appPool is not specificed explicitly default apppool would be used. In IIS Express default app pool is Clr4IntegratedAppPool
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
.If your application is not a .net 4.0 app, then set it accordingly. If your application is 2.0 app, then set the appPool to 'Clr2IntegratedAppPool'.
Below given are application pools pre-defined in IIS Express configuration.
所以,当我写完问题时,我实际上解决了这个问题。当我确定配置文件的详细信息时,我意识到项目的设置方式,配置中的第一个站点中定义了两个应用程序(一个是提供数据检索的服务,另一个是成熟的应用程序)网站),因此我只为三个应用程序中的两个提供缺少的 applicationPool 属性。
如果我能弄清楚为什么它缺少所需的 appPool 属性,我将更新此答案。希望这对其他人也有帮助!
So, I actually solved this as I was finishing writing the question. As I was ascertaining the details for the configuration file, I realized that the way the project is setup, there are two applications defined in the first site in the config (one is a service that provides data retrieval, the other is a full-fledged website), and so I was only providing the missing applicationPool attribute for two of the three applications.
If I can figure out why it was missing the required appPool attributes, I'll update this answer. Hopefully this helps someone else, too!
我在 VS 2017 中遇到了这个问题,在一台没有安装 IIS 的机器上。因此找到应用程序池设置比较困难。
我曾尝试将站点回滚到 .NET Framework 2.0。工作量超出了其价值,因此放弃了该分支并返回到我之前使用 4.6.1 的 git 分支。然而 IIS Express 一直试图以 2.0 的形式运行!
终于找到设置的地方了它位于解决方案文件夹下: .vs\config\applicationhost.config
然后找到我的站点(“CBR_Report”),以及设置:applicationPool="Clr2IntegratedAppPool"。
I ran into this in VS 2017, on a machine without IIS installed. So finding the application pool setting is harder.
I had tried rolling a site back to .NET Framework 2.0. More work than it's worth, so abandoned that branch and went back to my previous git branch which used 4.6.1. However IIS Express kept trying to run as 2.0!
Finally found where it's set. It's under the solution folder: .vs\config\applicationhost.config
Then found my site ("CBR_Report"), and the setting: applicationPool="Clr2IntegratedAppPool".