Keep object across web service calls?

J

John Granade

I have a 3rd party .dll that makes and keeps a connection to their server.
They offer a web service but for high volume transactions they offer this
..dll where you initially open the connection and then just keep using that
connection for all subsequent calls. I'm trying to leverage that in our web
service but I can't figure out how to have that 'shared' instance of their
dll. I thought I might could put it in the global.asax and just load it in
the application_start but I'm missing how to expose that instance of the
object to my web service and asp.net pages that need to access it.

What's the right way to initiate this object once and then have subsequent
web services and web pages use that object going forward?

Thanks,

John
 
J

John Saunders [MVP]

John Granade @GTSolutions.us> said:
I have a 3rd party .dll that makes and keeps a connection to their server.
They offer a web service but for high volume transactions they offer this
.dll where you initially open the connection and then just keep using that
connection for all subsequent calls. I'm trying to leverage that in our
web service but I can't figure out how to have that 'shared' instance of
their dll. I thought I might could put it in the global.asax and just load
it in the application_start but I'm missing how to expose that instance of
the object to my web service and asp.net pages that need to access it.

What's the right way to initiate this object once and then have subsequent
web services and web pages use that object going forward?

I would create a small Windows Service to host the third party DLL and to
expose its features through .NET Remoting. If you've never done it before,
it's very easy to create a Windows Service. Visual Studio will basically
create the infrastructure for you.

This will allow you to concentrate on the issues involved with managing the
access to this DLL by multiple callers. In particular, you need to find out
from the third party whether their DLL is thread safe. Not only whether they
_say_ it's thread-safe, but whether they've really _tested_ it on multi-CPU
systems. This is not always the case.

If you have any doubts about the safety of this DLL, you will have to code
your service so that only a single request can be processed at a time. You
may also need to ensure that all access to this DLL occurs on a single
thread.

I have experience with third party code that claims to be thread safe, but
is not. In the case I'm thinking of, the company had not actually tested
their product as called by an ASP.NET web service. I suggest you either make
sure that it has been properly tested, or else protect yourself in case it
has not been!

Good Luck!
 
J

John Granade

John,

Awesome information. Thank you so much for your insight. Based on your
direction, .NET Remoting seems to be what I need so I'm headed in that
direction now. The 3rd party .dll is a somewhat old C++ .dll.

Again, thanks for your insight.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top