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 Connector/Net library in the GAC.
Instead, you put a reference to the library in the
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:
Open the medium trust policy web configuration file, which should be under this folder:
Framework64in the path instead of
Frameworkif you are using a 64-bit installation of the framework.
<SecurityClass Name="SocketPermission" Description="System.Net.SocketPermission, System, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
Scroll down and look for the following
<PermissionSet version="1" Name="ASP.Net">
Add the following inside this
<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
MySQLClientPermissionsclass 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.