构建ASP.NET 5从Visual Studio在线ERROR_FILE_IN_USE Azure的网站 [英] Build ASP.NET 5 to Azure websites from Visual Studio Online ERROR_FILE_IN_USE

查看:477
本文介绍了构建ASP.NET 5从Visual Studio在线ERROR_FILE_IN_USE Azure的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造了在Visual Studio Online的Git的托管一个虚拟的Hello World ASP.NET 5(MVC 6)项目。
我跟着在本文建设的步骤和部署到Azure中我的网站。

I created a dummy Hello World ASP.NET 5 (MVC 6) project hosted in Visual Studio Online's Git. I followed the steps described at this document to build and deploy into my Azure Websites.

我花了好几次尝试作为构建有错误失败,如无法恢复的NuGet包或inexisting wwwfolder(我不得不承诺源头控制有它的工作),但我得到了它的工作和应用程序达运行。

It took me several attempts as the build failed with errors such as "Unable to restore NuGet package" or inexisting wwwfolder (which I had to commit to source control to have it working) but I got it working and the app is up and running.

我需要帮助的问题是与持续集成的配置。在Visual Studio中我选择了一个CI触发构建/部署每当有入住在我的主分支。
这触发正确的尝试,但它不断地失败,此错误。

The issue I need help with is with the Continuous Integration configuration. In Visual Studio I have selected a CI trigger to build/deploy whenever there is a check-in in my master branch. This triggers the attempt properly but it constantly fails with this error.

错误code:ERROR_FILE_IN_USE
更多信息:因为它是由一个外部进程锁定Web部署不能修改目标文件'AspNet.Loader.dll。为了让发布操作成功,您可能需要为重新启动您的应用程序解除锁定,或者使用.NET应用程序的AppOffline规则处理程序在您下次发布的尝试。

如何解决这个问题呢?

感谢您。

PS:另外我不知道为什么在部署下的Azure网站,我不能看到该日志。当我使用的是Gi​​tHub的钩它用于显示所有失败/成功部署。

PS: Also I don't know why in Azure websites under Deployment I cannot see the log. When I was using a GitHub hook it used to display all the failed/successful deployments.

通常在Azure中下的Web应用程序>部署

Usually in Azure under the web app > DEPLOYMENTS

推荐答案

我遇到了同样的问题。还有,如果你有多个部署插槽处理它的可能更优雅的方式,但对于具有停机的部署过程中一分钟,我的情况是可以接受的。

I ran into the same issue. There are probably more elegant ways of dealing with it if you have multiple deployment slots but for my situation having a minute of downtime during deployment is acceptable.

您可以修改脚本使用启动AzureWebsite和Stop-AzureWebsite
注:我添加$ hostNameIndex,因为这需要改变,如果你添加域名。然后,您可以通过这个在Azure的PowerShell脚本参数。

You can modify the script to use Start-AzureWebsite and Stop-AzureWebsite Note: I added $hostNameIndex as this needs to change if you add domain names. You could then pass this in the Azure Powershell Script Arguments.


    param($websiteName, $packOutput, $hostNameIndex = 1)
    Stop-AzureWebsite -Name $websiteName
    $website = Get-AzureWebsite -Name $websiteName

    # get the scm url to use with MSDeploy.
    # By default this will be the second in the array. Changes when you add custom domain names. 
    # Here I have the default and 2 custom so scm is in 4th position ie. index: 3
    $msdeployurl = $website.EnabledHostNames[$hostNameIndex]

    $publishProperties = @{'WebPublishMethod'='MSDeploy';
                        'MSDeployServiceUrl'=$msdeployurl;
                        'DeployIisAppPath'=$website.Name;
                        'Username'=$website.PublishingUsername;
                        'Password'=$website.PublishingPassword}


    $publishScript = "${env:ProgramFiles(x86)}\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\Publish\Scripts\default-publish.ps1"


    . $publishScript -publishProperties $publishProperties  -packOutput $packOutput
    Start-AzureWebsite -Name $websiteName

资源:


  1. https://msdn.microsoft.com/en-us/库/天蓝色/ dn495288.aspx

  2. https://msdn.microsoft.com/en-us/库/天蓝色/ dn495185.aspx

  3. https://msdn.microsoft.com/Library/ VS / ALM /编译/天蓝色/部署,aspnet5

  1. https://msdn.microsoft.com/en-us/library/azure/dn495288.aspx
  2. https://msdn.microsoft.com/en-us/library/azure/dn495185.aspx
  3. https://msdn.microsoft.com/Library/vs/alm/Build/azure/deploy-aspnet5

这篇关于构建ASP.NET 5从Visual Studio在线ERROR_FILE_IN_USE Azure的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆