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

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.