Development
Architecture
TODO
How to configure and upgrade boost
- The repo contains boost_1.75 ( Dec 11th 2020 )
- In upgrading to later versions, the following steps are to be done in Windows after extracting the desired version.
- Clear any cached prior builds If needed.
- run
rmdir stage /s /q - run
rmdir bin.v2 /s /q
- run
- run
bootstrap.bat - run
b2 asmflags=\safeseh variant=release link=static runtime-link=static -a --with-filesystem --with-coroutine --with-context --with-date_time --with-regex -j 8- asmflags explanation
- -a is to always rebuild
- -runtime-link=static corresponds to VS' Runtime Library Setting (/MT), x86 builds link to boost
-mt-libwhile x64 link tomt-s-x64-lib
- The stage/lib and the entire boost library is only needed after building. The following headers were removed to minimize file clutter (https://www.boost.org/doc/libs/1_75_0/):
- rm -rf polygon beast beast.hpp compute compute.hpp fiber flyweight flyweight.hpp geometry geometry.hpp gil gil.hpp graph hana hana.hpp mp11 mp11.hpp python python.hpp proto phoenix phoenix.hpp qvm spirit spirit.hpp test leaf leaf.hpp locale locale.hpp
Update submodules
git submodule update --init
Updating the version number on a new release
Update VERSION
Update the values in .\SigsciIISModule\Version.h
Update $env:SIGSCI_PREVIOUS_VERSION in .\packaging\package.ps1
Testing
This module uses the standard module-testing framework, but with the caveat of having to do the testing on Windows with docker.
Development Notes and Documentation
Overview of how the module executes:
- When the Application Pool is started by IIS, it will call
RegisterModule(in Main.cpp) once. RegisterModulewill create a single instance ofFactorywhich will be held by IIS for the remainder of the process.- Every time an HTTP request comes in, IIS will call
Factory::GetHttpModule. This method will create an instance ofModule, which will live for the duration of that one HTTP request. Module::OnBeginRequestis called.- On the first request to be serviced by the
Moduleclass, some initialization is performed:- The IIS configuration is read (specifically
SignalScienceselement described above). - This configuration is used to initialize the
AgentRpccode.
- The IIS configuration is read (specifically
- The
RPC.PreRequestmessage is sent to the Agent.
- On the first request to be serviced by the
- Processing continues through the other methods on the
Moduleinstance as appropriate (OnAsyncCompletion,OnPostEndRequest,OnSendResponse, not necessarily in that order). - Once the request has completed, IIS will call
Dispose(), where we make theRPC.PostRequestorRPC.UpdateRequestcall as appropriate. - When the Application Pool is being shut down, IIS will call
Factory::Terminateon theFactoryinstance we created on startup. This shuts down theAgentRpccode.
IIS 7 Documentation
IIS 7 documentation is sparse. These links were helpful in understanding the details of IIS native module development:
- http://jennylawblog.azurewebsites.net/2015/07/17/iis-native-module-2/
- https://www.iis.net/learn/develop/runtime-extensibility/develop-a-native-cc-module-for-iis
- https://forums.iis.net/t/1155643.aspx#1895087
- https://www.iis.net/learn/get-started/planning-your-iis-architecture/introduction-to-applicationhostconfig
- https://forums.iis.net/t/1148510.aspx?Calculating+bytes+sent+in+C+Native+Module+