If you install nService on a hosting provider, you may get an error like this.

Request for the permission of type 'System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
at d.a(Int32 A_0)<br>
<br>

nService uses sockets to retrieve emails. .Net 4 requires full trust in order to open a socket. Some hosting providers only allow medium trust. To solve this problem, you have two choices

1. Move to a hosting provider that allows full trust

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

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" />


Article #561
Updated On: 9/16/2011 Index
Was this article helpful? Yes | No