Solve ASP.NET Core deployed to IIS, update the project "another program is using this file, the process can not access."

If the application is running, the deployment folder file is locked. During deployment, you can not overwrite files that are locked. To unlock a locked file in your deployment, please stop the application pool to use one of the following methods:

  • Using the Web to deploy and referenced in the project file  Microsoft.NET.Sdk.WebApp_offline.htm system will place a file in the root directory of the Web application directory. When the file exists, ASP.NET Core module would normally close the application deployment process and provide app_offline.htm file. For more information, see  ASP.NET Core Module configuration reference .

  • In IIS Manager on the server, manually stop the application pool.

  • Use PowerShell to delete app_offline.html (need to use PowerShell version 5 or later):

    PowerShell
    $pathToApp = 'PATH_TO_APP'
    
    # Stop the AppPool
    New-Item -Path $pathToApp app_offline.htm # Provide script commands here to deploy the app # Restart the AppPool Remove-Item -Path $pathToApp app_offline.htm 
  •  https://docs.microsoft.com/zh-cn/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2

Guess you like

Origin www.cnblogs.com/lyl6796910/p/11247563.html