AutomationDrivers.IisExpressHost.IisExpress.IisExpress C# (CSharp) Method

IisExpress() public method

Initializes a new instance of the IISExpressHost class.
/// Thrown when the requested directory is not present. /// /// Thrown when one or more arguments are outside the required range. ///
public IisExpress ( string path, int port ) : System
path string The full path to the targeted web project
port int The port assigned by ProcessFactory.GetAvailablePort()
return System
        public IisExpress(string path, int port)
        {
            if (!Directory.Exists(path))
            {
                throw new DirectoryNotFoundException();
            }

            if (ushort.MinValue > port || ushort.MaxValue < port)
            {
                throw new ArgumentOutOfRangeException("port");
            }

            Path = path;
            Port = port;

            _startInfo = new ProcessStartInfo
            {
                FileName = IisExpressPath,
                Arguments = string.Format("/path:{0} /port:{1}", path, port),
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                UseShellExecute = false
            };
        }