使用Web Deploy部署.NET 4.5 Web应用程序

时间:2021-06-25 21:51:54

I have a working ASP.NET MVC 3 application. The project is built with VS 2010 and targets .NET 4.0. Now I re-targeted it to .NET 4.5 and successfully recompiled. Trying to deploy it to our test server (Windows 2008 R2 SP1) now fails:

我有一个有效的ASP.NET MVC 3应用程序。该项目使用VS 2010构建,目标是.NET 4.0。现在我将其重新定位到.NET 4.5并成功重新编译。尝试将其部署到我们的测试服务器(Windows 2008 R2 SP1)现在失败了:

Error Code: ERROR_APPPOOL_VERSION_MISMATCH More Information: The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v4.0'. This application requires 'v4.5'. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_APPPOOL_VERSION_MISMATCH.

错误代码:ERROR_APPPOOL_VERSION_MISMATCH更多信息:您尝试使用的应用程序池将“managedRuntimeVersion”属性设置为“v4.0”。此应用程序需要'v4.5'。有关详情,请访问:http://go.microsoft.com/fwlink/?LinkId = 221672 #ERROR_APPPOOL_VERSION_MISMATCH。

The server has .NET 4.5 installed but there is no app pool 4.5 (because it's inplace upgrade and as I understand 4.0 pool should be fine). The client machine has VS 2012 and so Web Deploy 3 (was Web Deploy 2 previously). I also installed Web Deploy 3 to the server.

服务器安装了.NET 4.5,但没有应用程序池4.5(因为它是在位升级,因为我理解4.0池应该没问题)。客户端计算机具有VS 2012,因此Web Deploy 3(之前是Web Deploy 2)。我还将Web Deploy 3安装到服务器上。

Tried to re-register ASP.NET with aspnet_regiis - no luck.

试图用aspnet_regiis重新注册ASP.NET - 没有运气。

Why do I get the error and how can I fix it? This is so frustrating...

为什么我会收到错误以及如何解决?这太令人沮丧了......

p.s. Found similar question about RC but it does not help

附:找到关于RC的类似问题,但它没有帮助

Update:

更新:

Looks like this is a bug Microsoft hasn't fixed since CTP. IgnoreDeployManagedRuntimeVersion property did the trick. What a shame!

看起来这是微软自CTP以来没有修复的错误。 IgnoreDeployManagedRuntimeVersion属性可以解决问题。多可惜!

4 个解决方案

#1


11  

You can try adding this property to the project:

您可以尝试将此属性添加到项目中:

<IgnoreDeployManagedRuntimeVersion>True</IgnoreDeployManagedRuntimeVersion>

#2


5  

Windows Server 2012 includes .NET 4.5 by default and (when Web server role added) IIS has the following app pools: DefaultAppPool, .NET v4.5, .NET v4.5 Classic that use .NET Framework 4.0 (because 4.5 is inplace upgrade of 4.0). However, if we install .NET 4.5 redistributable on Windows Server 2008 that has .NET 4.0 installed the pools are not renamed: ASP.NET v4.0, ASP.NET v4.0 Classic. And this is the key why Web Deploy fails.

Windows Server 2012默认包含.NET 4.5(当添加Web服务器角色时)IIS具有以下应用程序池:使用.NET Framework 4.0的DefaultAppPool,.NET v4.5,.NET v4.5 Classic(因为4.5是就地升级) 4.0)。但是,如果我们在安装了.NET 4.0的Windows Server 2008上安装.NET 4.5可再发行组件,则不会重命名池:ASP.NET v4.0,ASP.NET v4.0 Classic。这就是Web Deploy失败的关键。

#3


2  

@kzu: not trying, this will work.

@kzu:不尝试,这会奏效。

Had the same problem when installing Orchard CMS. Keep targeting v2.0. But find the simple solution: in IIS, on the Application Pools (the list with all application pools), you can find the 2nd setting top right list: "Set Application Pool Defaults.." change there the default from 2.0 to 4.0 et, voila.

安装Orchard CMS时遇到同样的问题。继续定位v2.0。但是找到简单的解决方案:在IIS中,在应用程序池(包含所有应用程序池的列表)上,您可以找到第二个设置右上角列表:“设置应用程序池默认值...”将默认值从2.0更改为4.0 et,瞧。

#4


1  

Register ASP.NET for IIS
a. Run CMD as Admin
b. CD to \windows\microsoft.net\framework\v4.x
c. Aspnet regiis -i

为IIS注册ASP.NET以管理员身份运行CMD。 CD到\ windows \ microsoft.net \ framework \ v4.x c。 Aspnet regiis -i

#1


11  

You can try adding this property to the project:

您可以尝试将此属性添加到项目中:

<IgnoreDeployManagedRuntimeVersion>True</IgnoreDeployManagedRuntimeVersion>

#2


5  

Windows Server 2012 includes .NET 4.5 by default and (when Web server role added) IIS has the following app pools: DefaultAppPool, .NET v4.5, .NET v4.5 Classic that use .NET Framework 4.0 (because 4.5 is inplace upgrade of 4.0). However, if we install .NET 4.5 redistributable on Windows Server 2008 that has .NET 4.0 installed the pools are not renamed: ASP.NET v4.0, ASP.NET v4.0 Classic. And this is the key why Web Deploy fails.

Windows Server 2012默认包含.NET 4.5(当添加Web服务器角色时)IIS具有以下应用程序池:使用.NET Framework 4.0的DefaultAppPool,.NET v4.5,.NET v4.5 Classic(因为4.5是就地升级) 4.0)。但是,如果我们在安装了.NET 4.0的Windows Server 2008上安装.NET 4.5可再发行组件,则不会重命名池:ASP.NET v4.0,ASP.NET v4.0 Classic。这就是Web Deploy失败的关键。

#3


2  

@kzu: not trying, this will work.

@kzu:不尝试,这会奏效。

Had the same problem when installing Orchard CMS. Keep targeting v2.0. But find the simple solution: in IIS, on the Application Pools (the list with all application pools), you can find the 2nd setting top right list: "Set Application Pool Defaults.." change there the default from 2.0 to 4.0 et, voila.

安装Orchard CMS时遇到同样的问题。继续定位v2.0。但是找到简单的解决方案:在IIS中,在应用程序池(包含所有应用程序池的列表)上,您可以找到第二个设置右上角列表:“设置应用程序池默认值...”将默认值从2.0更改为4.0 et,瞧。

#4


1  

Register ASP.NET for IIS
a. Run CMD as Admin
b. CD to \windows\microsoft.net\framework\v4.x
c. Aspnet regiis -i

为IIS注册ASP.NET以管理员身份运行CMD。 CD到\ windows \ microsoft.net \ framework \ v4.x c。 Aspnet regiis -i