When deploying a web site that uses Loupe you may occasionally find the deployment fails because one or more of the Loupe files are locked, typically Gibraltar.Agent.dll.


If the agent is set to send sessions on exit it will launch the Packager utility when the application domain exits.  This will hold a lock on its assemblies - including the Agent - until it can upload information to the server.  Depending on how long this takes and how fast the deployment runs it may still hold these locks when the deployment attempts to update the files.


All of the resolution paths revolve around either preventing the deployment from updating the Loupe files that are locked or ensuring the Packager has exited by the time it wants to change them.  Typical solutions are:

  • Don't include the Packager utility:  It's generally not necessary for web application since they typically start up immediately after they exit (due to being updated or a scheduled restart) so the final session data will be sent by the application soon after it starts (assuming it's set to automatically send sessions).
  • Ensure deployment only updates modified files: This reduces the occurrence instances to when you deploy a new agent which is generally going to be rare compared to all deployments.
  • Add a modest delay between shutting down the site and deploying: This would raise the odds the packager has completed its work before you modify files.  Unless the interval is 60 seconds or more this may not be sufficient so consider one of the other options first.