Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling first hit on a site
Message
De
27/09/2010 18:05:25
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
27/09/2010 17:37:40
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01482914
Message ID:
01482955
Vues:
49
>>>My whole class is static.
>>
>>Do you see any problem I have a local declaration on the lock object?
>>
>>BTW, I do not know if that is related but I am having a problem with some event being logged in the event viewer with this new architecture.
>>
>>Application: w3wp.exe
>>Framework Version: v4.0.30319
>>Description: The process was terminated due to stack overflow.
>>
>>So, when this happens, the application will restart and I then have a bunch of errors.
>
>I might not have seen enough of your code, but how will other instances know about the lFirstHit variable? I created my class and variable as static so it's a singleton throughout the application.

Just a side note Mike for clarification on your comment. You may already realize this. A static object does not constitute a singleton. An instance object can be kept to a single instance through the use of a singleton pattern. An object is referenced through a property and if the instance already exists the existing instance is passed back instead of creating another instance of the object. Here is an example in my EventLogger class. I use it because I want the same event log throughout the application. Notice the constructor is protected so it cannot be constructed directly.
public class EventLogger
{
	#region Private Singleton

	private static EventLogger instance = null;
	private static EventLogger Instance
	{
		get
		{
			if(instance == null)
				instance = new EventLogger();

			return instance;
		}
	}

	protected EventLogger()
	{
	}

	#endregion Private Singleton
       // All other stuff stripped out.
}
Tim
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform