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

查看:61
本文介绍了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 Service 中发布此版本时,我收到标题中的错误.但是如果我不使用我的 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 相关,或者我的函数应该采用 async 之类的结构.你能帮我解决这个问题吗?

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.

我在我的网站上进行了测试并且运行良好.转到您的网络应用程序,然后点击Extensions从应用服务中删除该扩展程序.并检查您本地的 nuget 包.这里有类似的issue,您可以参考.

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("Turkey Standard Time"); 我在更新数据函数中用于日期操作.

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天全站免登陆