CCan't create http_listener object.

Oct 17, 2014 at 8:39 PM
Edited Oct 17, 2014 at 9:03 PM
Hi all. I tried to create http_listener but all stop in .open function, why? (Windows 7, VS 2013)
Please help.
#include <cpprest\http_listener.h>
#include <cpprest\http_client.h>
#include <iostream>
using namespace std;
using namespace web;                        // Common features like URIs.
using namespace web::http;                  // Common HTTP functionality
using namespace web::http::client;
using namespace web::http::experimental::listener;
void get_handle(http_request resp)
int main(int argc, char** argv)
    http_listener listener(U(""));, get_handle);[&listener]()
        cout << "Server start" << endl;
    cout << "Listener stop" << endl;
    return 0;
Oct 23, 2014 at 12:36 AM
Hi rbkblhjy,

Looking at your code it appears you are starting the listener by calling http_listener::open() and then once it has been successfully opened you are immediately stopping the listener by calling http_listener::close(). After you call close no new requests will be accepted. Why don't you actually reply to the http_request in your get_handle function and call close at some later time?