I have a solution with contains a class library targeting the .Net framework 4.7 and another project with ASP.NET Core 2.2 .
The class library targeting the .Net framework contains controllers as shown below with the route prefix and the route name
And then in my StartUp.cs i have configured the below
On running this i make a call to the api in the .Net framework class library the call does not return the response from the web api instead returns the default index.html content.
I see on the first screen classes like RoutePrefix
, ApiController
, HttpResponseMessage
. They are from classic Asp.Net WebApi
. It is impossible to use old ApiControllers in Asp.Net Core
. It means you need to rewrite you controllers using Asp.net Core
.
Asp.net core projects may targeting to both .net core
and classic .Net Framework
. If you really need to target to the .Net Framework
you can create a class library targeting the .Net framework 4.7, create there Asp.Net Core
controllers and then use that library in Asp.Net Core
project as an external dll.