ASP.NET核心Web应用中的多个开发应用程序设置
我对ASP.NET核心Web应用程序和开发环境有一个理解的问题。 有没有办法在开发模式下具有多个应用程序?例如appsettings.development.json and AppSettings.development.linux.json。 问题是AppSettings.development.json保留特定于Windows的设置和AppSettings.development.linux.json保留特定于Linux的设置。如果我输入“ aspnetcore_environment”:“ devel那么,仅在发布版本中存在物理存在。至少这就是我到目前为止理解的方式。 因此,也许有一种方法可以编程和独立于Aspnetcore_environment启用开发模式?还是我做错了什么,我应该做不同的事情吗?
我的启动集。JSON看起来像:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8691",
"sslPort": 44311
}
},
"profiles": {
"Kestrel Dev Blazor": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "https://localhost:6501",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true",
"applicationUrl": "https://localhost:6501;http://localhost:6500"
},
"Development.Linux : WSL 2": {
"commandName": "WSL",
"launchBrowser": true,
"launchUrl": "https://localhost:6501",
"environmentVariables": {
"ASPNETCORE_URLS": "https://localhost:6501;http://localhost:6500",
"ASPNETCORE_ENVIRONMENT": "Development.Linux",
"LD_LIBRARY_PATH": "$LD_LIBRARY_PATH:[PATH_TO_64BIT_LIBS]:[PATH_TO_32BIT_LIBS]",
"LD_PRELOAD": "[PATH_TO_PRELOAD_LIBS]"
},
"distributionName": "Ubuntu"
}
}
}
I have an understanding question about ASP.NET Core Web Apps and the development environment.
Is there a way to have multiple appsetings in development mode? For example appsettings.Development.json and appsettings.Development.Linux.json.
The problem is that appsettings.Development.json holds Windows-specific settings and appsettings.Development.Linux.json holds Linux-specific settings. If I enter "ASPNETCORE_ENVIRONMENT": "Development.Linux" in the launchSettings, the development mode no longer works properly and I get error messages that static files can no longer be loaded, e.g. "_content/..." is not found at all, which is only physically exists in the Released Version. At least that's how I understood it until now.
So maybe there is a way to enable development mode programmatically and independently of ASPNETCORE_ENVIRONMENT? Or am I doing something completely wrong and should I proceed differently?
My launchSetting.json looks like:
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8691",
"sslPort": 44311
}
},
"profiles": {
"Kestrel Dev Blazor": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "https://localhost:6501",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": "true",
"applicationUrl": "https://localhost:6501;http://localhost:6500"
},
"Development.Linux : WSL 2": {
"commandName": "WSL",
"launchBrowser": true,
"launchUrl": "https://localhost:6501",
"environmentVariables": {
"ASPNETCORE_URLS": "https://localhost:6501;http://localhost:6500",
"ASPNETCORE_ENVIRONMENT": "Development.Linux",
"LD_LIBRARY_PATH": "$LD_LIBRARY_PATH:[PATH_TO_64BIT_LIBS]:[PATH_TO_32BIT_LIBS]",
"LD_PRELOAD": "[PATH_TO_PRELOAD_LIBS]"
},
"distributionName": "Ubuntu"
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论