Web deploy error to IIS - application pool managedRuntimeVersion - asp.net

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.

Related

How do I target a specific Application Pool when using Visual Studio 2012's Web Deploy?

My application can not deploy because of the following error:
Web deployment task failed. (The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v2.0'. This application requires 'v4.0'.)
Right now, I'm attempting to deploy my .NET application to IIS. VS is attempting to target the "DefaultAppPool" application pool. I want it to instead target the "ASP .NET v4.0" application pool. How do I do that in Visual Studio?
I am trying to not change any settings within IIS if possible.
I don't know if this would be considered a hack, but it got the job done without any issues.
What I did was I first created a folder in IIS and then converted it to an application. After which, I had it target the .NET 4.0 application pool and voila, Visual Studio was able to deploy the application without the error.
I hope this helps people in the future that Google their issue and come upon my question.

Migrate a ASP.Net application from one server to another server

I have developed a ASP.Net MVC 4 application with Visual Web Developer Express 2010. It was successfully published/deployed to a remote server A (development server) using the Web Developer's built-in publishing tool and it works perfectly on it IIS 7.0 with the web deployment component.
Now I want to deploy it to another remote server B (production server). This one sits in an isolated environment and does not have Internet access! Even if server B is a replica of server A, its IIS 7.0 does not have the web deployment tool component installed. So the built-in publishing tool does not work for the web deployment option.
I then tried to publish it using the File System option. I copied the exported files to a new folder on IIS on server B. The folder was configured the same way as its counterpart on server A. I tried the URL on server B and it just gave me directory/files listing on the browser instead of the welcome page of the application.
Has anybody got the experience or tips to solve the issue? Thanks.
Cheers,
Alex
edit:
because it a MVC site, the default document doesn't apply. check the following steps:
IIS Extension Less URLs are enabled and allowed.
ASP.NET 4.0 is installed and registered. C:\Windows\Microsoft.NET\Framework\<version> and then aspnet_regiis -i (this will typically force IIS to use the MVC infrastructure instead of using the default document methodology)
Ensure App Pool is in 4.0 Integrated mode.
Ensue that the IIS Advanced Settings for the website are showing the right root folder path.

Publishing my asp.net mvc web application using VS 2012 on IIS is not working, unless I run the web application inside the VS

I have an asp.net mvc 4 web application , and I use the visual studio publish feature, to publish my web application to the localhost iis. But currently if I type the web application URL it will not work unless I open the VS and run the application. so can anyone adive how I can publish my web application on IIS so users can access the web application event if the VS is not running .
Thanks
Publishing a website to your Inetpub\wwwroot is not recommended on a standard computer, you will need to host your application on a server. Windows server has no limit on the amount of connections allowed to your webpage, whereas your computer can only handle a maximum of 10 connections.
if you want your solution to work outside of VS but still on your computer, you will have to create a virtual directory within IIS or within VS (then VS will do it in IIS for you).
Right click on your project, go to the "web" tab, there is an option there to host it within IIS and a button that creates the virtual directory for you.
Also check that you then have an application pool set up and running the correct version of .NET (depending on the framework you created the application in)

How to host an ASP.NET Web Applications site on IIS 7

I'm locally working on an ASP.NET Web Applications site. It's almost finished so i wanted to try and put it in an IIS server.
The IIS server is running on a different server. What do i need to do to run my ASP.NET web site in that remote IIS server?
I tried to following:
I copied my entire project directory (so including the .csproj file, the bin folder etc.) to the following location on the remote server, where IIS is running C:\MyProject.
In IIS manager i added a Virtual Directory under Default Web Site. Located my Web Site files in C:\MyProject and added that folder. Then in IIS manager i converted that Virtual Directory to an Application.
But when i browse to my Web Site i get an error:
HTTP Error 500.23 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
So this is probably not the way to do it. I don't think i can just do a Deploy, because i never set up any .axd(?) or anything.
So my question is, what do i have to do in order to run my Web Site on IIS..?
The error will be probably because of, you developed the site in .net version 2.0 and try to run under the Integrated pipeline apppool that runs under .net framework 4.0.
SoL:
Create a new apppool with classic mode and .net framework equals to your application developed framework.
attach the newly created apppool to your virtual directory.
Note: For deployment, you don need to copy .csproj or unwanted solution files to destination location.
If it is otherway around, (i.e,) application is .net 4.0 and apppool is 2.0 please follow the below steps.
Update .net framework in the server to 4.0 if you have only 2.0.
Then register .net 4.0 version in IIS by running the following command in command prompt.
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
Try changing Application pool to Classic. To do that open Advanced settings of your application in IIS manager and change Application Pool. There should be "ASP.NET v4.0 Classic" or something similar according to your framework version.
http://technet.microsoft.com/en-us/library/cc731755(v=ws.10).aspx

Can't upload two different framework websites on a server

I am trying to upload two different framework(2.0 and 4.0) websites on a server.
If iis target framework 4.0 is enabled then my website 2.0 shows the error: Server Application Unavailable
If iis target framework 2.0 is enabled then my website 4.0 shows an error
Unrecognized attribute target Framework.
Note that attribute names are case-sensitive.
An IIS application can only run under one framework. Each application however is assigned to an application pool which determines what version of the framework to run.
You can simply create a new application pool that works with a different version of the framework.
See the MS Technet article on details for how to do this.
From the article for IIS7:
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
In the Connections pane, expand the server node and click Application Pools.
On the Application Pools page, in the Actions pane, click Add Application Pool.
On the Add Application Pool dialog box, type a friendly name for the application pool in the Name box.
From the .NET Framework version list, select the version of the .NET Framework required by your managed applications, modules, and handlers. Or select No Managed Code if the applications that you run in this application pool do not require the .NET Framework.
From the Managed pipeline mode list, select one of the following options:
Integrated, if you want to use the integrated IIS and ASP.NET request- processing pipeline.
Classic, if you want to use IIS and ASP.NET request-processing modes separately. In classic mode, managed code is processed by using Aspnet_isapi.dll instead of the IIS 7 integrated pipeline.
Select Start application pool immediately to start the application pool whenever the WWW service is started. By default, this is selected.
Click OK.
Edit1
The problem can be Framework. As it is case sensitive
You can set the framework as follows
<compilation debug="true" targetFramework="4.0">
Old
You need to create different application pool.
One application pool should be using framework 2.0
and another should be using framework 4.0
Apply in both the application accordingly.
Here is a good link
http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS-7-0
MSDN Article link

Resources