浪歌 · 随笔 我的开发笔记

netcore发布后的程序设置成开发环境

[netcore] 2024/3/6 14:54:54

详细参考:https://learn.microsoft.com/zh-cn/aspnet/core/fundamentals/environments?view=aspnetcore-8.0


需要在webconfig文件中做如下设置:


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\TestWebApi-20240303.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" >
       <environmentVariables>
              <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> //主要在这里。
          </environmentVariables>
      </aspNetCore>
    </system.webServer>
  </location>
</configuration>