简体   繁体   中英

Web deploy error to IIS - application pool managedRuntimeVersion

When trying to deploy an ASP.NET application deployment package to IIS, I receive an error

(The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v2.0'. This application requires 'v4.0'.

I have taken these steps:

  • ensured my server's default .NET Framework version is 4 (restarted the IIS service on the machine)
  • ensured my web application is set for .NET 4
  • ensured the application's web.config has no references to requiring .NET 2 or 3.5

What is the root cause of this error, and how can it be solved?

在此处输入图像描述

在此处输入图像描述

Web Deploy uses the default IIS web site settings while publishing. To change/confirm this on your IIS machine:

  • go to IIS->Default Web Site->Basic Settings->Application Pool
  • select ASP.NET v4.0 or the appropriate app pool using the appropriate Framework version

If you're trying to import this application into an existing site , ensure that its application pool is the same version. I was attempting the same, but didn't realize my 'new' website was running on an app pool that was v2.

Be sure that your Application Pools by default are configured also for v4.0 by default.

在此处输入图像描述

在此处输入图像描述

ASP.NET 4 is installed when you install Visual Studio. However, the installation process does not automatically register ASP.NET 4 with IIS, and existing IIS Web sites are not automatically assigned to.NET 4 application pools.

To fix this , register ASP.NET with IIS and set the application pool of the destination IIS Web site to the .NET Framework version that is required by the package.

To do this , open Command Prompt as administrator and go to C:\Windows\Microsoft.NET\Framework64\v4.0.30319 and type: aspnet_regiis -i

According to Web Deployment FAQ for Visual Studio and ASP.NET

I was trying to use Continuos Deployment in VSTS/TFS, in my Release Definition (which was default), I had a IIS Web App Manage Task (named Manage IISWebApplication), where it had Parent website name setting with the correct website name, and the Virtual Path setting was right as well.

I just had to fix the web site name in the Deployment Process section, where it has the Environment Name and Website name as well.

Silly, but it got me 2 days to notice the web site name was in two places in the Release Definition.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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