Cannot send request through RestClient VS Code extension

459 Views Asked by At

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

1

There are 1 best solutions below

2
Chen On

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.