2. Ask your hosting provider to change their medium trust policy with SocketPermission. Here are the steps.
a) Open up the following file in Notepad:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web_mediumtrust.config
for 64 bit: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web_mediumtrust.config
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web_mediumtrust.config
Add the following line in the SecurityClasses tag:
<SecurityClass Name="SocketPermission" Description="System.Net.SocketPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
Find PermissionSet:
<PermissionSet version="1" Name="ASP.Net">
Add the following inside this PermissionSet:
<IPermission class="SocketPermission" version="1" Unrestricted="true" />