views:

65

answers:

1

So I'm running a Windows Service as a user. Admin rights. This service launches an EXE via Process.Start. Within the EXE, a WebBrowser control is used to navigate to a website, log in, handle all the security handshaking, and get some data. It comes back out, writes the data to a file.

Not the most efficient process, admittedly, but my work situation has stuck me with it.

Anyway, when testing the WebBrowser EXE directly, it runs really quickly, but when it's running from the service it goes substantially slower. Why would this be? Are there some network bottlenecks placed on services? I've tried raising the starting thread priority of the process WebBrowser exe in the Process.StartInfo of it before I run it, and that works a bit, but it is still massively slow.

Within the WebBrowser EXE, I'm waiting until pages are complete or certain elements appear by constantly polling the state of the WebBrowser. Could that be the cause of this slowness?

I've also seen very similar slowdowns when using HTTPWebRequest to do the same sort of things from a service -- it'll run relatively fast from a Forms app, but very slowly from a service.

So yeah, my predicament can be summarized thusly:

Why do WebBrowser and HTTPWebRequest transactions seem to take longer when executed by an EXE called from a Windows Service running as an admin user?

A: 

There will be tons of setting missing because the HKEY_CURRENT_USER hive is not loaded in service (LoadUserProfile is not called in serivce). I am not even sure how IE's security zone policies work without the zone definitions.

And IE has a small simultaneous connections limit, 6 on a broadband connection in IE8. If your web server has more concurrent users than the limit then someone has to wait.

Sheng Jiang 蒋晟
Hmmm wow! I didn't know that. That could explain the issue, I guess.
Joshua Evensen
Also after some additional testing, the speed difference might have just been a series of weird testing flukes cause with the same settings it is working at comparable speeds now. hmmmmmmm.
Joshua Evensen