The good WEBAPI interface that was running was suddenly reported: "An error occurred while trying to create a controller of type TestController". Make sure that the controller has a parameterless public constructor "error.
Spent half a night in the final settlement,
Cause: The API controller references a key value that is not in the config configuration file
Private Static string Watchswitch = configurationmanager.appsettings["watchswitch"]. ToString (). Trim (); // Minimum withdrawal amount
Config file is missing the configuration of the Watchswitch attribute, plus it's good.
< appSettings > <!-- whether the hand ring end verifies the order code (on= verification off= not verified) when the order is submitted - < key= "Watchswitch" value= "Off"/> </appSettings>
As with similar problems, refer to
Webapi interface Access exception issue. An error occurred while trying to create a controller of type "TestController". Make sure the controller has a parameterless public constructor