0

I'm developing a program in Visual Studio Code on Windows 10 which starts an HTTP server and attempts to bind to localhost:8000.

When I run the tests for this program by clicking "Run Test" in VSCode, a temporary binary is created and executed. When this happens, Windows Firewall blocks access to locahost:8000, prompting me to allow access for future executions.

The generated test binaries look like this:

C:\users\<my user>\appdata\local\temp\go-build297997386\b001\<myapp>.test.exe  
C:\users\<my user>\appdata\local\temp\go-build683612242\b001\<myapp>.test.exe  
C:\users\<my user>\appdata\local\temp\go-build304551042\b001\<myapp>.test.exe  

Because the binaries have an unpredictable path, I am unable to create a Windows Firewall rule to allow that binary to bind to localhost:8000. I have tried creating Windows Firewall rules to allow all traffic to and from localhost:8000, but I still get the same binary-specific prompts when running the test code.

There are several unanswered and unsolved questions on this topic. Here are a few I found through searches: 1 2 3 4 5

There are two more solutions which only work for files which already exist, automating the process of creating firewall rules: 1 2

How can I get Windows Firewall to stop blocking the test code from binding to the local port?

1 Answer 1

0

I'm not entirely sure what I did, but after clicking "Accept" on the firewall rules for the 40th time or so, it stopped prompting me to allow access. Seems like the solution is to allow access until it stops prompting.

1
  • You should be able to see what firewall rules were created to deal with the issue in your firewall config.
    – NoelC
    Feb 24, 2023 at 19:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .