C
C#17mo ago
Cinnamon

❔ Trying to run operations off of a MVC API

Everything is loading properly, however this solution is very primitive because it uses a list instead of a context for now (MVP). I would like to do a simple Get, that returns everything in this list, and it will be attached as a screenshot at the end of this message. The only problem (and it is a big one), is that every time I try to run this (IIS), it thinks for about 5 seconds, and then crashes without throwing any error. What should I do?
28 Replies
Cinnamon
CinnamonOP17mo ago
Angius
Angius17mo ago
Yeah, .ToString()ing a list does not work like you think it would Just return Ok(theList)
Cinnamon
CinnamonOP17mo ago
I tried that, also didnt work @ZZZZZZZZZZZZZZZZZZZZZZZZZ
Angius
Angius17mo ago
And, of course, the return type should not be a string
Cinnamon
CinnamonOP17mo ago
Ill double check it though Right, List<Store> should do ti. it. Still nothing @ZZZZZZZZZZZZZZZZZZZZZZZZZ
Angius
Angius17mo ago
What's your updated code? Maybe it's something with IIS, dunno. I've never used IIS in my life
Cinnamon
CinnamonOP17mo ago
[HttpGet("Get")]
public ActionResult<List<Store>> Get()
{
if (stores.Count != 0 && stores != null)
{
return Ok(stores);
}
return BadRequest("There are no stores currently in the database!");
}
[HttpGet("Get")]
public ActionResult<List<Store>> Get()
{
if (stores.Count != 0 && stores != null)
{
return Ok(stores);
}
return BadRequest("There are no stores currently in the database!");
}
neither have I 😭
Angius
Angius17mo ago
Do you have to use IIS?
Cinnamon
CinnamonOP17mo ago
well its a local project, and using Http/https wont work because the certificate is bunz. so im guessing so
Angius
Angius17mo ago
Kestrel is a thing
Cinnamon
CinnamonOP17mo ago
with VS?
Angius
Angius17mo ago
The IDE has nothing to do with anything
Cinnamon
CinnamonOP17mo ago
I run it off of the IDE though
Cinnamon
CinnamonOP17mo ago
Angius
Angius17mo ago
Uh, maybe you can change the run setup? Dunno, been years since I used VS Also, did you try debugging? Placing a breakpoint here and there
Cinnamon
CinnamonOP17mo ago
i did, nothing worked. it didn't even hit the breakpoints (yes I was in debug mode)
Angius
Angius17mo ago
In that case, no idea Everything about this endpoint seems perfectly fine
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Cinnamon
CinnamonOP17mo ago
Same thing happens.
Cinnamon
CinnamonOP17mo ago
Cinnamon
CinnamonOP17mo ago
But I found this error.
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Cinnamon
CinnamonOP17mo ago
Like I dont know thats why I asked I dont have any idea to what that is telling me but I didn't know if it would help
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord17mo 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.
Cinnamon
CinnamonOP17mo ago
still did not work.
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord17mo 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.
Want results from more Discord servers?
Add your server