iis6.0 System.NullReferenceException: 未将对象引用设置到对象的实例
未将对象引用设置到对象的实例。说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
行 122:
行 123: //使用版块
行 124: if ((config.Iisurlrewrite == 1 || config.Aspxrewrite == 1) && requestPath.EndsWith("/list.aspx") &&
行 125: requestPath.IndexOf("/archiver/") < 0 && requestPath.IndexOf("/install/") < 0 && requestPath.IndexOf("/upgrade/") < 0 &&
行 126: requestPath.IndexOf("/admin/") < 0 && requestPath.IndexOf("/aspx/") < 0 && requestPath.IndexOf("/tools/") < 0 &&
源文件: D:\BBSProjects\XL.Forum\HttpModule.cs 行: 124
堆栈跟踪:
[NullReferenceException: 未将对象引用设置到对象的实例。]
XL.Forum.HttpModule.ReUrl_BeginRequest(Object sender, EventArgs e) in D:\BBSProjects\XL.Forum\HttpModule.cs:124
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +213
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.1
疑惑:
我在vs2008 调试的时候就没有这个异常,为什么部署到iis中就出现了这个异常呢?
希望老师给我个解答。 --------------------编程问答-------------------- config是空的 --------------------编程问答--------------------
添加配置文件啊
肯定数据库没连接上
配置文件都没写
怎么会对啊 --------------------编程问答-------------------- 是否是你要的 --------------------编程问答-------------------- 没有进行httpModule的配置吧 --------------------编程问答-------------------- 那怎么配置呢?我不太会 --------------------编程问答-------------------- 我这个 config 是读取的一个配置文件 comm.config 。 --------------------编程问答-------------------- 单步判断config是否为null
怎么读取的 --------------------编程问答-------------------- config是null ,部署到iis中 才报出这个错误,开发的时候是没有问题的。这可把我难住了 --------------------编程问答-------------------- GeneralConfigInfo config = GeneralConfigs.GetConfig();
------
public static GeneralConfigInfo GetConfig()
{
return m_configinfo;
}
static GeneralConfigs()
{
m_configinfo = GeneralConfigFileManager.LoadConfig();
generalConfigTimer.AutoReset = true;
generalConfigTimer.Enabled = true;
generalConfigTimer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
generalConfigTimer.Start();
}
--------
/// <summary>
/// 返回配置类实例
/// </summary>
/// <returns></returns>
public static GeneralConfigInfo LoadConfig()
{
try
{
ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
}
catch (Exception ex)
{
ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
}
return ConfigInfo as GeneralConfigInfo;
}
----
/// <summary>
/// 获取配置文件所在路径
/// </summary>
public new static string ConfigFilePath
{
get
{
if (filename == null)
{
//TODO:
filename = Utils.GetMapPath(BaseConfigs.GetForumPath + "config/general.config");
}
return filename;
}
}
这个逐级调用的方法 和类 --------------------编程问答-------------------- 会不会是 配置文件没有读取到?
--------------------编程问答-------------------- config/general.config
这个配置文件里是什么内容 --------------------编程问答-------------------- <?xml version="1.0"?>
<GeneralConfigInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Customauthorinfo>gender,bday,credits,posts,joindate|uid,digestposts</Customauthorinfo>
<Debatepagesize>5</Debatepagesize>
<Forumtitle>CGB-BBS</Forumtitle>
<Forumurl>forumindex.aspx</Forumurl>
<Webtitle>CGB-BBS</Webtitle>
<Weburl />
<Licensed>0</Licensed>
<Icp />
<Closed>0</Closed>
<Closedreason>抱歉!论坛暂时关闭,稍后才能访问.</Closedreason>
<Isframeshow>0</Isframeshow>
<Admintools>0</Admintools>
<Indexpage>0</Indexpage>
<Linktext />
<Statcode />
<Passwordkey>8V6DLRFBJ4</Passwordkey>
<Regstatus>1</Regstatus>
<Regadvance>1</Regadvance>
<Realnamesystem>0</Realnamesystem>
<Censoruser>admin
管理员
版主
超级版主</Censoruser>
<Doublee>0</Doublee>
<Regverify>0</Regverify>
<Accessemail />
<Censoremail />
<Hideprivate>0</Hideprivate>
<Regctrl>0</Regctrl>
<Ipregctrl />
<Ipdenyaccess />
<Ipaccess />
<Adminipaccess />
<Newbiespan>0</Newbiespan>
<Welcomemsg>1</Welcomemsg>
<Welcomemsgtxt>尊敬的用户, 您已经注册成为本论坛的会员, 请您在发表言论时, 遵守当地法律法规. 如果您有什么疑问可以联系管理员.</Welcomemsgtxt>
<Rules>0</Rules>
<Rulestxt>1 遵守国家法律法规
2 遵守所有与网络服务有关的网络协议、规定和程序
3 不得为任何非法目的而使用网络服务系统</Rulestxt>
<Secques>1</Secques>
<Templateid>1</Templateid>
<Hottopic>15</Hottopic>
<Starthreshold>2</Starthreshold>
<Visitedforums>20</Visitedforums>
<Maxsigrows>5</Maxsigrows>
<Moddisplay>0</Moddisplay>
<Subforumsindex>1</Subforumsindex>
<Stylejump>1</Stylejump>
<Fastpost>3</Fastpost>
<Showsignatures>1</Showsignatures>
<Showavatars>1</Showavatars>
<Showimages>1</Showimages>
<Smiliesmax>5</Smiliesmax>
<Archiverstatus>1</Archiverstatus>
<Seotitle>ASP.net|论坛</Seotitle>
<Seokeywords>ASP.net,论坛</Seokeywords>
<Seodescription>XL,论坛,asp.net</Seodescription>
<Seohead />
<Rssstatus>1</Rssstatus>
<Rssttl>60</Rssttl>
<Sitemapstatus>1</Sitemapstatus>
<Sitemapttl>12</Sitemapttl>
<Nocacheheaders>0</Nocacheheaders>
<Fullmytopics>1</Fullmytopics>
<Debug>1</Debug>
<Rewriteurl />
<Extname>.aspx</Extname>
<Whosonlinestatus>1</Whosonlinestatus>
<Maxonlinelist>300</Maxonlinelist>
<Userstatusby>1</Userstatusby>
<Forumjump>1</Forumjump>
<Modworkstatus>1</Modworkstatus>
<Maxmodworksmonths>3</Maxmodworksmonths>
<Seccodestatus>register.aspx,usercpnewpassword.aspx</Seccodestatus>
<Guestcachepagetimeout>0</Guestcachepagetimeout>
<Topiccachemark>0</Topiccachemark>
<Maxonlines>5000</Maxonlines>
<Postinterval>15</Postinterval>
<Searchctrl>30</Searchctrl>
<Maxspm>5</Maxspm>
<Visitbanperiods />
<Postbanperiods />
<Postmodperiods />
<Attachbanperiods />
<Searchbanperiods />
<Memliststatus>1</Memliststatus>
<Dupkarmarate>0</Dupkarmarate>
<Minpostsize>5</Minpostsize>
<Maxpostsize>20000</Maxpostsize>
<Tpp>20</Tpp>
<Ppp>10</Ppp>
<Maxfavorites>100</Maxfavorites>
<Maxpolloptions>10</Maxpolloptions>
<Maxattachments>10</Maxattachments>
<Attachimgpost>1</Attachimgpost>
<Attachrefcheck>0</Attachrefcheck>
<Attachsave>1</Attachsave>
<Watermarkstatus>9</Watermarkstatus>
<Watermarktype>1</Watermarktype>
<Watermarktransparency>5</Watermarktransparency>
<Watermarktext>{3} {4}上传于{1} {2}</Watermarktext>
<Watermarkpic>watermark.png</Watermarkpic>
<Watermarkfontname>Tahoma</Watermarkfontname>
<Watermarkfontsize>12</Watermarkfontsize>
<Showattachmentpath>0</Showattachmentpath>
<Attachimgquality>80</Attachimgquality>
<Attachimgmaxheight>0</Attachimgmaxheight>
<Attachimgmaxwidth>0</Attachimgmaxwidth>
<Reasonpm>0</Reasonpm>
<Moderactions>1</Moderactions>
<Karmaratelimit>0</Karmaratelimit>
<Losslessdel>0</Losslessdel>
<Edittimelimit>0</Edittimelimit>
<Editedby>1</Editedby>
<Defaulteditormode>0</Defaulteditormode>
<Allowswitcheditor>1</Allowswitcheditor>
<Smileyinsert>1</Smileyinsert>
<CookieDomain />
<Passwordmode>0</Passwordmode>
<Bbcodemode>0</Bbcodemode>
<Fulltextsearch>0</Fulltextsearch>
<Cachelog>0</Cachelog>
<Onlinetimeout>-10</Onlinetimeout>
<TopicQueueStats>0</TopicQueueStats>
<TopicQueueStatsCount>0</TopicQueueStatsCount>
<DisplayRateCount>30</DisplayRateCount>
<Reportusergroup>1</Reportusergroup>
<Photomangegroups />
<Silverlight>1</Silverlight>
<Enablespace>0</Enablespace>
<Enablealbum>0</Enablealbum>
<Spacename>空间</Spacename>
<Spaceurl>spaceindex.aspx</Spaceurl>
<Albumname>相册</Albumname>
<Albumurl>albumindex.aspx</Albumurl>
<BrowseCreateTemplate>0</BrowseCreateTemplate>
<Ratevalveset>1,50,200,600,800</Ratevalveset>
<Topictoblog>1</Topictoblog>
<Aspxrewrite>1</Aspxrewrite>
<Viewnewtopicminute>120</Viewnewtopicminute>
<Htmltitle>0</Htmltitle>
<Htmltitleusergroup />
<Specifytemplate>0</Specifytemplate>
<VerifyImageAssemly />
<Mytopicsavetime>30</Mytopicsavetime>
<Mypostsavetime>30</Mypostsavetime>
<Myattachmentsavetime>30</Myattachmentsavetime>
<Enabletag>1</Enabletag>
<Enablemall>0</Enablemall>
<Statscachelife>120</Statscachelife>
<Statstatus>0</Statstatus>
<Pvfrequence>60</Pvfrequence>
<Oltimespan>20</Oltimespan>
<Recommenddebates />
<Gpp>16</Gpp>
<Hottagcount>10</Hottagcount>
<Disablepostad>0</Disablepostad>
<Disablepostadregminute>60</Disablepostadregminute>
<Disablepostadpostcount>5</Disablepostadpostcount>
<Disablepostadregular>((\d{4}|\d{4}-)?(\d(?:\s*)){7})|((\d{3}|\d{3}-)?\d{8})|(1(?:\s*)[35](?:\s*)[0123456789](?:\s*)(\d(?:\s*)){8})[qQ](.+?)(\d(?:\s*)){7}|http(s)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?</Disablepostadregular>
<Whosonlinecontract>0</Whosonlinecontract>
<Postnocustom />
<Iisurlrewrite>0</Iisurlrewrite>
<Notificationreserveddays>7</Notificationreserveddays>
<Maxindexsubforumcount>0</Maxindexsubforumcount>
<Deletingexpireduserfrequency>5</Deletingexpireduserfrequency>
<Replynotificationstatus>1</Replynotificationstatus>
<Replyemailstatus>1</Replyemailstatus>
<Disallowfloatwin />
<Allwoforumindexpost>1</Allwoforumindexpost>
<Onlineoptimization>0</Onlineoptimization>
<OnlineUserCountCacheMinute>0</OnlineUserCountCacheMinute>
<AvatarMethod>1</AvatarMethod>
<Msgforwardlist>posttopic_succeed,editpost_succeed,postreply_succeed</Msgforwardlist>
<Quickforward>1</Quickforward>
<PostTimeStorageMedia>0</PostTimeStorageMedia>
<Disableshare>1</Disableshare>
<Sharelist>0|kaixin001|开心|1,1|sina|新浪微博|1,2|renren|人人|1,3|douban|豆瓣|1,4|sohu|白社会|1,5|qq|qq书签|1,6|google|google书签|1,7|vivi|爱问收藏|1,8|live|live收藏|1,9|favorite|收藏夹|1,10|baidu|百度收藏|1</Sharelist>
<Alipayaccout />
<Alipaypartnercheckkey />
<Alipaypartnerid />
<Tenpayaccout />
<Tenpaysecretkey />
<Usealipaycustompartnerid>0</Usealipaycustompartnerid>
<Usealipayinstantpay>0</Usealipayinstantpay>
<Cashtocreditrate>1</Cashtocreditrate>
<Mincreditstobuy>0</Mincreditstobuy>
<Maxcreditstobuy>1000</Maxcreditstobuy>
<Userbuycreditscountperday>15</Userbuycreditscountperday>
<Shownewposticon>1</Shownewposticon>
<Jqueryurl>/javascript/jquery.js</Jqueryurl>
<Antispamregisterusername>username</Antispamregisterusername>
<Antispamregisteremail>email</Antispamregisteremail>
<Antispamposttitle>title</Antispamposttitle>
<Antispampostmessage>message</Antispampostmessage>
<Antispamreplacement />
<Verifycode />
<Installation>0</Installation>
<Emaillogin>1</Emaillogin>
<Ratelisttype>0</Ratelisttype>
</GeneralConfigInfo>
补充:.NET技术 , ASP.NET