Asp.Net Threading Issue.

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

I have a mailer program for 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

    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"


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    Title # Comments Views Activity
    why to use string 10 53
    Fibonacci challenge 11 61
    array11 challenge 16 40
    countPairs challenge 7 37
    This article will show, step by step, how to integrate R code into a R Sweave document
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now