Condividi tramite


Workaround for outbound rewriting can be used together with IIS dynamic compression

 

I had a customer where he had IIS Dynamic compression enabled with outbound URL rewriting and we used to get 500.52 error when browsing the application.

We identified that we cannot have outbound rule working with dynamic compression enabled by default IIS settings.

The work around for Dynamic compression and outbound URL rewrite to work together is as below:

  • Adding LogRewrittenUrlEnabled registry key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite to 0 or by running below command line: “reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0”
  • Set the dynamicCompressionBeforeCache property to false for /system.webServer/urlCompression configuration element. Can be done from adding in web.config as below

<urlCompression doStaticCompression=”false” doDynamicCompression=”true” dynamicCompressionBeforeCache=”false” />

                                        OR

By running the below command from command prompt

appcmd.exe set config "WEBSITENAME" -section:system.webServer/urlCompression /dynamicCompressionBeforeCache:"False"

  • Re-arrange the IIS modules to have URL Rewrite module (RewriteModule) to run before Dynamic Compression module (DynamicCompressionModule). In IIS manager under Modules section, click on View ordered List and make sure that DynamicCompressionModule is above RewriteModule.
  • Restart IIS.

We had another scenario where my application pool was running under 32 bit on a 64 bit machine i.e. Enable 32-Bit Applications was set to true for my application pool setting and after running process monitor found out that LogRewrittenUrlEnabled registry key was expected in below location.

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432node\Microsoft\Inetstp\Rewrite.

Workaround for Dynamic compression and outbound URL rewrite to work together for a 32-bit enabled application on a 64 bit machine is to have:

  • Adding LogRewrittenUrlEnabled registry key under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432node\Microsoft\Inetstp\Rewrite to 0 or by running below command line: “reg add HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432node\Microsoft\Inetstp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0”
  • Set the dynamicCompressionBeforeCache property to false for /system.webServer/urlCompression configuration element. Can be done from adding in web.config as below

<urlCompression doStaticCompression=”false” doDynamicCompression=”true” dynamicCompressionBeforeCache=”false” />

                                       OR

By running the below command from command prompt

appcmd.exe set config "WEBSITENAME" -section:system.webServer/urlCompression /dynamicCompressionBeforeCache:"False"

  • Re-arrange the IIS modules to have URL Rewrite module (RewriteModule) to run before Dynamic Compression module (DynamicCompressionModule). In IIS manager under Modules section, click on View ordered List and make sure that DynamicCompressionModule is above RewriteModule.
  • Restart IIS.