0

I've setup a plain web API in .NET 6. App runs smoothly, no errors there, it also has Swagger configuration and I'am able to use it to send requests. Everything works fine.

However, I wanted to use RestClient extension (latest version) for VS Code and I can't send any request through it (on my local machine with Win 10). I've checked urls, ports etc. everything seems fine. Im getting an error:

The connection was rejected. Either the requested service isn’t running on the requested server/port, the proxy settings in vscode are misconfigured, or a firewall is blocking requests. Details: RequestError: connect ECONNREFUSED

I've tried disabling whole firewall on my PC, reinstalling extension, running both VS and VS Code as admin, disabling cors in app.

Any ideas what is going wrong? :D

mrcn98
  • 1

1 Answers1

0

I created a Web Api project for testing but there is no problem:

GET https://localhost:7174/WeatherForecast
Content-Type: application/json

If I send request, I get the correct response: enter image description here

But when I stop running my Api project I got the same error as you: enter image description here

Please make sure your Api project is running. If this is not the reason for your error, please provide some code to reproduce the problem.

Chen
  • 4,499
  • 1
  • 2
  • 9
  • Api project is running, my project is a plain API that comes from template, no changes there, as I said, I can send requests through Swagger and it works fine. Also, I've downloaded Postman and checked same scenario in there - it works fine. I have no idea whats wrong, kinda gave up on that, since Postman is working – mrcn98 Apr 22 '23 at 19:18
  • Hi @mrcn98, I really can't reproduce your situation, except that the Api project stops running, I don't have this error in other situations. Both Swagger and Postman are also normal. If you just want to test whether the Api can be called, then Swagger and Postman are enough. – Chen Apr 24 '23 at 09:33