How to fix WCF error: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission

1k views Asked by At

I am hosting a netTcpBinding WCF server in a Windows service. I am able to successfully connect to its remote calls via my own client without issue, so I know that it works well.

However, I generate the exception Request for the permission of type 'System.Security.Permissions.EnvironmentPermission when I attempt to connect to the same service via a .NET plugin fom a third party solution.

My client plugin loaded from the third party application is doing the following:

        EndpointAddress endpointAdress = new EndpointAddress("net.tcp://localhost:2001/MyWCFServer/Server");

        NetTcpBinding binding1 = new NetTcpBinding();

        CTraderClient  _client = new CTraderClient(new InstanceContext(this), binding1, endpointAdress);

         _client.RegisterBotInstance("GBPUSD", 30);

where RegisterBotInstance is a call to the remote method exposed by the WCF server.

When I call this remote method _client.RegisterBotInstance("GBPUSD", 30);the following exception is raised:

Additional information: Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Action: System.Security.Permissions.SecurityAction.Demand

Can anyone think of a fix to this?

By the way, the third party application is cAlgo in case this is of any use.

It seems that this third party software has some trust issues.

1

There are 1 answers

0
guerrillacodester On

The solution to this is to add this to the plugin header:

AccessRights = AccessRights.FullAccess