Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying .NET 4.5 web app with Web Deploy

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:

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.

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.

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

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

Update:

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

like image 779
UserControl Avatar asked Oct 10 '12 13:10

UserControl


People also ask

How do I deploy to Azure Web App?

To deploy to any Azure App service (Web app for Windows, Linux, container, Function app or web jobs), use the Azure App Service Deploy task. This task is automatically added to the release pipeline when you select one of the prebuilt deployment templates for Azure App Service deployment.


2 Answers

You can try adding this property to the project:

<IgnoreDeployManagedRuntimeVersion>True</IgnoreDeployManagedRuntimeVersion>
like image 85
kzu Avatar answered Sep 28 '22 06:09

kzu


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.

like image 37
UserControl Avatar answered Sep 28 '22 05:09

UserControl