Multithreaded Automating of IE

  • Thread starter Thread starter Alan Pretre
  • Start date Start date
A

Alan Pretre

I have a .NET windows service that automates IE through interop to shdocvw.
Everything works great as long as I only try to do one task at a time.
However, this is a multithreaded service where each thread wants to go to
different websites to do some work, and I find that my multiple instances of
shdocvw.InternetExplorer step over each other. So I conclude that there
really is only one instance of IE under the hood that they are
unintentionally sharing.

If I write a test application in WinForms and open multiple copies of it,
the IE instances are kept separated as I would expect. Unfortunately, I
need this same kind of isolation in a windows service. I have tried
creating new appdomains for each instance and instantiating with
CreateComInstanceFrom(), but that doesn't help.

Basically, what I need is multiprocess-like isolation within a single
process and separate appdomains are not cutting it. Any ideas?

TIA.

-- Alan
 
I'd imagine you could get multi-tasking if you used the webrequest method
assuming you don't need to *see the results in a browser? Is that a
requirement?

--

________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
 
Alvin Bruney said:
I'd imagine you could get multi-tasking if you used the webrequest method
assuming you don't need to *see the results in a browser? Is that a
requirement?

The pages are complex with arrays of hyperlinks, buttons, and whatnot that
need to navigated, values filled in for querying, etc. IE seemed at the
time the easiest way to accomplish this. And is in fact easy except for
that multithreading problem.

-- Alan
 
Back
Top