I'm using the Application Request Routing and URL Rewrite modules in IIS7.5 to host a Wordpress blog as a subdirectory of my ASP.NET 4.0 site. Most everything is working, except I get 502 errors when Wordpress redirects to php pages such as wp-comments-post.php. I cannot trace down the source of this problem. I've duplicated the web.config in the wwwroot folder for the Default Website, and if I stop the website I've set up in IIS and allow the Default Website to catch the request everything works fine- no more 502's. I'm stumped. Here's the error message I get in failed request trace log for the website I've set up:
ModuleName ApplicationRequestRouting
Notification 128
HttpStatus 502
HttpReason Bad Gateway
HttpSubStatus 3
ErrorCode 2147942438
ConfigExceptionInfo
Notification EXECUTE_REQUEST_HANDLER
ErrorCode Reached the end of the file. (0x80070026)
Failed request tracing in IIS doesn't seem to be telling me anything new. Google and IIS forum searches haven't yielded much. If I could put a bounty on this one I would. If more info is required, please let me know and I will try to provide. Any help would be greatly appreciated.
Found the issue. We use Kentico CMS and a module that it uses ended up being the culprit. The solution was to host a separate application in a subfolder of the main application and remove the module in the web.config of the nested app. The web.config ended up looking like this:
<?xml version="1.0"?>
<configuration>
<system.web>
<httpModules>
<remove name="XHtmlModule"/>
</httpModules>
<compilation debug="true" numRecompilesBeforeAppRestart="100">
<assemblies>
<clear/>
</assemblies>
</compilation>
<roleManager defaultProvider="SQL" enabled="false">
<providers>
<clear/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules>
<remove name="XHtmlModule"/>
</modules>
</system.webServer>
</configuration>
Ultimately we also ended up installing PHP on IIS and hosting the blog in the nested app, but the above changes should allow the proxy server solution to work properly as well. Hopefully this will help someone who runs into the same problem.
User contributions licensed under CC BY-SA 3.0