Crash when using http_listener with public IP address
http_listener listener(U("http://xxx.xxx.xxx.xxx/test/"));
listener.support(methods::GET, [](http_request req) {});
listener.open().then([]()
{
qDebug () << "then";
});
Previous code ends up crashing when xs are replaced with the public IP, and I haven't been able to catch an exception. Everything works as expected with the local IP.
Tested on: Windows 7 64bit with MSVC 2015 and cpprest v2.8 from nuget Ubuntu 15.10 64bit with GCC 5.2.1 and cpprest from master branch
you should run command "netsh http add iplisten xxx.xxx.xxx.xxx" with user admin, then run the program with user admin
After read, i found that run "netsh http add urlacl url=http://xxx.xxx.xxx.xxx/YourUrl user=USER_OR_GROUP" may more useful. see https://casablanca.codeplex.com/discussions/532385 and https://msdn.microsoft.com/en-us/library/windows/desktop/cc307223(v=vs.85).aspx
I had a lot of problems with this, but for me on windows 10 worked just running the application With Administrative privileges (right click and run as Administrator). Not even need netsh is needed. It maybe not the best option, but it works.
On Windows you always have to run as administrator to serve to a public IP address.
Damien
On September 28, 2016 4:25:43 AM raimuucka [email protected] wrote:
I had a lot of problems with this, but for me on windows 10 worked just running the application With Administrative privileges (right click and run as Administrator). Not even need netsh is needed.
You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/Microsoft/cpprestsdk/issues/164#issuecomment-250129707
I have a similar problem except running the application with administrative rights doesn't change anything. See my stackoverflow question for more information.
@damienhocking Any official documents regarding to administrator rights? I'd like to know why. Thanks.
On windows 7 i was making cpp project tcp server wit 3??? Port without admin rights. So i do not know why this one needs admin rights on even bigger port number.
I have the same problem. For me these two points work: 1- you have to set http_listener url as : "http://*:port". 2- run your code as admin
I has that problem, always running as admin, but server crashing every time when listener url not localhost. Please help Stackoverflow question
I has that problem, always running as admin, but server crashing every time when listener url not localhost. Please help Stackoverflow question
try netsh http add urlacl url=http://xxx.xxx.xxx.xxx/YourUrl user=USER_OR_GROUP
I has that problem, always running as admin, but server crashing every time when listener url not localhost. Please help Stackoverflow question
try netsh http add urlacl url=http://xxx.xxx.xxx.xxx/YourUrl user=USER_OR_GROUP
Already tryed that, its all stays the same( Error that trowing right before crashing is "error adding url to a url group"