Shared Hosting Providers - Trust Levels - Non-direct Mode

Shared Hosting Providers - Trust Levels - Non-direct Mode

Postby NCM » Fri 22 Sep 2006 08:58

I'm in a frustrating position where I'm not able to use the MySQLDirect provider in ASP.NET 2.0 on a shared hosting server because they only allows "medium" trust.

After many emails and telephone calls, it is clear that I will have to revert to using non-direct mode because they just wont budge.

Can anyone give me an example of how to use non-direct mode to connect to the MySQL database plse?

Thanks in advance
Leon
NCM
 
Posts: 11
Joined: Fri 22 Sep 2006 08:49

Postby Alexey » Fri 22 Sep 2006 11:58

To work in non-direct mode you should set Direct=false in the connection string.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby NCM » Fri 22 Sep 2006 12:21

Even though I have Direct=false set, I still get the following security exception (connstring included below):







Server Error in '/' Application.
--------------------------------------------------------------------------------

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.SecurityPermission, 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.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Runtime.Serialization.Formatters.Binary.ObjectReader.CheckSecurity(ParseRecord pr) +1642820
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseArray(ParseRecord pr) +847
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord pr) +76
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr) +64
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadArray(BinaryHeaderEnum binaryHeaderEnum) +1127
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() +186
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) +183
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) +190
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) +12
CoreLab.Common.aq.a(Stream A_0, String A_1, String A_2, String& A_3) +137
CoreLab.Common.aq.a(Type A_0, String& A_1, Assembly& A_2) +974
CoreLab.Common.aq.a(LicenseContext A_0, Type A_1, String& A_2, Boolean& A_3, String& A_4) +41
CoreLab.Common.aq.a(LicenseContext A_0, Type A_1, Object A_2, Boolean A_3) +1261
CoreLab.MySql.MySqlConnection.Open() +98
CoreLab.Common.Web.Providers.DbProfileProvider.GetPropertyValues(SettingsContext context, SettingsPropertyCollection properties) +452
NCM
 
Posts: 11
Joined: Fri 22 Sep 2006 08:49

Postby Alexey » Fri 22 Sep 2006 12:39

MySQLDirect .NET requires SocketPermission permission to be added when using "Medium" trust level.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby NCM » Fri 22 Sep 2006 12:48

Alexey wrote:MySQLDirect .NET requires SocketPermission permission to be added when using "Medium" trust level.


The hosting provider explicitly stated that they do not allow SocketPermission in medium trust level, so I guess the non-direct mode is also no help to me.
NCM
 
Posts: 11
Joined: Fri 22 Sep 2006 08:49

Postby Alexey » Fri 22 Sep 2006 13:46

SocketPermission is needed for direct mode. We've just performed a test using MySQLDirect .NET 3.50.13 in Direct=false mode, .NET Framework 2.0.50727, IIS 5.1 with default medium trust level settings. No problems have been encountered.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby NCM » Fri 22 Sep 2006 14:15

Ok, so does the security exception I get above indicate that it is still attempting direct mode?

The site configuration is IIS6, .NET Framework Version:2.0.50727.42 and Corelab.MySQL 3.50.10.0
NCM
 
Posts: 11
Joined: Fri 22 Sep 2006 08:49

Postby Alexey » Fri 22 Sep 2006 14:26

does the security exception I get above indicate that it is still attempting direct mode?
What do you mean? You set the mode you need by yourself.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby NCM » Fri 22 Sep 2006 14:30

The security exception I am getting above is with Direct=false.

What I'm asking is, looking at the stack trace, is it still possibly trying to make a direct connection, therefor throwing the exception?
NCM
 
Posts: 11
Joined: Fri 22 Sep 2006 08:49

Postby Alexey » Mon 25 Sep 2006 15:19

We are investigating this. You will be notified on results as soon as possible.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby NCM » Wed 11 Oct 2006 07:25

Has there been any progress in resolving this?
NCM
 
Posts: 11
Joined: Fri 22 Sep 2006 08:49

Postby Alexey » Wed 11 Oct 2006 11:28

What version of MySQLDirect do you use?
We can't reproduce any error.
Seemingly there is a difference in our config files. Try to check record in web.config file that level="Medium":
Code: Select all
           
               
               
               
               
               
           

           

and maybe web_mediumtrust.config differs from default.
Send this file (web_mediumtrust.config) to the address provided in the Readme file.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby NCM » Sun 15 Oct 2006 11:32

I am using version 3.50.10

I'm waiting for feedback from the hosting provider. I requested a copy of the web_mediumtrust.config file and will send it along as soon as I receive it.
NCM
 
Posts: 11
Joined: Fri 22 Sep 2006 08:49

Postby Alexey » Mon 16 Oct 2006 07:04

I've sent you web_mediumtrust.config file.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby NCM » Mon 16 Oct 2006 08:30

I have just emailed you the config file used by the hosting provider to the address indicated in the readme document.
NCM
 
Posts: 11
Joined: Fri 22 Sep 2006 08:49

Next

Return to dotConnect for MySQL