Connecting Tech Pros Worldwide Forums | Help | Site Map

Needing some help with Business Objects in ASP.Net PLEASE

Guy Thornton
Guest
 
Posts: n/a
#1: Nov 9 '06
I have an application in asp.net using vb.

The asp.net portion of this application is mainly the user interface. The
UI has references made to our business logic layer. And the business logic
layer uses a database class to access our data environment.

The business logic layer and database class is compiled into a class
library. The database class is a single class that contains all of our
queries there. It is implemented following the Singleton pattern so there
should only be 1 instance of the class.

The problem we are having is when multiple users start hitting the web site,
we get very erratic errors to occur at different points within the
application. All errors are System.InvalidOperationException. Invalid
attempt to read when reader is closed.

The application runs fine with 1 user on the system. So I know that the
code logic is ok. I am concerned that because I implemented a Singleton
database class, that all users in the system are trying to share that 1 class
instance.

Has anybody encountered this before?
Does anyone have any suggestions for me?

Some questions I would love to hear about are
1. When using class libraries, is a copy of the object model unique only at
the application level or at the session level?
2. Is there a way to specify at what level an object model may live within
an asp.net app?

Any feedback someone may have would greatly be appreciated. We have rather
hit a wall here and do not know how to continue.

Thanks.



sloan
Guest
 
Posts: n/a
#2: Nov 9 '06

re: Needing some help with Business Objects in ASP.Net PLEASE


You can check this article out:
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/


Some additional thoughts.
Make sure you do some locking with the Singleton.
Or abandon the Singleton thinking altogether.
How are you writing an Asp.Net singleton?
See
10/24/2005
Web Session Wrapper for storing and retrieving objects

Make sure you close your IDataReaders. Don't reuse connection objects.
It is less expensive to start a new connection object, then to tear one down
and build it back up.

I'd take a deep look at the first blog entry above, and then read the MS
article I mention at the bottom of that article.
On my blog, pay attention to the "SqlHelper is a substitute of your
application's data layer object".

I'd abandon a Singleton as a database class. Its more important to
Open LATE
Use quickly.
Close quickly.
Make sure you close and don't let connections linger. This is where I think
youre singleton is probably screwing you.





"Guy Thornton" <wdonotspamthornton@incresearch.comwrote in message
news:E7A77FC9-2F1A-4188-814D-1FE77659E9EF@microsoft.com...
Quote:
I have an application in asp.net using vb.
>
The asp.net portion of this application is mainly the user interface. The
UI has references made to our business logic layer. And the business
logic
Quote:
layer uses a database class to access our data environment.
>
The business logic layer and database class is compiled into a class
library. The database class is a single class that contains all of our
queries there. It is implemented following the Singleton pattern so there
should only be 1 instance of the class.
>
The problem we are having is when multiple users start hitting the web
site,
Quote:
we get very erratic errors to occur at different points within the
application. All errors are System.InvalidOperationException. Invalid
attempt to read when reader is closed.
>
The application runs fine with 1 user on the system. So I know that the
code logic is ok. I am concerned that because I implemented a Singleton
database class, that all users in the system are trying to share that 1
class
Quote:
instance.
>
Has anybody encountered this before?
Does anyone have any suggestions for me?
>
Some questions I would love to hear about are
1. When using class libraries, is a copy of the object model unique only
at
Quote:
the application level or at the session level?
2. Is there a way to specify at what level an object model may live
within
Quote:
an asp.net app?
>
Any feedback someone may have would greatly be appreciated. We have
rather
Quote:
hit a wall here and do not know how to continue.
>
Thanks.

David
Guest
 
Posts: n/a
#3: Nov 9 '06

re: Needing some help with Business Objects in ASP.Net PLEASE


I don't know what is on your site, but it crashed my internet explorer twice
and firefox has high cpu usage and showing an apparent memory leak (memory
usage constantly climbing)

Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"sloan" <sloan@ipass.netwrote in message
news:OErgV7CBHHA.2140@TK2MSFTNGP02.phx.gbl...
Quote:
You can check this article out:
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/
>
>
Some additional thoughts.
Make sure you do some locking with the Singleton.
Or abandon the Singleton thinking altogether.
How are you writing an Asp.Net singleton?
See
10/24/2005
Web Session Wrapper for storing and retrieving objects
>
Make sure you close your IDataReaders. Don't reuse connection objects.
It is less expensive to start a new connection object, then to tear one
down
and build it back up.
>
I'd take a deep look at the first blog entry above, and then read the MS
article I mention at the bottom of that article.
On my blog, pay attention to the "SqlHelper is a substitute of your
application's data layer object".
>
I'd abandon a Singleton as a database class. Its more important to
Open LATE
Use quickly.
Close quickly.
Make sure you close and don't let connections linger. This is where I
think
youre singleton is probably screwing you.
>
>
>
>
>
"Guy Thornton" <wdonotspamthornton@incresearch.comwrote in message
news:E7A77FC9-2F1A-4188-814D-1FE77659E9EF@microsoft.com...
Quote:
>I have an application in asp.net using vb.
>>
>The asp.net portion of this application is mainly the user interface.
>The
>UI has references made to our business logic layer. And the business
logic
Quote:
>layer uses a database class to access our data environment.
>>
>The business logic layer and database class is compiled into a class
>library. The database class is a single class that contains all of our
>queries there. It is implemented following the Singleton pattern so
>there
>should only be 1 instance of the class.
>>
>The problem we are having is when multiple users start hitting the web
site,
Quote:
>we get very erratic errors to occur at different points within the
>application. All errors are System.InvalidOperationException. Invalid
>attempt to read when reader is closed.
>>
>The application runs fine with 1 user on the system. So I know that the
>code logic is ok. I am concerned that because I implemented a Singleton
>database class, that all users in the system are trying to share that 1
class
Quote:
>instance.
>>
>Has anybody encountered this before?
>Does anyone have any suggestions for me?
>>
>Some questions I would love to hear about are
>1. When using class libraries, is a copy of the object model unique only
at
Quote:
>the application level or at the session level?
>2. Is there a way to specify at what level an object model may live
within
Quote:
>an asp.net app?
>>
>Any feedback someone may have would greatly be appreciated. We have
rather
Quote:
>hit a wall here and do not know how to continue.
>>
>Thanks.
>
>

sloan
Guest
 
Posts: n/a
#4: Nov 9 '06

re: Needing some help with Business Objects in ASP.Net PLEASE


That's something MS did.

Its a IE issue, some SP they released on August.

Its something along the lines of "http 1.1" in the IE advanced options.

I don't know, it does the same for me.

You'd think an msn space page would actually work with IE.






"David" <david.colliver.NEWS@revilloc.REMOVETHIS.comwrot e in message
news:%23q7aCSDBHHA.4672@TK2MSFTNGP02.phx.gbl...
Quote:
I don't know what is on your site, but it crashed my internet explorer
twice
Quote:
and firefox has high cpu usage and showing an apparent memory leak (memory
usage constantly climbing)
>
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"sloan" <sloan@ipass.netwrote in message
news:OErgV7CBHHA.2140@TK2MSFTNGP02.phx.gbl...
Quote:
You can check this article out:
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/


Some additional thoughts.
Make sure you do some locking with the Singleton.
Or abandon the Singleton thinking altogether.
How are you writing an Asp.Net singleton?
See
10/24/2005
Web Session Wrapper for storing and retrieving objects

Make sure you close your IDataReaders. Don't reuse connection objects.
It is less expensive to start a new connection object, then to tear one
down
and build it back up.

I'd take a deep look at the first blog entry above, and then read the MS
article I mention at the bottom of that article.
On my blog, pay attention to the "SqlHelper is a substitute of your
application's data layer object".

I'd abandon a Singleton as a database class. Its more important to
Open LATE
Use quickly.
Close quickly.
Make sure you close and don't let connections linger. This is where I
think
youre singleton is probably screwing you.





"Guy Thornton" <wdonotspamthornton@incresearch.comwrote in message
news:E7A77FC9-2F1A-4188-814D-1FE77659E9EF@microsoft.com...
Quote:
I have an application in asp.net using vb.
>
The asp.net portion of this application is mainly the user interface.
The
UI has references made to our business logic layer. And the business
logic
Quote:
layer uses a database class to access our data environment.
>
The business logic layer and database class is compiled into a class
library. The database class is a single class that contains all of our
queries there. It is implemented following the Singleton pattern so
there
should only be 1 instance of the class.
>
The problem we are having is when multiple users start hitting the web
site,
Quote:
we get very erratic errors to occur at different points within the
application. All errors are System.InvalidOperationException. Invalid
attempt to read when reader is closed.
>
The application runs fine with 1 user on the system. So I know that
the
Quote:
Quote:
Quote:
code logic is ok. I am concerned that because I implemented a
Singleton
Quote:
Quote:
Quote:
database class, that all users in the system are trying to share that 1
class
Quote:
instance.
>
Has anybody encountered this before?
Does anyone have any suggestions for me?
>
Some questions I would love to hear about are
1. When using class libraries, is a copy of the object model unique
only
Quote:
Quote:
at
Quote:
the application level or at the session level?
2. Is there a way to specify at what level an object model may live
within
Quote:
an asp.net app?
>
Any feedback someone may have would greatly be appreciated. We have
rather
Quote:
hit a wall here and do not know how to continue.
>
Thanks.
>
>

David
Guest
 
Posts: n/a
#5: Nov 9 '06

re: Needing some help with Business Objects in ASP.Net PLEASE


Ah, OK, but it still is a big problem.

It even fails on firefox, but at least I get a chance to read the page on
FF. I reading it on my laptop, which is on my knee and it gets really hot,
so I saved the page to my HD, removed the script at the top and can read it.
(I could only do this in FF, IE crashed twice. I gave up with IE.).

Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available

"sloan" <sloan@ipass.netwrote in message
news:%23H9H%23TDBHHA.3560@TK2MSFTNGP03.phx.gbl...
Quote:
That's something MS did.
>
Its a IE issue, some SP they released on August.
>
Its something along the lines of "http 1.1" in the IE advanced options.
>
I don't know, it does the same for me.
>
You'd think an msn space page would actually work with IE.
>
>
>
>
>
>
"David" <david.colliver.NEWS@revilloc.REMOVETHIS.comwrot e in message
news:%23q7aCSDBHHA.4672@TK2MSFTNGP02.phx.gbl...
Quote:
>I don't know what is on your site, but it crashed my internet explorer
twice
Quote:
>and firefox has high cpu usage and showing an apparent memory leak
>(memory
>usage constantly climbing)
>>
>Best regards,
>Dave Colliver.
>http://www.AshfieldFOCUS.com
>~~
>http://www.FOCUSPortals.com - Local franchises available
>"sloan" <sloan@ipass.netwrote in message
>news:OErgV7CBHHA.2140@TK2MSFTNGP02.phx.gbl...
Quote:
You can check this article out:
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/
>
>
Some additional thoughts.
Make sure you do some locking with the Singleton.
Or abandon the Singleton thinking altogether.
How are you writing an Asp.Net singleton?
See
10/24/2005
Web Session Wrapper for storing and retrieving objects
>
Make sure you close your IDataReaders. Don't reuse connection objects.
It is less expensive to start a new connection object, then to tear one
down
and build it back up.
>
I'd take a deep look at the first blog entry above, and then read the
MS
article I mention at the bottom of that article.
On my blog, pay attention to the "SqlHelper is a substitute of your
application's data layer object".
>
I'd abandon a Singleton as a database class. Its more important to
Open LATE
Use quickly.
Close quickly.
Make sure you close and don't let connections linger. This is where I
think
youre singleton is probably screwing you.
>
>
>
>
>
"Guy Thornton" <wdonotspamthornton@incresearch.comwrote in message
news:E7A77FC9-2F1A-4188-814D-1FE77659E9EF@microsoft.com...
>I have an application in asp.net using vb.
>>
>The asp.net portion of this application is mainly the user interface.
>The
>UI has references made to our business logic layer. And the business
logic
>layer uses a database class to access our data environment.
>>
>The business logic layer and database class is compiled into a class
>library. The database class is a single class that contains all of
>our
>queries there. It is implemented following the Singleton pattern so
>there
>should only be 1 instance of the class.
>>
>The problem we are having is when multiple users start hitting the web
site,
>we get very erratic errors to occur at different points within the
>application. All errors are System.InvalidOperationException.
>Invalid
>attempt to read when reader is closed.
>>
>The application runs fine with 1 user on the system. So I know that
the
Quote:
Quote:
>code logic is ok. I am concerned that because I implemented a
Singleton
Quote:
Quote:
>database class, that all users in the system are trying to share that
>1
class
>instance.
>>
>Has anybody encountered this before?
>Does anyone have any suggestions for me?
>>
>Some questions I would love to hear about are
>1. When using class libraries, is a copy of the object model unique
only
Quote:
Quote:
at
>the application level or at the session level?
>2. Is there a way to specify at what level an object model may live
within
>an asp.net app?
>>
>Any feedback someone may have would greatly be appreciated. We have
rather
>hit a wall here and do not know how to continue.
>>
>Thanks.
>
>
>>
>>
>
>

sloan
Guest
 
Posts: n/a
#6: Nov 9 '06

re: Needing some help with Business Objects in ASP.Net PLEASE



My FireFox works ok with it. (No crashes).

Yeah, I gave up on IE also. I have FF open .. with my blog stuff, and is
the only thing I have in FF.

I just did a Windows Update yesterday, so ............ I'm as good as I can
get with IE.

Crazy stuff, crazy stuff.




"David" <david.colliver.NEWS@revilloc.REMOVETHIS.comwrot e in message
news:etYrf3DBHHA.4472@TK2MSFTNGP03.phx.gbl...
Quote:
Ah, OK, but it still is a big problem.
>
It even fails on firefox, but at least I get a chance to read the page on
FF. I reading it on my laptop, which is on my knee and it gets really hot,
so I saved the page to my HD, removed the script at the top and can read
it.
Quote:
(I could only do this in FF, IE crashed twice. I gave up with IE.).
>
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
>
"sloan" <sloan@ipass.netwrote in message
news:%23H9H%23TDBHHA.3560@TK2MSFTNGP03.phx.gbl...
Quote:
That's something MS did.

Its a IE issue, some SP they released on August.

Its something along the lines of "http 1.1" in the IE advanced options.

I don't know, it does the same for me.

You'd think an msn space page would actually work with IE.






"David" <david.colliver.NEWS@revilloc.REMOVETHIS.comwrot e in message
news:%23q7aCSDBHHA.4672@TK2MSFTNGP02.phx.gbl...
Quote:
I don't know what is on your site, but it crashed my internet explorer
twice
Quote:
and firefox has high cpu usage and showing an apparent memory leak
(memory
usage constantly climbing)
>
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
"sloan" <sloan@ipass.netwrote in message
news:OErgV7CBHHA.2140@TK2MSFTNGP02.phx.gbl...
You can check this article out:
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/


Some additional thoughts.
Make sure you do some locking with the Singleton.
Or abandon the Singleton thinking altogether.
How are you writing an Asp.Net singleton?
See
10/24/2005
Web Session Wrapper for storing and retrieving objects

Make sure you close your IDataReaders. Don't reuse connection
objects.
Quote:
Quote:
Quote:
It is less expensive to start a new connection object, then to tear
one
Quote:
Quote:
Quote:
down
and build it back up.

I'd take a deep look at the first blog entry above, and then read the
MS
article I mention at the bottom of that article.
On my blog, pay attention to the "SqlHelper is a substitute of your
application's data layer object".

I'd abandon a Singleton as a database class. Its more important to
Open LATE
Use quickly.
Close quickly.
Make sure you close and don't let connections linger. This is where
I
Quote:
Quote:
Quote:
think
youre singleton is probably screwing you.





"Guy Thornton" <wdonotspamthornton@incresearch.comwrote in message
news:E7A77FC9-2F1A-4188-814D-1FE77659E9EF@microsoft.com...
I have an application in asp.net using vb.
>
The asp.net portion of this application is mainly the user
interface.
Quote:
Quote:
Quote:
The
UI has references made to our business logic layer. And the
business
Quote:
Quote:
Quote:
logic
layer uses a database class to access our data environment.
>
The business logic layer and database class is compiled into a class
library. The database class is a single class that contains all of
our
queries there. It is implemented following the Singleton pattern so
there
should only be 1 instance of the class.
>
The problem we are having is when multiple users start hitting the
web
Quote:
Quote:
Quote:
site,
we get very erratic errors to occur at different points within the
application. All errors are System.InvalidOperationException.
Invalid
attempt to read when reader is closed.
>
The application runs fine with 1 user on the system. So I know that
the
Quote:
code logic is ok. I am concerned that because I implemented a
Singleton
Quote:
database class, that all users in the system are trying to share
that
Quote:
Quote:
Quote:
1
class
instance.
>
Has anybody encountered this before?
Does anyone have any suggestions for me?
>
Some questions I would love to hear about are
1. When using class libraries, is a copy of the object model unique
only
Quote:
at
the application level or at the session level?
2. Is there a way to specify at what level an object model may live
within
an asp.net app?
>
Any feedback someone may have would greatly be appreciated. We have
rather
hit a wall here and do not know how to continue.
>
Thanks.


>
>
>
>

Guy Thornton
Guest
 
Posts: n/a
#7: Nov 9 '06

re: Needing some help with Business Objects in ASP.Net PLEASE


Sloan,

Thanks for the information, I am reviewing that now. I thought I would
write you back since you asked about how I implemented singleton in asp.net.

In my class library, as I mentioned, I have a database class that is my data
layer. In this class I have a private static variable that will hold the
single instance of the class.
So it would look something like this:

Public Class MyDatabaseClass
{
...
private static MyDatabaseClass dbInstance;
... //other private attributes

Public static MyDatabaseClass myDb()
{
if (dbInstance == null)
dbInstance = new MyDatabaseClass;
return dbInstance;
}
}

Everything else is implemented as instance methods or functions.

So now, elsewhere within the object model, this would be called as
MyDatabaseClass.mydb

I do agree with your assessment, however that the fact that I am using this
1 instance of a database layer is causing my problems.

Thanks for your help.
Guy.

"sloan" wrote:
Quote:
You can check this article out:
5/24/2006
Custom Objects/Collections and Tiered Development
http://sholliday.spaces.live.com/
>
>
Some additional thoughts.
Make sure you do some locking with the Singleton.
Or abandon the Singleton thinking altogether.
How are you writing an Asp.Net singleton?
See
10/24/2005
Web Session Wrapper for storing and retrieving objects
>
Make sure you close your IDataReaders. Don't reuse connection objects.
It is less expensive to start a new connection object, then to tear one down
and build it back up.
>
I'd take a deep look at the first blog entry above, and then read the MS
article I mention at the bottom of that article.
On my blog, pay attention to the "SqlHelper is a substitute of your
application's data layer object".
>
I'd abandon a Singleton as a database class. Its more important to
Open LATE
Use quickly.
Close quickly.
Make sure you close and don't let connections linger. This is where I think
youre singleton is probably screwing you.
>
>
>
>
>
"Guy Thornton" <wdonotspamthornton@incresearch.comwrote in message
news:E7A77FC9-2F1A-4188-814D-1FE77659E9EF@microsoft.com...
Quote:
I have an application in asp.net using vb.

The asp.net portion of this application is mainly the user interface. The
UI has references made to our business logic layer. And the business
logic
Quote:
layer uses a database class to access our data environment.

The business logic layer and database class is compiled into a class
library. The database class is a single class that contains all of our
queries there. It is implemented following the Singleton pattern so there
should only be 1 instance of the class.

The problem we are having is when multiple users start hitting the web
site,
Quote:
we get very erratic errors to occur at different points within the
application. All errors are System.InvalidOperationException. Invalid
attempt to read when reader is closed.

The application runs fine with 1 user on the system. So I know that the
code logic is ok. I am concerned that because I implemented a Singleton
database class, that all users in the system are trying to share that 1
class
Quote:
instance.

Has anybody encountered this before?
Does anyone have any suggestions for me?

Some questions I would love to hear about are
1. When using class libraries, is a copy of the object model unique only
at
Quote:
the application level or at the session level?
2. Is there a way to specify at what level an object model may live
within
Quote:
an asp.net app?

Any feedback someone may have would greatly be appreciated. We have
rather
Quote:
hit a wall here and do not know how to continue.

Thanks.
>
>
>
Closed Thread