I'm writing a MVC 2.0 app with VS2010. On my Windows 7 Ultimate 64bit machine it runs fine. On my laptop (Windows 7 Home Premium, 32bit) it is getting a null reference on Server when I call M开发者_开发技巧apPath.
public ActionResult Index()
{
ContentModel content = new ContentModel();
content.Content = ContentInterface.GetHtmlContent(Server.MapPath("~"), "Home");
content.Ads = ContentInterface.GetPartialAds(Server.MapPath("~"), AdCount);
content.Testimonials = ContentInterface.GetTestimonials();
return View(content);
}
I have installed MVC 2 via Webinstaller, I reregistered .Net 4 with IIS. I've confirmed IIS 6 WMI compatibility mode.
Any ideas?
Figured it out: permissions. I granted Full Control to IUSR and it works now.
精彩评论