Answered by:
How to put native module before compression of response.

Question
-
User-1300195255 posted
<br>
When native module is getting chunk data of type chunkFromMemory it is compressed . Because of that native module is not able to process it in OnSendResponse event handler . I want to put my native module before compression of response .<br>
IIS version:10.0Monday, December 9, 2019 7:12 PM
Answers
-
User690216013 posted
but not sure on which event it does compression .Nothing can hide from FRT, https://docs.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Tuesday, December 10, 2019 6:27 AM
All replies
-
User690216013 posted
There are a few ways to change the execution order, http://www.ksingla.net/2006/06/execution_order_of_modules_in_iis7/
Monday, December 9, 2019 7:49 PM -
User-1300195255 posted
thanks lextm , i read this article , in module i am handling on RQ_SEND_RESPONSE event , but looks like compression module compress the data on some other event which occuers before RQ_SEND_RESPONSE .
but not sure on which event it does compression .
Tuesday, December 10, 2019 6:12 AM -
User690216013 posted
but not sure on which event it does compression .Nothing can hide from FRT, https://docs.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Tuesday, December 10, 2019 6:27 AM -
User-848649084 posted
Hi,
You can change the order of the module execution.for that first, you need to unlock them at the server level.
To unlock them you could use below PowerShell script:
Import-Module WebAdministration Get-WebConfiguration ` -pspath 'MACHINE/WEBROOT/APPHOST' ` -filter "system.webServer/modules/add" -recurse | ` where {$_.PSPath -eq 'MACHINE/WEBROOT/APPHOST' -and $_.Type -eq ''} ` | foreach { $filter = "system.webServer/modules/add[@name='" + $_.Name + "']" Remove-WebConfigurationLock -pspath 'MACHINE/WEBROOT/APPHOST' -filter $filter -verbose }
Do not forget to run the PowerShell as an administrator. Usually, only the native modules (with an empty 'type' property) are locked. Unlock them all. now change the order of the module at the site level.
Be careful when the re-ordering, if you change the order of some of the system modules, IIS may no longer work expectedly.
Also remember, that if you make changes to the modules at the server level, the site will no longer inherit these and you have to apply them to the site level as well.Regards,
Jalpa
Tuesday, December 10, 2019 6:48 AM -
User-1300195255 posted
with the help of FRT link you gave i was able to see that staticCompression module is doing compression at MAP_REQUEST_HANDLER event .
<fieldset>ModuleName StaticCompressionModule Notification 16 fIsPostNotification false Notification MAP_REQUEST_HANDLER StaticCompressionModule MAP_REQUEST_HANDLER 0 I want to trigger my module before StaticCompression Module so i did this as described in the article shared on MAP_REQUEST_HANDLE event .
pModuleInfo->SetPriorityForRequestNotification(
RQ_MAP_REQUEST_HANDLER,
PRIORITY_ALIAS_FIRST
);after doing this still StaticCompression module was getting called first . so i moved my module above StaticCompression module as suggesetd in the article . but still behaviour is same.
is there any other thing which decides order of execution ,
</fieldset>Wednesday, December 11, 2019 1:37 PM -
User-848649084 posted
you could try to set the order at the server level and restart the server after doing changes.
Monday, December 16, 2019 8:18 AM -
User-1300195255 posted
thanks Jalpa, i have tried that also ,
one other thing when i am calling SetPriorityForRequestNotification result code has error that you can not access/open something .
Monday, December 16, 2019 8:25 AM -
User-848649084 posted
Could you share that error message?
Monday, December 16, 2019 8:29 AM -
User-1300195255 posted
i am getting this error failed Priority setting The parameter is incorrect
I am setting priority and printing in below manner.
hr = pModuleInfo->SetPriorityForRequestNotification(
RQ_MAP_REQUEST_HANDLER,
PRIORITY_ALIAS_FIRST
);if (hr != S_OK)
{std::string message = std::system_category().message(hr);
Log("failed Priority setting %s", message.c_str());
}and OnPostMapRequestHandler function is getting triggered .
OnMapRequestHandler is never invoked.
Monday, December 16, 2019 9:32 AM