[Last Call] Learn how to a build a cloud-first strategyRegister Now


Asp.Net Threading Issue.

Posted on 2005-05-17
Medium Priority
Last Modified: 2008-01-09

I have a mailer program for asp.net which has been working fine, until I added this:

Dim myThread as New Threading.Thread(AddressOf SendMessages)

Sometimes my page works, sometimes I get this pop up in my Visual Studio:

An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in Unknown Module.

Additional information: The type System.Web.HttpException in Assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a is not marked as serializable.

This never happened until I started running the SendMessages sub on a seperate thread.

Any ideas?
Question by:Codestone
1 Comment
LVL 96

Accepted Solution

Bob Learned earned 2000 total points
ID: 14018998
What was the original reason for wanting threading?  It can be a complex operation, even though it seems simple at first.

Here is some information that may prove to be useful for multi-threaded applications:

Introduction to making multithreaded VB.NET Apps:

Sub IncrementWebCount()
    SyncLock objMyLock
        intWebHits += 1
    End SyncLock
End Sub

From help:
A SyncLock statement allows statements to be synchronized on an expression, which ensures that multiple threads of execution do not execute the same statements at the same time.

This is called the "critical section"


Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Make the most of your online learning experience.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question