首页 > 解决方案 > 将开发更改为生产环境损坏的应用程序

问题描述

我是 dotnet 核心的新手。

我正在构建一个 Dotnet Core WebAPI 应用程序,并且在Developmentenv 下一切正常,但是当我更改为ProductionASPNETCORE_ENVIRONMENT 时,发生了以下未处理异常:

启动.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#.netasp.net-mvcasp.net-core

解决方案


你应该检查你的appsettings.json,appsettings.Development.jsonappsettings.Production.json.

开发使用appsettings.jsonappsettings.Development.json.

生产使用 appsettings.jsonappsettings.Production.json.


推荐阅读