本文介绍了Azure上的Asp.Net Core 2.0得出502.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小型Web应用程序,它使用Azure上部署的Asp.Net Core 1.1开发,并且运行良好.我刚刚将项目迁移为使用Asp.Net Core 2.0,并尝试将其部署在Azure上.部署进行得很好,但是当我打开站点时,出现了502.5错误.当我检查Azure日志流时,出现以下错误:

不用说它可以在我的开发机器上使用相同的代码很好地工作.请注意,尽管我在Azure上停用了数据库创建(以检查是否不是原因),但我也在使用Entity Framework Core 2.0.

有关信息,我从1.1迁移到2.0的方法是将目标框架设置更改为"netcoreapp2.0",并使用NuGet包"Microsoft.AspNetCore.All".可以肯定的是,我还删除了我的发布配置文件,然后重新创建了一个.

Asp.Net Core 2.0是否可能在Azure上不可用?我对Asp.Net Core相当陌生,所以我不知道Azure何时提供新版本.

编辑

当我尝试通过natemcmaster提出的调试控制台通过dot net CLI运行我的应用程序时,出现以下问题:

我将DLL下载到我的桌​​面上,并使用Dot Net Peak检查版本,确实,DLL是1.1.2,尽管我使用Visual Studio创建了项目并直接将其发布,所以Visual Studio是否存在问题?还是Nuget?

解决方案

问题实际上出在以下事实上:首先,我的Web应用使用的是.net core 1.1,它将所有DLL部署在"wwwroot"中Web应用程序的文件夹.但是,使用asp.net core 2.0,由于从全局存储库中提取了DLL,因此不再执行此操作.但是,由于Visual Studio不会在发布之前清除目标文件夹,所以我最终遇到了1.1 DLL位于我的wwwroot中的情况,因此网站选择了这些文件夹而不是store文件夹中的2.0 DLL./p>

这在这里有更详细的解释: https://github.com/Azure/app-service-announcements-discussions/issues/2#issuecomment-313816550

I have a small web app developed with Asp.Net Core 1.1 deployed on Azure and it works well. I just migrated the project to use Asp.Net Core 2.0 and tried to deploy it on Azure. The deployment went fine but when I open the site, I get a 502.5 error. When I check my Azure log stream, I get the following error:

Useless to say that it works well on my development machine with the same code. Note that I'm also using Entity Framework Core 2.0 although I deactivated the database creation on Azure (to check if it was not the cause).

For information, the way I migrated from 1.1 to 2.0 is by changing the target framework settings to "netcoreapp2.0" and by using the NuGet package "Microsoft.AspNetCore.All". Just to be sure, I also deleted my publish profile and recreate one.

Is it possible that Asp.Net Core 2.0 is not yet available on Azure ? I'm fairly new to Asp.Net Core, so I don't know when new releases are made available on Azure.

EDIT

When I try to run my app with dot net CLI via the debug console as proposed by natemcmaster, I got the following issue:

I downloaded the DLL on my desktop and check the version with Dot Net Peak and indeed, the DLL is 1.1.2, although I created the project with Visual Studio and directly publish it, so is it an issue with Visual Studio ? Or Nuget ?

解决方案

the issue was actually coming from the fact that, at first, my web app was using .net core 1.1, which deploys all the DLL in the "wwwroot" folder of the web application. However, with asp.net core 2.0, it does not do that anymore as the DLL are picked up from a global store. However, as Visual Studio does not clean the destination folder before a publish, I ended up with a situation where the 1.1 DLL were in my wwwroot, so the web site was picking up these ones instead of the 2.0 ones in the store folder.

This is explained in more details here: https://github.com/Azure/app-service-announcements-discussions/issues/2#issuecomment-313816550

这篇关于Azure上的Asp.Net Core 2.0得出502.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 20:46