Project

General

Profile

ISAP and Rest Command

Added by Patrick ottavi almost 4 years ago

hello,

I'm trying to implement a Rest command within a Website under windows, everything works perfectly in stand-alone mode but in isapi mode the get command on the ressource is not recognized: I get the page of my website in return for the get.

do you have any suggestions?

My code:

class RestGetMaj : public Wt::WResource
{
public:
    virtual ~RestGetMaj() {}
protected:
    virtual void handleRequest(const Wt::Http::Request &request, Wt::Http::Response &response)
{
        response.out() << "Maj OK\n";
    OutputDebugStringA("Fonction mise à jour activée");
};

int main(int argc, char ** argv)
{   
    //return WRun(argc, argv, &createApplication);
    try {
        Wt::WServer server(argv[0]);
        server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);
        server.addResource(new RestGetMaj, "/Maj");
        server.addEntryPoint(EntryPointType::Application, createApplication);
        server.start();
#ifdef WTHTTP_STATIC
        Wt::WServer::waitForShutdown();

        server.stop();
#endif
        return 0;
        }
        catch (WServer::Exception& e)
        {
        std::cerr << e.what() << std::endl;
        }
        catch (std::exception &e)
        {
        std::cerr << "exception: " << e.what() << std::endl;
        }
        return 0;       
}

in Isapi Mode I send from an external application a Get with /MyCmd.dll/Maj

in standalone Mode: Get /Maj -> works perfectly

Trace log on IIS:

#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2018-10-23 09:27:14
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) cs(Referer) sc-status sc-substatus sc-win32-status time-taken
2018-10-23 09:27:14 192.168.5.16 GET /MyCmd.dll/Maj - 8081 - 192.168.5.16  - 200 0 0 2
2018-10-23 09:27:23 192.168.5.16 GET /MyCmd.dll/Maj - 8081 - 192.168.5.16  - 200 0 0 2

maybe mixed mode is not possible in isapi mode?

thank you in advance for any answers,

Patrick.