Cannot reach the RestServer other than localhost.
See original GitHub issueHello , I am using VS2012 and Grapevine 3.0.4 , when i use the Grapevine same machine with localhost hostname , everything works well. If I want to reach from other PC with client , Server could not be start listening with hostname ip address or Computername
If i try server pc set hostname to localhost , it starts listening but when reached from other PC with IP or name server returns bad request 400
Is it something wrong with my code or library.
My Server code is public class embeddedHTTP // {
private RESTServer Server;
public void ServerStart()
{
try
{
Server = new RESTServer();
Server.Port = GlobalVars.HttpHostPort;
Server.Host = GlobalVars.HttpHostAdress; // THIS ONLY WORKS FOR LOCALHOST
Server.MaxThreads = 20;
Server.Start();
while (Server.IsListening)
{
Thread.Sleep(GlobalVars.HttpHostRespTime);
}
}
catch (Exception ex)
{
messenger.logque("embedded HTTP server not started, Error ID : 52", 3, null);
}
}
public void ServerStop()
{
Server.Stop();
}
public sealed class MyResource : RESTResource
{
//d+$^ [a-zA-Z]+
[RESTRoute(Method = Grapevine.HttpMethod.GET, PathInfo = @"/")]
public void HandleFooRequests(HttpListenerContext context)
{
// String RawuR = context.Request.RawUrl;
String URL = Convert.ToString(context.Request.Url);
String ResultXML = brain.HTTPCMD(URL);
this.SendTextResponse(context, ResultXML);
}
}
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Cannot reach the RestServer other than localhost. · Issue #35
Hello , I am using VS2012 and Grapevine 3.0.4 , when i use the Grapevine same machine with localhost hostname , everything works...
Read more >Hyperledger REST Server Angular Web App getting could ...
Problem arise when I try to use the application outside of localhost. I can access the REST Server on port 3000 and interact...
Read more >404 - Page cannot be found when access rest api throught ...
it was http://[pc-name]:port , but it worked fine when i used localhost:port, just cannot browse to _api/web, the original url aslo.
Read more >Localhost REST service cannot connect
Hi,. I have a local rest service (node.js) running on port 3000 on my developer machine (localhost). I would like to get my...
Read more >Could not connect to server: http://localhost:8087
Hello, I have the user name and password when setup/install correct, but when trying to login to Wowza Streaming Engine Manager I get...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Just a small note on this, in case someone needs one simple example (4.x version):
However, run this in VS directly will encouter errors:
The simplest and cleanest way (in my opinion) is do as @jimmyland pointed out, run it in command line but with admin privileges.
Maybe try the following:
When you create the new RESTServer(…), the first argument (hostname) can be “*”
Of course check the firewall settings and ensure you’ve opened the port you’re running the server on
Either run the server as admin, or open a terminal as admin and run “netsh http add urlacl url=http://*:1234/ user=Everyone” (where 1234 should be whatever port you’re running on)