Upgrading Aspnet Core application on linux gives Error - linux

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/

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.

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

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.

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

Auto-deployment with continuous integration of .NET CORE fails because it cannot modify the file 'xxx.exe'

I have created a new ASP.NET Core Web Application. I'm using TFS (2015 Update 2) MS Build process to build and deploy my application to my Dev/QA server. I'm running my code with a Kesrel/IIS configuration on a window server.
My build Steps are:
Command Line: dotnet Restore -- restores my nuget packages
Command Line: dotnet build -c Dev -- builds my dev profile
Command Line: dotnet publish --framework netcoreapp1.1 --runtime win7-x64 --output "C:_work\dev\svc" --configuration DEV --no-build
Publish Build Artifacts: from that output folder in step 3 to my web server.
Problem:
The major problem I have is that the new core applications all run as console applications, so there is an 'xxx.exe' file running, in addition to the w3svc.exe IIS app running. When my Publish Build Artifacts steps runs, the process fails because the 'xxx.exe' file is in use, and cannot be modified.
So far as I can tell, you have to use the "dotnet" CLI to build and publish your CORE applications, and you cannot use the VS Build steps.
I've tried pointing my "dotnet publish" command to directly to the web server, but that has the same problem. You can see in my "dotnet publish" command I'm indicating a configuration to use (DEV). However even if I have DEV setup in VS to do a webdeploy, the "dotnet publish" command ignores that and either puts the code in a default publish location, or the location I specified in the command. So that doesn't work like the old .net framework did either.
My hosting team won't give me access to run remote powershell scripts to stop the IIS apps and console application, and I don't see any other build steps that would work to build the CORE application.
I'm on TFS 2015 Update 2. We're soon going to be on Update 3, but I don't know if that will give me feature to fix this either. If anyone know, I'd love to hear it!!
If I stop IIS app pools and make sure the console app is also stopped, my Build and Deploy steps above, work perfectly, but I don't want to have to manually stop IIS app pools every time before a build.
ASP.NET Core still respects the presence of an app_offline.htm file, so if you can copy a file with that name to the app destination on your server before step 4, and remove the file after step 4, the deployment should work. The ASP.NET Core module watches for this file and shuts down the hosting process (the .exe).
I'm sure you can run msdeploy tasks from VSTS, and msdeploy has a parameter to create an app_offline.htm file for you (although there is currently a bug in the ASP.NET Core module deployed to Azure where the file has to be all lower case letters). Msdeploy does work in deploying a published Core application to IIS.
Since stopping IIS app pools can solve the issue, you may try to install IIS Utilities to stop or start Application pool.

How to update .NET Core on Azure Web App?

I have my Azure Web App configured to deploy from a local git repository - I just push my changes to the Web App git repo and it builds and deploys the site.
I just updated to my ASP .NET Core site to: "version": "1.0.0-preview2-003133", previously it was 003131 which worked no problems.
I now get the response when doing the git push:
remote: GETSDKTOOLINGINFO : error : The project is configured to use .NET Core SDK version 1.0.0-preview2-003133 which is not installed or cannot be found under the path D:\Program Files (x86)\dotnet. These components are required to build and run this project. Download the version of .NET Core SDK specified in global.json or update the SDK version in global.json to the version that is installed.
I would prefer to update the .NET Core version on my Web App than downgrade, but how?
In case you are wonder how I have 3133 already: https://github.com/aspnet/Tooling/issues/801
You basically can not update the dotnet version on Azure. Currently the version of dotnet that is running is 003131. So you still have to use the previous version.
How are you building your release package?
I had this yesterday using a VSTS build process, when using the 'Visual Studio' build task it will fail with this error currently - changing your process to use the "CMD line" build task and "dotnet publish" allows the build to complete successfully.

Resources