我在测试服务器上远程部署了一个dotnet核心应用程序。在远程计算机上,ASPNETCORE_ENVIRONMENT变量应设置为“Development”。每次部署时,ASPNETCORE_ENVIRONMENT变量都被“Develop”覆盖。每次部署时,我都必须进入IIS管理配置编辑器,替换不正确的ASPNETCORE_ENVIRONMENT变量。
有人能帮助我理解为什么每次部署时都会覆盖此变量吗?
下面是我的web.config文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation>
<buildProviders>
<remove extension=".xml" />
<add extension=".xml"
type="System.Web.Compilation.ForceCopyBuildProvider" />
</buildProviders>
</compilation>
</system.web>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*"
modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet"
arguments=".\WorkersCompensation.dll" stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="true">
<environmentVariables>
<clear />
<environmentVariable name="ASPNETCORE_ENVIRONMENT"
value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer>
</configuration>
下面是我的Dev.pubxml文件:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<PublishFramework>netcoreapp1.0</PublishFramework>
<UsePowerShell>True</UsePowerShell>
<publishUrl>\\esdev2.elwood.local\D$\Core\WorkersCompensation</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<ExcludeFoldersFromDeployment>wwwroot\node_modules</ExcludeFoldersFromDeployment>
<UseMsDeployExe>true</UseMsDeployExe>
</PropertyGroup>
<ItemGroup>
<MsDeploySkipRules Include="SkipNodeModules">
<AbsolutePath>wwwroot\node_modules</AbsolutePath>
</MsDeploySkipRules>
</ItemGroup>
</Project>
1条答案
按热度按时间mqkwyuun1#
我相信我已经为其他有这个问题的人找到了问题/解决方案。