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.
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.
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.
Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'AspNet.Loader.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.
How to solve this problem?
Thank you.
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.
Usually in Azure under the web app > DEPLOYMENTS
Create or open an Azure cloud service project in Visual Studio. In Solution Explorer, right-click the project, and, from the context menu, select Convert > Convert to Azure Cloud Service Project. In Solution Explorer, right-click the newly created Azure project, and, from the context menu, select Publish.
Publishing the MVC applicationOpen the MVC project's solution in Visual Studio. Right-click the project in the Solution Explorer and select Publish.... Select Microsoft Azure App Service and choose Select Existing. Click Publish.
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.
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
Resources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With