I would need to raise the UrlSegmentMaxLength of the Http.sys registry settings on Windows Azure. Does anyone knows how to do that? (or do something that leads to an equivalent behavior)
1) Add a .cmd file to your web project. Set Build Action to “None” and Copy to Output Directory to “Copy always”.
2) Update .cmd file. Here is the example script I used which checks to see if the registry change has been set, and if it hasn't modify the registry and then reboot the server (reboot required - simply restarting the http service causes the azure deployment to go in a never ending loop).
@echo off
setlocal
set regpath=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters
reg query "%regpath%" /v "AllowRestrictedChars"
if errorlevel 1 (
reg add %regpath% /v AllowRestrictedChars /t REG_DWORD /d 00000001
reg add %regpath% /v UrlSegmentMaxCount /t REG_DWORD /d 00000000
reg add %regpath% /v PercentUAllowed /t REG_DWORD /d 00000001
reg add %regpath% /v UrlSegmentMaxLength /t REG_DWORD /d 00000000
shutdown /r /t 0
)
3) In your Azure role’s servicedefinition.csdef, add the .cmd as a startup task:
<WebRole name="WebRoleName">
...
<Startup>
<Task commandLine="httpSys.cmd" executionContext="elevated" />
</Startup>
</WebRole>
4) Deploy your Azure role and the registry changes should have taken place.
It looks like those reg keys are in HKLM. I don't believe you can change those without admin access (which you don't have in Windows Azure today).
Unless there's another way to override that (like in web.config), I think you're out of luck until admin mode comes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With