I am trying to distribute IIS Express with my application. IIS Express will serve external web requests on port 80.
I have no problems running IIS Express as well as
The answer like: string IIS_EXPRESS = @"C:\Program Files\IIS Express\iisexpress.exe";
StringBuilder arguments = new StringBuilder();
arguments.Append(@"/path:");
arguments.Append(@"C:\Inetpub\wwwroot\ClientSyncService");
arguments.Append(@" /Port:2000");
Process process = Process.Start(new ProcessStartInfo()
{
FileName = IIS_EXPRESS,
Arguments = arguments.ToString(),
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
});
Should work, however the trick is that you need to grant ACLs for the the identity of the service so that it can take ownership of port 80. In other words, during your setup program (assuming you have an MSI that will run elevated), make it run a command line like: netsh http add urlacl url=http://WhateverMachineName:80/ user=everyone
where you can limit "everyone" to instead just a specific account under which your service will be running. When you do that, then IIS express should be able to start just fine without requiring administrator privileges.