Documentation Home
Connectors and APIs Manual
Download this Manual
PDF (US Ltr) - 4.1Mb
PDF (A4) - 4.1Mb


Connectors and APIs Manual  /  ...  /  Configuring Partial Trust with Connector/NET Library Not Installed in GAC

4.5.7.3 Configuring Partial Trust with Connector/NET Library Not Installed in GAC

When deploying a web application to a Shared Hosted environment, where this environment is configured to run all their .NET applications under a partial or medium trust level, you might not be able to install the MySQL Connector/NET library in the GAC. Instead, you put a reference to the library in the bin or lib folder inside the project or solution. In this case, you configure the security in a different way than when the library is in the GAC.

Connector/NET is commonly used by applications that run in Windows environments where the default communication for the protocol is used via sockets or by TCP/IP. For this protocol to operate is necessary have the required socket permissions in the web configuration file as follows:

  1. Open the medium trust policy web configuration file, which should be under this folder:

    %windir%\Microsoft.NET\Framework\{version}\CONFIG\web_mediumtrust.config

    Use Framework64 in the path instead of Framework if you are using a 64-bit installation of the framework.

  2. Locate the SecurityClasses tag:

    <SecurityClass Name="SocketPermission"
    Description="System.Net.SocketPermission, System, Version=4.0.0.0,
    Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
  3. Scroll down and look for the following PermissionSet:

    <PermissionSet version="1" Name="ASP.Net">
  4. Add the following inside this PermissionSet:

    <IPermission class="SocketPermission" version="1" Unrestricted="true" />

    This configuration lets you use the driver with the default Windows protocol TCP/IP without having any security issues. This approach only supports the TCP/IP protocol, so you cannot use any other type of connection.

    Also, since the MySQLClientPermissions class is not added to the medium trust policy, you cannot use it. This configuration is the minimum required in order to work with Connector/NET without the GAC.