Monday, December 6, 2010

IIS 7.5 WebResource.axd and ScriptResource.axd not found

Last week i deployed a web application on a new server. the site was containing wordpress blog and posting, when i took the web online i observed that my AJAX toolkit is not working. so i started debugging the problem. after spending couple of days and 30 hours i concluded that it is due to some handler which is not allowing the runtime files to be shown because each time i try to browse a webresource it throw 404 page not found. i was using Windows server 2008 R2 so i observed in the handler that each request which blongs to a web resouce which does not exists is actually routed to php/wordpress engine. who then evalute this request as valid or not so it was my issue. some people suggested that i have to use static url path for web resource which was not possible due to extensive change. so this was the issue
script src="/ScriptResource.axd?d=6jlaIZUKRXg3wAiiwb5CXRLLE4-Gm23NRJYO6UGKsEfKVWmmRDjpjYUxUQc3rzA15AxvjFMTyyBHnHZwnp436Rh4PelOuGVzY5dYg0oEc1rFylLCCtLPLtzdaF9l9sPZW6Nu8_s0HdGhCknizdMILSk85R81&t=634213836780000000" type="text/javascript".
many solution like these
so looked over the net for the solution since it has been many days i could not remember the linke but following the solution.
in web.config section
<rewrite> <rules> <rule name="wordpress" patternsyntax="ECMAScript">
<match url=".*"> <conditions> <add negate="true" input="{REQUEST_FILENAME}"
matchtype="IsFile"> <add negate="true" input="{REQUEST_FILENAME}" matchtype="IsDirectory">
<add negate="true" input="{URL}" pattern="\.axd$"> </conditions> <action
url="index.php" type="Rewrite"> </rule>