C
C#ā€¢2y ago
infernus8349

ā” RestApi

how can i return List<class> in the function Get() in Controller when i do, i get an error it says "This XML file does not appear to have any style information associated with it." i am putting my WebApiConfig file code
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services

// Web API routes
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services

// Web API routes
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
I am a beginner in API field and idk anything about front end.
18 Replies
Angius
Angiusā€¢2y ago
WebApiConfig..? Isn't it something from, like, the ancient versions of ASP?
infernus8349
infernus8349ā€¢2y ago
idk , i am using .net standard version 4.7.2 or 4.7.8 not sure
Angius
Angiusā€¢2y ago
Oh noooooo
infernus8349
infernus8349ā€¢2y ago
0_0 ?
Angius
Angiusā€¢2y ago
It's some ancient shit Don't use Framework $newproject
MODiX
MODiXā€¢2y ago
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
infernus8349
infernus8349ā€¢2y ago
just core?
Angius
Angiusā€¢2y ago
Here Yeah Use at least .NET 6 .NET 7 if you don't care about LTS
infernus8349
infernus8349ā€¢2y ago
but i saw the tutorials following .net standsard (it was made on 2016 šŸ˜„ ) oh ok fine
Angius
Angiusā€¢2y ago
Well here's your answer
infernus8349
infernus8349ā€¢2y ago
fine fine fine fine fine, i will but how to fix this? any idea?
Angius
Angiusā€¢2y ago
The .NET ecosystem went through a major shift going from Framework to Core
infernus8349
infernus8349ā€¢2y ago
oh
Angius
Angiusā€¢2y ago
No clue how to fix it
infernus8349
infernus8349ā€¢2y ago
lol ok i will ditch this stuff
Angius
Angiusā€¢2y ago
I never was much into archaeology
infernus8349
infernus8349ā€¢2y ago
thanks for letting me know šŸ¤£ thanks for letting me know, i will deal with it
Accord
Accordā€¢2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.