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

别等时光非礼了梦想. 提交于 2020-01-17 06:12:20

问题


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:


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

AccessRights = AccessRights.FullAccess



来源:https://stackoverflow.com/questions/27494275/how-to-fix-wcf-error-request-for-the-permission-of-type-system-security-permis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!