This project is read-only.

Request for the permission of type 'System.Net.DnsPermission,

Apr 4, 2013 at 9:25 AM
I am trying to connect to an sftp server in a .NET soap webservice. When trying to connect I get the exception:
Request for the permission of type 'System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
When running the same code from a console application it works as intented.
I included the Renci.Sshnet binary as reference in my webservice.

The code is very simple, just trying to make a connection. The credentials are replaced below.
using (SftpClient sftp = new SftpClient("<my host>", "<my username>", "<my password>"))
{
    sftp.Connect();
    if (sftp.IsConnected)
    {
    }
}
Any idea how to solve this problem?
Apr 4, 2013 at 4:37 PM
I think this is because assembly doesn't have this permission.
I am not sure how but I think there is a way to add this permission in App.config or application.

Hope it helps,

Thanks,
Oleg