Click here to Skip to main content
15,883,887 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: get html element value has made runtime Pin
Not Active16-Aug-11 9:42
mentorNot Active16-Aug-11 9:42 
GeneralRe: get html element value has made runtime Pin
Shameel16-Aug-11 21:21
professionalShameel16-Aug-11 21:21 
GeneralRe: get html element value has made runtime Pin
Not Active17-Aug-11 2:22
mentorNot Active17-Aug-11 2:22 
QuestionTHREE TIER in ASP.NET WEBSERVICES Pin
sheemap14-Aug-11 11:51
sheemap14-Aug-11 11:51 
AnswerRe: THREE TIER in ASP.NET WEBSERVICES Pin
#realJSOP15-Aug-11 7:48
mve#realJSOP15-Aug-11 7:48 
GeneralRe: THREE TIER in ASP.NET WEBSERVICES Pin
sheemap15-Aug-11 7:53
sheemap15-Aug-11 7:53 
SuggestionRe: THREE TIER in ASP.NET WEBSERVICES Pin
RMohit25-Aug-11 0:21
RMohit25-Aug-11 0:21 
QuestionIssue with Background tasks on remote server but works fine locally Pin
tauseef rashid kazi13-Aug-11 16:21
tauseef rashid kazi13-Aug-11 16:21 
Hi,

I have an asp.net application wherein we are suppose to Mail stored items i database to clients at a particular time in a day i have constructed a task that runs when application starts using global.asax application_start function.
the logic works fine when tested on local IIS or using testing server, however when this application is deployed on remote IIS it does not work at all as no mails are send from the remote IIS. I tried below two different technique that worked well on local machine but failed remotely:

Solution 1: Using Threading model where code is as follows (global.asax)

01.//Declaration goes here.
02.Thread SendEmail, CleanOld, MassMailer;
03. 
04.void Application_Start(object sender, EventArgs e)
05.{
06.   //// Code that runs on application startup
07.   SendEmail = new Thread(ArticleEmailTask);
08.   SendEmail.Start();
09.}
10. 
11.void ArticleEmailTask()
12.{
13.    //allow System to load for 5 min.700000
14.    System.Threading.Thread.Sleep(700000);
15.    while (true)
16.    {
17.      if (DateTime.Now.Hour >= 9 && DateTime.Now.Hour <= 10)
18.      {
19.         //Do some Mail sending work
20.      }
21.      else
22.      {
23.        // wait until next time span
24.        System.Threading.Thread.Sleep(3500000);
25.      }
26.    }
27.     
28.}


Solution 2: Using Caching Background Task where code is as follows (global.asax)

01.protected void Application_Start(object sender, EventArgs e)
02.{
03.  AddTask("DoStuff", 120);
04.}
05.private static CacheItemRemovedCallback OnCacheRemove = null;
06. 
07.private void AddTask(string name, int seconds)
08.{
09.  OnCacheRemove = new CacheItemRemovedCallback(CacheItemRemoved);
10.  HttpRuntime.Cache.Insert(name, seconds, null,
11.  DateTime.Now.AddSeconds(seconds), Cache.NoSlidingExpiration,
12.  CacheItemPriority.NotRemovable, OnCacheRemove);
13.}
14. 
15.public void CacheItemRemoved(string k, object v, CacheItemRemovedReason r)
16.{
17.  // do stuff here if it matches our taskname, like WebRequest
18.  // re-add our task so it recurs
19.  DoSomeFileWritingStuff();
20.  AddTask(k, Convert.ToInt32(v));
21.}
22. 
23.private void DoSomeFileWritingStuff()
24.{
25.  clsMassMailer objMassmailer = new clsMassMailer();
26.  objMassmailer.NewMassMailTask();
27.}


Kindly advice as soon as possible,
thanks in advance.
AnswerRe: Issue with Background tasks on remote server but works fine locally Pin
Bernhard Hiller17-Aug-11 0:41
Bernhard Hiller17-Aug-11 0:41 
Questiontut's For Newbie's Pin
David C# Hobbyist.13-Aug-11 10:15
professionalDavid C# Hobbyist.13-Aug-11 10:15 
AnswerRe: tut's For Newbie's Pin
Blue_Boy13-Aug-11 16:05
Blue_Boy13-Aug-11 16:05 
GeneralRe: tut's For Newbie's Pin
David C# Hobbyist.13-Aug-11 16:13
professionalDavid C# Hobbyist.13-Aug-11 16:13 
AnswerRe: tut's For Newbie's Pin
Richard MacCutchan13-Aug-11 22:15
mveRichard MacCutchan13-Aug-11 22:15 
Questioncss and mobileadapter Pin
amer shammout12-Aug-11 23:34
amer shammout12-Aug-11 23:34 
AnswerCROSS POST Pin
Not Active13-Aug-11 5:49
mentorNot Active13-Aug-11 5:49 
QuestionOverride Page.Theme directory Pin
econner12-Aug-11 19:15
econner12-Aug-11 19:15 
Questiontable and timer [modified] Pin
bhujith12-Aug-11 6:40
bhujith12-Aug-11 6:40 
AnswerRe: table and timer Pin
Not Active13-Aug-11 5:47
mentorNot Active13-Aug-11 5:47 
QuestionGet hidden Excel sheet names [modified] Pin
padmanabhan N11-Aug-11 18:22
padmanabhan N11-Aug-11 18:22 
AnswerRe: Get hidden Excel sheet names Pin
Dalek Dave14-Aug-11 21:43
professionalDalek Dave14-Aug-11 21:43 
Questionnice Forums [modified] Pin
sivakumat11-Aug-11 1:27
sivakumat11-Aug-11 1:27 
Questioncomment box Pin
bhujith11-Aug-11 0:41
bhujith11-Aug-11 0:41 
AnswerRe: comment box Pin
Not Active11-Aug-11 1:46
mentorNot Active11-Aug-11 1:46 
GeneralRe: comment box Pin
Morgs Morgan11-Aug-11 2:36
Morgs Morgan11-Aug-11 2:36 
GeneralRe: comment box Pin
Not Active11-Aug-11 3:01
mentorNot Active11-Aug-11 3:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.