views:

57

answers:

1

I have a component, which silently retrieves some data from web using .NET WebBrowser component. It is written so that it will not show any dialog boxes, or any other interactive UI components, but since it is a form component, I need to create a form and STA thread to host it. I'm then starting it using Form.ShowDialog()

This works perfectly, except I cannot run this setup in non-interactive service. When I'm trying to do this, I'm receiving an exception "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application."

Is there any way to configure a service so that it runs WebBroswer anyway, without displaying any UI or anything?

+1  A: 

No, there isn't, this change was made from Windows Vista on as a security measure that you have to opt-in to in order to use.

Generally speaking, what you are doing isn't the best way to get scrape content, but if you must do it this way, then you will need to enable the service to interact with the desktop.

casperOne