I am trying to connect to an sftp server in a .NET soap webservice. When trying to connect I get the exception:
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.
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?