7 Answers, 1 is accepted
As far as I know there is no medium trust problem with OpenAccess. Which errors are you getting and how does your setup look like?
All the best,
Jan Blessenohl
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>
I tried again, and I have the error:
Sin conexion.
Descripcion del error: Required security permission not given for the database driver used. Telerik.OpenAccess.RT.sql.SQLException: Required security permission not given for the database driver used. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(RuntimeAssembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandleInternal rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, UInt32 invocationFlags)
at System.RuntimeMethodHandle.PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, UInt32 invocationFlags)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
at OpenAccessRuntime.ReflectionUtils.SetInstanceProperty(Object obj, String name, Object val)
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PostgreSqlFactory.MapConnectionString(ConnectionString conString)
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PostgreSqlFactory.CreateConnection(ConnectionString conString, String& id)
--- End of inner exception stack trace ---
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.connect(ConnectionString connectionString, IDictionary driverProps)
at OpenAccessRuntime.Relational.sql.SqlDriver.InitializeFor(ConnectionString connectionString, Boolean noConnect, PropertySet props, Driver& driver, Connection& conn)
Metodo que produce la excepcion: System.Collections.Generic.List`1[GantNube.BE.Usuario] getConnection()
Pila de errores: at GanttNube.BL.BLTareas.getConnection() in D:\PROYECTOS\SIMBIOSYS\NUBE.GANTT\04.DES\DES\GE.WS\GanttNube.BL\BLTareas.cs:line 38
at GanttNube.WS.Service.getPruebaConexion() in D:\PROYECTOS\SIMBIOSYS\NUBE.GANTT\04.DES\DES\GE.WS\GanttNube.WS\Service.asmx.cs:line 29
And in the "Model Settings" I selected "Medium Trust" and mi IIS server has a "Medium Level Trust", but when I publish it doesn't work.
So I have Telerik version:
Telerik_OpenAccess_ORM_Free_Edition_2011_2_713_SDK
Telerik_OpenAccess_ORM_Free_Edition_2011_2_713
Regards
It looks like they have changed that with the latest version of the driver. Maybe the one that we ship is too old. Please download the latest version from here. As I can see it, it should work.
All the best,
Jan Blessenohl
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>
I forgot to mention that you have to add the provider fatcory entry to your web.config to redirect to the new version.
3.4 Using Npgsql with ProviderFactory
Npgsql can be used with Provider Factory pattern which allows you to write code which is independent of database you are using.
In order to do that, you have to use the following configuration:
<?
xml
version
=
"1.0"
encoding
=
"iso-8859-1"
?>
<
configuration
>
<
system.data
>
<
DbProviderFactories
>
<
add
name
=
"Npgsql Data Provider"
invariant
=
"Npgsql"
support
=
"FF"
description
=
".Net Framework Data Provider for Postgresql Server"
type
=
"Npgsql.NpgsqlFactory, Npgsql, Version=2.0.11.91, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"
/>
</
DbProviderFactories
>
</
system.data
>
</
configuration
>
This configuration can be put inside the global machine.config file or in the application specific .config file.
You have to replace the version with the one you are downloading.Kind regards,
Jan Blessenohl
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>
I added the provider factory and download npgsql versions, but I had some errors:
- When I published with Npgsql2.0.11.91, I had the same error than http://www.telerik.com/community/forums/orm/databases/postgresql-error.aspx
but Ady, answered :
" This is a problem with the latest version of the Npgsql driver - 2.0.11.91. This version introduced a breaking change where the type of the NpgsqlConnectionStringBuilder.Password property was changed from 'string' to 'Byte[]'. This has been fixed by the community and a newer version is available, although it still is a preview version. "
And She suggested:
"You can upgrade to this preview version or downgrade to version 2.0.10.0 .Ensure that you have only 1 version installed."
But if I downgrade the pgsql version (different from 2.0.11.0.) the problem about security level persists, like bellow image:
Sin conexion.
Descripcion del error: Database driver installation problem: Cannot use factory for postgresql. Inheritance security rules violated while overriding member: 'Npgsql.NpgsqlException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriverException: Database driver installation problem: Cannot use factory for postgresql. Inheritance security rules violated while overriding member: 'Npgsql.NpgsqlException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden. ---> System.TypeLoadException: Inheritance security rules violated while overriding member: 'Npgsql.NpgsqlException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at System.Reflection.Assembly.GetType(String name, Boolean throwOnError)
at OpenAccessRuntime.ReflectionUtils.Load(DbProviderFactory factory, String name)
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PostgreSqlFactory.AssureLoaded(DbProviderFactory tmp)
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.PostgreSqlFactory..ctor(DbProviderFactory f)
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.GetFactoryByName(String backend, DbProviderFactory factory)
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.GetFactory(ConnectionString cs, Boolean err)
--- End of inner exception stack trace ---
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.GetFactory(ConnectionString cs, Boolean err)
at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.connect(ConnectionString connectionString, IDictionary driverProps)
at OpenAccessRuntime.Relational.sql.SqlDriver.InitializeFor(ConnectionString connectionString, Boolean noConnect, PropertySet props, Driver& driver, Connection& conn)
Metodo que produce la excepcion: System.Collections.Generic.List`1[GantNube.BE.Usuario] getConnection()
Pila de errores: at GanttNube.BL.BLTareas.getConnection() in D:\PROYECTOS\SIMBIOSYS\NUBE.GANTT\04.DES\DES\GE.WS\GanttNube.BL\BLTareas.cs:line 38
at GanttNube.WS.Service.getPruebaConexion() in D:\PROYECTOS\SIMBIOSYS\NUBE.GANTT\04.DES\DES\GE.WS\GanttNube.WS\Service.asmx.cs:line 29
So do you know if Npgsql comunity fix this error?
Kind regards,
Sorry for that, looks like the only chance to get medium trust working is to compile the 2.0.11 version by yourself. You can download the 2.0.11 and 2.0.11.91 source packages, copy the
Npgsql2\src\Npgsql\AssemblyInfo.cs
File from the 2.0.11.91 to the 2.0.11 version and build the 2.0.11 version. That should fix your problem.
Best wishes,
Jan Blessenohl
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>
It worked.
Thanks a lot.