Beispiel #1
0
        private static void EnablePreload(IISDeploymentParameters baseDeploymentParameters)
        {
            baseDeploymentParameters.EnsureSection("applicationInitialization", "system.webServer");
            baseDeploymentParameters.ServerConfigActionList.Add(
                (config, _) => {
                config
                .RequiredElement("system.applicationHost")
                .RequiredElement("sites")
                .RequiredElement("site")
                .RequiredElement("application")
                .SetAttributeValue("preloadEnabled", true);
            });

            baseDeploymentParameters.EnableModule("ApplicationInitializationModule", "%IIS_BIN%\\warmup.dll");
        }
    public static void SetWindowsAuth(this IISDeploymentParameters parameters, bool enabled = true)
    {
        parameters.EnsureSection("windowsAuthentication", "system.webServer", "security", "windowsAuthentication");
        parameters.EnableModule("WindowsAuthenticationModule", "%IIS_BIN%\\authsspi.dll");

        parameters.AddServerConfigAction(
            element =>
        {
            var windowsAuthentication = element
                                        .RequiredElement("system.webServer")
                                        .RequiredElement("security")
                                        .RequiredElement("authentication")
                                        .GetOrAdd("windowsAuthentication");

            windowsAuthentication.SetAttributeValue("enabled", enabled);
            var providers = windowsAuthentication.GetOrAdd("providers");
            providers.GetOrAdd("add", "value", "Negotiate");
            providers.GetOrAdd("add", "value", "NTLM");
        });
    }