C
C#12mo 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
Cinnamon12mo ago
Angius
Angius12mo ago
Yeah, .ToString()ing a list does not work like you think it would Just return Ok(theList)
Cinnamon
Cinnamon12mo ago
I tried that, also didnt work @ZZZZZZZZZZZZZZZZZZZZZZZZZ
Angius
Angius12mo ago
And, of course, the return type should not be a string
Cinnamon
Cinnamon12mo ago
Ill double check it though Right, List<Store> should do ti. it. Still nothing @ZZZZZZZZZZZZZZZZZZZZZZZZZ
Angius
Angius12mo ago
What's your updated code? Maybe it's something with IIS, dunno. I've never used IIS in my life
Cinnamon
Cinnamon12mo 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
Angius12mo ago
Do you have to use IIS?
Cinnamon
Cinnamon12mo ago
well its a local project, and using Http/https wont work because the certificate is bunz. so im guessing so
Angius
Angius12mo ago
Kestrel is a thing
Cinnamon
Cinnamon12mo ago
with VS?
Angius
Angius12mo ago
The IDE has nothing to do with anything
Cinnamon
Cinnamon12mo ago
I run it off of the IDE though
Cinnamon
Cinnamon12mo ago
Angius
Angius12mo 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
Cinnamon12mo ago
i did, nothing worked. it didn't even hit the breakpoints (yes I was in debug mode)
Angius
Angius12mo ago
In that case, no idea Everything about this endpoint seems perfectly fine
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Cinnamon
Cinnamon12mo ago
Same thing happens.
Cinnamon
Cinnamon12mo ago
Cinnamon
Cinnamon12mo ago
But I found this error.
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Cinnamon
Cinnamon12mo 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 User12mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord12mo 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
Cinnamon12mo ago
still did not work.
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord12mo 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.