The type initializer for 'PayPal.Manager.ConfigManager' threw an exception >Paypal SetExpressCheckout - asp.net-mvc-4

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.

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.

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.

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.

Related

Asp.net Core application is not running with VS 2017?

I have installed the visual studio 2017 for ASP.Net Core. I created Dot Net Core project. Build it successfully and run it but on Firefox it shows the blank page and on chrome it shows "**The localhost page isn’t working
localhost is currently unable to handle this request"
I thought there is a problem in code. I debugged the code and there is nothing wrong with the code. It's the default template and code generated for Asp.Net Core. I googled and tried many things like restart the VS, removed cache, etc but nothing worked for me. Then i uninstalled the VS 2017 and used C Cleaner to remove all temp files etc and installed the visual studio 2017 again but the same error came again. Then i created MVC application, console application in VS 2017 and both worked fine. Issue comes only in Asp.net core application. I use fiddler to see the request status and it is 500. I debugged the code but nothing wrong with the code(No Exception). I have tried many things but did not find anything helpful. Can anyone tell me what's the issue?
The blank page response can be caused by a number of reasons. Sometimes because you are lacking something in the system , routing issues, wrong code on the wrong location, .csproj configuration issues, permission issues, and many more.
There are a couple of things you can try:
Check to see if you have the appropriate ASP.NET Core Module installed in you system. (Either x86 or x64 depending on your system )
Make sure you have enabled IIS Integration in your code
See if you have the error middleware in your Configure code, it mostly helps to solve your issues by giving full detail.
Looks like you are running into error similar to this issue with browserlink .What version of browser link package do you have in your machine
Microsoft.VisualStudio.Web.BrowserLink should be 1.0.1 referring the templates
This SO post discuss the similar issue .If that does not solve, Please make sure you have 1.0.1 in your project referenced and then try this
Clearing your NuGet cache
dotnet nuget locals all --clear
Set Environment variable DOTNET_SKIP_FIRST_TIME_EXPERIENCE to 1 . This is to avoid caching packages
dotnet restore
Does it happens to be runtime compilation issues?
I stumble across this issues log while studying the feasibility of using ASP.Net Core for ERP System host on LinuxOS.
Issues #2017 on GitHub
Try setting
<PreserveCompilationContext>false<PreserveCompilationContext>
in your csproj

Error "Unable to load one or more of the requested types" on Telerik ASP.NET MVC Project

I start with Piranha for a week now, after read the documents and questions here I still can't solve the problem, so I post it here. Please help me. (I'm using Visual studio 2013 Update 2, Piranha 2.2.4)
I tested Piranha on the template project. Everything is fine, now I create a Telerik ASP.NET MVC Q3 2014 project and follow the "Getting started" tutorial to add Piranha to an exist project. I got this error message (I also applied this issue https://github.com/PiranhaCMS/Piranha/issues/277)
http://pastebin.com/1B0WNA2V
When I remove Piranha and Piranha.MVC reference and add references from source project I get this error
http://pastebin.com/17CSziUK
Please help me. Thanks a lot
Piranha CMS uses MEF to import extensions into the framework. There's been issues before that some other projects don't play to nice with MEF, maybe the Telerik stuff you're using has this issue.
There's a fix coming in 2.3 where you can tell the framework to only scan the Piranha assemblies for extensions which would probably fix your issues. I'll see if I can deploy a patch for this!
Regards
Håkan

New to C#/Mono, ServiceStack.Redis cannot find reference

I'm trying to build a console app to test out redis/mono communication. I've been hitting a brick wall using Monodevelop 4.0 (Xamarin Studios)+Nuget Port to work with ServiceStack.Redis on mac os.
All the solutions I've found online only say, change the ".Net 4.0 Client Profile" into ".Net 4.0 full" on visual studios. I haven't found a related function on MonoDevelop, not even sure if such an option exists. So no help there.
The error I am getting is:
"The type or namespace name `RedisClient' could not be found. Are you missing a using directive or an assembly reference?"
The screencap below shows the missing references, even though it is clearly in the reference folder :(. It is very puzzling.
Has anyone had a similar problem? Any help would be appreciated.
I think this is generally an issue with lagging version numbers on Mono.
For example, here's an example that can reproduce the issue:
Your ServiceStack.Redis is compiled against ServiceStack.Interfaces -> 3.9.45.
But you've actually pulled the latest 3.9.48 versions of:
ServiceStack.Interfaces 3.9.48
ServiceStack.Common 3.9.48
ServiceStack.Text 3.9.48
Mono will have problems forwarding old ServiceStack references 3.9.45 to 3.9.48.
So, recompiling from source will resolve the issue.
Or, ensure all your references are using the same version number by opening up all ServiceStack.*.dll (as you've done) and ensure there are no lagging version number references.
Similarly, I had a problem with ServiceStack.Logging.NLog compiled against 3.9.44 packages which lead to various TypeLoadExceptions on Mono when the head version of ServiceStack.* is 3.9.48.
So after hair tearing fighting with the MonoDevelop IDE and nuget. I just resorted to building the Servicestack.redis from source in MonoDevelop, and copied over the output DLLs. This worked without a problem.
It seems either that monodevelop doesn't like the Dlls from nuget, or that the nuget port has some bugs with DLl references. Either way, I don't know the specifics, but there is a solution around it by building servicestack components from source in MonoDevelop.
I was having this same issue with Xamarin Studio 4.0.12 + NuGet Port running against Mono 2.10.9.
Yesterday I decided to try to get OrmLite working & when I went to add the package, I saw that there were ServiceStack updates available (to version 3.9.66.0 from 3.9.63.0). Installed the updates and added the OrmLite package and I started getting the same error...
"The type or namespace name 'OrmLiteConnectionFactory" could not be
found. Are you missing a using directive or an assembly reference?"
The weird part was Intellisense was working (I could fully qualify OrmLiteConnectionFactory in the IDE and it would find it fine) but it would not build. Just like you, I also saw in Assembly Browser that my ServiceStack DLLs were referencing previous versions of some of the other ServiceStack projects.
Upgrading to the latest Mono release (3.2.3 atm) solved the issue for me. Hallelujah! Not sure why I was using Mono 2.10.9 to begin with.

Error when creating MVC Endpoints with NServiceBus

I just installed NServiceBus, started to go through the getting started sample, but when I tried to create a MVC endpoint as suggested here http://docs.particular.net/samples/web/ I got an unexpected exception stating that this product type is not supported by this installation, all other endpoint type work.
Any ideas on how to solve this?
Cheers
It seems like you don't have the ASP NET MVC 3 project type installed on your environment.
Please try installing it from http://www.asp.net/mvc/mvc3.
If you have tried to install it using the Web Platform Installer Tool, be sure that you installed the right version and product (I use to make mistakes with so many similar named products).

Compilation errors with ImageResizer 3.2.1

After allowing Nuget to update ImageResizer 3.1.5 to version 3.2.1 my compiles are failing with multiple errors (all same type):
Error 5 Missing compiler required member 'System.Runtime.CompilerServices.ExtensionAttribute..ctor'
Apparently this is the result of an assembly version mismatch. Deleting all ImageResizer references in the project allows an error-free compile.
Reverting to ImageResizer 3.1.5 also allows a successful compilation.
My project is a simple MVC3 application targeting .NET4 - both ImageResizer 3.1.5 and 3.2.1 are targeting v2.0.50727
Any ideas on how this could be fixed?
Thanks in anticipation!
Update (Jun 20th 2012): The best solution is for the project to roll back extension method support. ImageResizer 3.2.2 will no longer offer extension methods, but some of the functionality will be duplicated in the ResizeSettings and Instructions classes to minimize breakage for those who have already coded against the new alpha APIs.
ImageResizer V4 will most likely require .NET 3.5, and will re-introduce the missing features.
Update: please see this question instead if you have any solutions to this catch-22.
I apologize for the issues.
I'm still trying to gather data and discover a long-term solution, but this is what I have so far:
Workaround A:
In Solution Explorer, expand the References folder in your project, select ImageResizer, and go to Properties. Change the Aliases field from 'global' to 'ir'.
Workaround B:
Set your project to use .NET 2.0, save, then revert it back to using .NET 3.5 or .NET 4.
Workaround C:
Manually remove your System.Core reference and add the correct one back. (The usual culprit is an upgraded project with a System.Core 3.0 reference in a 3.5 project). On ASP.NET, you can do this in web.config.
Workaround D:
Revert to 3.2.0, but only if you're using C#.
Why this is happening
VisualStudio/MSBuild find multiple definitions of System.Runtime.CompilerServices.ExtensionAttribute in the project during compilation, but instead of picking the public copy defined in System.Core, the compiler decides to use the internal, assembly-local copy defined in ImageResizer.dll. Then it complains because other assemblies can't reach it. Inane.
What should happen
Microsoft has used this technique several times in the past without issues, and it's widely documented. The compiler is supposed to pick the public instance for project-wide use, but instead it's picking the 'internal' copy. And this isn't affecting many developers; and only a few can reproduce it with a new project.
Public vs. Internal
V2.3.0 defined ExtensionAttribute as public instead of internal. This caused a compile-timer error in VB projects, but not in C# projects. I immediately released 2.3.1 with it marked internal, but I'm now seeing problems with C# projects instead. Catch-22 here.
It works for other people... and Microsoft! Why me?
http://www.danielmoth.com/Blog/Using-Extension-Methods-In-Fx-20-Projects.aspx
http://www.codethinked.com/using-extension-methods-in-net-20
http://kohari.org/2008/04/04/extension-methods-in-net-20/
Using extension methods in .NET 2.0?
The 'hack' was even featured in MSDN magazine.
How you can help
I need more data to completely figure this out. If you're experiencing the issue, please e-mail a .zip file of the project to support#imageresizing.net, and include your VisualStudio/.NET version numbers (Go to Visual Studio, Help, About, and click Copy Info, then paste it into the e-mail).
Hopefully I'll be able to find the exact circumstance(s) that trigger the problem.
Update - just found this article which implies the only solution is creating multiple versions of the assembly. But Microsoft didn't! What am I missing? Also, NuGet doesn't support 2.0 vs 3.5 versioning, so unless I can find a single-assembly solution I might have to drop 2.0 support.