首页 > 解决方案 > 将 ASP.NET Core 5 应用程序从 Windows 移动到 Linux 后出现 InvalidCastException

问题描述

将我的 ASP.NET Core 5 应用程序从 Azure Windows 应用程序服务移动到 Linux 应用程序服务后,我几乎在所有端点上都收到了这些错误:

InvalidCastException(无法将“System.Int32”类型的对象转换为“System.String”类型。
无法将“System.Guid”类型的对象转换为“System.String”类型。等)

SqlNullValueException

移回 Windows 后一切正常。

使用 EF Core 5 和 SQL Azure。我想相信这不是某种 .NET Core 错误,我只是缺少一些配置,因为从 Windows 迁移到 Linux 很常见。

标签: azure-web-app-serviceasp.net-core-5.0ef-core-5.0azure-linux

解决方案


似乎是因为应用服务计划太弱了。应用服务计划扩大后一切正常。


推荐阅读