ASP.NET Core app build to target Core 2.1 fails on IIS 10 server where Core 2.1 is installed - iis

I have just setup up IIS 10 on a clean Server 2016 hosted server, and installed the following packages that I have gleaned should be on the machine to allow IIS to host ASP.NET Core applications:
aspnetcore-runtime-2.1.0-win-x64.exe
dotnet-hosting-2.1.0-win.exe
dotnet-runtime-2.1.0-win-x64.exe
I have installed my app straight into the Default Web Site and replaced all files in C:\inetpub\wwwroot\ with my app files. I also did assign the web site an app pool with no managed code, so that isn't my problem.
Last time my app was built with 2.0, and I installed the latest versions of the above packages, which I'm sure was 2.0, and the only error I had was that the command dotnet that IIS uses to invoke Kestrel to run the site, was not in the PATH env. variable
Now when I try and browse to localhost on the Server 2016 machine, it gives me the following error, found in the Windows event log:
Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' with physical
root 'C:\inetpub\wwwroot\' failed to start process with commandline
'dotnet .\QuickDrive.Mvc.dll', ErrorCode = '0x80004005 : 8000808c.
Initially I tried with the same build as before, which was 2.0, and when I got this error, I rebuilt the app to target 2.1. Nearly every search result and relevant SO answer I can find suggest a version conflict, but now there should at least be no version conflict between the runtime and hosting package on the server. Maybe there are other version conflicts I am not aware of though?
At very least I'm asking for some advice on how to get more detailed diagnostic information, even if I don't get an answer that tells me straight what config options and versions to check on Windows and on IIS.

You have to install the Core SDK for whatever version you want to target in Visual Studio. Installing the runtime alone won't do the trick. You may have the restart Visual Studio afterward to see it in the list.
Here is a link to the SDK 2.1 download (the latest as of this writing).

I solved the problem by running dotnet myWesite.dll in PowerShell, and first I found that dotnet.exe was not in the PATH environment variable, and after fixing that, running dotnet myWesite.dll again gave me a meaningful error message that an assembly was missing because it had not been included when I published the website.

I faced the same error on the dev machine in IIS Express. MVC App stopped working all of the sudden. Eventlog gave the 0x80004005 error code.
After trying multiple suggestions, the solution to debug the wired error code was to run the app in the console:
[Project bin folder]> dotnet [projectname].dll
It appeared that during the NuGet package update, the dotnet core version was accidentally updated to 2.1.4 where as the installed version was 2.1.3
[could be a bug in Nuget manager as the update was from there]
I edited the project file to reference the available version (2.1.3) and the app started to work properly.

Related

Build works locally and fails in Azure

I have a project in C Sharp which build correctly in my local machine ( as well as in the one from my colleagues ). But when we try to configure the pipeline in Azure, in the step of Nuget restore everything stops and we get an error message stating that package "A" is not compatible with netcore 2.2, as well as package B,C,D,etc.
Why is it possible to see this error in Azure but not in my local? The project is setup to use netcore 2.2 and builds fine in my local machine.
Why is it possible to see this error in Azure but not in my local? The project is setup to use netcore 2.2 and builds fine in my local machine.
This error can occur with an outdated version of nuget. The default version of NuGet running in the VSTS pipeline was not the latest one.
So, to resolve this issue, there is a nuget version installer task which you can run as part of your build step to upgrade the version of nuget running in your build pipeline:
Besides, if update nuget version not resolve this issue, please check the SDK version on the build agent is same as your local, you can use the task Use .NET Core to update the SDK version.
Hope this helps.

Upgrading Aspnet Core application on linux gives Error

I am trying to upgrade an Asp.net core application on Debian vm. After I copy the new dlls and test with dotnet path-to-my-app.dll I get this error.
LTTng-UST: Error (-17) while registering tracepoint probe. Duplicate registration of tracepoint probes having the same name is not allowed.
Two further clarify, I am upgrading a self contained app. I first stop the running service and then replace the files with new ones and then just do a
dotnet path-to-myapp.dll
and the above error appears. There was no change in appsettings or any other configuration changes. Do I need to stop any other services as well?
For the general public here is the issue and the solution:
The version on my linux VM was 2.1.5 and my App target version was 2.1.0, However the previous target framework version of installed app was 2.1.0 and it was working fine. I only made a few changes and went on to deploy the new version, first it failed to build with the command "dotnet build --runtime linux-x64" complaining about different frameworks to restore and build. So I first changed the project file to use
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
And after that it failed to run with the above error. Finally I changed the RuntimeFrameworkVersion to 2.1.5 to match my host version AND didn't use the "dotnet build --runtime linux-x64" command but Publish instead. I also read about using the Publish command here:
https://codeblog.dotsandbrackets.com/package-downgrade-issue/

Cannot find compilation library location for package 'Microsoft.NETCore.App' After publishing to IIS - .NET Core 2.1.1

I am facing an issue when I publish my .NET Core 2.1.1 app to IIS and this has started to happen after upgrading from .NET Core 2.1 to 2.1.1.
I am getting Cannot find compilation library location for package 'Microsoft.NETCore.App'.
I tried to reinstall/uninstall/install the SDK 2.1.301 and the related runtime but no success.
This works fine on my dev PC but not on the IIS server.
I fixed my issue by setting MvcRazorExcludeRefAssembliesFromPublish to false in my .csproj file.

Error 502.5 on my Azure Web app with dotnet core 2.0

I have a web application developed with Asp.Net Core 1.1 deployed on Azure and it works well. I just migrated projects to use Asp.Net Core 2.0 and tried to deploy it on Azure. The deployment went well, but when I open the site, I have a 502.5 error. When I check my Azure log feed, I get the following error:
This error occurs when a CGI application does not return a valid set of HTTP headers, or when a proxy or gateway could not send the request to a parental gateway. You may need to get a network trace or contact the proxy server administrator if this is not a CGI problem.
Needless to say, it works well on my development machine with the same code.
For more information, the way I migrated from 1.1 to 2.0 is to change the settings of the target structure to "netcoreapp2.0" and use the NuGet package "Microsoft.AspNetCore.All".
When I use the web application console in azure and run: dotnet mywebapp.dll, I have the following error:
It was not possible to find a compatible frame version
The specified 'Microsoft.NETCore.App' frame, version '2.0.0' was not found.
- Check the application's dependencies and target a version of the framework installed at:
\
- Alternatively, install the version of the '2.0.0'
Dotnet --version:
2.0.0-preview2-006497
my csproj target the good framework:
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<PropertyGroup>
I also removed content of site\wwwroot and redeploy, but no change.
What is wrong ?
In local, I run : Update-Package -reinstall
One package was update in one project.
Then I deploy again and everything is ok

Deploy .NET Core ASP.NET Website - HTTP Error 502.5 - Process Failure

I'm trying to publish the template project "ASP.NET Core Web Application (.NET Framework)" from Visual Studio 2015 to IIS.
I use the Visual Studio publish to File System feature.
I'm using Windows 10.
I followed the guide from here.
I set up a website in IIS and changed the Application Pool .NET CLR Version to No Managed Code
I instaled the .NET Core Windows Server Hosting bundle
I restarted my machine.
I get this error:
I added a logs folder, but no logs get created.
Any ideas on how I can solve this?
EDIT:
Output of running the .exe from powershell:
PS C:\TestCoreWebsite> .\Web_CoreWebNetFramework.exe
Hosting environment: Production
Content root path: C:\TestCoreWebsite
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Then I navigate to http://localhost:5000 and the sample site works.
Found the solution:
In the root web.config change:
processPath="%LAUNCHER_PATH%"
to:
processPath=".\Web_CoreWebNetFramework.exe"
I ran the following command in cmd
C:\fullpath\dotnet C:\fullpath\PROJECT.dll
on the command prompt, which gave me a much more meaningful error:
"The specified framework 'Microsoft.NETCore.App', version '1.0.1' was
not found. - Check application dependencies and target a framework
version installed at: C:\Program
Files\dotnet\shared\Microsoft.NETCore.App - The following versions are
installed: 1.0.0 - Alternatively, install the framework version
'1.0.1'.
I Installed the correct net core and the project worked correctly
With VisualStudio 2017, open up the .csproj file and add to the first block:
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
Usually the result will be:
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
</PropertyGroup>
For whoever faces the same issue as mine(running well in VS but got above issue when deploying into Local IIS), I missed Setting Environment Variable and It works after I added the Setting Environment Variable
Ref: How to add Setting Environment Variable in IIS

Resources