'System.UnauthorizedAccessException' in System.EnterpriseServices.Wrapper.dll Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

0

I have a class "Settings" written in VB.NET. I am trying to use this class in a console application written in C#. When I instantiate Settings class in my console application I am getting this exception:

'System.UnauthorizedAccessException' in System.EnterpriseServices.Wrapper.dll An unhandled exception of type 'System.UnauthorizedAccessException' occurred in System.EnterpriseServices.Wrapper.dll Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

I have tried changing launch and activation permissions in DCOM Config.


    class Program
        {
            static void Main(string[] args)
            {
                SqlConnection CN = null;
                Settings S = new Settings();// Exception throws here
                CN = new SqlConnection(S.GetLocalSetting("CnStr"));
            }
        }

Settings class imports these namespaces:

 Imports System.IO
 Imports System.EnterpriseServices
 Imports System.Xml
 Imports Data.Encryption

// Constructor
Public Sub New()

    End Sub

And has many methods which are used to get and delete settings, to connect to database etc.

c#
vb.net
asked on Stack Overflow Apr 24, 2019 by RoshanJha • edited Apr 24, 2019 by RoshanJha

1 Answer

0

The classes in Data.Encryption requires administrator permissions to run, and that's why you got this exception.

You try run your visual studio in administrator mode?

answered on Stack Overflow Apr 24, 2019 by Gonçalo Garrido

User contributions licensed under CC BY-SA 3.0