2017-08-10 90 views
1

我想改變我的asp.net核心託管環境的發展。 我已經做的是:Asp淨變更託管環境發展

  1. 運行以下命令:

    enter image description here

  2. 運行這些命令:

    set ASPNETCORE_ENVIRONMENT=Development 
    
  3. 更改系統環境變量

    dotnet restore 
    
    dotnet watch run 
    

我只是在projectName.csproj文件中看到有是說它運行生產評論,也許這就是問題所在。

<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish"> 
<!-- As part of publishing, ensure the JS resources are freshly built in production mode --> 
<Exec Command="npm install" /> 
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" /> 
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" /> 

但現在我在我的項目中看到的是託管環境:生產 ,我想將其更改爲環境,因爲我看不到活的變化,當我改變,如HTML客戶端的變化,CSS。

+0

你能在那裏您運行'DOTNET手錶run'命令提示符下運行'回聲%ASPNETCORE_ENVIRONMENT%'?這將確認環境變量是否正確設置。 –

+0

看看這裏的文檔https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments – Nkosi

回答

1

要設置ASPNETCORE_ENVIRONMENT環境變量在Windows,運行在cmd中此命令:

setx ASPNETCORE_ENVIRONMENT "Development" 

或者

使用嘗試web.config,如:

<configuration> 
<!-- 
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380 
--> 
<system.webServer> 
    <handlers> 
     <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> 
    </handlers> 
    <aspNetCore processPath=".\MyApplication.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"> 
     <environmentVariables> 
      <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> 
     </environmentVariables> 
    </aspNetCore> 
</system.webServer> 
</configuration>