Adding Web API and API documentation to an existing MVC project

后端 未结 7 961
时光说笑
时光说笑 2021-02-14 03:01

I have successfully added a web api controller to an existing MVC4 application.

I would like to have the api documentation functionality as is

7条回答
  •  忘掉有多难
    2021-02-14 03:49

    V5.2.2 has the following code:

    public HelpController()
            : this(GlobalConfiguration.Configuration)
        {
        }
    
        public HelpController(HttpConfiguration config)
        {
            Configuration = config;
        }
    

    in the HelpController

    Unity uses the constructor with the most arguments, so to get it to use the parameterless constructor I changed the second overload to protected:

        protected HelpController(HttpConfiguration config)
        {
            Configuration = config;
        }
    

    And the help pages are back

提交回复
热议问题