28
submitted 3 months ago* (last edited 3 months ago) by BeamBrain@hexbear.net to c/technology@hexbear.net

Here's what I've tried so far:

  • Made the default "ASP.NET Core API" project (the weather forecasting one) in Visual Studio
  • Built it and copied the contents of the build folder to C:\Users\[My username]\TestService
  • Ran the TestService executable. It says "Now listening on: http://localhost:5000"
  • Open my browser, enter the "http://localhost:5000" URL. I get a 404 error. This is all on the same computer.
  • Noticed that, under launchSettings.json, there were some other URLs listed, none of them localhost:5000. It gives 2 https URLs: https://localhost:7079 and http://localhost:5222. Both of these give "connection refused" errors.
  • At this point, I don't know what else to do

Please help I don't want to lose my job

EDIT: I was able to figure out what was going on. Solution is here. Thanks to hypercracker and everyone else who advised heart-sickle

you are viewing a single comment's thread
view the rest of the comments
[-] BeamBrain@hexbear.net 8 points 3 months ago* (last edited 3 months ago)
  1. You got a 404 response, which is different from the nothing-ness response you'd get from going to like localhost:12345 or some random port. This means that a web service is actually listening on port 5000, receiving your request, and serving you a 404 page; is any logging happening on the console when you access this page?
  2. Are you supposed to access your app over a web browser (like it serves an HTML page) or is it a REST API that you would use a different tool to access (usually a browser extension or some CLI tool)?
  3. If you're supposed to access your app over a web browser, try going to localhost:5000/index.html or something

THANK YOU! This helped me figure it out. I looked in the TestService project and found TestService.http with the following contents:

@TestService_HostAddress = http://localhost:5222

GET {{TestService_HostAddress}}/weatherforecast/
Accept: application/json

So I tried going to http://localhost:5000/weatherforecast and that opened the page.

this post was submitted on 05 Sep 2024
28 points (100.0% liked)

technology

23383 readers
240 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 4 years ago
MODERATORS