MVC :: MemoryCache Threading?

Mar 13, 2010

MSDN says that MemoryCache's instance members are not thread safe. (http://msdn.microsoft.com/en-us/library/system.runtime.caching.memorycache(VS.100).aspx)

Does that mean every time I call Get() or Add() in a action method I have to wrap it with a lock?

View 1 Replies


Similar Messages:

Implications Of Using Memorycache In Asp?

Oct 7, 2010

I've got a class that needs to store data in a cache. Originally I used it in an asp.net application so I used System.Web.Caching.Cache.Now I need to use it in a Windows Service. Now, as I understand it, I should not use the asp.net cache in a not asp.net application, so I was looking into MemoryCache. The problem is that they are not compatible, so either I change to use MemoryCache in the asp.net application, or I will need to create an adapter so ensure that the two cache implementations have the same interface (maybe derive from ObjectCache and use the asp.net cache internally?)What are the implications of using MemoryCache in an asp.net?

View 1 Replies

What Is Threading And How It Is Done

Feb 19, 2011

what is threading and how it is done?

Is there any difference between threading in web applications and threading in winforms applications

View 2 Replies

Use Threading With DAL Operations?

Sep 7, 2010

I want to use my functions in DAL asynchronously by executing them in a separate thread. The issue in all this is suppose I have a function DAL.GetProducts() which returns a DataTable. If I execute this function in a separate thread, when it is completed how do I get the returned DataTable from this thread and bind it to my UI?

View 3 Replies

Trying To Do Some Multi-threading In Website?

Mar 2, 2011

I'm trying to do some multi-threading in my asp.net web site. But I'm having trouble getting my child thread to interact with my main thread. In the following very simple example I would expect that, 3 seconds after clicking the button, the "Hello World" text would be displayed on my page and on my label. Instead, after a few seconds, I get the following error in a pop-up box "WebDev.WebServer20.exe has stopped working - Windows is checking for a solution to the problem.". I am running Visual Web Developer 2010 Express. If you know why I'm getting this error and if you know how to fix the problem respond.

ASPX file is as follows:

[Code]....

CS file is as follows:

[Code]....

View 1 Replies

C# - Threading In Crashing Server?

Mar 17, 2011

I'm trying to get threading to work in ASP.NET but for some reason it keeps crashing my local server, and simply does not work at all when uploaded online. Here's the code:

protected void testThread()
{
for (int i = 0; i < 10; i++)

[code]...

View 3 Replies

Use The System.Threading Namespace In Asp?

Mar 19, 2010

This may seem like a really simple question, but can I use the System.Threading namespace in ASP.NET web forms? I have a web page which uses HTTP GET/POST to gather page customisations (title, subtitle, etc.) from the user and numerical input which is passed to a ASMX web service. Currently they work sequentially, the customisation first followed by numerical processing. So can I use threading to do this?

View 3 Replies

How To Use Threading To Perform Background Tasks

Jan 29, 2011

In my ASP.NET website, I am having a function which has to be automatically performed once every 2-3 mins on its own, i.e. without user intervention. This function contains database access.

Can I use threading to perform this process in background?

If Yes, How can I use that?

Edit

Also I am not looking for a solution which includes windows service because I am using shared hosting. So I dont have all the rights to access the host computer.

View 5 Replies

How To Use Threading To Call A Repetitive Process

Jan 22, 2011

In my website, I need to do a repetitive task which should not affect the main activity and performance of the website.

So I think I need to use threading. I am new into threading in .Net.

How to use threading is .NET?

View 1 Replies

Multi Threading Life Cycle?

Nov 22, 2010

I'm a completly noob in Multi-Threading c# web pages... and i'm taking the first steps... I have one web page that create one new thread for each image to load. Each thread only read the external image and save it to local server. I have for example pages that have 25 images... that page loads but it launchs 25 thread (1 for each image).

The code:

[Code]....

I assumed that when a thread finish it's job it will automaticaly be killed, is it that way ?? I'm asking because, when i try this code on the server, after some navegation and multiple images loaded the IIS goes down and the page return "Service Unavailable" error :( To solved it i need to restart the IIS Application Pool... For those that have experience in multi-threading web pages how can i kill this threads ? Aren't they suposed to be killed when their job is finish ? ? Do you know a good tutorial or article for begginers ???

View 2 Replies

Threading Hangs Other Page Loading?

Jun 1, 2010

I have a Main page containing links to five other pages. each page has a button which does some job using Thread. Problem is when i open a window from main page and click the button, The Process starts but if now i want to open another page from main window it doesn't load untill that previous page loads fully(when thread ends). I am not using any session variable on my page.

View 2 Replies

Web Forms :: System.Threading.ThreadAbortException In Export To CSV?

Nov 23, 2010

I m getting the error System.Threading.ThreadAbortException while exporting datatable to CSV. But export to CSV is completed sucessfully.Here is my Code:

Dim dt As DataTable

Dim sb As New StringBuilder

dt = objsqlds.Tables(0)

[code]...

View 2 Replies

C# - Getting An Out Of Memory Exception With System.Threading.ReaderWriterCount

Nov 1, 2010

I've got an asp.net application, it's running on DotNetNuke, under load we get the occasional out of memory exception. I've got a dump loaded it into windbg. the end of !dumpheap -stat is

1192a588 88684 2128416 AutoMapper.MappingEngine
79333594 9482 2266348 System.Byte[]
134b0034 88695 2838240 System.EventHandler`1[[AutoMapper.TypeMapCreatedEventArgs, AutoMapper]]
13d8703c 88684 4611568 System.Collections.Generic.Dictionary`2[[Castle.DynamicProxy.Generators.CacheKey, AutoMapper],[System.Type, mscorlib]]
13d86dc8 88684 4611568 Castle.DynamicProxy.ModuleScope
13d865bc 88684 4611568 System.Collections.Generic.Dictionary`2[[AutoMapper.Internal.TypePair, AutoMapper],[AutoMapper.IObjectMapper, AutoMapper]]
79327434 88703 4612556 System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Int32, mscorlib]]
6c38e4e4 88684 5675776 System.Threading.ReaderWriterLockSlim
79330b24 87736 6458012 System.String
000d9c88 129 24186884 Free
793042f4 221202 101117016 System.Object[]
6c38e4a0 22703104 544874496 System.Threading.ReaderWriterCount

I can't find much information on the System.Threading.ReaderWriterCount, as it seems to be the problem. What is the likely cause? Or failing that what's the best next step to work that out? Based on the pointer from the given answer I had a look at ReaderWriterLockSlim. I wasn't using it directly, but I saw that it had 88684 instances, digging deeper I saw quite a few classes with that number of instances, pointing to AutoMapper.MappingEngine. This should be a singleton, so I've had a look at where it's being created. I suspect that it's the DI container and have made some changes around that to see if it helps

View 1 Replies

C# - Delegate Threading Overhead In Wepage Lookup?

Dec 1, 2010

I have a web app where a user will visit a page with a QueryString parameter passing the ID of the object I should retrieve.

What I then need to do is run a number of checks to ensure the user can access that data, and also find out if another user has a lock (recorded in the DB) on that object.

Currently these searches are all performed sequentially, however I'm thinking the best option might be to use delegates to be able to fire off the three or four searches required at once then use the results as they are returned.

My implementation for this would be using a delegate(s) and calling BeginInvoke, however I'm worried the overhead of threading this may lead to no speed increases.

My research has indicated it will use the ThreadPool, so there shouldn't be too much overhead, but I'd like to know if anyone has implemented this kind of solution to a similar scenario on a high traffic site and seen good resutls from it?

The reason I'm looking to do this is we are reengineering our application from the ground up, and need to make sure we are building something that will scale considerably.

View 2 Replies

Web Forms :: Threading Stops The Development Server?

Jan 25, 2010

I am using threading in my c# code to upload multiple files. The code is as shown below:

[Code]....

When I run this code, the ASP.Net Development Server gets stopped without throwing any exceptions. What might be the reason?

Object objFilePath = (Object)Element;

View 1 Replies

DataSource Controls :: Multi-Threading With OleDbDataAdapter?

Jun 22, 2010

I have a .NET 4.0 console application that does a lot of reads from SQL Server 2008 using the OleDbDataAdapter object.I tried to improve performance by spreading the processing logic across four threads using Visual Studio 2010's Task Parallel Library. Sadly the multi-threaded version is three times slower than the original. Using VS2010's performance tools, I found thousands of thread contentions caused by the method OleDbDataAdapter.Fill() which populates a DataSet.This is puzzling as there are no static classes or variables involved that would result in the OleDbDataAdapter being shared by my threads. Also, four simultaneous connections just can't cause a hold up at the database level, right? The default connection pool size should be much larger than this.

View 1 Replies

AJAX :: Threading Is Not Working With Update Panel Properly?

Jun 4, 2010

I have one button on my page. On click of this I need to run four methods parallely in four saperate thead and need to show the progress bar for each method. Also need to update the label controls form those threaded methods.

Also I need to user Update panel of AJAX control tool kit to avoid post back to user.

I have used the read pool for that. When I remove the update panel the code works fine and update four labels but when I put the update panel it is not updating the labels.

View 2 Replies

Visual Studio :: Can Debug Multi Threading And Watch Local Variables Of Each Thread

Jan 26, 2010

how can we debug multi threading and watch local variables of each thread.

Thread windows does not show variable values.

View 1 Replies

IIS 6/7 Threading - Long Running Aspx Page Keeps Other Aspx Pages From Loading

Oct 11, 2010

I wrote a test page that does a bunch of busy work in a method called at page load. This process as I have it now takes around 12 seconds.

If I try to load another page while the first long running page is loading, this second page doing nothing except writing out a world, it doesn't load until the first long running page is finished.

Why is this the case? I would think IIS would be able to handle multiple concurrent connections, it seems crazy that one long running page would stop every other page in the application from loading. I must be missing something or not understand how IIS works.

I would think multiple independent requests would be spawned on different threads. Is this only the case if the requests are from different sessions entirely? Are all requests from a single session bound to a single thread?

View 1 Replies

System.Threading.Tasks - Limit The Number Of Concurrent Tasks?

May 24, 2010

I have just started to look at the new "System.Threading.Tasks" goodness in .Net 4.0, and would like to know if there is any build in support for limiting the number of concurrent tasks that run at once, or if this should be manually handled.

E.G: If I need to call a calculation method 100 times, is there a way to set up 100 Tasks, but have only 5 execute simultaneously? The answer may just be to create 5 tasks, call Task.WaitAny, and create a new Task as each previous one finishes. I just want to make sure I am not missing a trick if there is a better way to do this.

[code]....

View 5 Replies

C# - Threading Problem With Monitor.Wait () And Monitor.Pulse ()?

Oct 18, 2010

I have a producer-consumer scenario in ASP.NET. I designed a Producer class, a Consumer class and a class for holding the shared objects and responsible for communication between Producer and Consumer, lets call it Mediator. Because I fork the execution path at start-up (in parent object) and one thread would call Producer.Start() and another thread calls Consumer.Start(), I need to pass a reference of Mediator to both Producer and Consumer (via Constructor). Mediator is a smart class which will optimize many things like length of it's inner queue but for now consider it as a circular blocking queue. Producer would enqueues new objects to Mediator until the queue gets full and then Producer would block. Consumer dequeues objects from Mediator until there's nothing in the queue. For signaling between threads, I implemented two methods in Mediator class: Wait() and Pulse(). The code is something like this:

Class Mediator
{
private object _locker = new object();[code]....

Inside Mediator I use this.Pulse() every time something is Enqueued or Dequeued so waiting threads would be signaled and continue their work.But I encounter deadlocks and because I have never used this kind of design for signaling threads, I'm not sure if something is wrong with the design or I'm doing something wrong elsewhere ?

View 6 Replies







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