Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / April 2004

Tip: Looking for answers? Try searching our database.

webservice concurrency

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paolo Liverani - 27 Apr 2004 13:42 GMT
Hi,
   I am writing a Web Service and I am having problems managing
concurrency of web methods.
Actually, I am interested in avoiding concurrency at all.
How can I ensure that only one web method is running at a given time?

   I tried to wrap every webmethod inside an Application.Lock() /
Application.Unlock() pair, but it doesn't seem to be working.

   The problem I am trying to solve is the following: on entry,
every web method reads in a status file, performs some computations,
and then writes down the file to disk. I must be sure that access to
this file is mutually exclusive.

Thank you in advance for your help
[MSFT] - 28 Apr 2004 04:08 GMT
Hi Paolo,

I think there are two approuch to achieve this:

1. Instead of a text file, you may consider use a database. ADO.NET will
take care the concurrency issue.
2. Create a type library for read/write the status file. In your web method
call the type library. In the type library, you can consider
ReaderWriterLock Class to control the read/write. For more inforamtion
about it, you can refer to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemThreadingReaderWriterLockClassTopic.asp

Luke
Microsoft Online Support

Signature

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Paolo Liverani - 28 Apr 2004 22:56 GMT
Ok, thank you Luke.
That's not exactly what I was looking for but if there is no other solution
I'll for the first one.
   -Paolo

> Hi Paolo,
>
[quoted text clipped - 17 lines]
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
Dilton McGowan II - 29 Apr 2004 05:30 GMT
> Hi,
>     I am writing a Web Service and I am having problems managing
> concurrency of web methods.
> Actually, I am interested in avoiding concurrency at all.
> How can I ensure that only one web method is running at a given time?

Static constructor for the whole web service class? This is not something I
recommend from a performance angle.

>     I tried to wrap every webmethod inside an Application.Lock() /
> Application.Unlock() pair, but it doesn't seem to be working.
[quoted text clipped - 3 lines]
> and then writes down the file to disk. I must be sure that access to
> this file is mutually exclusive.

Define a static class global object and lock( it ) ? This is somewhat
better, at least it allows some concurrency.

Side note is that if you are going to do something in all or many methods
creating a custom attribute class can be useful.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.