我正在docker下运行(在Mac Mojave 10.14.14上为Visual Studio Code)构建的应用程序,并且出现此错误:
ASP.NET Core with Entity Framework Core – ASPNETCORE_ENVIRONMENT
Error.
An error occurred while processing your request.
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.
Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
最有可能是因为我将环境变量ASPNETCORE_ENVIRONMENT设置为Development!
在Startup.cs文件的默认公共void Configure(IApplicationBuilder应用程序,IHostingEnvironment env,ILoggerFactory loggerFactory)方法中也有一些代码对此进行了检查。
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
Docker-compose.yml:
version: '3.4'
services:
site:
image: ${DOCKER_REGISTRY-}site
build:
context: .
dockerfile: site/Dockerfile
lanchSettings.json:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:18215",
"sslPort": 44326
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"site": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
请问有什么解决方案吗?
谢谢