We currently are on a shared windows server through Hostgator. They are forcing the shared servers to run in Medium Trust. They have MySql.Data.DLL (6.9.7) in the GAC. The issue is they don't have MySql.Data.Entity.EF6.DLL in the GAC, nor will they install it for me. So I tried referencing there MySql.Data dll from the gac and then referencing the MySql.Data.Entity.EF6.dll (6.9.9) from our project. When I do this I get a security error. I am assuming this is due to the EF6 dll requiring full trust. Any solution to this? Thanks
Error:
{"Message":"An error has occurred.","ExceptionMessage":"Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.","ExceptionType":"System.Security.SecurityException","StackTrace":" at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)\r\n at System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark)\r\n at System.Security.CodeAccessPermission.Demand()\r\n at System.Environment.GetEnvironmentVariable(String variable)\r\n at MySql.Data.MySqlClient.MySqlConnectAttrs.Is64BitOS()\r\n at MySql.Data.MySqlClient.MySqlConnectAttrs.get_Platform()"}
WebConfig:
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.9.9.0" newVersion="6.9.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data.Entity.EF6" publicKeyToken="c5687fc88969c44d" />
<bindingRedirect oldVersion="0.0.0.0-6.9.9.0" newVersion="6.9.9.0" />
</dependentAssembly>