Application launched, but unable to connect to port xxxx

I built it as an exe, (say myapp.exe) and put all generated files, including myapp.exe, myapp.cgi, and config.cfg in /apache/cgi-bin.

When calling the app on a web browser, URL http://mypcname/cgi-bin/myapp.cgi
I am getting the message of the port being unavailable.

In the config.cfg, the option AUTO_PORT=1. I tried w/ about 10 other port numbers 2xxxx and 5xxxx, but the results were the same.

In Xojo IDE all works fine, using port 8080.

Any suggestions would be appreciated.