MVC3 web site with Wordpress in subdirectory

2019-08-13 20:05发布

问题:

My hosting plan includes 1 site. I have installed a MVC3 project on that site and it is working as designed. Now I would like install a blog on the same site in a subdirectory. The blog I am using is Wordpress. Wordpress is installed to a subdirectory on the MVC3 site. When I run the Wordpress blog I get a .NET error page with the error:

"'System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded"

The MVC3 site runs at http://www.setlisthelper.com I want the blog site to run at http://www.setlisthelper.com/blog

I assume MVC3 is looking for a BlogController when I go the blog directory. Is there a setting in IIS7 or MVC3 that tells it to leave the blog directory alone and not use .NET?

回答1:

try adding this to your RegisterRoutes function in Global.asax.cs:

routes.IgnoreRoute("{*blog}", new { blog = @"blog(/.*)?" });

You should be able to go to it with link: http://www.setlisthelper.com/blog/index.php