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

Apr 4, 2013 at 8: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=, 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>"))
    if (sftp.IsConnected)
Any idea how to solve this problem?
Apr 4, 2013 at 3: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,