Azure Cloud service returns error 500 after 30 hours - asp.net-mvc-4

I have a strange problem. I have an MVC 4 application (cloud service) on MS Azure. Application after deployment works fine but after 24-30 hours is returning an error 500. Then I have to reboot the instance. Currently it is running on the machine size S, I have 900 megabytes of free memory and the CPU is at about 3%. I have 1 instance. OS family = 3 (because of .NET framework 4.5)... Any ideas what is going on?

I have found it. Thanks for idea about app pool. Application pool is automatically recycling after 29 hours (default settings). So I recycled it manually and get error:
Could not load file or assembly 'file:///D:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.1\System.Data.Entity.dll'
From log I found that the reason is Entity Framework Profiler. I forgot remove it before deploying the app.

Related

ASP.NET Core - Failed to start application '/LM/W3SVC/3/ROOT', ErrorCode '0x8007023e'

I'm currently encountering a problem when I deploy my ASP.NET Core program on IIS, and I have no idea how to fix it. Could somebody tell me why?
Probably missing some server roles or features.
Checking the Application Event Log I found the error '0x8007023e'
Checking the System Event Log I found a WAS (Windows Process Activation Service) communication error:
Then I installed the following roles and features:
Also I reinstalled ASP.NET Core Module
Finally I had to reassign the app pool to the site, and everything worked
In my case, the application had been assigned to a different app pool, somehow. Changing it back fixed the issue.
IIS > {Application} > Advanced Settings > General > Application Pool

HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process

I hosted a .NET CORE 3.0(razor pages) application which was running fine after few days for no reason it was just displaying HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process Common solutions to this issue:
Select a different application pool to create another in-process application., then I found this solution HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process that fixed it by deleting .vs Folder, On Saturday morning I downloaded the new visual studio update 16.6.0. This morning the application running on the server started showing the same error, without any changes to the it, I followed the same step I used to fix it earlier but still didn't fix it, please is there any other solution to fix this? Because right now everything is working fine in my local machine. Thanks in advance.

Application '/LM/W3SVC/1/ROOT/' with physical root '' failed to load clr and managed application

My Web API runs OK most of the time in IIS v.10 on Windows Server 2016. However, an error occurs from time to time and I can't figure out the error source or cause. The corresponding Windows Logs/Application error log record is as follows
Application '/LM/W3SVC/1/ROOT/MyWebAPI' with physical root '....\MyWebAPI\' failed to load clr and managed application.
Managed server didn't initialize after 120000 ms.
Process Id: 4840.
File Version: 12.2.19169.6. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: e7f262e33108e92fc8805b925cc04b07d254118b
The error results in HTTP Error 500.30 - ANCM In-Process Start Failure on the client side. After that, MyWebAPI stops working and I have to recycle MyWebAPI application pool manually.
Can anybody help, please?
ACM 500.30 means something wrong with the startup.
for more info -> https://learn.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-3.1#50030-in-process-startup-failure
If you are using 3rd party services like KeyVault etc then surround them with try-catch and log error in the logger.
you can use event viewer for debugging.
https://www.happycoder.gr/blog/aspnet-core-20-event-viewer-application-logging/
I got the same error when I published my .net core 3.1 project.
You can get this error if your server is win-x64 and you published to win-x86. If this is the case, you must change the target runtime to win-x64.

Deploying Asp.net Core 3.1 does not work on Windows server

I have this Asp.net Core 3.1 developed on VS2019 preview.
basically it is a blazor server-side app with referenced assemblies and some nugets.
it runs fine on VS2019 and on my IIS after publishing to folder..
problem is when i move that folder to windows server machine with IIS installed and everything.
an error with 500 code appears.
one thing i noticed here..the log_error.txt file in the server it points out an exception
,and that exception -what ever it is- showing the error line of the startup.cs file with my laptop directory path !
i mean it shows this C:/mrmeeez/..../Startup.cs line 411
but this path does not exists in the windows server machine
it supposed to be F:/.... somthing/Startup.cs line 411
i don't know if it has something too do with the problem anyway..or maybe my assemblies and nugets not shipping correctly to the server
windows server machine is working fine , i tried blazor app template and it ran perfectly.
i need your help guys , Thanks !
Ok , i found it
i don't know for sure is this related to asp.net core 3.1
because i deployed asp.net core 2.1 months ago and it was fine
anyway i used the development exception page in the final publish to see what causing the error and showed this
UnauthorizedAccessException: Access to the path 'C:\Windows\system32\config\systemprofile\AppData\Local\ASP.NET\DataProtection-Keys' is denied.
and after searching for that i found the answer from a guy in github
it seems that the user IIS_IUSRS for this application pool -by default- does not have permissions to access that path
to solve this problem,either one of the two below:
1-Give IIS_IUSRS permissions to access the system files -NOT RECOMANDED-
2-Change the user of the your application pool to LocalSystem account in IIS by going to Application Pools -> Right-Click your app -> Advance Settings -> Process Model section then change Identity
Reference: https://github.com/dotnet/aspnetcore/issues/1983
Thanks!

AppHarbor + RavenDB - EsentFileAccessDeniedException

I'm trying to get my application running in AppHarbor using a RavenDB instance. I've updated my raven libs to build 888 and I'm still getting the error below. I've also allowed file system write access but im still getting the same error. Any ideas how to resolve this issue?
[EsentFileAccessDeniedException: Cannot access file, the file is locked or in use]
at Microsoft.Isam.Esent.Interop.Api.Check(Int32 err) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:line 2739
at Microsoft.Isam.Esent.Interop.Api.JetInit(JET_INSTANCE& instance) in C:\Work\ravendb\SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:line 131
at Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator uuidGenerator) in c:\Builds\RavenDB-Stable\Raven.Storage.Esent\TransactionalStorage.cs:line 205
It appears that during app startup, my app was creating a data directory in the application root. I discovered that I had an old reference to RavenDB Embedded which was on longer being used in the project which was creating the unneeded data directory. Once I removed that reference and pushed, everything began working correctly.
Are you trying to use the AppHarbor web worker instance file storage for the RavenDB backing store? That's a bad idea, use the hosted RavenHQ add-on instead.
The self-hosted RavenDB not working on AppHarbor is a known problem.
Even if you get it to work, note that the worker filesystems are not persisted when you deploy new versions of your code or in case of worker instance failure.