Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) while trying to deploy a BizTalk Solution from Visual Studio

Posted: November 24, 2016 in BizTalk
Tags: , , , , ,

Continuing with “Errors and Warnings, Causes and Solutions”, let’s talk today about a classic (and annoying) one:

“Error 87 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Error 88 at Microsoft.BizTalk.Gac.Fusion.IAssemblyCache.InstallAssembly(AssemblyCacheInstallFlag flags, String manifestFilePath, IntPtr referenceData)

at Microsoft.BizTalk.Gac.Gac.InstallAssembly(String assemblyPathname, Boolean force)

at Microsoft.BizTalk.Deployment.BizTalkAssembly.GacInstall(String assemblyLocation)

at Microsoft.BizTalk.Deployment.BizTalkAssembly.PrivateDeploy(String server, String database, String assemblyPathname, String applicationName)

at Microsoft.BizTalk.Deployment.BizTalkAssembly.Deploy(Boolean redeploy, String server, String database, String assemblyPathname, String group, String applicationName, ApplicationLog log)

Error 89 Unspecified exception: "

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Error 90 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Error 91 Failed to add resource(s). Change requests failed for some resources. BizTalkAssemblyResourceManager failed to complete end type change request. Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Error 93 Assembly "<name of the assembley>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d6ddb8f4f8e0e50" references the following assemblies that must be deployed before deploying this assembly:

Assembly "<name of the assembley>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d6ddb8f4f8e0e50"

Error 94  Deploy operation failed.

""

Assembly "<name of the assembley>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d6ddb8f4f8e0e50" references the following assemblies that must be deployed before deploying this assembly:

Assembly "<name of the assembley>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d6ddb8f4f8e0e50"”

Visual-Studio-BizTalk-Solution-Deploy-Access-denied

while trying to deploy from Visual Studio a BizTalk solution.

This is actually very common in the recent versions of BizTalk Server, special because some additional securities setting present in recent Windows Server versions.

CAUSES

There are several possible causes for you to get access denied errors when deploying BizTalk solutions directly from Visual Studio. Here are some of the most common causes that you need to take in consideration and check for:

  • You are not a local Administrator: make sure you have administrator rights on the BizTalk server, this is required because BizTalk assemblies needs to be deployed into GAC;
  • You don’t have the right BizTalk privileges to deploy artifacts: Make sure the user account that is trying to deploy the Visual Studio BizTalk Solution is member of:
    • BizTalk Server Administrators group
    • And also, member of SSO Administrators or SSO Affiliate Administrators group

This is required because BizTalk artifacts needs to be “registered” in BizTalk databases and these memberships should grant you the required access to the databases;

  • Visual Studio BizTalk Deployment properties are incorrect: Visual Studio use the setting present in Deployment tab of each BizTalk project present in the visual studio solution to correctly deploy the artifacts (dlls). You should verify that your deployment configurations are correct by right-clicking the project in Visual Studio, selecting “Properties” and then click the Deployment tab. The most important properties that you need to check should be “Configuration Database” and “Server”, validate if they are what you expect them to be, and you should also check the “Application Name” property. Check more about Deployment Properties here: How to Set Deployment Properties in Visual Studio;
  • You are not running Visual Studio as administrator: If you have UAC activate, or sometimes even disactivated, there are some additional securities setting present in recent Windows Server versions that, by default, doesn’t run Visual Studio with elevate permissions. Again, this is required because BizTalk assemblies needs to be deployed into GAC;
  • Some process is locking the files: in some situations, some other processes, other Visual Studios or BizTalk Host Instances, may have a lock on the file(s) you are trying to replace, in these cases, stopping or restarting these services before deploying the solution should help.
SOLUTIONS

In the causes, I already described the basic steps to solve this error based on the situation you are in, so I will not address in detail here all the possible solution. In my case, and I think that is the most common situation, was that, despite having disabled the UAC, I was running the Visual Studio without elevate permissions.

There are several ways to solve this problem (running Visual Studio with elevate permissions), the simple way of course is to:

  • On the Start screen, type Visual Studio.
  • Right-click under Visual Studio and choose “Run as administrator” option.

Visual-Studio-run-as-administrator-Access-denied

The problem of this approach is that I need to remember myself to do it whenever I want to run Visual Studio, otherwise, the next time it will fail again with the same error.

To resolve once and for all, you can opt for two approaches:

  • Option one:
    • Access to the devenv.exe file on the file system, for example: “C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE”
    • Right-click devenv.exe and select "Troubleshoot compatibility".

Visual-Studio-Troubleshoot-compatibility

    • On the “Select troubleshooting option” page, select "Troubleshoot compatibility" option.

Visual-Studio-Troubleshoot-compatibility-option

    • On the “What problems do you notice?” page, select the "The program requires additional permissions" option and then click “Next”

Visual-Studio-Troubleshoot-compatibility-problem-notice

    • On the “Test compatibility settings for the progem” page, click "Test the program…", wait for the program to launch and then click "Next".
    • Select "Yes, save these settings for this program"
    • and then click "Close"
  • Option two:
    • Right click the Visual Studio icon and select “Properties” option
    • On the Visual Studio … Properties windows select the “Shortcut” tab and then click “Advanced…” button
    • On the “Advanced Properties” window, check “Run as administrator” option and then click “OK”

Visual-Studio-run-as-administrator-advance-properties

    • Back to the Visual Studio … Properties windows, click “OK”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s