all groups > dotnet web services > december 2004 >
You're in the

dotnet web services

group:

SoapExtension cannot share resources properly


Re: SoapExtension cannot share resources properly Sami Vaaraniemi
12/29/2004 6:09:42 PM
dotnet web services:

[quoted text, click to view]

You are trying to access a shared resource (the log file) concurrently from
more than one place. This is not going to work unless you somehow control
the concurrent access.

One way is to log into a database instead of a file. In this case the
database engine will take care of concurrency issues for you.

Another way is to try and handle the concurrency yourself. Effectively, this
means that you will need to program your services so that only one of them
accesses the resource at any given time. You can use the Mutex class for
this purpose as it can provide cross-process synchronization.

Yet another way, probably the simplest one too, would be to use a separate
log file for each service. This would be the simplest solution and at the
same time you would avoid creating a potential bottle-neck.

Regards,
Sami

SoapExtension cannot share resources properly Sridhar, S.
12/29/2004 6:33:52 PM
Hi all,
I am working on a project which requires webservices to log information
about requests that are sent to it. I have written a SoapExtension that logs
client information when a request is sent to the webservice.

When there are two webservices (on the same IIS machine) and both of them
have the same SoapExtension class configured on to it, only one of them can
log information (log is written to the same file - I use Log4Net to write to
the log file). If I want the second webservice to log, I have to re-start
IIS and send a request to the second webservice upon which the first
webservice will no longer log.

I have factored out Log4Net as the problem by putting a simple TextWriter
log with the same result.

My webservices config in web.config looks like this:
<webServices>
<soapExtensionTypes>
<add type="com.company.mi.SoapWebServiceCollector1,ws-agent,
Version=1.0.1824.25573, Culture=neutral, PublicKeyToken=e3a81a1efb72531c"
priority="1" group="0" />
</soapExtensionTypes>
</webServices>

What could I be doing wrong for this to happen?

Thanks for your time and patience.
Sridhar.

Sridhar, S.
sridharsa@gmail.com

AddThis Social Bookmark Button