HTTP错误500.30-ANCM进程内启动失败Asp.net-Core 3.1 [英] HTTP Error 500.30 - ANCM In-Process Start Failure Asp.net-Core 3.1

查看:2844
本文介绍了HTTP错误500.30-ANCM进程内启动失败Asp.net-Core 3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Asp.net Core 3.1 编写 API 。我在 API 中使用 IHostedService 进行后台处理。

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

IHostedService 类:

    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);
            }

        }
    }

在我的 UpdateData 函数,

我在数据库中记录了10分钟的数据。我正在从其他API提取此保存的数据。

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.

当我在 Azure Web服务中发布此版本时,出现标题错误。但是,如果我不使用 UpdateData 函数,就不会收到错误。

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.

我无法了解它是否与Azure相关,或者我的功能应采用类似异步的结构。您可以帮我吗?

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?

推荐答案

出现此问题是由于在项目中混合了库引用。例如,如果要将.NET Core 2.2应用程序升级到.NET Core 3.1,则应确保没有对2.2库的引用或依赖性。

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测试在我的网站上运作良好。转到您的Web应用程序,然后单击扩展程序,然后从App服务中删除扩展程序。并在本地检查nuget软件包。您可以参考以下类似的问题

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.

更新

此问题的原因来自 var info = TimeZoneInfo.FindSystemTimeZoneById( 土耳其标准时间); 我用于更新数据功能中的日期操作。

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

这篇关于HTTP错误500.30-ANCM进程内启动失败Asp.net-Core 3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆