c++ - Native IIS7.5 Module not running -


i've created simple chttpmodule adds custom header requests:

#define _winsockapi_ #include <windows.h> #include <sal.h> #include <httpserv.h>  class appendheadermodule : public chttpmodule { public:     request_notification_status         onbeginrequest(         in ihttpcontext * phttpcontext,         in ihttpeventprovider * pprovider         )     {         unreferenced_parameter(pprovider);          pcstr testheadername = "foo";         pcstr testheader = "bar";         phttpcontext->getresponse()->setheader(testheadername, testheader, (ushort)strlen(testheader), true);          return rq_notification_continue;     }      void terminate() {         delete this;     }      appendheadermodule() { }     ~appendheadermodule() { } };  class appendheadermodulefactory : public ihttpmodulefactory { public:     hresult         gethttpmodule(         out chttpmodule ** ppmodule,         in imoduleallocator * pallocator         )     {         unreferenced_parameter(pallocator);          appendheadermodule* pmodule = new appendheadermodule;          if (!pmodule) {             return hresult_from_win32(error_not_enough_memory);         }         else {             *ppmodule = pmodule;             pmodule = null;             return s_ok;         }     }      void terminate() {         delete this;     } };   hresult __stdcall registermodule( dword dwserverversion, ihttpmoduleregistrationinfo * pmoduleinfo, ihttpserver * pglobalinfo ) {     unreferenced_parameter(dwserverversion);     unreferenced_parameter(pglobalinfo);      appendheadermodulefactory* pmodule = new appendheadermodulefactory;     if (pmodule == null)          return hresult_from_win32(error_not_enough_memory);      return pmoduleinfo->setrequestnotifications(pmodule, rq_begin_request, 0); } 

i've copied c:\windows\system32\inetsrv, registered module, , added list. however, i'm not seeing additional header in of requests. created similar managed module, installed gac, registered it, , works fine. native module seems nothing. there step required native modules handle requests?

also, i'm not sure if matters, requests being made asp.net site. native handlers not run asp.net?

if module 32-bit module need enable 32-bit applications in application pool website. go application pools, select pool website, advanced settings , set "enable 32-bit applications true.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -