WCF Exception - Urgent

Created at 15 Dec 2014, 23:58
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
olddirtypipster's avatar

olddirtypipster

Joined 18.04.2014

WCF Exception - Urgent
15 Dec 2014, 23:58


I have defined in by bot the following code that should allow me to connect to a WCF Server in the cBot constructor.

            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.DemandStranger yet, when I call this method from my standalone test exe, I am able to make this call successfully.

Somehow, cAlgo is making it impossible for me to reach my service.

This is very much unacceptable.

Is there a fix to this? I absolutely require that my cBot be able to contact my WCF server. What is the fix?

Thanks.


@olddirtypipster
Replies

Spotware
16 Dec 2014, 10:36

In code of your cBot instead of "AccessRights = AccessRights.None" you need to specify "AccessRights = AccessRights.FullAccess". You can find more information in the following guide: /api/guides/access_rights


@Spotware

olddirtypipster
16 Dec 2014, 21:02

Yes. This worked.

Thank you for your time.

 

- OldDirty -


@olddirtypipster