コード例 #1
0
        public static void Process([NotNull] string rootFolderPath, [NotNull] string webRootPath, [NotNull] string dataFolder)
        {
            Assert.ArgumentNotNull(rootFolderPath, "rootFolderPath");
            Assert.ArgumentNotNull(webRootPath, "webRootPath");
            Assert.ArgumentNotNull(dataFolder, "dataFolder");

            if (Settings.CoreInstallHttpRuntimeExecutionTimeout.HasUserValue)
            {
                var executionTimeout = Settings.CoreInstallHttpRuntimeExecutionTimeout.Value;
                var webConfig        = XmlDocumentEx.LoadFile(Path.Combine(webRootPath, "web.config"));
                var systemWeb        = webConfig.SelectSingleElement("/configuration/system.web");
                if (systemWeb == null)
                {
                    systemWeb = webConfig.CreateElement("system.web");
                    webConfig.DocumentElement.AppendChild(systemWeb);
                }

                var httpRuntime = systemWeb.SelectSingleElement("httpRuntime");
                if (httpRuntime == null)
                {
                    httpRuntime = webConfig.CreateElement("httpRuntime");
                    systemWeb.AppendChild(httpRuntime);
                }

                httpRuntime.SetAttribute("executionTimeout", executionTimeout.ToString());
                webConfig.Save();
            }

            SetupWebsiteHelper.SetDataFolder(rootFolderPath, dataFolder);
            if (Settings.CoreInstallNotFoundTransfer.Value)
            {
                CreateIncludeFile(rootFolderPath, "UseServerSideRedirect.config", new NameValueCollection
                {
                    {
                        "RequestErrors.UseServerSideRedirect", "true"
                    }
                });
            }

            var addressString = Settings.CoreInstallMailServerAddress.Value;

            if (string.IsNullOrEmpty(addressString))
            {
                return;
            }

            var credentialsString = Settings.CoreInstallMailServerCredentials.Value;

            var address = Parameters.Parse(addressString);
            var host    = address[0];
            var port    = address[1];

            var credentials = Parameters.Parse(credentialsString);
            var username    = credentials[0];
            var password    = credentials[1];

            var settings = new NameValueCollection
            {
                {
                    "MailServer", host
                },
                {
                    "MailServerPort", port
                },
                {
                    "MailServerUserName", username
                },
                {
                    "MailServerPassword", password
                }
            };

            CreateIncludeFile(rootFolderPath, "MailServer.config", settings);
        }
コード例 #2
0
        public static void Process([NotNull] string rootFolderPath, [NotNull] string webRootPath, [NotNull] string dataFolder, bool serverSideRedirect, bool increaseExecutionTimeout)
        {
            Assert.ArgumentNotNull(rootFolderPath, "rootFolderPath");
            Assert.ArgumentNotNull(webRootPath, "webRootPath");
            Assert.ArgumentNotNull(dataFolder, "dataFolder");

            if (increaseExecutionTimeout)
            {
                var executionTimeout = Settings.CoreInstallHttpRuntimeExecutionTimeout.Value;
                var webConfig        = XmlDocumentEx.LoadFile(Path.Combine(webRootPath, "web.config"));
                var httpRuntime      = GetHttpRuntime(webConfig, true);

                httpRuntime.SetAttribute("executionTimeout", executionTimeout.ToString());
                webConfig.Save();
            }

            SetupWebsiteHelper.SetDataFolder(rootFolderPath, dataFolder);
            if (serverSideRedirect)
            {
                CreateIncludeFile(rootFolderPath, "UseServerSideRedirect.config", new NameValueCollection
                {
                    {
                        "RequestErrors.UseServerSideRedirect", "true"
                    }
                });
            }

            var addressString = Settings.CoreInstallMailServerAddress.Value;

            if (string.IsNullOrEmpty(addressString))
            {
                return;
            }

            var credentialsString = Settings.CoreInstallMailServerCredentials.Value;

            var address = Parameters.Parse(addressString);
            var host    = address[0];
            var port    = address[1];

            var credentials = Parameters.Parse(credentialsString);
            var username    = credentials[0];
            var password    = credentials[1];

            var settings = new NameValueCollection
            {
                {
                    "MailServer", host
                },
                {
                    "MailServerPort", port
                },
                {
                    "MailServerUserName", username
                },
                {
                    "MailServerPassword", password
                }
            };

            CreateIncludeFile(rootFolderPath, "MailServer.config", settings);
        }