C# - Continuously Running Thread In Web Application?

Mar 31, 2011

i want a continously running thread in my web application for sending mail to admin if the logged complaint of the user in not solved by technician within 24 hours.

i am able to send mail to administrator

i just want a watch on database for unsolved issues with timespan of more than 24 hours and inform to administrator about the same

View 3 Replies


Similar Messages:

Does The Continuously Running Thread In Background Impact The Website's Performance

Feb 3, 2011

In my website I am using thread to perform the function which downloads the CSV from a website and parses the data into the database.

Now if I am not able to stop the thread then what could be the impact on the performance?

Also If I unknowingly start another thread then would it impact my website's performance?

View 3 Replies

How To Start A New Thread To Query A Database While Web Application Continues Running

Feb 11, 2011

I want to start a new thread to query a database while my web application continues running. I was under the impression that by using threads I can run the querying process independently while the normal web application page cycle carries on, but I could be wrong.

public class DbAsyncQuery
{
Dictionary<string, object> serviceResults = new Dictionary<string, object>();
public void UpdateBillingDB()
{
QueryAllServices();
foreach (KeyValuePair<string, object> p in serviceResults)
{
IEnumerable results = (IEnumerable)p.Value;
IEnumerable<object> sessions = results.Cast<object>();
DbUtil.MakeBillingDBEntry(sessions, p.Key);
}
}
public static string[] servicesToQuery = new string[] // Must go in config file ultimately
{
"xxx.x.xxx.xx"
};
public delegate void Worker();
private Thread worker;
public void InitializeThread(Worker wrk)
{
worker = new Thread(new ThreadStart(wrk));
worker.Start();
}
public void InitializeQuery()
{
Worker worker = QueryAllServices;
InitializeThread(worker);
}
private void QueryAllServices()
{
Dictionary<string, DateTime> lastEntries = DbUtil.GetLastEntries();
foreach (string ip in servicesToQuery)
{
string fullServicePath =
"http://" + ip + ":800/MyWebService.asmx";
//object[] lastEntry = new object[] { lastEntries[ip] };
object[] lastEntry = new object[] { new DateTime(2011, 1, 1, 0, 0, 0) };
object obj = WebServiceHandler.CallWebService
(fullServicePath, "MyWebService", "GetBillingDBEntries", lastEntry);
serviceResults.Add(ip, obj);
}
}
}

It seems to basically stall and wait to finish the query before loading the page (which can be thousands of rows, so it takes awhile). I put this in the following section of Global.asax:

protected void Application_Start(object sender, EventArgs e)
{
DbAsyncQuery query = new DbAsyncQuery();
query.UpdateBillingDB();
}

This is one of my first web pages, and I'm new to threading. I understand there is a difference between creating your own thread and using the ThreadPool. In this method, I am using my own thread, I think. Not sure if that's the best way. The querying process can be completely independent, and its only going to occur on scheduled intervals (every 8 hours or so). The user doesn't need to have up to the minute data, so it can take awhile. I just don't want the site to wait for it to finish, if that's possible.

View 1 Replies

How To Optimize The Performance Of A Thread Running In Background

Feb 4, 2011

In my website, I am using thread to perform a repetitive process in background. Now the process takes around 30 to 45 seconds to update the database.

Basically the function performs the following:

1) Download the CSV from a website.

2) Parse the CSV and update the database tables.

I want to optimize the performance and decrease the time it takes to 15 seconds.

How can I do this?

EDIT:

Here is the Code:

[code]....

View 1 Replies

ThreadPool Thread Running As User =ASPNET

Nov 24, 2010

I have a web service that uses ThreadPool to delegate a task to a thread but it runs on ASPNET (System.Environment.UserName) while the main thread runs as windows account. How can I make this thread run with same windows account. Note that I have impersonate=true in web.config. This is causing problems accessing database.

View 1 Replies

Getting Website's URL Without HttpContext.Current (running In Background Thread)?

Aug 3, 2010

Bit of a long shot, but is there a way in ASP.NET to dynamically get the website's URL [URL] when there is no HttpContext.Current available.

There is no HttpContext because the code is running in a background thread* (but under the ASP.NET AppDomain). I have a background process that sends emails out every evening, and needs to include the Web address, but I don't want to hard code it because of deployments and testing (it changes from [URL] to[URL] and then to [URL] for the live site).

View 2 Replies

Cross-thread Operation Not Valid: Accessed From A Thread Other Than The Thread It Was Created On

Apr 2, 2010

I want to remove checked items from checklistbox (winform control) in class file method which i am calling asynchronously using deletegate. but it showing me this error message:-

Cross-thread operation not valid: Control 'checkedListBox1' accessed from a thread other than the thread it was created on.

i have tried invoke required but again got the same error. Sample code is below:

[code]....

View 1 Replies

Application Domain Vs Thread - Relationship?

Mar 29, 2010

Can someone explain me what is is the relationship between App Domain and thread? msdn says "threads are free to cross application domain boundaries; a new thread is not created for each application domain." suppose there is one thread t inside Appdomain a1 .there is an another App domain a2 .thread t can cross to a2 from a1 means it can access a2 memory area If thread can cross the app domain boundaries share the memory space then how application domain isolation is still there?

View 5 Replies

Multithreading - Want To Create A Thread In A Mvc Application?

Nov 5, 2010

I want to create a thread in a asp.net mvc application. What will happen?

A) Thread will die when request ends and the response is sent.

B) Thread will continue to run and response will be sent when thread terminates.

C) Thread will run without blocking the response and die when it have completed it's task

View 1 Replies

C# - Load Data To Application Domain Using A Thread?

Jan 22, 2011

I want to load data to my application domain using a thread so it will be executed at all times. How can I achieve this? I want the thread will start when iis starts and terminate when iis exits.

Note:

I want to do this so I can use disconnected architecture in my asp.net application.

View 1 Replies

C# - Async Function Thread.Sleep In Web Application?

Sep 8, 2010

I maintain a ASP.NET web application that causes a user's network connection to reset for several seconds when it executes a procedure. Therefore, the page request times out on the user's end as they never receive the web application's response (the connection dies before it gets the response packet).

To resolve this situation, I was contemplating having the ASP.NET page execute an asynchronous function that incorporates a Thread.Sleep(5000); // sleep for 5 seconds before executing the connection reset This way, the browser has 5 seconds to receive the page's response before their connection resets.

I have concerns with using Thread.Sleep and asynchronous functions in ASP.NET though. I've never attempted to do it before, so I'm unsure of the potential problems it may cause. Does anyone see potential problems with starting an asynchronous thread that contains a Thread.Sleep in an ASP.NET application?

View 3 Replies

MVC :: Identity.Name Is Disposed In IIS7 Application Thread?

Jun 16, 2010

I don't know if it's IIS, ASP.NET or IIS7 related. I take a chance here, if you think I'm in the wrong forum, just tell me which one I should post to.

I have made the smallest demo project to illustrate my problem. You can download the sources

Here

Visual Studio 2008, .NET 3.5, IIS7, Windows 7 Ultimate 32 bits. The IIS Website is configured
ONLY for Windows Authentication in an Integreated pipeline app pool (DefaultAppPool).

Here's the problem. I have an Asp.NET MVC 2 application. In an action, I start a thread. The View returns.

The thread is doing it's job... but it needs to access Thread.CurrentPrincipal.Identity.Name

BANG

The worker process of IIS7 stops. I have a window that says: "Visual Studio Just-In-Time Debugger An unhandled exception ('System.Object.DisposedException') occured in w3wp.exe [5524]"

I checked with the debugger and the Thread.CurrentPrincipal.Identity is valid, but the Name property is disposed.

If I put a long wait in the action before it returns the view, then the Thread can do it's job and the Identity.Name is not disposed. So I think the Name gets disposed when the view is returned.

For the sake of the discussion, here's the code that the thread runs (but you can also download the demo project. The link is on top of this post):

[Code]....

Here's the code that starts the thread

[Code]....

View 3 Replies

Visual Studio :: Debug A Multi Thread Program To See Local Variables Of Each Thread Using 2008

Jan 27, 2010

How can we debbug a multi-thread program to see local variables of each thread using visual studio 2008.

View 1 Replies

Architecture :: How Can Thread Update A Variable Shared With The Main Thread

Nov 24, 2010

I'm new to threading and have used it successfully, but limited. I can spawn a thread and have the main thread reference variables in the spawned thread, but I don't know how to allow the spawned thread to reference (and update) variables in the main thread.

Any example threading code I've seen on the web appears to be WAY more complicated than what I do, so I am unable to understand or integrate into my code.

Here is a quick example of how I use threading:

[code].....

View 3 Replies

Create A 'thread' To Execute A Function On Page Load / Application Start?

Jan 10, 2011

I need to call a function everytime a visitor visits one of my website's page. But I do not want the execution of the function to interfere with the interface between the user and the website i.e. different thread. What is the best way to do that on ASP.Net?

View 3 Replies

Data Controls :: ProgressBar Thread With Database In Windows Forms Application

May 22, 2013

How to use progressBar with thread in windowsApplication..

I have a for loop in c# layer when loop start progressBar with start and  when loop finish progressBar is full ???

View 1 Replies

C# - Unloading An Application Can Affect Another Running Application?

Oct 12, 2010

Application domains allow applications to be unloaded separately. My question is how unloading an apllication can crash another application.

View 2 Replies

What Are The Differences Between Currently Executing .NET Thread And Win32 Thread

Mar 24, 2010

I am reading the Asp.net security documentation on msdn.I come across these tow terms and get really confused.

# WindowsIdentity = WindowsIdentity.GetCurrent()

which returns the identity of the security context of the currently executing Win32 thread.

# Thread = Thread.CurrentPrincipal

which returns the principal of the currently executing .NET thread which rides on top of the Win32 thread.

View 1 Replies

C# - Lock Thread.sleep Not Working With .NET Thread?

Jun 25, 2010

I have a password page and when someone enters an incorrect password I want to simply foil a brute force attack by having

bool isGoodPassword = (password == expected_password);

lock (this)
{
if (!isGoodPassword)
Thread.Sleep(2000);
}
I would expect that this would allow all correct passwords without stalling, but if one user enters a bad password another successful password from a different user would also be blocked. However, the lock doesn't seem to lock across ASP.NET threads.

View 4 Replies

Web Forms :: Use Thread.sleep Method For A Particular Thread?

Aug 27, 2010

I want a example of multithreading .i want to use it in a web form not on console.i am using C#.net .and how to use thread.sleep method for a particular thread.

View 5 Replies

C# - Application Running Under A Less Privileged Account Start A Process Executing Another Application Under An Administrative Account?

Mar 9, 2011

I am logged in as the administrator when I installed an application named pdflatex.exe on my server. This application works as a converter from LaTeX input file to Pdf file. I host an Asp.net MVC 3 application running under an Application Pool Identity with Load User Profile = True. The Asp.net MVC 3 code contains a code that executes pdflatex.exe using System.Diagnostic.Process instance as follows:

Process p = new Process();
p.EnableRaisingEvents = true;
p.Exited += new EventHandler(p_Exited);
p.StartInfo.Arguments = "-interaction=nonstopmode " + inputpath;
p.StartInfo.WorkingDirectory = @"c:mydomain.comworking";
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "pdflatex.exe";
p.Start();
p.WaitForExit();

From the scenario above, the web application runs under a restricted acount but it executes an external application under a default account that I don't know. Can an application running under a less privileged account start a process executing another application under an administrative account?

View 2 Replies

C# - Continuously Updating Chat Messages?

Jan 2, 2011

I'm creating a very simple chat application. It has an ASP.NET web page as front-end and a WCF service as back-end for storing the messages to a database.Everything works great except one thing; when Browser A enters a chat message I want Browser B to see the message as soon as possible (yeah, I know, that's the purpose of a chat).What I've done so far is to setup a trigger within the UpdatePanel, like this:

<Triggers>
<asp:AsyncPostBackTrigger ControlID="chatTimer" EventName="Tick" />
</Triggers>

which uses a timer:

<asp:Timer ID="chatTimer" runat="server" OnTick="chatTimer_Tick" Interval="1000" />

Is this the best approach or is there a better, yet simple, way to accomplish updating of messages. One drawback with this solution is that the textbox used to enter chat messages loses focus every time the Tick event runs.

View 3 Replies

Installation :: Running 4.0 Application On IIS 5.1?

Sep 19, 2010

I created a simple .NET 4.0 WebSite through VisualStudio 2010 using the Installed Template for ASP.NET Web Site.This brought me to "Choose Location" where I chose Local IIS, then Create New Web Application.This created the template app with all of the local files within IIS.This complies fine, but Im constantly getting the HTTP 403 Error "the website declined to show this webpage"I checked IIS properties for this and its set to 4.0 and the Directory Security has Anonymous Access enabled. Allow IIS to control password is also checked.I just installed VS 2010 on my new computer, and Im trying to get this configured so I can run 4.0 apps through IIS.

View 2 Replies

Error While Running Application

Sep 17, 2010

I am getting below error while running the application

Exception in MS Oracle DAAB Method - GetDataSet : Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "DABResource.resources" was correctly embedded or linked into assembly "DBServices" at compile time, or that all the satellite assemblies required are loadable and fully signed.

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.Exception: Exception in MS Oracle DAAB Method - GetDataSet : Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "DABResource.resources" was correctly embedded or linked into assembly "DBServices" at compile time, or that all the satellite assemblies required are loadable and fully signed.

View 5 Replies

Error When Running Application In IIS

Mar 24, 2010

I have an application in asp.net.I configured it in IIS.When i running this application in IIS i getting an error;

Server "/" error:
Resource Cannot be Found
Error:404

Some of pages only produce this issues.Other forms are working perfectly.Without running application in IIS Its working perfectly.
If any one can answer send the answer immediatly.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved