The cause of the "instance of the object not referenced" error caused by URL rewriting (urlrewriter)

Source: Internet
Author: User

Recently, a project with URL rewriting went online and found that the error "the instance of the object is not referenced" sometimes occurs. After refreshing the page, the error disappears, but it will appear again later. the time of the intermediate interval is uncertain.
After one day of error capture, it is determined that this error occurs because of the loss of data cache. The data obtained through the cache is converted to null during use, resulting in errors.
I commented out the cache and there was no error.
But let's look at me.ProgramThe data was added to the cache before the cache was used, and then obtained immediately. What is the problem? I suspect there is a problem with the reference.
For testing, I set this part of cache access to system. Web. caching. cacheitempriority. notremovable. After that, no problem occurs.
Therefore, it should not be a reference error, but an inexplicable cache is cleared. However, after the cache is forcibly retained, no problem occurs.

The error is recorded here. Why? I will study it later. If you have any understanding, let's talk about it :)

// channelindexareas
If (cacheisinvaild (channelcachekey. channelindexareas)
{< br> cacheadddata (channelcachekey. channelindexareas, DT, channelcachekey. maxspan);
}< br> datatable dt = cachegetdata (channelcachekey. channelindexareas);

// channelindexmorelinks
If (cacheisinvaild (channelcachekey. channelindexmorelinks)
{< br> cacheadddata (channelcachekey. channelindexmorelinks, dtmore, channelcachekey. maxspan);
}< br> datatable dtmore = cachegetdata (channelcachekey. channelindexmorelinks);

// Channelindexsubtitles
If (cacheisinvaild (channelcachekey. channelindexsubtitles ))
{
Cacheadddata (channelcachekey. channelindexsubtitles, dtsubtitle, channelcachekey. maxspan );
}
Datatable dtsubtitle = cachegetdata (channelcachekey. channelindexsubtitles );

// Zikao _ area16 isn't null cache is null: the object reference is not set to the instance of the object
// The error is determined as cache loss, which may be caused by URL rewriting. The specific cause is unknown.
Try
{
Switch (item. itemtype)
{
Case edushop. Main. Business. appcontrol. channelitemtype. Area:
Fillarea (item, DT );
Break;
Case edushop. Main. Business. appcontrol. channelitemtype. Subtitle:
Filltitle (item, dtsubtitle, dtmore );
Break;
}
}
Catch (exception E)
{
Error = new error ();
String itemnull = (item = NULL? "Is null": "isn' t null ");

string cachenull = "cache isn't null";
If (Dt = NULL | dtsubtitle = NULL | dtmore = NULL)
cachenull = "cache is null";
error. logmessage = string. format ("{0} {1} {2 }:{ 3}", item. ID, itemnull, cachenull, E. message);
error. username = "channel page error Collector";
errornormal. insert (error);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.