1

I've followed the following SO article - How to run IIS Express as a process started via a Windows Service

I've installed the Windows Service on my machine using the following code:

private Process _process;

protected override void OnStart(string[] args)
{
    var processStartInfo = new ProcessStartInfo
    {
        FileName = @"C:\Program Files (x86)\IIS Express\iisexpress.exe",
    };

    _process = new Process
    {
        StartInfo = processStartInfo,
        EnableRaisingEvents = true
    };

    _process.Start();
}

protected override void OnStop()
{
    _process.Kill();
}

However when I attempt to start the service, after a long attempt to start the service it fails. When I check the Event Log, I get the following IIS Express errors:

The worker process for app pool 'Clr4IntegratedAppPool', PID='8596', failed to initialize the http.sys communication when asked to start processing http requests and therefore will be considered ill by W3SVC and terminated.  The data field contains the error number.

The worker process failed to initialize correctly and therefore could not be started.  The data is the error.
Community
  • 1
  • 1
5StringRyan
  • 3,604
  • 5
  • 46
  • 69
  • IIS is already ran as a service. Why are you trying using IIS Express instead of IIS anyways? – Security Hound May 02 '12 at 17:36
  • @Ramhound - As much as I would love to use IIS instead of IIS Express, I'm unable to. – 5StringRyan May 02 '12 at 17:40
  • What flavor of windows are you using ? What user is the service configure to run as ? – user957902 May 02 '12 at 20:24
  • @user957902 - The service is running as Local System. I'm currently testing this using Windows 7 Pro, but it will eventually run on Windows XP. – 5StringRyan May 02 '12 at 21:42
  • I don't think LocalSystem has network access by default. Try using the NetworkService user. Also, http is a protected resource. Look for documentation on **netsh.exe http add urlacl** – user957902 May 03 '12 at 12:45
  • @user957902 - It looks like the update to NETWORK SERVICE in the installer for the project worked. List this as an answer and I will accept it. – 5StringRyan May 08 '12 at 18:45

1 Answers1

0

I don't think LocalSystem has network access by default. Try using the NetworkService user.

user957902
  • 3,010
  • 14
  • 18