简体   繁体   English

从 .NET 核心 2.2 迁移到 .NET 5 后,应用程序在部署到 azure 应用程序服务后无法启动 - 启动超时

[英]After migration from .NET core 2.2 to .NET 5 the application won't start after deploying to azure app service - startup timeout

I am having the following problem.我有以下问题。 A while ago I migrated my project from .net core 2.2 to .net 5. Migration itself was no problem, locally everything worked almost out of the box.不久前,我将我的项目从 .net 核心 2.2 迁移到 .net 5。迁移本身没有问题,本地一切几乎都是开箱即用的。 But then I was facing problems deploying the app into an azure app service.但后来我在将应用程序部署到 azure 应用程序服务时遇到了问题。 The app wouldn't start up.该应用程序无法启动。 I was getting start up timeouts.我正在启动超时。 After a while I solved the problem by switching the hosting model to outOfProcess过了一会儿,我通过将托管 model 切换到 outOfProcess 解决了这个问题

<PropertyGroup>
  <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>

Because of lack of time to thoroughly test the application, I had to stick with .net 2.2 until now.由于没有时间彻底测试应用程序,我不得不坚持使用 .net 2.2 直到现在。

Now that I migrated again, I am facing the same issue.现在我再次迁移,我面临着同样的问题。 Locally everything works just fine, but after deploying to the app service, the application won't start.在本地一切正常,但在部署到应用服务后,应用程序无法启动。 But the hostingModel doesn't solve it this time.但是这次hostingModel没有解决。

I tried linux and windows app service, and I tried to deploy via our azure devops pipes as well as manually from VS.我尝试了 linux 和 windows 应用程序服务,我尝试通过我们的 azure devops 管道以及从 VS 手动部署。 I tried to deploy into an existing app service, I tried to deploy into a new app service, created during the deployment process.我尝试部署到现有的应用程序服务中,我尝试部署到在部署过程中创建的新应用程序服务中。 None of it solves it.没有一个能解决它。

When i look at the log stream, I see the following:当我查看日志 stream 时,我看到以下内容:

2022-02-10T09:13:55.360Z ERROR - Container webapp... for site t2bwebappdev did not start within expected time limit. 2022-02-10T09:13:55.360Z 错误 - 站点 t2bwebappdev 的容器 webapp... 未在预期时限内启动。 Elapsed time = 230.2593377 sec 2022-02-10T09:13:55.368Z ERROR - Container webapp... didn't respond to HTTP pings on port: 8080, failing site start.已用时间 = 230.2593377 秒 2022-02-10T09:13:55.368Z 错误 - 容器 webapp... 未响应端口 HTTP ping:8080,站点启动失败。 See container logs for debugging.查看容器日志进行调试。

So I tried to solve this via PORTS and WEBSITES_PORT settings - but non of it seems to get it up and runnig.所以我试图通过PORTSWEBSITES_PORT设置来解决这个问题 - 但似乎没有一个可以启动并运行。

Thanks in advance for any hints on how to solve this.预先感谢有关如何解决此问题的任何提示。

Update:更新:

While I was playing around with the logs, I saw that the app was listening on port 5000. Seems with the Net5 upgrade the launchsettings.json is being ignored.当我查看日志时,我看到该应用程序正在侦听端口 5000。似乎随着 Net5 升级,launchsettings.json 被忽略了。

Then I just dockerized it from VS 2019, and in that container I can also not reach the app.然后我只是从 VS 2019 对它进行了 docker 化,在那个容器中我也无法访问该应用程序。 So after all this, could it just be a port issue?那么在这一切之后,这可能只是一个端口问题吗?

Try adding this line in your Program.cs class:尝试在Program.cs class 中添加这一行:

程序.cs

And make sure you expose ports in Dockerfile :并确保在Dockerfile中公开端口:

文件

NOTE:笔记:

Everything depends on which port was exposed in Dockerfile .一切都取决于Dockerfile中暴露了哪个端口。 Port that you have exposed should match with the port you will pass to UseUrls as an argument.您公开的端口应与您将作为参数传递给UseUrls的端口相匹配。 Also, consider either http/https in accordance with the existence of the certificate.此外,根据证书的存在考虑http/https

I hope my answer was useful and helpful!我希望我的回答是有用的和有帮助的!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure 部署ASP.Net后服务应用不可用 Web 核心应用 - Azure Service App Becomes Unavailable After Deploying ASP.Net Web Core App 将 .NET 核心控制台应用程序部署到 Azure 后加载我的 web 应用程序时出错 - Error loading my web app after deploying .NET Core console app to Azure 从ASP.NET Core访问Azure App Service ConnectionString - Access Azure App Service ConnectionString from ASP.NET Core ASP.NET 核心应用程序在尝试发布到 Azure 后不使用 appsettings.json 中的设置 - ASP.NET Core app does not use setting from the appsettings.json, after trying to publish to Azure .Net App in Docker - Startup Can't Find Azure App Configuration - .Net App in Docker - Startup Can't Find Azure App Configuration .NET 核心 2.1 Azure 函数不会在 Azure 管道中构建 - .NET Core 2.1 Azure Functions won't build in Azure Pipelines 如何配置.NET 7 Web API部署到Azure应用服务 - How to configure .NET 7 Web API for deploying to Azure App service Azure App Service .NET Core 3.1 导出到文件异常 - Export To File Exception in Azure App Service .NET Core 3.1 ASP.net 核心 docker https on Azure 应用服务容器 - ASP.net core docker https on Azure App Service Containers 如何手动将 ASP.NET 核心应用程序的部署版本复制到 Azure web 应用程序(应用服务) - How can I manually copy a deployment build of ASP.NET Core application to Azure web application (App Service)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM