none
OleDb SecurityException after new PC/upgrade to VS 2008 RRS feed

  • Question

  •  

    Recently I got a new PC and upgraded to VS 2008.  I cannot get an application that I developed in VS 2005 on my old PC to execute w/o a security exception when attempting to open an Access 2003 table.  The app worked fine in 2005.  So I'm probably missing some kind of setting. 

     

    The app is set for full-trust.  VS hosting process is turned off. 

     

    Any help is appreciated.

     

     

    Tuesday, April 15, 2008 7:23 PM

Answers

  • I recreated the app from scratch and now it works fine.  So something weird happened in the conversion from 2005 to 2008. 

    Wednesday, April 16, 2008 9:23 PM

All replies

  • What is exact exception message?
    Wednesday, April 16, 2008 9:51 AM
    Moderator
  • Thanks for replying.

     

    Short version:  Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

     

    Detailed version:  System.Security.SecurityException was unhandled
      GrantedSet="<PermissionSet class="System.Security.PermissionSet" version="1"> <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="USERNAME"/> <IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/> <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="Q:\Edtech\emanning\VisualStudio\Edtech\CME Tracking\CMETracking\bin\Debug\" PathDiscovery="Q:\Edtech\emanning\VisualStudio\Edtech\CME Tracking\CMETracking\bin\Debug\"/> <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Allowed="AssemblyIsolationByUser" UserQuota="9223372036854775807" Expiry="9223372036854775807" Permanent="True"/> <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ReflectionEmit"/> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Assertion, Execution, BindingRedirects"/> <IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/> <IPermission class="System.Security.Permissions.UrlIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Url="file:///Q:/Edtech/emanning/VisualStudio/Edtech/CME Tracking/CMETracking/bin/Debug/CMETracking.exe"/> <IPermission class="System.Security.Permissions.ZoneIdentityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Zone="Intranet"/> <IPermission class="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/> <IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" version="1" Level="DefaultPrinting"/> </PermissionSet> "
      Message="Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
      PermissionState="<PermissionSet class="System.Security.PermissionSet" version="1"> <IPermission class="System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" AllowBlankPassword="False"> <add ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\CMETracking.mdb" KeyRestrictions="" KeyRestrictionBehavior="AllowOnly"/> </IPermission> </PermissionSet> "
      RefusedSet=""
      Source="mscorlib"
      Url="file:///Q:/Edtech/emanning/VisualStudio/Edtech/CME Tracking/CMETracking/bin/Debug/CMETracking.exe"
      StackTrace:
           at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)    at System.Security.PermissionSet.Demand()    at System.Data.Common.DbConnectionOptions.DemandPermission()    at System.Data.OleDb.OleDbConnection.PermissionDemand()    at System.Data.OleDb.OleDbConnectionFactory.PermissionDemand(DbConnection outerConnection)    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)    at System.Data.OleDb.OleDbConnection.Open()    at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)    at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)    at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)    at CMETracking.CMETrackingDataSetTableAdapters.tlkpFacultyTableAdapter.Fill(tlkpFacultyDataTable dataTable)    at CMETracking.Form1.Form1_Load(Object sender, EventArgs e)    at System.EventHandler.Invoke(Object sender, EventArgs e)    at System.Windows.Forms.Form.OnLoad(EventArgs e)    at System.Windows.Forms.Form.OnCreateControl()    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)    at System.Windows.Forms.Control.CreateControl()    at System.Windows.Forms.Control.WmShowWindow(Message& m)    at System.Windows.Forms.Control.WndProc(Message& m)    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)    at System.Windows.Forms.ContainerControl.WndProc(Message& m)    at System.Windows.Forms.Form.WmShowWindow(Message& m)    at System.Windows.Forms.Form.WndProc(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)    at System.Windows.Forms.Control.SetVisibleCore(Boolean value)    at System.Windows.Forms.Form.SetVisibleCore(Boolean value)    at System.Windows.Forms.Control.set_Visible(Boolean value)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.Run(ApplicationContext context)    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)    at CMETracking.My.MyApplication.Main(String[] Args)
      InnerException:

     

    Wednesday, April 16, 2008 1:27 PM
  • Are you running the app from the IDE or outside of the IDE? If the app is running outside of the IDE is it running from the network? Is the database located on the network?
    Wednesday, April 16, 2008 4:15 PM
  • Running from inside the IDE.

     

    Both the app and database are on the network.

     

    Thanks for your reply.

     

     

    Wednesday, April 16, 2008 4:24 PM
  • I recreated the app from scratch and now it works fine.  So something weird happened in the conversion from 2005 to 2008. 

    Wednesday, April 16, 2008 9:23 PM