Request for the permission of type 'System.Data.OleDb.OleDbPermission .. ' failed.

0

Posiadam assembly z wbudowanymi metodami dostępu do bazy danych ms access.
Są 2 scenariusze:

  1. Dołączam assembly jako resource do pliku wykonywalnego i tworzę standardowy obiekt klasy zawierającej owe metody

  2. Wykonuje operacje na bazie danych - wszystko jest ok.

  3. Tworzę obiekt owej klasy za pomocą Activatora

  4. Przy próbie wykonania operacji na bazie danych, nawet zwykłe selecty, aplikacja rzuca wyjątek z message opisanym w temacie.

W googlach wyczytałem, że muszę użyć narzędzia do przyznania pełnego zauwania dla aplikacji.
Co, jeśli posiadam uprawnienia zwykłego usera? Jakie mam wtedy wyjście?

A tak na marginesie, czemu 1 scenariusz nie generuje wyjątku? Spotkał się ktoś kiedyś z tym problemem?

0

A cały stack trace etc. wyjątku możesz wkleić, a nie tylko typ. Oraz kod jak aktywujesz obiekt w drugim scenariuszu.
Próbowałeś assembly ze strong name, tzn. podpisać ją, nie wiem czy to coś zmieni, ale może?

0

Wyjątek, który zostaje złapany przez aplikację:

  1. Message: Exception has been thrown by the target of an invocation.
  2. StackTrace:
    at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
    at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
    at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
    at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
    at System.Activator.CreateInstance(Type type, Object[] args)
    at RemoteAgent.MainForm.ExecuteTest(Int32 taskId) in c:\Documents and Settings\jradziem\Pulpit\Smart test\source\RemoteAgent\RemoteAgent\MainForm.cs:line 229
  3. InnerException:
    a) Message: Exception list was not loaded. Couldn't add error logs to database. Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    b) StackTrace
    at AccessDefinitions.AccessConnection.ExecuteMultiRowQuery(String procedureName, String[] queryParams)
    at DataObjects.RemoteAgentDatabaseConnection.GetInputArguments(Int32 taskId)
    at SeleniumObjects.TestDataCollection.LoadInputArguments()
    at SeleniumObjects.TestDataCollection..ctor(RemoteAgentDatabaseConnection dbObj, Int32 taskId)
    at SeleniumObjects.BaseTarriffTest.SetupTest()
    at SeleniumObjects.BaseTarriffTest..ctor(RemoteAgentDatabaseConnection connectionObject, Int32 taskId)
    at Aviva_CC.HouseHold_Tarriff..ctor(RemoteAgentDatabaseConnection connectionObject, Int32 taskId)

Linijka w punkcie 3b) at AccessDefinitions.AccessConnection.ExecuteMultiRowQuery(String procedureName, String[] queryParams) jest odpowiedzialna za pierwsze wywołanie procedury składowanej (kwerendy w accessie).

Myślę, że kodu nie ma sensu zamieszczać, bo jest tego sporo, jeśli chcesz, mogę zbudować prosty kod na prostej klasie na potrzeby weryfikacji problemu.

1 użytkowników online, w tym zalogowanych: 0, gości: 1