Exemplo n.º 1
0
        /// <summary>
        ///     ctor
        /// </summary>
        public WebServerIisExpress(WebServerSettings settings, Dependencies dependencies)
        {
            if (TestEasyConfig.Instance.Client.Remote)
            {
                throw new NotSupportedException("For tests using remote browsers, IISExpress web server type is not supported, please use IIS.");
            }

            if (string.IsNullOrEmpty(settings.RootPhysicalPath) && !string.IsNullOrEmpty(settings.WebAppName))
            {
                settings.RootPhysicalPath = TestEasyHelpers.Tools.GetUniqueTempPath(settings.WebAppName);
            }

            _architecture          = settings.Architecture;
            _fileSystem            = dependencies.FileSystem;
            _environmentSystem     = dependencies.EnvironmentSystem;
            _processRunner         = dependencies.ProcessRunner;
            _serverManagerProvider = dependencies.ServerManagerProvider;

            _type             = "IISExpress";
            _hostName         = settings.HostName;
            _startupTimeout   = settings.StartupTimeout;
            _rootPhysicalPath = string.IsNullOrEmpty(settings.RootPhysicalPath)
                ? Path.GetDirectoryName(_fileSystem.GetExecutingAssemblyDirectory())
                : settings.RootPhysicalPath;
            _httpPort                  = _environmentSystem.GetNextAvailablePort(0);
            _serverExecutablePath      = LocateIisExpress(); // _version is initialized here
            _applicationHostConfigPath = CreateApplicationHostConfigFromTemplate();

            _configs = new Dictionary <string, string>
            {
                {
                    "applicationhost.config", _applicationHostConfigPath
                }
            };

            _iisExpressConfig = new IisExpressConfig(_applicationHostConfigPath, dependencies.FileSystem);

            InitializeApplicationHostConfig();

            Start();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     ctor
        /// </summary>
        public WebServerIisExpress(WebServerSettings settings, Dependencies dependencies)
        {
            if (TestEasyConfig.Instance.Client.Remote)
            {
                throw new NotSupportedException("For tests using remote browsers, IISExpress web server type is not supported, please use IIS.");
            }

            if (string.IsNullOrEmpty(settings.RootPhysicalPath) && !string.IsNullOrEmpty(settings.WebAppName))
            {
                settings.RootPhysicalPath = TestEasyHelpers.Tools.GetUniqueTempPath(settings.WebAppName);
            }

            _architecture = settings.Architecture;
            _fileSystem = dependencies.FileSystem;
            _environmentSystem = dependencies.EnvironmentSystem;
            _processRunner = dependencies.ProcessRunner;
            _serverManagerProvider = dependencies.ServerManagerProvider;

            _type = "IISExpress";
            _hostName = settings.HostName;
            _startupTimeout = settings.StartupTimeout;
            _rootPhysicalPath = string.IsNullOrEmpty(settings.RootPhysicalPath)
                ? Path.GetDirectoryName(_fileSystem.GetExecutingAssemblyDirectory())
                : settings.RootPhysicalPath;
            _httpPort = _environmentSystem.GetNextAvailablePort(0);
            _serverExecutablePath = LocateIisExpress(); // _version is initialized here
            _applicationHostConfigPath = CreateApplicationHostConfigFromTemplate();

            _configs = new Dictionary<string, string>
            {
                {
                    "applicationhost.config", _applicationHostConfigPath
                }
            };

            _iisExpressConfig = new IisExpressConfig(_applicationHostConfigPath, dependencies.FileSystem);
            
            InitializeApplicationHostConfig();

            Start();
        }