Web Forms :: Implementing The Threadpool Concept And Have Doutbt In Threads Being Created

May 14, 2010

Am implementing the threadpool concept and have doutbt in threads being created.

[Code]....

Initially i gave (1,1) in semaphores and only one thread was created and it did only one task, and (5,5) created one thread and it used for all the times.

Is ter anything wrong in wat i did or any other way of doin other than semaphores. And mainly wat abt the remaining 20 threads in threadpool? its a waste of CPU right. Can i create only 5?

View 6 Replies


Similar Messages:

Implementing OpenId In Custom Application Where Users Are Created By Administrator Only?

Feb 16, 2011

In my asp.net application, users are created by the administrators & those users need to log-in into the system using their own email/password or openid. So what is the best option to implement in this scenario?

I mean, as users can't register them self,do administrator required to associate each openid with the users & what kind of table structure do I need?

And do I also need the log-in interface like that of [URL] showing multiple types of authentication(default & openid from various providers)?

View 1 Replies

Thread ID From ThreadPool.QueueUserWorkItem?

May 18, 2010

after invoking an async method using ThreadPool.QueueUserWorkItem how do i lookup the assigned thread id?

View 4 Replies

Caching - .NET CacheDependency Out Of ThreadPool

Feb 19, 2010

In an async http handler, we add items to the ASP.NET cache, with dependencies on some files. If the async method executes on a thread from the ThreadPool, all is fine:

AsyncResult result = new AsyncResult(context, cb, extraData);
ThreadPool.QueueUserWorkItem(new WaitCallBack(DoProcessRequest), result);

But as soon as we try to execute on a thread out of the ThreadPool:

AsyncResult result = new AsyncResult(context, cb, extraData);
Runner runner = new Runner(result);
Thread thread = new Thread(new ThreadStart(runner.Run());

... where Runner.Run just invokes DoProcessRequest,

The dependencies do trigger right after the thread exits. I.e. the items are immediately removed from the cache, the reason being the dependencies.We want to use an out-of-pool thread because the processing might take a long time.

So obviously something's missing when we create the thread. We might need to propagate the call context, the http context...

Note: off-the-shelf custom threadpools probably solve this. Writing our own threadpool is probably a bad idea (think NIH syndrom). Yet I'd like to understand this in details, though.

View 1 Replies

C# - ThreadPool.QueueUserWorkItem Causes App To Hang Until Finished?

Dec 10, 2010

This may be due to a lack of understanding of what's going on under the hood or simply a lack of understanding of threading in general. When a user logins I need to run some tasks that call web services to update data in my system. Since the services could take a considerable amount of time I thread the entire process. However, even though I think I'm running the whole series of tasks in a thread separate from my application, my application waits until the called function is finished before it proceeds.

WindowsIdentity identity = WindowsIdentity.GetCurrent();
Manager manager = (Manager)Session["Manager"];

ThreadPool.QueueUserWorkItem(new SafeWaitCallback().Call(identity, delegate(object noCallBack)
{
manager.RunAccountUpdater(identity);
}));

The application hangs until the function "RunAccountUpdater" is finished and the callback occurs. What am I doing wrong/not understanding?

View 1 Replies

Using Threadpool.QueueWorkItem In Asnychronous Handler

Mar 28, 2011

This MSDN example for an Asynchronous Handler starts the new thread using ThreadPool.QueueUserWorkItem.

I thought that you should not use ThreadPool.QueueUserWorkItem to start the new thread as the thread is taken from the ASP.net thread pool and defeats the purpose of using an Asynchronous handler.

Is the example wrong?

View 1 Replies

Web Forms :: ObjectDataSource Concept - From Where Data Is Pulling

Feb 17, 2010

I was hired to do some contract work for a short contract. I am looking at this code on this Aspx web form. What they do is load the labels for a radio button list from an ObjectDataSource object. Well this is the first time I have ever heard of an ObjectDataSource. The problem is that I don't even know where this object is pulling data from. With a SqlDataSource object, I can easily view the flyout menu to see the sql query where the data is being pulled from. Anyway, I need some figuring out where objectDataSourcePlanType lives and where it is pulling data from. I know I can't list the entire project, but I am sure someone who is familiar with ObjectDataSource

<tr>
<td>Type of Plan</td>
<td><img alt="Required" src="/Images/arrow.png" /></td>
<td>
<asp:RadioButtonList ID="radioButtonListPlanType" runat="server" AutoPostBack="True" DataSourceID="objectDataSourcePlanType"
DataTextField="PlanTypeName" DataValueField="PlanTypeId" OnSelectedIndexChanged="RadioButtonListPlanType_SelectedIndexChanged"
RepeatColumns="1" RepeatDirection="Vertical" AppendDataBoundItems="true">
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="requiredFieldValidator10" runat="server" ControlToValidate="radioButtonListPlanType" ErrorMessage="Type
of Plan is required."
SetFocusOnError="true" />
<asp:ObjectDataSource ID="objectDataSourcePlanType" runat="server" SelectMethod="ListPlanTypes" TypeName="Candle.Web.PlanRequest.CommonWeb">
</asp:ObjectDataSource>
</td>
</tr>

View 2 Replies

Signaling Web Page When ThreadPool Thread Is Completed?

Aug 25, 2010

From a web page I start a time consuming job and update it's status on the UI using webmethod.

Job is done in a thread:

ThreadPool.QueueUserWorkItem(new WaitCallback(DoJob), parameters); Job set's it status using static properties, and when web page, using javascript, calls web method it read those properties.

[System.Web.Services.WebMethod]
public static ProcessStatus GetProgressStatus()
{
Jober.Lock.EnterReadLock();
ProcessStatus st = new ProcessStatus(Jober.PercentageCompleted, Jober.TotalNumber);
Jober.Lock.ExitReadLock();
return st;
}

The UI progress is updated through javascript, the problem is that after thread completes I need to update UI on server side, so javascript won't help me here. What Is the best way to signal when thread is completed?

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

Multithreading - .net ThreadPool - Long Running Operation.

Jan 27, 2010

My application is a asp.net 3.5 running on iis 6 (windows 2003)

This application is serving 1000's of users daily (100-500 users online).

I want to send an email newsletter to customers weekly.

Around 200,000 emails every time.

This is the code im using:

ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncProcessMailerQueue), null);

private static void AsyncProcessMailerQueue(object data)[code]....

When testing this locally (on my dev machine) i see the application is working alot slower.

Is there a better way to write this code? Should i use ThreadPool.QueueUserWorkItem or create a new thread using Thread t = new Thread(new ThreadStart(DoWork)); ? Will it be better to create a totally seperate application for the purpose of sending the newsletters. will that help if ill run this application on the same machine?

i've seen other posts here talking about ThreadPool vs Thread but its seem no one is sure which is better.

View 3 Replies

Web Forms :: How To Synchronize Users Requests / Threads

Feb 6, 2011

I have what I consider a pretty complex situation that I am not sure if it can even be accomplished via an ASP.NET web application. (I am using aps.net 4.0) But what I want to do is design a "online auction site" that can handle many autions running at the same time. So I can only imagine eBay and all the other millions of auction sites out there are all doing this someway or another. My biggest concern is that I want to make sure the design here to make the site as effiecent as possible. Here is specifically what I am trying to figure out.

I think I need to create an object (per active auction) that stays in memory for the life of the auction. This object would have at least the following information:

Aution ID, time remaining, highest bidder id, bid price, Thread Control Variable, etc...

Now here is the tricky part that I think is vital for auction sites. Lets say you have 500 users on my website that are all watching the same auction and it is getting down to the last second of the auction and they all click to place a bid at the same time. Keep in mind this may also be at the same time hundreds of other users are placing bids for other auctions going on all at the same time.

How do I get all these requests (bids), for a single auction, lined up so that they are processed "one at a time"? But some how I need to be able to make all requests wait in a queue until it is their "turn" then I would need to be able to update the in memory object, write a record into a SQL database and then begin returning information back to each user.

Based on other development languages I have used in the past I know their were objects that I could create that could be used to get multiple threads to run in order (in other words syncronized). Usually it would be a case where I would be listening on a server socket and could do something like ThreadVariable.Lock, <process the request>, thenThreadVariable.Unlock. What that would do, is force all threads that tried to call ThreadVariable.Lock to wait until no other threads had the variable locked then it could proceed. Obviously the code it processes between the lock and unlock should be as quick and effecient as possible so it does not create a major traffic jam.

Because my thinking is this "object" I am referring to as being in memory, most likely will play a big role in answering the question about getting the requests in a "one at a time" situation it may be the focus of the question is more like how would I create "an object" and store it in memory to be quickly and easily accessed?

And even more generically does this even sound like I am on the right track

I think the topic of "communication to and from users" will need to be a completly different thread.

View 5 Replies

Web Forms :: Restric Multiple Download Concept Implemented By Rapidshare And Hotfile

Feb 8, 2010

rapidshare,hotfile and many site they restric user to download more than one file at a time. what is their concept and how can i implement this concept by asp.net

View 1 Replies

Forms Data Controls :: Bind Gird Using The Bindlinglist Concept Of Generic Class?

Oct 13, 2010

I want to bind grid using Bindlist(Generic class) and also ensure it does not have an impact on performance of the page.

View 2 Replies

Asp MVC Vs. Asp Web Forms / Breaking Code Design Into 3 Layers (presentation, Dal And Business) Meets MVC Concept?

Dec 20, 2010

I'm a junior programmer, i do not get the concept of MVC! My method of coding is seperating my application design into 3 layers:

Presentation Layer
Business Layer
Data Access Layer

I find it very practical to a junior developer or at least to me, so i do not really get the point of MVC since i believe MVC just tries to separate logic from UI. Right?

I decided to have this book to help me have a better idea on code design:

http://www.amazon.com/Professional-ASP-NET-Design-Patterns-Millett/dp/0470292784/ref=sr_1_1?ie=UTF8&qid=1292836936&sr=8-1

Note: i also decided to start learning about TDD.

QUESTION:

Is breaking my code design into 3 layers (presentation, dal and business) meets MVC concept?

View 4 Replies

Concept Of Sessioncookies To Asp.net?

Dec 20, 2010

I am new to ASP.Net i dont understand the concept of sessioncookiesWhat is a sessioncookie,what are the advantages of sessioncookie whats is sessioncookie is all about,how to create a sessioncookie,how to retreive values from sessioncookies,how to store values in sessioncookies.i searched in net but i dont get clear idea about the sessioncookie concept can anyone pls clarify whats is sessioncookies and its concepts and provide some code samples if possible.

View 2 Replies

Want To Learn Each Concept Of Enum In .net?

Apr 28, 2010

i am fresher, so i want to learn Enum deeply.

What is enum, when to use it and why to use it?

Because i want to clear from basic. Infact i want to become my basic concepts strong in OOPS, Collections.

View 4 Replies

Need A Brief Description And Concept That What Is Event Mapping

Oct 13, 2010

I need a brief description and concept that what is event mapping in Asp.Net?

If you have any useful link tell me. Write here if you know about this

View 3 Replies

Concept Of Datakeyname In Grid View?

May 16, 2010

i wanna know the concept of datakey name in grid view how its work...

when we connect it to the sqldatasource when i updata the field

i write the following code:

<asp:SqlDataSource ID="datasource1" ProviderName="System.Data.SqlClient" runat="server" ConnectionString="<%$ConnectionStrings:ConnectionS tring%>" SelectCommand="Select * From ManageClient"
UpdateCommand="Update ManageClient Set ClientName=@ClientName,Address=@Address,MobileNo=@ MobileNo,Image=@Image Where ClientId=@ClientId"></asp:SqlDataSource>

in the above code we donot use <updateparameter> tag can u explain why

when i connect it to the grid view & i keep the datakeynames="ClientId"

View 3 Replies

Insert Data By Using Linq To Sql Concept?

Feb 15, 2011

I am trying to insert the data via linq to sql concept. i wrote down the code like this. here customers is the table name in which i want to insert the data. How to achieve it? following code is not working. How to insert the data via this concept.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim context As New linq_to_sql_classesDataContext
Dim custid As New Customer
custid.CustomerID = Trim(txt_custid.Text)

[Code]....

View 2 Replies

How To Manage Threads In A C# Web App

Jan 6, 2011

I built a little web application that displays charts. I was thinking that it might be useful for the superuser of the app to do a complete data refresh, however this process takes around 10 minutes to complete. I was thinking perhaps the user could click a button that would start off a new thread to do a data refresh and subsequent clicks would kill the thread and restart the data population process. The user would then be free to browse about the site and view the charts as their data is populated.

Is there a simple method of accomplishing something like this?

View 3 Replies

.net - Inheritance Concept - Inherit Private Methods And Use Them?

Aug 2, 2010

Let's say in ASP.NET you have a base page class which defines a private Page_Load method which handles Page.Load. All aspx pages in your project inherit from this base page class. In this case the aspx pages would be able to call this private method. However it does not feel right that private methods can be called outside its own class? If so, privates methods cannot be hidden from outside?

View 1 Replies

Security :: Use The Concept Of Single Sign On (SSO) In Asp Application?

Sep 30, 2010

I am trying to use the concept of Single Sign On (SSO) in my asp.net application.

for the purpose i have created a main domain say
mydomain.com.

now i have 2 subdomains
sub1.mydomain.com & sub2.mydomain.com.

I am running these very fine. But now I want to have a SSO for my domains. For the same have

googled lot and found some stuff such as adding machine key to web.config and specifying domain names in cookies.

But it is not at all working for me. when I specify the domain name for cookies i am unable to sign out.

I am using FormsAuthentication in asp.net.

Following is the code I have in my web.config.

[Code]....

I have the same code in web.config of each domain.
I have placed the code for each domain in different directory on my website.
for ex. mydomain.com ---------> F:/HostedSites/mydomain
sub1.mydomain.com ---------> F:/HostedSites/subdomain1
sub2.mydomain.com ---------> F:/HostedSites/subdomain2

my Authentication code is

[Code]....
and sign out code is

[Code]....

Can anybody tell me where exactly I am wrong ? what changes do i need to do at server end also.

I am checking this on my testing domain ie. mydomain.tv. can this be a problem ?

View 2 Replies

VS 2005 - Extract Text From Images Using OCR Concept

Feb 29, 2012

I tried to extract text from images using ocr concept with MODI.In vb and console application it will work fine but i have an error when i applied my code in asp.net ....

Code:
string name = fileupdImage.FileName;
fileupdImage.Visible = this.fileupdImage;
fileupdImage.SaveAs(Server.MapPath("images/" + name));
string path = "images/" + name;

[Code] ....

Error occurred in following line as COM unhandled exception.
doc.Create(name);

I dont know why this error occured...

View 4 Replies

Trying To Get A Better Handle On How Threads Work?

Aug 20, 2010

I'm trying to get a better handle on how threads work in ASP.NET, so I have a test site with a few pages, and I have a test WinForms client that creates 40 roughly concurrent requests to the test site. The requests take about 5-10 seconds to complete--they call a web service on another server. When I run the test client, I can use Fiddler to see that the requests are being made concurrently. However, when I look at Performance Monitor on the web server, with counters "ASP.NET Apps v2.0.xxx/Requests Executing", "ASP.NET/Requests Current", "ASP.NET Requests Queued", these counters never display more than 2.

This is the case regardless of whether the test page I'm requesting is set up with Async=True and using the Begin/End pattern of calling the web service, or if it's set up to make the call synchronously. Judging by what I see in Fiddler, I would think I should be seeing a total of 40 requests in one of those states, but I don't. Why is that? Do these counters not mean what I think they mean?

View 1 Replies

How To Share Data Between Threads

Nov 1, 2010

In the main thread I open a new thread that gets the number of new messages of user (takes about 5 secs) and this second thread should save the number in some place.

In the main thread I should check the "some place" and if the value exists I display it on the page.

Where can I save the value from the second thread to read it from the main one? This value is unique per user so I can't use static field.

View 3 Replies







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