Publishing Web App to Azure - azure

I have a web app on Azure. When I publish an update to it using WebDeply it doesn't work. I get a 502.5 Process Failure error. Upon investigation the content of the error is:
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Abstractions, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at Web.Program.Main(String[] args)
Does anyone know why I would be getting this?
It works locally but not when published. The most recent update I did to the AspNetCore ddls was done as part of this release where I upgraded the NuGet packages reference to be the latest patch fixes ie. from 2.0.0 to 2.0.2. Is it something I did wrong?

I eventually solved the issue by using an FTP, deleting all of the DLLs in the website folder and re-publishing the application.
Seems Web Publish or VS decided not to update those files for some reason.

Addional information for Adam Stapleton.
As Adam Stapleton mentioned it seems that Web publish or VS doesn't update the related files. If we update the AspNetCore, I recommend that we could remove the Azure WebApp files during republish the WebApp. We also could do this with VS. For more detail information, please refer to the screenshot.

Related

Azure Function err: microsoft.Azure.WebJobs.Extensions.Http

I just had the same 'TestTrigger' can't be invoked from Azure WebJobs SDK. Is it missing Azure WebJobs SDK attributes?"-error in a v4 function running .Net 6.0.
error :
"System.Private.CoreLib: Could not load file or assembly 'Microsoft.Azure.WebJobs.Extensions.Http, Version=3.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified."
enter image description here
It think this issue is misleading.
I changed TargetFramework from netcoreapp3.1 to net6.0 and this issue started to appearing.
I was looking for solutions in the web, without any success. In the end I created new Azure Function and copy code step by step.
It occurred that for my case I needed to
remove dependencies
add _FunctionsSkipCleanOutput property
In the screenshot below please focus on Microsoft.Extension part.

HTTP Error 502.5 - Process Failure after Deployed the .Net core to Azure appservice

I have recently upgraded my .Netcore webapi from 2.2 to 3.1 and deployed to azure app services.
Since then I got the below issue. I have reverted the release but still getting the same error.
I found few solutions for IIS but nothing for Azure app services .How to fix this?
[NEWEST]
Solution:
Reduce the version of Microsoft.Extensions.Configuration.Abstractions to 3.1.17 or 3.1.16.
Troubleshooting:
Try to find Microsoft.Extensions.Configuration.Abstractions on scm site.
I guess it don't include Microsoft.Extensions.Configuration.Abstractions package when deploy, so try to use below code in .csproj file. But it failed.
I try to find the reason on scm site, and I find it. On azure, .net core 3.1 just support the version of Microsoft.Extensions.Configuration.Abstractions are 3.1.17 and 3.1.16.
[PREVIOUS] The way to find the error logs
Judging from the error message, your webapp did not start. To solve the problem, we can only locate the error by querying the log.
You have the following two solutions to solve the problem. View the log:
Prerequisite: If you have successfully deployed the project before, please log in to the scm site to clean up all the files in the original wwwroot folder.
Plan 1:
Find the web.config file in the wwwroot folder and set stdoutLogEnabled="true".
You can refer to the following posts and github issues.
Azure Web App - Python: can't open file 'manage.py': [Errno 0] No error
How to enable stdoutLogEnabled=true when site is deployed with Run From Package
After add the settings in web.config, we can check the logs.
Plan 2:
Follow below picture, check Application Event Logs.
You also can refer my answer to Collect .NET Profiler Trace (Azure - Unhandled Exception: System.IO.FileNotFoundException).
After find the error, you can solve it quickly. If you also have some problem, you can create a new project without any sensitive info for us to reproduce your issues.

API deployed in Azure that doesn't work and i dont know why

PS: Found solution see below
i deployed my API to azure via bitbucket pipleine using FTP, but whehn i open the link of the API it displays "HTTP Error 500.30 - ASP.NET Core app failed to start"
Also when i make a request over postman or the frontend SPA it gives me ther same error.
Im realy lost within azure, becouse so many menus and i cant understand whats the problem. It works fine locally and the pipeline was sucessfully.
Can someone help me understand whats going on?
PS: after some diagnostic ( its menu is not intuitive at all) i found this:
: System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. The system cannot find the file specified. File name: 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
My instaled verson is 12.0.0.3 and version 12.0.0.0 dosent even exist on nuget packet manager. Any ideas?
PS: FOUND A SOLUTION
my pipeline is:
https://ibb.co/xC1tcFp
Before the solution the line " cp ./AzureFix/Newtonsoft.Json.dll ./publish" didnt existed and the problem was that the file "Newtonsoft.Json.dll" that bitbucket generated inside the "publish" folder was invalid and when i did "dotnet publish --output publish --configuration release" in my pc that same file was valid.
I found that by using an FTP software to transfer my local files of the "publish" folder to azure and it worked.
So i created a folder in the bitbucket repository with the valid file inside it and in the pipeline i added a line that copy that file to the "publish" folder generated by bitbucket folder and it works like a charm.
Why did that happen ( the generated file of the bitbucket "publish" was invalid) ?
500.30 errors are startup problems, and can stem from a lot of different things, so giving an exact answer is tough. Check your Startup.cs and Program.cs to ensure everything is correct. This could be various dependencies such as DB stuff, cache, KeyVault, etc. or issues with ASP.Net versions.
If you have App Insights running for this App Service, check to see if it reports any issues. Or turn on application logging (https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs).
You can also use Kudo to do advanced debugging: https://zimmergren.net/solving-asp-net-core-3-on-azure-app-service-causing-500-30-in-process-startup-failure/
Please check if all the NuGet packages are updated -
I struggled with this error for four days and tried every possible suggestion on forum.
And finally after updating all NuGet packages the problem was resolved.

Suddenly App Service stopped working because of exception Could not load file or assembly 'Microsoft.ApplicationInsights'

Our Azure Web App Service in production was working fine and suddenly on 15 November exactly at 019-11-15 06:22:56.2653 we saw the app service being down due to the following error. We have not changed anything neither deployed anything new on the said app service. Wanted to know if there was any upgrade from Microsoft which caused this?
ERROR|Stopped program because of exception Could not load file or assembly 'Microsoft.ApplicationInsights, Version=2.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Also, looking at the error we took new nuget package for appinsight and deployed and it seems to be working fine. But wanted to know what caused this and how can we prevent this in future.
There is actually an pre-release of Microsoft.ApplicationInsights, version 2.12.0-beta2 on 15 November. But this should does nothing to do with your issue.
You should nav to your azure web site -> kudu, to see if the specified dll is removed by accident.

Azure MVC Continous Integration Vs Publishing - missing Owin dll

I have a strange issue.
When I publish my MVC site to Azure it works.
When I hook it up to deploy using continuous integration on check-in I get a missing dll:
Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I can't work out what is going on as the code base is always the same!
All, after reading a couple of comments I have uploaded the following images. All my Owin references are coming from Nuget but it looks like I have a few different version numbers of Own references. I don't know why this would be as the web project.
I have searched my project for the word Owin and found there are very few references and, as you can see in this image, there are 3 different version numbers for various DLLs that are related to Owin:
Also, here are all the references to Owin in my Visual Studio Online build log:
Maybe someone can comment on why there are varying version?
thanks
Russ

Resources