Opening the “Add Adapter Service Reference…” in Visual Studio on Vista results in error “error loading the binding, JNBridge.JMSAdapter.JMSAdapterBinding…Exception thrown by target of an invocation”

The Problem

The error manifests when attempting to open the “Add Adapter Service Reference…” dialog. The resulting error dialog displays:

There was an error loading the binding, JNBridge.JMSAdapter.JMSAdapterBinding, from your system configuration.
ConfigurationErrorsException: Exception has been thrown by the target of an invocation.

If the “Details” button is clicked on the error dialog, you’ll see the stack trace:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.UnauthorizedAccessException: Access to the path ‘C:Program FilesJNBridgeJMSAdaptersDotNetbinbind.properties’ is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at JNBridge.JMSAdapter.Core.JMSBindingManager.deserializeFromFile(String path)
at JNBridge.JMSAdapter.JMSAdapterBinding.setEnvironment()
at JNBridge.JMSAdapter.JMSAdapterBinding..ctor()
— End of inner exception stack trace —
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Microsoft.ServiceModel.Channels.Tools.MetadataSearchBrowse.MetadataPanel.EnumerateAllAvailableBindings()

The adapter is trying to access the file bind.properties, but has insufficient privledges. This file provides persistence for JMS server connection properties (hostname, ports, connection factories, etc.) so developers don’t have to continually enter values in the dialog box.

The Cause

The user privileges do not include read/write access to bind.properties, found in the install directory: [INSTALLDIR]JNBridgeJMSAdaptersDotNetbin. This is primarily caused by enabling User Access Control (UAC) in Vista as developers routinely have default Administrator privledges. But then again, most developers just turn off UAC with extreme prejudice. At any rate, either UAC must be disabled or the default user group must be given read/write access.

The Solution

Disable UAC or modify access privileges for the users’s default group. To change privileges for a Group, use the properties dialog for the file: