Hello!
I am able to set the Handlers order using the IIS Manager. If I pull "OPTIONSVerbHandler" down, IIS changes my Web.Config and adds a "<clear />" tag followed by all the handlers in the order I defined. This works, Handlers are executed in the order shown.
However, if I do it manually, editing my web.config and just place this under the <httpHandlers> tag:
<handlers>
<remove name="OPTIONSVerbHandler" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,DELETE,PUT,PATCH,OPTIONS" modules="IsapiModule" NOT_RELEVANT_CONFIG_HERE />
<add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" responseBufferLimit="4194304" />
</handlers>
Then, the OPTIONSVerbHandler will still be executed prior to my ExtensionlessUrlHandler-ISAPI-4.0_32bit handler. IIS ignores this ordering unless a <clear> tag is present. I was expecting IIS to order Handlers as I add/remove them in the Web.Config. If I place
a <clear /> tag in the Web.config just after the <httpHandlers> start tag, then IIS will do the order as stated in the web.config (removing, of course, all the headers I don't add after).
Another strange behaviour is that if I name my Handler with "Something_Other_than_Default" (e.g.: OPTIONSVerbHandlerXPTO) with the exact same definition, IIS puts it ontop of the list automatically, in front of all Handlers:
<add name="OPTIONSVerbHandlerXPTO" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" responseBufferLimit="4194304" />
Again, I wasn't expecting this behavior.
Please note that I don't want all the Handlers in my web.config after a <clear />.
Is there a way to order Handlers without having all of them in the web.config and with a <clear />? Or, at least, just Append my handlers in the order I list them in Web.Config?
Thanks in advance