Racing57
Racing57

Reputation: 91

The type initializer for 'PayPal.Manager.ConfigManager' threw an exception >Paypal SetExpressCheckout

for some reason I am getting an error "cannot read config file" when trying to set the SetExpressCheckout, I have copied across the web config settings, but for some reason I cannot read them, the error isn't very helpful other than what I have mentioned.

I am using mvc4, and to be honest I have had a problem reading the web.config in the past..

any suggestions would be much appreciated.

Upvotes: 0

Views: 2101

Answers (3)

Phil
Phil

Reputation: 84

I had a similar problem and ended up getting both the core and merchant sdk source from GitHub. Change the SpecificVersion=True to False for the log4net reference in the core sdk and re-build it. I also re-targeted both for .net 4.0 so I re-built the merchant sdk with a reference to the new core sdk. Import both of these new dll's to your main project and you should be good to go. I had to change the config in 1 place for the section handler.

<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK"/>

since the Assembly name does not have the underscores if built from source (vs downloaded or added via NuGet).

A bit of explanation: I was already using log4net version 1.11 before adding the sdk. The sdk was looking specifically for version 1.10. these 2 versions have a different public key, so 'simple' binding redirection won't work. If you have a reference to a different version of log4net (for example using ninject logging extensions requires min version 2.11 so these 2 ninject and the paypal sdk, are incompatible off the shelf).

so the root of the problem was actually caused by the dll version issues but manifested as a Configuration exception. check the inner exceptions and see what you get.

Upvotes: 1

John Irvine
John Irvine

Reputation: 196

Just looked at this... thought it might help someone. Looked at the Inner Exception, saw it was looking for the Log4Net dll... so I gave it to the app and hey ho. It worked.

Upvotes: 1

Racing57
Racing57

Reputation: 91

ok, just a quick update, I think it must be something to do with MVC, I have created a new empty asp project, copied the sdk config details across, created the same function call as I have in my mvc code, and called it from a simple asp button... and it works ??

does anyone have any ideas why I am getting an error in an mvc4 project, and not in a simple asp project ??

any help or ideas would be much appreciated.

Upvotes: 0

Related Questions