Security Exception (shared hosting)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
robertnzana
Posts: 23
Joined: Fri 12 Sep 2008 05:07

Security Exception (shared hosting)

Post by robertnzana » Sun 05 Jul 2009 10:51

ASP.NET website using MySql db and a connector I purchased (MyDirect.NET).

Local machine: All works perfectly.

Deployed to GoDaddy ASP.NET web hosting. I get this error:

----------------

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +58
System.Reflection.Assembly.get_Location() +70
CoreLab.Common.ab.a(Assembly A_0) +32
CoreLab.Common.ac.a(LicenseContext A_0, Type A_1, String& A_2, String& A_3, String& A_4) +2413
CoreLab.Common.ac.a(LicenseContext A_0, Type A_1, String& A_2, Boolean& A_3, String& A_4, String& A_5) +33
CoreLab.Common.ac.a(LicenseContext A_0, Type A_1, Boolean A_2) +181
CoreLab.MySql.MySqlDirectFactory.CreateConnection() +64
System.Data.Design.DataComponentMethodGenerator.AddConnectionMembers(CodeTypeDeclaration dataComponentClass) +56
System.Data.Design.DataComponentMethodGenerator.AddMethods(CodeTypeDeclaration dataComponentClass, Boolean isFunctionsDataComponent) +106
System.Data.Design.DataComponentGenerator.GenerateDataComponent(DesignTable designTable, Boolean isFunctionsComponent, Boolean generateHierarchicalUpdate) +819
System.Data.Design.TypedDataSourceCodeGenerator.GenerateDataSource(DesignDataSource dtDataSource, CodeCompileUnit codeCompileUnit, CodeNamespace mainNamespace, String dataSetNamespace, GenerateOption generateOption) +485
System.Data.Design.TypedDataSetGenerator.GenerateInternal(DesignDataSource designDS, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeDomProvider codeProvider, GenerateOption generateOption, String dataSetNamespace) +201

Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3072

-------

In web.config I changed Trust level to Full but then I got another error:

-------

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using from an inherited configuration file.

Source Error:


Line 55:
Line 56:
Line 57:
Line 58:
Line 59: <!--

Source File: D:\Hosting\4616160\html\web.config Line: 57

------------

Any ideas?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 06 Jul 2009 09:09

We cannot give you any piece of advice in the permission settings. Probably, machine-level web.config in your shared hosting environment has the allowOverride="false" entry for the trust level settings. And the trust level used there has its own *.config file where the FileIOPermission limitations are. We don't know how these settings can be changed without modifying machine-level web.config. We recommend you to contact the technical support of your shared hosting environment.

The following permissions are required by dotConnect for MySQL as partially trusted code (this is actual for web projects):
1) in Direct mode - medium trust plus SocketPermission.
2) in client mode - just medium trust permissions. However, if there are no dotConnect for MySQL assemblies in GAC, the UnmanagedCode flag should be added to the SecurityPermission section.

For more information about the medium trust level, please refer to http://msdn.microsoft.com/en-us/library/ms998341.aspx .

diesen
Posts: 2
Joined: Mon 10 Aug 2009 17:26
Location: Netherlands

Post by diesen » Mon 10 Aug 2009 17:35

Having the same problem here, and consulted my provider. He states that all IO permissions within my application folder should work just fine, and that the environment is running in medium trust, and also has the socket permission set:



So now I'm wondering, what file does the driver want to open? since it's in your driver's code, I presume you might have an idea about that.

Ps, I'm running your latest demo version, since I must first be sure this is going to work before I buy a licensed version.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 17 Aug 2009 13:12

Diesen, sorry for the delay. We have investigated the issue. It is necessary to have permissions for access to all directories on the machine at the moment (to GAC in our case). In the next build we will correct this situation - to have access for files inside the application directory only will be enough. Now you should use the High trust level because it has the following entry in its *.config file:

diesen
Posts: 2
Joined: Mon 10 Aug 2009 17:26
Location: Netherlands

Post by diesen » Thu 20 Aug 2009 04:22

A high trust level can not be set/changed on the machine, since it's shared hosting, the provider will not change any security settings just for me.

Can you tell me when the next build is going to be?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 20 Aug 2009 12:32

We plan to make a new build next week.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 04 Sep 2009 14:29

The new build of dotConnect for MySQL 5.40.42 is available for download now.
It can be downloaded from http://www.devart.com/dotconnect/mysql/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=15739 .

Post Reply