HTTP Error 500.30 - ANCM In-Process Start Failure Asp.net-Core 3.1

一个人想着一个人 提交于 2020-05-16 19:15:18

问题


I am writing an API using Asp.net Core 3.1. I'm using IHostedService for background processing in the API.

IHostedService class:

    public class DataUpdateBackgroundService : Microsoft.Extensions.Hosting.BackgroundService
    {
        private ITurkeyProvinceDataService _dataService;

        public DataUpdateBackgroundService(ITurkeyProvinceDataService dataService)
        {
            _dataService = dataService;
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            stoppingToken.Register(() =>
                Console.WriteLine(""));

            while (!stoppingToken.IsCancellationRequested)
            {

                // Your code here
                _dataService.UpdateData();
                await Task.Delay(TimeSpan.FromMinutes(10), stoppingToken);
            }

        }
    }

In my UpdateData function,

I record data in a database for 10 minutes. I am pulling this saved data from a different API.

As such, it works smoothly on my local device.

When I publish this version in Azure Web Service, I get the error in the title. But if I don't use my UpdateData function, I don't get the error.

I could not understand whether it is related to Azure or my function should be in a structure like async. Can you help me with this?


回答1:


This issue occurs because of mixing library references in the project. For example, if you are upgrading your .NET Core 2.2 application to .NET Core 3.1, you should make sure there is no reference or dependency to 2.2 libraries.

I test in my site and work well. Go to your webapp and click Extensions and remove the extension from the App service. And check the nuget package in you local. Here are similar issue you could refer to.

Update:

The reason for this problem stems from var info = TimeZoneInfo.FindSystemTimeZoneById("Turkey Standard Time"); that i use for date operations in update data function.



来源:https://stackoverflow.com/questions/61121039/http-error-500-30-ancm-in-process-start-failure-asp-net-core-3-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!