Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Serializing a request for an ASP page containing COM objects

Reply
Thread Tools

Serializing a request for an ASP page containing COM objects

 
 
Max
Guest
Posts: n/a
 
      08-01-2006
Due to the behaviour of a particular COM object, I need to ensure that a
request for a particular ASP page is finalized before another request for
the page is processed. Does IIS have a way to ensure that subsequent
requests will be queued until the current request is completed?

If not, can IIS be configured to use seperate processes to satisfy requests
for a nominated ASP page?

Thanks in advance.

Max


 
Reply With Quote
 
 
 
 
Bobbo
Guest
Posts: n/a
 
      08-01-2006

Max wrote:

> Due to the behaviour of a particular COM object, I need to ensure that a
> request for a particular ASP page is finalized before another request for
> the page is processed. Does IIS have a way to ensure that subsequent
> requests will be queued until the current request is completed?
>
> If not, can IIS be configured to use seperate processes to satisfy requests
> for a nominated ASP page?


As far as I'm aware, you can only specify process isolation on a
per-application basis. This procedure varies with the version of IIS
you're using.

Here's the procedure for version 6 (my version):
http://www.microsoft.com/technet/pro....mspx?mfr=true

 
Reply With Quote
 
 
 
 
Egbert Nierop \(MVP for IIS\)
Guest
Posts: n/a
 
      08-01-2006

"Max" <> wrote in message
news:44cf04dd$0$1509$...
> Due to the behaviour of a particular COM object, I need to ensure that a
> request for a particular ASP page is finalized before another request for
> the page is processed. Does IIS have a way to ensure that subsequent
> requests will be queued until the current request is completed?
>
> If not, can IIS be configured to use seperate processes to satisfy
> requests for a nominated ASP page?
>
> Thanks in advance.


Hi Max, as long as you don't have more web servers that serve the same
website (ie url like www.yoursite.com) you can lock your page, through a
Mutex object.
A mutex, enables multiple processes on the same machine to synced single
access to a single event.

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      08-01-2006
Max wrote:
> Due to the behaviour of a particular COM object, I need to ensure
> that a request for a particular ASP page is finalized before another
> request for the page is processed. Does IIS have a way to ensure that
> subsequent requests will be queued until the current request is
> completed?
> If not, can IIS be configured to use seperate processes to satisfy
> requests for a nominated ASP page?
>

If the object is not free-threaded, storing it in Application may accomplish
your goal. This is the reason we constantly advise against storing ADO
objects (such as Connections) in Application: they are apartment-threaded so
they can only service one thread at a time, in effect serializing all uses
of the object.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      08-01-2006

"Bob Barrows [MVP]" <> wrote in message
news:...
> Max wrote:
> > Due to the behaviour of a particular COM object, I need to ensure
> > that a request for a particular ASP page is finalized before another
> > request for the page is processed. Does IIS have a way to ensure that
> > subsequent requests will be queued until the current request is
> > completed?
> > If not, can IIS be configured to use seperate processes to satisfy
> > requests for a nominated ASP page?
> >

> If the object is not free-threaded, storing it in Application may

accomplish
> your goal. This is the reason we constantly advise against storing ADO
> objects (such as Connections) in Application: they are apartment-threaded

so
> they can only service one thread at a time, in effect serializing all uses
> of the object.
>


It's a nice idea but the application object simply disallows
apartment-threaded objects.


> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>



 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      08-01-2006

"Bobbo" <> wrote in message
news: ps.com...
>
> Max wrote:
>
> > Due to the behaviour of a particular COM object, I need to ensure that a
> > request for a particular ASP page is finalized before another request

for
> > the page is processed. Does IIS have a way to ensure that subsequent
> > requests will be queued until the current request is completed?
> >
> > If not, can IIS be configured to use seperate processes to satisfy

requests
> > for a nominated ASP page?

>
> As far as I'm aware, you can only specify process isolation on a
> per-application basis. This procedure varies with the version of IIS
> you're using.
>
> Here's the procedure for version 6 (my version):
>

http://www.microsoft.com/technet/pro....mspx?mfr=true
>


On it's own it doesn't help serialise access to the page. It may be
possible to tweak the application metadata to allow only one worker thread
then only one request into the application can be processed at a time.

One approach might be to enable debugging. That limits the app to a single
thread but care needs to be taken that any configured debugger doesn't block
operation (e.g. Dr Watson style debugging is ok but script debugger will
just hang the process if there is an error).

If there is only one CPU then setting AspProcessorThreadMax to 1 might also
do it.

Anthony.


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      08-01-2006
Anthony Jones wrote:
> "Bob Barrows [MVP]" <> wrote in message
> news:...
>> Max wrote:
>>> Due to the behaviour of a particular COM object, I need to ensure
>>> that a request for a particular ASP page is finalized before another
>>> request for the page is processed. Does IIS have a way to ensure
>>> that subsequent requests will be queued until the current request is
>>> completed?
>>> If not, can IIS be configured to use seperate processes to satisfy
>>> requests for a nominated ASP page?
>>>

>> If the object is not free-threaded, storing it in Application may
>> accomplish your goal. This is the reason we constantly advise
>> against storing ADO objects (such as Connections) in Application:
>> they are apartment-threaded so they can only service one thread at a
>> time, in effect serializing all uses of the object.
>>

>
> It's a nice idea but the application object simply disallows
> apartment-threaded objects.
>
>

I'm not sure I'm following your point. Could you expand on what you mean by
"disallows"?

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
Michael D. Kersey
Guest
Posts: n/a
 
      08-02-2006
Max wrote:
> Due to the behaviour of a particular COM object, I need to ensure that a
> request for a particular ASP page is finalized before another request for
> the page is processed. Does IIS have a way to ensure that subsequent
> requests will be queued until the current request is completed?
> If not, can IIS be configured to use seperate processes to satisfy requests
> for a nominated ASP page?
> Max
>

Use the Application.Lock and Application.Unlock methods:
....
Application.Lock
....
'Critical section of code.
....
Application.Unlock
....

While there may be several copies of that page executing, the lock
ensures that only one is be executing the critical section of code at
any time. If a page finds the Application object locked, it will wait.

It isn't necessary to store anything in the Application object. You're
merely using the Application object's methods as a mutex to enforce
serialized access to the critical section of code.

Of course, serializing access will result in queuing and will slow
response. So minimize the time and resources utilized in the critical
section of code, enter it as late as possible and exit it as soon as
possible.
 
Reply With Quote
 
Max
Guest
Posts: n/a
 
      08-02-2006

"Bob Barrows [MVP]" <> wrote in message
news:%...
> Anthony Jones wrote:
>> "Bob Barrows [MVP]" <> wrote in message
>> news:...
>>> Max wrote:
>>>> Due to the behaviour of a particular COM object, I need to ensure
>>>> that a request for a particular ASP page is finalized before another
>>>> request for the page is processed. Does IIS have a way to ensure
>>>> that subsequent requests will be queued until the current request is
>>>> completed?
>>>> If not, can IIS be configured to use seperate processes to satisfy
>>>> requests for a nominated ASP page?
>>>>
>>> If the object is not free-threaded, storing it in Application may
>>> accomplish your goal. This is the reason we constantly advise
>>> against storing ADO objects (such as Connections) in Application:
>>> they are apartment-threaded so they can only service one thread at a
>>> time, in effect serializing all uses of the object.
>>>

>>
>> It's a nice idea but the application object simply disallows
>> apartment-threaded objects.
>>
>>

> I'm not sure I'm following your point. Could you expand on what you mean
> by "disallows"?
>
> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>

My thanks to Bobbo, Anthony, Egbert and Bob for their input.

Unfortunately I may have some input on the setup of our clients web server
but not on the machine it runs on. As I cannot guarantee a single
processor, I cannot use your "set AspProcessorThreadMax to 1" suggestion.

I am still looking at the suggestion to enable debugging although the
possibility of the process just hanging on the customers site would not be
acceptable.

I am interested in Anthonys suggestion to "tweak the application metadata to
allow only one worker thread" but am not sure which metadata values I would
need to set to accomplish this.

The COM object that I am using is marked as single threaded and doesn't
appear to have any protection when IIS makes overlapping requests for the
ASP page using it. We may be able to use a mutex but performance would be an
issue.

I have been looking into the use of a web garden (in IIS6) which appears to
offer multiple processes on the same application. Do you think that using a
web garden would be useful in this situation? Perhaps in combination with
allowing only one worker thread as suggested by Anthony?

Thanks in advance,

Max


 
Reply With Quote
 
Anthony Jones
Guest
Posts: n/a
 
      08-02-2006

"Bob Barrows [MVP]" <> wrote in message
news:%...
> Anthony Jones wrote:
> > "Bob Barrows [MVP]" <> wrote in message
> > news:...
> >> Max wrote:
> >>> Due to the behaviour of a particular COM object, I need to ensure
> >>> that a request for a particular ASP page is finalized before another
> >>> request for the page is processed. Does IIS have a way to ensure
> >>> that subsequent requests will be queued until the current request is
> >>> completed?
> >>> If not, can IIS be configured to use seperate processes to satisfy
> >>> requests for a nominated ASP page?
> >>>
> >> If the object is not free-threaded, storing it in Application may
> >> accomplish your goal. This is the reason we constantly advise
> >> against storing ADO objects (such as Connections) in Application:
> >> they are apartment-threaded so they can only service one thread at a
> >> time, in effect serializing all uses of the object.
> >>

> >
> > It's a nice idea but the application object simply disallows
> > apartment-threaded objects.
> >
> >

> I'm not sure I'm following your point. Could you expand on what you mean

by
> "disallows"?
>


<%

Dim o: Set o = Server.CreateObject("MSXML2.DOMDocument.3.0")

Set Application("x") = o

%>

ASP just errors saying that assigning this sort of object into the
application object is disallowed.
You can only assign free-threaded objects into the application object.

Assigning into the session is allowed but that will affiliate the session ID
with a thread and all requests containing that session cookie will only ever
be serviced be the affiliated thread (this doesn't help in the OP's case).
Over time this will mean requests will queue up to be serviced even though
worker threads are available because their affiliated thread is busy with
another request. What's really annoying is that even if the object
reference is only fleeting stored in the session object and then removed the
thread will still remain affiliated.


> --
> Microsoft MVP - ASP/ASP.NET
> Please reply to the newsgroup. This email account is my spam trap so I
> don't check it very often. If you must reply off-line, then remove the
> "NO SPAM"
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Objects containing objects Steve Perl Misc 2 01-13-2008 12:39 PM
Serializing objects into a stream blazingdragon@gmail.com Java 3 04-06-2006 11:14 AM
Problem in serializing objects in session sangha Java 4 03-08-2006 09:45 PM
Serializing generic objects Christopher V. Kimball Java 0 12-11-2004 11:06 PM
Re: template and static WAS: Re: serializing/unserializing objects... john smith C++ 0 08-09-2003 09:58 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57