By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,537 Members | 1,750 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,537 IT Pros & Developers. It's quick & easy.

COMException when using Interop.SHDocVw

P: n/a
I have an application that loads IE and iterates through web pages to
retrieve information from the page then activates specific controls to
retrieve the next page and iterate through that page for it's information,
etc, etc.

I have found many articles from people getting COMException errors when
trying to use Interop.SHDocVw from a windows service, so it's pretty
apparent to me that this is a difficult application to build, but I have yet
to find an article that explains either an alternative way to retrieve
information from a web page or that explains how to get Interop.SHDocVw to
work from an agent. I have tried running the agent under my own user account
that is a member of the machine Administrators group but I still get the
error. I have included the error below if someone can make more sense out
of it then I can.

Thanks in advance,
Jay A. Moritz
Predictable Outcomes

Timestamp: 7/8/2005 2:58:04 AM
Message: HandlingInstanceID: 8b1ce84e-9041-4b7d-a1b3-0a7be47db2b7
An exception of type 'System.Runtime.InteropServices.COMException' occurred
and was caught.
-------------------------------------------------------------------------------------------
07/08/2005 02:58:04
Type : System.Runtime.InteropServices.COMException, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : The object invoked has disconnected from its clients.
Source : Interop.SHDocVw
Help link :
ErrorCode : -2147417848
TargetSite : Void Navigate2(System.Object ByRef, System.Object ByRef,
System.Object ByRef, System.Object ByRef, System.Object ByRef)
Stack Trace : at SHDocVw.IWebBrowser2.Navigate2(Object& URL, Object&
Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
at
pOrchestrator.DataLinks.HTMLParser.GetHTMLFromBrow ser(InternetExplorer& ie,
Collection SiteRules, SiteURL SiteURL, Boolean IsFirstPage, Int32
MaxNavigationDuration)

Additional Info:

MachineName : HP-BIZ2
TimeStamp : 7/8/2005 6:58:04 AM
FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
AppDomainName : porchestratoragent.exe
ThreadIdentity :
WindowsIdentity : NT AUTHORITY\LOCAL SERVICE

Category: General
Priority: 0
EventId: 100
Severity: Error
Title:pSystem.Exception
Machine: HP-BIZ2
Application Domain: porchestratoragent.exe
Process Id: 2788
Process Name: c:\program files\porchestrator agent\porchestratoragent.exe
Win32 Thread Id: 1640
Thread Name:
Extended Properties:
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
ShDocVw is not a server type component but a client type ActiveX component,
that means it should be properly hosted inside a visual control like a Form.
Services aren't able to host ActiveX controls.

Willy.

"Jay A. Moritz" <jm*****@predictableoutcomes.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
I have an application that loads IE and iterates through web pages to
retrieve information from the page then activates specific controls to
retrieve the next page and iterate through that page for it's information,
etc, etc.

I have found many articles from people getting COMException errors when
trying to use Interop.SHDocVw from a windows service, so it's pretty
apparent to me that this is a difficult application to build, but I have
yet to find an article that explains either an alternative way to retrieve
information from a web page or that explains how to get Interop.SHDocVw to
work from an agent. I have tried running the agent under my own user
account that is a member of the machine Administrators group but I still
get the error. I have included the error below if someone can make more
sense out of it then I can.

Thanks in advance,
Jay A. Moritz
Predictable Outcomes

Timestamp: 7/8/2005 2:58:04 AM
Message: HandlingInstanceID: 8b1ce84e-9041-4b7d-a1b3-0a7be47db2b7
An exception of type 'System.Runtime.InteropServices.COMException'
occurred and was caught.
-------------------------------------------------------------------------------------------
07/08/2005 02:58:04
Type : System.Runtime.InteropServices.COMException, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : The object invoked has disconnected from its clients.
Source : Interop.SHDocVw
Help link :
ErrorCode : -2147417848
TargetSite : Void Navigate2(System.Object ByRef, System.Object ByRef,
System.Object ByRef, System.Object ByRef, System.Object ByRef)
Stack Trace : at SHDocVw.IWebBrowser2.Navigate2(Object& URL, Object&
Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
at
pOrchestrator.DataLinks.HTMLParser.GetHTMLFromBrow ser(InternetExplorer&
ie, Collection SiteRules, SiteURL SiteURL, Boolean IsFirstPage, Int32
MaxNavigationDuration)

Additional Info:

MachineName : HP-BIZ2
TimeStamp : 7/8/2005 6:58:04 AM
FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
AppDomainName : porchestratoragent.exe
ThreadIdentity :
WindowsIdentity : NT AUTHORITY\LOCAL SERVICE

Category: General
Priority: 0
EventId: 100
Severity: Error
Title:pSystem.Exception
Machine: HP-BIZ2
Application Domain: porchestratoragent.exe
Process Id: 2788
Process Name: c:\program files\porchestrator agent\porchestratoragent.exe
Win32 Thread Id: 1640
Thread Name:
Extended Properties:

Nov 21 '05 #2

P: n/a
Thank you Willy, but it does lead to a second question:

How do I get information out of a web page when I need to do it from a
windows service? Do you know of an object/class I can use?

Thanks in advance,
Jay A. Moritz
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:OG**************@tk2msftngp13.phx.gbl...
ShDocVw is not a server type component but a client type ActiveX
component, that means it should be properly hosted inside a visual control
like a Form. Services aren't able to host ActiveX controls.

Willy.

"Jay A. Moritz" <jm*****@predictableoutcomes.com> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
I have an application that loads IE and iterates through web pages to
retrieve information from the page then activates specific controls to
retrieve the next page and iterate through that page for it's information,
etc, etc.

I have found many articles from people getting COMException errors when
trying to use Interop.SHDocVw from a windows service, so it's pretty
apparent to me that this is a difficult application to build, but I have
yet to find an article that explains either an alternative way to
retrieve information from a web page or that explains how to get
Interop.SHDocVw to work from an agent. I have tried running the agent
under my own user account that is a member of the machine Administrators
group but I still get the error. I have included the error below if
someone can make more sense out of it then I can.

Thanks in advance,
Jay A. Moritz
Predictable Outcomes

Timestamp: 7/8/2005 2:58:04 AM
Message: HandlingInstanceID: 8b1ce84e-9041-4b7d-a1b3-0a7be47db2b7
An exception of type 'System.Runtime.InteropServices.COMException'
occurred and was caught.
-------------------------------------------------------------------------------------------
07/08/2005 02:58:04
Type : System.Runtime.InteropServices.COMException, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : The object invoked has disconnected from its clients.
Source : Interop.SHDocVw
Help link :
ErrorCode : -2147417848
TargetSite : Void Navigate2(System.Object ByRef, System.Object ByRef,
System.Object ByRef, System.Object ByRef, System.Object ByRef)
Stack Trace : at SHDocVw.IWebBrowser2.Navigate2(Object& URL, Object&
Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
at
pOrchestrator.DataLinks.HTMLParser.GetHTMLFromBrow ser(InternetExplorer&
ie, Collection SiteRules, SiteURL SiteURL, Boolean IsFirstPage, Int32
MaxNavigationDuration)

Additional Info:

MachineName : HP-BIZ2
TimeStamp : 7/8/2005 6:58:04 AM
FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
AppDomainName : porchestratoragent.exe
ThreadIdentity :
WindowsIdentity : NT AUTHORITY\LOCAL SERVICE

Category: General
Priority: 0
EventId: 100
Severity: Error
Title:pSystem.Exception
Machine: HP-BIZ2
Application Domain: porchestratoragent.exe
Process Id: 2788
Process Name: c:\program files\porchestrator agent\porchestratoragent.exe
Win32 Thread Id: 1640
Thread Name:
Extended Properties:


Nov 21 '05 #3

P: n/a
Jay,

You can use by instance the HTTPWebrequest/response classes

\\\
Module main
Public Sub main()
Dim myReg As Net.HttpWebRequest = _
DirectCast(Net.WebRequest.Create("http://www.google.com"), _
Net.HttpWebRequest)
Dim myResp As Net.HttpWebResponse = _
DirectCast(myReg.GetResponse(), Net.HttpWebResponse)
Dim myStream As IO.Stream = myResp.GetResponseStream()
Dim myreader As New IO.StreamReader(myStream)
Dim mystring As String = myreader.ReadToEnd()
myResp.Close()
End Sub
End Module
///

I hope this helps a little bit?

Cor
Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.