我在本机上调试通过没有问题(win2000),上传到服务器(win2003)(已设置forums目录为应用程序),
结果出现如果错误
 “/Forums”应用程序中的服务器错误。 
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 行 8: </mp:Content> 行 9: <mp:Content id="MainContent" runat="server"> 行 10: <Forums:ForumGroupView runat="server" /> 行 11: </mp:Content> 行 12: </mp:ContentContainer>
 源文件: D:\wwwroot\Forums\forums\Default.aspx    行: 10 堆栈跟踪: [NullReferenceException: 未将对象引用设置到对象的实例。] AspNetForums.Controls.SkinnedForumWebControl..ctor() +61 AspNetForums.Controls.ForumGroupView..ctor() +38 ASP.default_aspx.__BuildControl__control2() in D:\wwwroot\Forums\forums\Default.aspx:10 ASP.default_aspx.__BuildControlMainContent() in D:\wwwroot\Forums\forums\Default.aspx:9 ASP.default_aspx.__BuildControlMPContainer() in D:\wwwroot\Forums\forums\Default.aspx:5 ASP.default_aspx.__BuildControlTree(Control __ctrl) in D:\wwwroot\Forums\forums\Default.aspx:1 ASP.default_aspx.FrameworkInitialize() in c:\windows\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\forums\1dd158ef\fe075fd9\9nfqqvc-.0.cs:0 System.Web.UI.Page.ProcessRequest() +84 System.Web.UI.Page.ProcessRequest(HttpContext context) +18 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87 
 
--------------------------------------------------------------------------------版本信息: Microsoft .NET Framework 版本:1.1.4322.2300; ASP.NET 版本:1.1.4322.2300 不知道是不是因为IIS6没有把AspNetForums.Components.dll和AspNetForums.Controls.dll成功装载
请高手指点,不胜感激!!!!

解决方案 »

  1.   

    你需要设置虚拟目录吧啊
    你在web.config 中把虚拟目录去掉
      

  2.   

    堆栈跟踪: [NullReferenceException: 未将对象引用设置到对象的实例。] AspNetForums.Controls.SkinnedForumWebControl..ctor() +61 AspNetForums.Controls.ForumGroupView..ctor() +38 ASP.default_aspx.__BuildControl__control2() in D:\wwwroot\Forums\forums\Default.aspx:10 ASP.default_aspx.__BuildControlMainContent() in D:\wwwroot\Forums\forums\Default.aspx:9 ASP.default_aspx.__BuildControlMPContainer() in D:\wwwroot\Forums\forums\Default.aspx:5 ASP.default_aspx.__BuildControlTree(Control __ctrl) in D:\wwwroot\Forums\forums\Default.aspx:1 ASP.default_aspx.FrameworkInitialize() in c:\windows\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\forums\1dd158ef\fe075fd9\9nfqqvc-.0.cs:0 System.Web.UI.Page.ProcessRequest() +84 System.Web.UI.Page.ProcessRequest(HttpContext context) +18 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87 ------------------------------------------------------------------------------------
    从堆栈跟踪可以看出,你得问题出在GroupoView这个类,Forum得换肤技术使得这个类是加载了网站得一个.ascx自定义控件得页面文件作为模板,在GroupVIew里面采用FindControl来获得对控件里面服务端控件得引用,这个方法,就很可能返回null,我看Forum里面并没有处理这个,所以,请首先查看你上传到服务器上得网站得GroupView。ascx文件是否和你本地一模一样!如果只是细微地差别,但差别出在控件ID上,这个问题就必出无疑了!
      

  3.   

    SkinnedForumWebControl是Forum里面得皮肤控件得基类!在这里断开
    1.你得模板文件不存在,不过这时候一般抛出“错误:皮肤文件  " + skinPath + " 没有找到. 皮肤必须被指定,以用于控件的呈现!”
    但是你的并没有抛出,所以基本可以排除这种情况!
    接着往下看跟踪!.__BuildControlMainContent() in 
    这句,主要是Forum在换肤上使用了别人得一个dll,就是MetaBuilders.WebControls.MasterPages.dll
    这个控件其实就是扩展了以下PlaceHolder,但很可能没有被IIS加载!
    测试方法:
    去掉首页中得 <mp:Content id="MainContent" runat="server"> 行 10: <Forums:ForumGroupView runat="server" /> 行 11: </mp:Content>看问题是否依然!
    如果能正常显示出一个页面,说明,上述考虑没有发生,否则就是
    MetaBuilders.WebControls.MasterPages.dll
    没有被正常加载,或是mp:ContentContainer设置得MasterPageFile错误,不过可能比较小!