Variables ambiente - Web.Config
https://blog.dangl.me/archive/setting-asp-net-core-environment-variables-via-web-config-in-iis/
Since RC2, hosting .Net Core apps within IIS is no longer using the common HttpPlatformHandler as with any other processes but instead the ASP.NET Core Module for Windows Server Hosting.
While not a lot has changed, the Xml schema for the web.config elements is new, so you need to specify environment variables the following way in your main web.config file:
1
2
3
4
5
6
7
8
9
10
11
12
13
| <? xml version = "1.0" encoding = "utf-8" ?> < configuration > < system.webServer > < handlers > < add name = "aspNetCore" path = "*" verb = "*" modules = "AspNetCoreModule" resourceType = "Unspecified" /> </ handlers > < aspNetCore processPath = "%LAUNCHER_PATH%" arguments = "%LAUNCHER_ARGS%" forwardWindowsAuthToken = "false" stdoutLogEnabled = "true" > < environmentVariables > < environmentVariable name = "ASPNETCORE_ENVIRONMENT" value = "Production" /> </ environmentVariables > </ aspNetCore > </ system.webServer > </ configuration > |
Alternatively, you can still use regular web.config transformations for publishing to IIS (there's currently no support for that in dotnet-publish-iis), for example in your web.Production.config:
1
2
3
4
5
6
7
8
9
10
| <? xml version = "1.0" encoding = "utf-8" ?> < system.webServer > < aspNetCore > < environmentVariables xdt:Transform = "Insert" > < environmentVariable name = "ASPNETCORE_ENVIRONMENT" value = "Production" /> </ environmentVariables > </ aspNetCore > </ system.webServer > </ configuration > |
Variables de ambiente, Panel de Control, Sistema
No hay comentarios:
Publicar un comentario