Azure app service Configuration ambiguity - azure

I've uploaded an asp.net core app with VS 2019 publish, and targeted the app netcoreapp2.2.
The app worked perfectly, but when checking some performance issue, I've noticed that in Azure portal-Configuration-General settings, the app stack settings was .NET (not .net core), and version is V4.7.
This raises 2 questions:
1. How is it even working...?
2. Why VS deployment process wasn't configured with the settings displayed in publish section?
VS publish settings:
Azure settings:
Thanks!

I fixed the issue by updating the following lines in .sln
from:
Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
To:
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22

ASP.NET Core 2.x can target .NET Core or .NET Framework. ASP.NET Core apps targeting .NET Framework aren't cross-platform—they run on Windows only. Generally, ASP.NET Core 2.x is made up of .NET Standard libraries. Libraries written with .NET Standard 2.0 run on any .NET platform that implements .NET Standard 2.0.
When you published to the .NET Core 2.2 runtime app you would always get the following warning message:
"There was a problem starting MyProjectName on MyWebAppServiceName. Your application requires the .NET Core 2.2.0 runtime, but Microsoft Azure App Service only support the following versions:.
One way to fix this problem is by changing the deployment mode to self-contained in the publish settings, which will allow the application to carry its own runtime."
Refer to this similar case.
Edit:
When you create webapp on portal, you could go to arm template to get the stack setting which is set as CurrentStack: dotnetCore. But when you publish project on VS, it could net set the runtime.
So, it may a VS issue that you could give feedback or you could create webapp on Azure first which set runtime as .Net Core and publish project to it using VS.

Related

Azure app service container crash with "Could not load file or assembly" on ASP.NET Core MVC .NET 6

I am trying to deploy my .NET 6 asp.net core web app but I'm getting a weird error when trying to do so:
I don't understand why it is searching for .NET 7 packages when my project and stack is on 6.
I tried ZIP deploy through VS and automated through GitHub to no avail. My app worked fine the other day all I did was switch to a Basic B1 plan from Standard S1 to reduce cost.
I think the problem is related to your Github Actions. You're building the entire solution, but your project EasyRank.Tests.Common uses a different version of Microsoft.EntityFrameworkCore 7.0.0, while the others are using 6.0.10. Internally it has a dependency on Microsoft.Extensions.DependencyInjection.Abstractions and they are conflicting.

How to debug a legacy Azure function

I've been given the task to debug an Azure function on VS 2022 targeting .Net Framework 4.8. While its straight forward to debug it in .Net Core 3.0 or later, I keep getting the error - A project with an Output Type of Class Library cannot be started directly, when I try to run it by pressing F5. Looking around, I followed this link to download Azure functions core tools; https://github.com/Azure/azure-functions-core-tools but it hasn't worked even after restarting VS.The function has following properties:
While I can run and debug functions written in .Net Core 3.1 and .Net 6 but I'm struggling with this legacy function. Any help is really appreciated.
We have tried to create Azure function with .net framework 4.8 and successfully tested in our local by using visual studio 2022.
We have installed azure function core tool 4x on our local. Make sure that only one azure function core tool has installed on our local.
Created one azure function with http trigger by selecting .net framework and targeting it to version 4.8.
Able to debug successfully as shown below
For more information please refer this MICROSOFT DOCUMENTATION

Azure App Services: assembly specified in application dependencies manifest (Microsoft.AspNetCore.AzureAppServices.HostingStartup.deps.json) not found

I have a .net core 2.1 application that is hosted on Microsoft Azure App Service.
It worked for a couple of years and hasn't been updated in the last year.
But it stop with error in stdout:
Error:
An assembly specified in the application dependencies manifest (Microsoft.AspNetCore.AzureAppServices.HostingStartup.deps.json) was not found:
package: 'Microsoft.AspNetCore.AzureAppServices.HostingStartup', version: '2.2.0'
path: 'lib/netcoreapp2.1/Microsoft.AspNetCore.AzureAppServices.HostingStartup.dll'
Also it still works well in IIS in a virtual machine.
I've got the similar issue yesterday.
After digging up into this and hadn't found solution, I've created support ticket to Microsoft.
They provided the following recommendations:
Publish with:
<PublishWithAspNetCoreTargetManifest>False</PublishWithAspNetCoreTargetManifest>
Upgrade to .NET Core 2.2
These steps helped me and application returned back to online.
Looks like they stopped support of .NET Core 2.1 version on their Azure App Services. Check this link for detalis:
https://devblogs.microsoft.com/dotnet/net-core-2-1-will-reach-end-of-support-on-august-21-2021/
PS: As far as I can tell, .NET Core 2.2 might be gone soon too. So I'm focusing to move my application to .NET Core 3.1 shortly.

Select .NET or .NET Core on Azure with a ASP.NET Core website

I'm hosting a range of websites on Azure. Some ASP.NET MVC and others ASP.NET Core. I noticed that there is a Stack setting beneath General settings with the values .NET and .NET Core:
For some of my ASP.NET Core websites, the value .NET is selected. Typically the ones that I migrated to ASP.NET Core and just deployed to an existing website previously running ASP.NET MVC. My question here is, what does this setting do? And why doesn't it seem to make a difference when deploying a ASP.NET Core website which setting this has?
In App Service Stack settings are used to set type of language and the version you need to use. App Service support in general supports the following languages:
ASP.NET Core
Node.js
PHP
Python
Java
Ruby
and depend on the OS say,
if you create on windows, there are 5 stacks underneath it
.NET
.NET Core
PHP
Python
Java
If you choose linux, there are 7 stacks can selected on portal
Ruby
Node
PHP
.NET Core
Java8
Java11
Python
Here are the details on the stack settings

VS Code + Develop(Linux) + Target(.net Framework) + Host(Windows)

I am developing a Web Application with ASPNET Core 2.0 on Visual Studio Code on Linux. But the host I'm trying to deploy the application is a Windows Server and the only target available option is .Net Framework 4.6.
So, when I try to run dotnet publish -o /folder -f net461 it shows me
this error.
Is it possible to develop an aspnet core application on linux and deploy it on windows using .Net Framework?
The following is the text of the error:
/usr/share/dotnet/sdk/2.0.0/Microsoft.Common.CurrentVersion.targets(1122,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/home/maransatto/Projects/FATEC/EraDoConhecimento/web/BDAg.csproj]
There are 2 scenarios: ASP.Net Core with .Net framework and ASP.Net Core with .Net Core. You can't develop asp.net core with .net framework on linux, so probably your application's target is "netcoreapp2.0" (suposed you downloaded the latest version). It's ok you deploy your app on windows server just using .net core runtime 2.0.
your command should be
dotnet publish -c Release -f netcoreapp2.0
You can deploy Framework-dependent or self-contained version. See (https://learn.microsoft.com/en-us/dotnet/core/deploying/index).
You also need Asp.Net Core Module on windows with IIS Integration.
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
When publishing self-contained you don't need .net core to be installed on the server.

Resources