开发者

Unable to Add .net 3.5 Website to IIS Express

开发者 https://www.devze.com 2023-03-14 00:56 出处:网络
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

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 a path attribute specified, no applicationPool 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 develo开发者_JAVA百科pers with the same code?


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.

Clr4IntegratedAppPool
Clr4ClassicAppPool
Clr2IntegratedAppPool
Clr2ClassicAppPool


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!


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

<sites>
        <site name="WebSite1" id="1" serverAutoStart="true">
            <application path="/">
                <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation=":8080:localhost" />
            </bindings>
        </site>
        <site name="CBR_Report" id="2">
            <application path="/" applicationPool="Clr2IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Code\Cost_Based_Rate\CBR_Report" />
            </application>
0

精彩评论

暂无评论...
验证码 换一张
取 消