This project is read-only.

URLs like /blog/post/ /blog/category/ always return a 404 error in BE 2.6 and 2.7

Topics: Business Logic Layer
Nov 13, 2012 at 5:11 PM

I've copied my BE 2.6 blog from a staging web server (IIS 6) to a production one (also IIS 6 and supposedly of identical configuration). The blog runs, but all links to posts and categories that begin with /blog/post and /blog/category return a 404 error. Links to post tags such as /blog/?tag=/Test+Posts work fine. All the links of whatever format on the staging copy of the blog work correctly. The staging and production copies of the blog are byte-for-byte identical.

I've tried un-zipping a completely fresh copy of BE 2.7 into the production blog folder, and it has the exact same problem -- the even a link to the default "welcome" post /blog/post/2012/10/15/Welcome-to-BlogEngineNET-27/#comment returns a 404.

Please help! What do I need to do to get these links working? It sounds like something is missing from the production environment, but I have no idea what it could be.

Nov 14, 2012 at 11:00 PM
Edited Nov 14, 2012 at 11:00 PM

I've verified that the machine.config files between the two servers are identical for framework 4.0, except for attribute spacing on a few tags.

I've also verified that nothing is re-writing the URL before it gets to IIS: on both servers, the category URL in question appears in the IIS logs as /blog/category/Restaurant-Operations/ in both cases. It's just that on one, the status is 200, and on the other, its' 404.

Can someone tell me what mechanism it is that should be catching the requests for /blog/category/ and /blog/post/ URLs? I think they might be being redirected to default.aspx, but I can't even verify that. Since I don't understand what's doing the redirection, I can't troubleshoot it.

My thanks to whoever can help!

Nov 15, 2012 at 9:49 AM

Seems to me that you should check your IIS settings of the application pool -> I also ran into to the odd 404 messages because the pipeline mode was on classic mode and should be on integrated mode.

1. Start Internet Information Services (IIS) Manager. 

2. Click on the + next to your server name and then click on Application Pools. 

3. Locate the application pool for the website you are changing for. Right click on the application pool and click on Basic Settings. 

4. From the drop down menu under Managed pipeline mode: choose classic then click on ok. (Integrated is the default mode, but maybe this is on classic mode)

Nov 15, 2012 at 4:50 PM

Thank you for your suggestion. However, IIS 6 does not have those choices for application pools. I did make sure that what settings IIS 6 has, such as for worker process recycling and "enable rapid fail protection," are exactly the same between the two servers. This did not fix the 404 problem.

Nov 16, 2012 at 3:49 AM

From settings, uncheck "Remove extensions from URLs" and see if it will make any difference. IIS 6 does not have URL rewrite, I"m more surprised it works this way in your staging.

Nov 16, 2012 at 5:30 PM
Edited Nov 16, 2012 at 5:32 PM

rtur, thank you -- that does work.

I also reviewed, in as much depth as possible, the IIS settings for each containing website and blog folder; there, I found the solution to getting the re-written URLs to work in IIS 6, along with getting .cshtml pages to work without setting up a specific application mapping: I set up a wildcard application mapping to the .net 4 aspnet_isapi.dll and turned off "Verify that file exists" as shown in this blog post. It looks like I'd done that at some point and then forgotten to document it because it was so easy to do.

I'm going to add the steps for this fix to a comment on one of the installation documents...setting up that mapping seems to be a cure for at least two common IIS 6 installation troubles.