Why is a Web API Controller not being picked up?

Hassan Ali asked on July 3, 2020 12:24

We have a Kentico 8.2 WebForms App in C#.NET using .NET Framework 4.0. I have recently implemented a WebAPI v1 Controller within the CMS project (Stored under CMSApp\ApiControllers\, as opposed to being inside a new library.

When I try to access an API method I get the following error No type was found that matches the controller named 'My'

I have just released the website to UAT but the Web API Controller isn't being registered. I had a similar issue in the DEV Environment, but re-releasing the build worked.

I am using Web API v4.0.30506 and have updated the various Web API libs to the same version. I have also added [assembly: RegisterApiController(typeof(CMSApp.ApiControllers.MyController))] to register the controller.

I have posted a similar question SO here:

StackOverflow Question

Many thanks.

Recent Answers


Hassan Ali answered on July 3, 2020 15:52

Removing the "MS-ApiControllerTypeCache.xml" under "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files" seemed to have fixed it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.