无法将 web 包部署到 IIS 网站
我创建了一个 ASP.NET Core 应用程序和 Azure DevOps 持续集成 (CI) 和持续交付 (CD) 管道。
我已在本地计算机中创建并配置自托管 Windows 代理作为服务。它按预期工作。
当我第一次运行 CI/CD 管道时,它成功运行,并且 Web 应用程序成功发布到我的本地 IIS。
问题是当我向 Azure DevOps git 存储库提交另一个更新时,无法将 web 包部署到我的本地 IIS 网站,并出现以下错误和警告
2019-08-21T10:56:59.1480862Z ##[error]Failed to deploy web package to IIS website.
2019-08-21T10:56:59.1492670Z ##[warning]Can\'t find loc string for key: Trytodeploywebappagainwithrenamefileoptionselected
2019-08-21T10:56:59.1493093Z ##[warning]Trytodeploywebappagainwithrenamefileoptionselected
2019-08-21T10:56:59.1493421Z ##[error]Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'DemoWebApp.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.
Error count: 1.
我已经在发布配置文件 (.pubxml) 中配置了 appOffline 规则,并将 EnableMSDeployAppOffline 元素添加到 PropertyGroup,如下所示:
<PropertyGroup>
<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
</PropertyGroup>
如更多信息的了解更多 URL http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE中所述。
仍然无法将 web 包部署到我的本地 IIS 网站,并出现相同的错误和警告。
当我尝试手动重新部署几次时,它会成功运行,否则会失败并出现相同的错误和警告。因为我认为该文件在我的本地机器进程中被锁定了一段时间。
当我使用该锁定文件从 IIS 发布文件夹中手动删除所有文件时,它也可以成功运行。
需要帮助,文件被任何一个本地进程锁定。我找不到那个本地进程。我无法弄清楚这个问题。我也不知道我是否发现了这个过程,然后如何找出问题所在。这只是局部问题吗?
谁能帮我吗?