Asp.net core ASP.NET Core 1.1-设置环境
我使用ASP.NET Core 1.1。Asp.net core ASP.NET Core 1.1-设置环境,asp.net-core,Asp.net Core,我使用ASP.NET Core 1.1。 当我发布应用程序时,IHostingEnvironment总是将环境返回为“生产”。 我通过web.config进行了如下尝试: <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/> </handler
当我发布应用程序时,IHostingEnvironment总是将环境返回为“生产”。
我通过web.config进行了如下尝试:
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
)但是它没有识别这个参数。
非常感谢您的想法……您在服务器上安装了.NET Core Windows Server主机包吗?我不是部署到服务器,而是部署到Pivotal cloud foundry。发布到本地文件系统,然后使用cf push命令从那里发布到Pivotal。我看到发布忽略了环境变量。它生成“appsettings.Production.json”文件。我假设如果正确读取了环境变量,则为“appsettings.Development.json”。应用程序确实在目标系统上运行,但它声称在生产系统上运行。您是否在服务器上安装了.NET Core Windows Server主机包?我不是部署到服务器,而是部署到Pivotal cloud foundry。发布到本地文件系统,然后使用cf push命令从那里发布到Pivotal。我看到发布忽略了环境变量。它生成“appsettings.Production.json”文件。我假设如果正确读取了环境变量,则为“appsettings.Development.json”。应用程序确实在目标系统上运行,但它声称在生产系统上运行。