Closed Daniel25A closed 4 years ago
Hi Daniel,
You can set the binding of the Webserver to wildcard char '+', so you will be listing any IP Address on your computer.
If you have something similar to:
var webServer = new WebServer("http://localhost:800");
Change the binding to:
var webServer = new WebServer("http://+:800");
Hello @Daniel25A, thanks for using EmbedIO... or at least for giving it a try!
I think there may be a misunderstanding here: an application using EmbedIO is not necessarily a Windows service.
If what you are trying to build is a Windows service, i.e. a software that runs silently alongside other software, without opening a console window, and starts automatically with Windows, then you need a slightly different approach with respect to what you can find in EmbedIO's example code.
A Windows service does not have a "main" method that does all the work: rather, a service registers itself with Windows during installation, and gets started and stopped by either calling different methods inside a DLL (if it is compiled as such), or starting the executable with different command-line parameters.
Although the whole matter is more complicated than I can explain here, there are nice libraries that can be used in conjunction with EmbedIO to build a Windows service that acts as a Web server. One of them is Topshelf.
The shortest possible guide to creating a Windows service with EmbedIO:
WebServer
;WebServer
and dispose it;My only problem is that I cannot connect or at least query data directly from a real ip .. Only in localhost.. I don't know if they understand me.. I want to be able to make requests from my browser to my vps through the ip, do they understand me?
Oh, OK, now it's a lot more clearer. Then @geoperez gave you the right advice.
If, after binding your WebServer to "http://+:{port}", you still cannot access it from another machine, you probably should take a look at your firewall configuration.
why is there no guide or something like using this service outside localhost? most of the services are not done by console applications but by asp.net or .net core web, but this does not show how to do it.. which I think makes it horrible for someone who starts with this