1

I want to implement Paypal into my WPF-Application and created a TestProject. Everything works fine but when I transfer the written code into my existing project, I get a MethodAccessException at line

var accessToken = new OAuthTokenCredential(clientID, clientSecret, sdkConfig).GetAccessToken();

Fehler beim Versuch der SecurityTransparent-Methode "PayPal.Api.OAuthTokenCredential.GenerateOAuthToken()", auf die sicherheitskritische Methode "Newtonsoft.Json.JsonConvert.DeserializeObject(System.String)" zuzugreifen. Die Assembly "PayPal, Version=1.8.0.0, Culture=neutral, PublicKeyToken=5b4afc1ccaef40fb" ist mit "AllowPartiallyTrustedCallersAttribute" markiert und verwendet das Sicherheitstransparenzmodell der Stufe 2. Bei Festlegung der Transparenz auf Stufe 2 werden alle Methoden in AllowPartiallyTrustedCallers-Assemblys standardmäßig sicherheitstransparent, was die Ursache der Ausnahme sein kann.

I don't know what this message would look like in english, so sorry for writing it in german.

Hopefully someone could tell me what is happening here

Thanks!

DirtyNative
  • 2,553
  • 2
  • 33
  • 58
  • Do you run your existing project in a hosted environment? – silkfire Dec 09 '16 at 11:40
  • What do you mean with hosted environment? Both the testcode and realcode are running inside a virtual machine on my server – DirtyNative Dec 09 '16 at 11:45
  • I meant if you run it on Azure or Amazon for example. Could you try updating your config file inside the `` block with the following line and see if it makes a difference: ``? – silkfire Dec 09 '16 at 12:05
  • I see, well no I don't, like I said, it is running on my own server. And I forgot to mention that it is a WPF-Application – DirtyNative Dec 09 '16 at 12:48
  • Try changing the trust level as per my comment – silkfire Dec 09 '16 at 12:50
  • cannot find where to put this line in, because I am using WPF there is no web.config file and adding it into App.config with creating **** still throws the exception – DirtyNative Dec 09 '16 at 13:07
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/130218/discussion-between-silkfire-and-daniel-dirtynative-martin). – silkfire Dec 09 '16 at 13:13

0 Answers0