【问题标题】:Changed Development to Production Env Broke App将开发更改为生产环境损坏的应用程序
【发布时间】:2021-06-18 03:40:46
【问题描述】:

我是 dotnet 核心的新手。

我正在构建一个 Dotnet Core WebAPI 应用程序,在 Development 环境下一切正常,但是当我在 ASPNETCORE_ENVIRONMENT 中更改为 Production 时,发生了以下未处理异常:

Startup.cs

services.AddDbContext<DBContext>(options => options.UseMySql(Configuration.GetConnectionString("LocalDatabase")));

\\ Error 
\\ System.ArgumentException: 'Option 'user variables' not supported.'
\\ This exception was originally thrown at this call stack:
\\  [External Code]
 ReferralSystem.Startup.ConfigureServices.AnonymousMethod__0(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder) in Startup.cs
\\  [External Code]

可能的原因是什么?

【问题讨论】:

标签: c# .net asp.net-mvc asp.net-core


【解决方案1】:

您应该检查您的appsettings.jsonappsettings.Development.jsonappsettings.Production.json

开发使用appsettings.jsonappsettings.Development.json

生产使用appsettings.jsonappsettings.Production.json

【讨论】:

    猜你喜欢
    • 2010-12-29
    • 1970-01-01
    • 2011-07-02
    • 2019-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-14
    相关资源
    最近更新 更多