Issue with error in hosting my application - asp.net

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.

Related

How to run .NET framework project with VS Code, which has dependency of ReactJS?

I am beginner to .NET framework and ReactJS. I have a code repository which is .NET framework, with ReactJS dependency.
When I opened the repository, VS Code suggested me to install C# extension, I installed.
Now when I opened the main file abc.csproj; it automatically started installing packages.
It ended with message:
Finished
Failed to spawn 'dotnet --info'
and notified:
The .NET core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on path.
What is process and list of extensions if I need it to be ran in VS Code?
P. S. It is a .NET framework 4.5 project and not core .NET project
The C# extension no longer ships with an included Mono & MSBuild Tools...
If you still need Unity or .NET Framework support, you can set
omnisharp.useModernNet to false
in your VS Code settings and restart OmniSharp.
See issue #5120 for more details.
https://github.com/OmniSharp/omnisharp-vscode/issues/5120
it seems you don't have the .net framework SDK installed on your machine.
you can download and install .net sdk from here : https://dotnet.microsoft.com/download/visual-studio-sdks to be able to build .net framework projects
I will suggest to use Microsoft Visual Studio. I am using it and it's good and dragless rather than getting SDKs and having installation troubles.

The current .NET SDK does not support targeting .NET Core 3.1

I have downloaded and install Visual Studio 2019 and have dotnet core 3.1 installed.
As I am starting to play around with VS, I have just created a simple project using VS built-in Web App Template and try to run without debugging.
It gives the error of "The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 3.0 or lower, or use a version of the .NET SDK that supports .NET Core 3.1."
May I know how it can be resolved?
Thanks.
Regards,
Andrew
If you already have the correct .NET Core 3.1 SDK installed it could be caused by a file called global.json. This file allows to configure which SDK is used:
The global.json file allows you to define which .NET Core SDK version
is used when you run .NET Core CLI commands. Selecting the .NET Core
SDK is independent from specifying the runtime your project targets.
The .NET Core SDK version indicates which versions of the .NET Core
CLI is used.
Delete the file or change the defined SDK to 3.1:
{
"sdk": {
"version": "3.1.100",
"rollForward": "latestPatch",
"allowPrerelease": false
}
}
If you already have VS 2019 version more then v16.4, then magicandre1981 answer will be helpful.
But, I would suggest you to check your VS version as well. as I have invested lots of hours and checked my version much later.
Minimum compatibility visual studio version for .net Core 3.1 is Visual Studio 2019 (v16.4). I updated it and it worked.
Release update:
https://dotnet.microsoft.com/download/dotnet-core/3.1
For me, it was an environment variable. Not sure what set it (maybe some lame chocolatey package or something.)
I had environment variable MSBuildSDKsPath set as C:\Program Files\dotnet\sdk\2.0.3\Sdks
Removing that environment variable fixed the issue for me. (Actually, I renamed the environment variable to OLD_MSBuildSDKsPath, just in case ;) )
I was having vs 17 vs 19 both
I was trying to open code developed in visual studio 2019 into 2017.
Opening that project in VS 19 solved the issue for me
I am using VS 2022 and have a parallel installation of VS 2019 on my PC.
And I noticed that .NET 3.1 SDK (LTS) had to be installed (both 32 and 64 bit packages) to support an existing EF code first project (running with EF 3.x). Without it, the migration did not work and I got an error message like the one mentioned in the question.
Note that they can be installed in parallel with other versions (I have .NET 5 and .NET 6 on my PC installed as well).
You can find the required packages here: https://aka.ms/dotnet-download

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.

Asp.net Core 2.0 with .net framework 4.6.1 - Cannot find reference assembly '.NETFramework/v4.6.1/Microsoft.CSharp.dll

I have recently upgraded my project from asp.net core 1.1 to asp.net core 2.0. and app us using .Net framework 4.6.1. Application is working as expected on local dev machine but once it deployed to server with dotnet publish command I am seeing this error
InvalidOperationException: Cannot find reference assembly
'.NETFramework/v4.6.1/Microsoft.CSharp.dll' file for package
Microsoft.CSharp.Reference
I have also noticed that ref folder that use be present when using asp.net core 1.1 when published is now missing. How to fix this issue.
Same issue was resolved when MvcRazorCompileOnPublish was added to .csproj file.
Give it a try.
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
I noticed if you have the Views folder included with the compiled View.dll when you start your IIS pool, you get this error. I was doing this on purpose for a short term work around hack.
In my case (I run .Net core in console application mode) none of above solutions didn't works, i just downloaded .Net Framework 4.6.1 from this link.

Setting up a .NET 4.5 application in IIS

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

Resources