ASP.NET Core returns StatusCode:500

I ported an MVC WEB API project to ASP.NET Core and now the Service just returned StatusCode: 500 every time I called it.

Visual Studio doesn't give me any information or Exception to indicate what happened.

To find the error I disabled "Enable just my Code" in the visual studio settings.

Now the visual studio showed this exception from the framework, when I call the service:
"Multiple constructors accepting all given argument types have been found in type "…". There should only be one applicable constructor".

This error indicates that we have multiple constructors, which accepts same argument types. But this wasn't the case, I just removed the empty constructor and it worked fine.

 

One was the empty constructor I had before in my ASP.NET WEB API application and the other one was for ASP.NET Core.
I just removed the empty one and it worked fine J

 

Recap: Don't use multiple constructors when injection IOptions.


Posted Nov 10 2016, 01:56 PM by Holger Vetter
Filed under: ,

Add a Comment

(required)  
(optional)
(required)  
Remember Me?
developers.de is a .Net Community Blog powered by daenet GmbH.