Setting up a .NET 4.5 application in IIS - asp.net

I have an application built using .NET version 4.5
I created a site in IIS and pointed it to my application, but I'm receiving this error:
The 'targetFramework' attribute in the element of the Web.config file is used only to target version 4.0 and later of the .NET Framework (for example, ''). The 'targetFramework' attribute currently references a version that is later than the installed version of the .NET Framework. Specify a valid target version of the .NET Framework, or install the required version of the .NET Framework.
This applications works correctly if I'm running it on my local machine, but for some reason I can't get it to run with IIS.

Select the correct application pool...
http://technet.microsoft.com/en-us/library/cc731755(v=ws.10).aspx

Related

What version of .NET framework is actually used under ASP.NET

So let's say I have my app pool set for "4.0.30319". In Visual Studio, my project settings are set for ".NET Framework 4.6.2".
In my web.config, there is a line:
<httpRuntime targetFramework="4.5" maxRequestLength="30720" executionTimeout="36000"/>
And 4.8 is actually installed on the server running ISS.
Now lets say there was a change in behavior shipped in, say, 4.7. Will I see the new behavior in my application?
According to the docs:
If the version of the .NET Framework that the application was built against is present on the computer, the application runs on that version.
If the version of the .NET Framework that the application was built against is not present and a configuration file does not specify a version in a Element, the application runs on the latest version of the .NET Framework that is present on the computer.
If the version of the .NET Framework that the application was built against is not present and the configuration file specifies a version in a Element, the application runs on the latest version that is specified in the application configuration file and is present on the computer.
So I would say 4.8, You can always check it programmatically using:
Environment.Version
Additionaly check out this question.

Asp.Net Core 2.1 with .Net Framework 4.6.1 error after deployment using dotnet publish or visual studio publish

I am trying to deploy Asp.Net Core 2.1 application with target framework 4.6.1 on server. I am using dotnet publish command and copying the publish folder on the server where deployment is intended. Everything works fine on local machine. But when I am trying to run the application on the server , it is throwing the exception ".Net Framework 4.6.1 not installed, please install it.".
I thought .Net framework is not installed but when I checked installed software , I can see .Net 4.6.1 is installed. Not sure why the error is occurring.
Here is screenshot for the application error and installed software
That error is odd, since you do indeed seem to have that version installed. However, I believe it may be a red herring. I haven't personally tried to run ASP.NET Core 2.1 on .NET Framework, but I suspect it may not work at the moment. The full framework support depends on .NET Standard compatibility which only goes up to .NET Core 2.0. (With .NET Standard 2.0). ASP.NET Core requires .NET Core 2.1. You can try targeting a later version of .NET Framework - something recent like 4.7.2. You may need to downgrade to ASP.NET Core 2.0, if you need to target .NET Framework.
Your list only shows development packages to support targeting and developing for .NET Framework 4.6.1
See How to: Determine which .NET Framework versions are installed for ways to check the .NET Framework version on the machine.

Install ASP.NET MVC 4.0.4

I have a production server for a project, and I try to build a test server for the same project with the same environment.
For this, I need to install on the test server (that means, no VS or any dev stuff like package managers, etc.) the same version installed on the prod server version of ASP.NET MVC: 4.0.4xxx.
I searched to download the latest ASP.NET MVC 4 installer, and the only download MS proposes is the ASP.NET MVC 4 for Visual Studio 2010 SP1 (don't really understand what has to do here VS 2010 - should it work only with VS?!) - once installed I navigate to C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies and the System.Web.Mvc.dll version is 4.0.207xxx.
Where could I find the ASP.NET MVC 4.0.4xxx?
More info:
the .NET installed is
the ASP.NET seems to be 4.0.0.0:
also
Finally, in localhost, I get the following error:
Since ASP.NET MVC version 3.0.20105.1, the Microsoft.AspNet.Mvc DLL has been available through NuGet. This means your application should include Microsoft.AspNet.Mvc version 4.0.40804 as part of its distribution (in the bin folder) when your application is published.
The only thing you need to install on a production or test server is the .NET Framework Redistributable 4.0+ in order for ASP.NET MVC 4 to function.
Do note that .NET Framework 4.0 is no longer supported, so it is recommended to use at least Microsoft .NET Framework 4.5.2. All versions of .NET Framework 4.0+ are in-place upgrades, so all higher versions should work with your application without any changes.
There was also a security update that broke compatibility with 4.0.0.0, that will need to be applied to your server if it is not already installed. This updates MVC 4 assembly version from 4.0.0.0 to 4.0.0.1, so it is a breaking change for applications that are compiled against 4.0.0.0. Since your application is looking for 4.0.0.1 (as it should) that means your application is compiled with the security update, but the server needs the security update for MVC 4 installed.

Issue with error in hosting my application

I am trying to deploy a project visual studio 2015 project in IIS 8 and I get the following error :
hosting_error
The target framework in the <compilation> element of the web.config
file is used only to target version only to 4.0 and later of the .NET
framework (for example <target framework="4.0">. The target
framework currently references to a version that is later than the
installed version of the .NET framework. Specify a valid version of
the .NET framework, or install the required version of .NET framework.
My .NET version is 4.5.2. So, how can I solve this issue. Please help me in this. Should I install VS 2015 in my server where the IIS 8 resides. I have checked the App_pools, They are targeted to 4.0 version. Please help me in this.
In IIS, The Application pool version need to be changed from 2.0 to 4.0. That will solve the Issue.

IIS7 Application Pool 4.5 framework

I built a web app using dotNet 4.5. I went into IIS and created a new app pool but there was not 4.5 option, only 4.0 and 2.0. I went to install 4.5 and it says "already installed". I do a google search and see infact the registry and explorer show it to be installed.
What gives?
Although the .NET Framework Version column shows "v2.0" and "v4.0" for .NET Framework versions, these equate to ASP.NET 3.5 and ASP.NET 4.5.
Due to the internals of how application pools bind to .NET Framework versions, the actual version name written to configuration (and thus displayed in the tool) corresponds to the original .NET Framework file version.
Your question is tagged as IIS7 but the link information regarding .net versions is applicable.
Soruce: http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45

Resources