c# - 将开发更改为生产环境损坏的应用程序
问题描述
我是 dotnet 核心的新手。
我正在构建一个 Dotnet Core WebAPI 应用程序,并且在Development
env 下一切正常,但是当我更改为Production
ASPNETCORE_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]
可能的原因是什么?
解决方案
你应该检查你的appsettings.json
,appsettings.Development.json
和appsettings.Production.json
.
开发使用appsettings.json
,appsettings.Development.json
.
生产使用 appsettings.json
,appsettings.Production.json
.
推荐阅读
- javascript - 为什么我的方法不适用于删除 firebase 对象?在 vue 上
- azure-devops - VSTS 扩展 - 如何在加载自定义选项卡时从测试套件表中获取选定的套件数据
- javascript - 尝试使用导航栏切换图标按钮(动画菜单图标)创建覆盖
- moodle - 在学生登录 Moodle 后执行额外验证
- spring-cloud-stream - 由于 Spring 集成依赖关系,LogConsumer Spring Cloud 功能失败
- php - array_merge 删除一个空字符串
- android - 找不到 git repo(库)
- spring-boot - Spring webflux 反应式 Mono::subscribe
- xcode - 深色模式下 UITableview 的 sectionIndexBackgroundColor 相关问题
- java - java中的数组是否是线程安全的:一个线程更改值,一个线程读取值?