MVC 2服务器上的空引用

时间:2010-10-10 01:29:28

标签: asp.net-mvc visual-studio-2010 asp.net-mvc-2

我正在用VS2010编写一个MVC 2.0应用程序。在我的Windows 7旗舰版64位机器上运行正常。在我的笔记本电脑(Windows 7家庭高级版,32位)上,当我调用MapPath时,它在服务器上获得了一个空引用。

        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);
    }

我已经通过Webinstaller安装了MVC 2,我使用IIS重新注册了.Net 4。我已经确认了IIS 6 WMI兼容模式。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

想出来:权限。我授予IUSR完全控制权,现在可以使用。