Discuz!NT官方社区

首页 » Discuz!NT交流与讨论 » BUG 反馈 » 修改模板文件之后出现运行时错误
heique - 2007-5-26 1:30:00
修改模板文件之后出现运行时错误,麻烦帮助解决一下,谢谢!“/”应用程序中的服务器错误。 运行时错误 说明: 服务器上出现应用程序错误。此应用程序的当前自定义错误设置禁止远程查看应用程序错误的详细信息(出于安全原因)。但可以通过在本地服务器计算机上运行的浏览器查看。

详细信息: 若要使他人能够在远程计算机上查看此特定错误信息的详细信息,请在位于当前 Web 应用程序根目录下的“web.config”配置文件中创建一个 <customErrors> 标记。然后应将此 <customErrors> 标记的“mode”属性设置为“Off”。

<!-- Web.Config 配置文件 --><configuration>    <system.web>        <customErrors mode="Off"/>    </system.web></configuration>

注释: 通过修改应用程序的 <customErrors> 配置标记的“defaultRedirect”属性,使之指向自定义错误页的 URL,可以用自定义错误页替换所看到的当前错误页。

<!-- Web.Config 配置文件 --><configuration>    <system.web>        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>    </system.web></configuration>
51aspx - 2007-5-26 18:03:00
在别的机器上没问题,但是在我的机器上有问题,也把cookie清除了


Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
  <system.web>
      <compilation debug="true"/>
  </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]  Discuz.Forum.BasePage..ctor() +3383  Discuz.ForumPage.index..ctor() +75  ASP.aspx_1_index_aspx..ctor() +10  __ASP.FastObjectFactory_app_web_index_aspx_e804085e_3hz3ljlm.Create_ASP_aspx_1_index_aspx() +20  System.Web.Compilation.BuildResultCompiledType.CreateInstance() +49  System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +115  System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31  System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40  System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +139  System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +120  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
对着瓶子唱歌 - 2007-6-12 13:24:00
我也出现了同样的问题,是在删除模板之后出现的
怎么办阿?
对着瓶子唱歌 - 2007-6-12 13:30:00
有没有人帮忙啊?
bighead - 2007-6-12 13:44:00
找到论坛的config目录修改目录中general.config文件中<Templateid>节点,将节点中的ID修改为数据库中存在的正确的模板块ID试试
戏水 - 2007-6-12 13:48:00
如果出现这个问题是 因为你删除了模板,但本地cookie中记录的还是你原来模板的信息,
这样在加载的时候就会出现一些问题, 解决办法就是清空本地cookies 。
另外 如果清空cookies 无效,请尝重启一下站点或者iis,刷新一下配置看看
fandown - 2007-6-12 14:05:00


引用:
原帖由 戏水 于 2007-6-12 13:48:00 发表
如果出现这个问题是 因为你删除了模板,但本地cookie中记录的还是你原来模板的信息,
这样在加载的时候就会出现一些问题, 解决办法就是清空本地cookies 。
另外 如果清空cookies 无效,请尝重启一下站点或者iis,......


这个问题建议DNT在系统自动判断,如果模板找不到,就用系统默认模板。

如果让普通用户来清空cookie或者删除相应cookie还是比较麻烦的。
对着瓶子唱歌 - 2007-6-12 14:15:00
bighead  和戏水老大说的都很有道理
我去再测试一下看看
对着瓶子唱歌 - 2007-6-12 14:17:00
问题肯定出在模板被删除的问题上
对着瓶子唱歌 - 2007-6-12 15:43:00
找到论坛的config目录修改目录中general.config文件中<Templateid>节点,将节点中的ID修改为数据库中存在的正确的模板块ID试试

这个问题说来奇妙,我修改站点根目录的web.config文件 ,保存后就好使了!

前提是我按照老大的说法,把默认模板修改为了ID是1的模板!

之后又在sql数据库中修改了模板数据表被我删除的ID字段

总之一顿倒来倒去 总算是好了

asp.net还是很复杂的
bighead - 2007-6-14 14:20:00
这个地方也算是我们的考虑不足,感谢您提出这个问题。
我们会考虑进行改进的
cgb1021 - 2008-4-18 10:19:00


引用:
原帖由 bighead 于 2007-6-12 13:44:00 发表
找到论坛的config目录修改目录中general.config文件中<Templateid>节点,将节点中的ID修改为数据库中存在的正确的模板块ID试试

搞了一晚的大问题总算让你帮我解决了。
1
查看完整版本: 修改模板文件之后出现运行时错误