Number of visitors Count is resetting to 0 every one hour for website in asp.net c# -


visitors count resetting every 1 hour zero.

i need total number of visitors website each day. can store total count in db per day.

protected void session_start(object sender, eventargs e) {     application.lock();     application["sitevisitedcounter"] = convert.toint32(application["sitevisitedcounter"]) + 1;     application.unlock(); } 

is there other way store total number of visitors per day??

as marcusvinicius answered here

you configure periodic restart settings application pool recycling in iis:

the element contains configuration settings allow control when application pool recycled. can specify internet information services (iis) 7 recycle application pool after time interval (in minutes) or @ specific time each day. can configure iis base recycle on amount of virtual memory or physical memory worker process in application pool using or configure iis recycle application pool after worker process has processed specific number of requests.

but has side-effect of putting application offline during time pool restarting, if have user connected @ time lose session. can minimized restarting application @ time have no users connected, @ dawn.

the following config snippet set application pool daily recycle @ 3:00 a.m.:

<add name="example">    <recycling logeventonrecycle="schedule">      <periodicrestart>        <schedule>           <clear />           <add value="03:00:00" />         </schedule>      </periodicrestart>    </recycling>  <processmodel identitytype="networkservice" shutdowntimelimit="00:00:30" startuptimelimit="00:00:30" /> </add> 

(or)

application not permanent object. created once application starts (e.g first session started) , disposes of after application pool times out. can either persist variable or change idle time-out parameter in apppool

(iis=>application pools => apppool (or defaultapppool if haven't defined one)=> advanced settings => idle time-out).


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -