Error Deploying New Relic Instrumented Site to Azure from Github & VS.NET
Asked Answered
H

6

12

I am getting the following error:

Error: The process cannot access the file 'C:\DWASFiles\Sites\mywebsitename\VirtualDirectory0\site\wwwroot\newrelic\NewRelic.Agent.Core.dll' because it is being used by another process.

In the Running deployment command... log file when attempting to deploy an Azure website from Github.

Would appreciate any pointers as to what could be causing this.

UPDATE: Turns out this is also failing when publishing directly from VS.NET with the following:

1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4196,5): Warning : An error was encountered when processing operation 'Create File' on 'NewRelic.Agent.Core.dll'.  
1>Retrying operation 'Update' on object filePath (mywebsitename\newrelic\NewRelic.Agent.Core.dll). Attempt 1 of 2.
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4196,5): Error : Web deployment task failed. ((06/07/2013 23:54:58) An error occurred when the request was processed on the remote computer.)

This was working before and I am not sure why it would have stopped.

Heaps answered 6/7, 2013 at 21:53 Comment(1)
you should mark one of the answers as correctBethelbethena
O
13

NewRelic recommend stopping the website to unload the file and allow the deployment to go through.

As an alternative, you can set COR_ENABLE_PROFILING to 0 in your app settings on the configure tab to temporarily disable the profiling, which should then allow you to continue with the deployment while leaving the website operational throughout.

Orris answered 5/9, 2013 at 13:40 Comment(4)
Anyone have any idea how to automate this? I have CI builds from BitBucket and would like to automate changing that environment setting.Deafmute
Might be possible to automate it using Powershell, which I'm looking into right now cos this is annoying me too.Merbromin
We set COR_ENABLE_PROFILING to 0 and then got this: Error Web deployment task failed. (Web Deploy cannot modify the file 'Microsoft.CodeAnalysis.CSharp.dll' on the destination because it is locked by an external process. Any idea where this is comming from? It just started after installing the NewRelic APM. I had to then manually stop the site to deploy from Visual Studio :-(Homologize
I also had to switch the web app's "Always On" setting to "Off" to get rid of the errorBonnes
A
8

Instead of stopping the website you can temporarily turn off New Relic monitoring via the Configure tab on manage.windowsazure.com:

Configure > developer analytics > select "OFF" > Save

Deploy

Configure > developer analytics > select "ADD-ON" > Choose Add-on from dropdown > Save

Worked for me, both with a regular deployment from VS and an automatic build from VSO.

Andrien answered 15/5, 2014 at 8:4 Comment(0)
F
3

This is a known issue with the New Relic .NET agent for Azure Websites when performing an upgrade of the agent. The workaround is to stop the website to release the dll, finish the deployment and then restart the instance.

https://newrelic.com/docs/dotnet/azure-web-sites#h2-1

Femineity answered 9/7, 2013 at 21:17 Comment(2)
Thanks - I did try stopping the website with no success. In the end I created a new clean website in Azure and started again now it seems I can redploy ok.Heaps
It seems that it can take a while until the log-file is released, even after you stop the website. I experience delays of up to 15 minutes.Subscapular
C
1

Not really a solution but more of a work-around, in the publish dialog view a preview of the changes and uncheck the NewRelic.Agent.Core.dll file so that it doesn't get published.

Celerity answered 24/7, 2015 at 6:9 Comment(0)
M
0

None of these answers work for me anymore. I have an Azure Basic tier website plan, which hosts multiple actual websites.

If I don't stop the website, I get the error mentioned above (newrelic.agent.core.dll is in use)...

If I do stop the website (or all of them), I get an error saying that the publishing endpoint isn't available.

If I go to the configure tab and disable the AddOn, we still get the error mentioned above (newrelic.agent.core.dll is in use)...

Pretty much we just republish over and over again with different permutations of the above until if works. It took me hours the other day, took me 10 minutes today.

Mcneely answered 4/8, 2014 at 18:49 Comment(0)
M
0

If you are using webdeploy, then you can configure your webdeploy settings so that it ignores the file. However, if you do that, you will manually have to deploy any updates to the new relic agent.

I had a similar issue with the new relic log file being locked, and solved it by:

  1. Moving the new relic log file to a subdirectory of the web root (e.g. \newreliclogs)
  2. Adding 2 lines to my powershell script that configured the skip directive to ignore that whole directory. e.g. (where destBaseOptions is of type Microsoft.Web.Deployment.DeploymentBaseOptions

    $skipDirective = new-object Microsoft.Web.Deployment.DeploymentSkipDirective("NewRelicLog","objectName=dirPath,absolutePath=.*\newreliclogs$")

    $destBaseOptions.SkipDirectives.Add($skipDirective)

Depending on how you are using webdeploy, the configuration is achieved slightly differently, I used the following links to help me piece it together:

And I used the powershell script from the Octopus Deploy Library at https://library.octopusdeploy.com/#!/step-template/actiontemplate-web-deploy-publish-website-(msdeploy).

Melnick answered 20/2, 2015 at 21:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.