示例#1
0
        internal static WebExtensionStatus CheckIIS6WebExtensions()
        {
            WebExtensionStatus status = WebExtensionStatus.NotInstalled;

            DirectoryEntry iis = new DirectoryEntry("IIS://LocalHost/W3SVC");

            foreach (string propertyName in iis.Properties.PropertyNames)
            {
                if (propertyName.Equals("WebSvcExtRestrictionList", StringComparison.InvariantCultureIgnoreCase))
                {
                    PropertyValueCollection valueCollection = iis.Properties[propertyName];
                    foreach (object objVal in valueCollection)
                    {
                        if (objVal != null && !string.IsNullOrEmpty(objVal.ToString()))
                        {
                            string strVal = objVal.ToString().ToLower();
                            if (strVal.Contains(@"\v2.0.50727\aspnet_isapi.dll".ToLower()))
                            {
                                if (strVal[0] == '1')
                                {
                                    status = WebExtensionStatus.Allowed;
                                }
                                else if (status == WebExtensionStatus.NotInstalled)
                                {
                                    status = WebExtensionStatus.Prohibited;
                                }
                            }
                        }
                    }
                }
            }
            return(status);
        }
示例#2
0
        private CheckStatuses CheckASPNET(out string details)
        {
            details = "ASP.NET 2.0 is installed.";
            CheckStatuses ret = CheckStatuses.Success;

            try
            {
                if (SetupVariables.IISVersion.Major == 6)
                {
                    //iis 6
                    WebExtensionStatus status = GetASPNETStatus();
                    switch (status)
                    {
                    case WebExtensionStatus.NotInstalled:
                    case WebExtensionStatus.Prohibited:
                        InstallASPNET();
                        EnableASPNET();
                        ret     = CheckStatuses.Warning;
                        details = "ASP.NET 2.0 has been installed.";
                        break;
                    }
                }
                else
                {
                    //IIS 7 on Windows 2008 and higher
                    if (!IsWebServerRoleInstalled())
                    {
                        details = "Web Server (IIS) role is not installed on your server. Run Server Manager to add Web Server (IIS) role.";
                        Log.WriteInfo(string.Format("ASP.NET check: {0}", details));
                        return(CheckStatuses.Error);
                    }
                    if (!IsAspNetRoleServiceInstalled())
                    {
                        details = "ASP.NET role service is not installed on your server. Run Server Manager to add ASP.NET role service.";
                        Log.WriteInfo(string.Format("ASP.NET check: {0}", details));
                        return(CheckStatuses.Error);
                    }
                }
                Log.WriteInfo(string.Format("ASP.NET check: {0}", details));
                return(ret);
            }
            catch (Exception ex)
            {
                if (!Utils.IsThreadAbortException(ex))
                {
                    Log.WriteError("Check error", ex);
                }
                details = "Unexpected error";
#if DEBUG
                return(CheckStatuses.Warning);
#endif
#if !DEBUG
                return(CheckStatuses.Error);
#endif
            }
        }
示例#3
0
        private bool CheckWebExtensions()
        {
            bool ret = true;

            try
            {
                if (SetupVariables.IISVersion.Major < 7)
                {
                    DirectoryEntry     iis    = new DirectoryEntry("IIS://LocalHost/W3SVC");
                    WebExtensionStatus status = WebExtensionStatus.NotInstalled;
                    foreach (string propertyName in iis.Properties.PropertyNames)
                    {
                        if (propertyName.Equals("WebSvcExtRestrictionList", StringComparison.InvariantCultureIgnoreCase))
                        {
                            PropertyValueCollection valueCollection = iis.Properties[propertyName];
                            foreach (object objVal in valueCollection)
                            {
                                if (objVal != null && !string.IsNullOrEmpty(objVal.ToString()))
                                {
                                    string strVal = objVal.ToString().ToLower();
                                    if (strVal.Contains(@"\v2.0.50727\aspnet_isapi.dll".ToLower()))
                                    {
                                        if (strVal[0] == '1')
                                        {
                                            status = WebExtensionStatus.Allowed;
                                        }
                                        else if (status == WebExtensionStatus.NotInstalled)
                                        {
                                            status = WebExtensionStatus.Prohibited;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (status == WebExtensionStatus.NotInstalled)
                    {
                        ShowWarning("ASP.NET 2.0 is not installed in the Web Service Extensions in IIS. Please install ASP.NET 2.0 Web Service Extension and click Next button to continue with the installation.");
                        ret = false;
                    }
                    else if (status == WebExtensionStatus.Prohibited)
                    {
                        ShowWarning("ASP.NET 2.0 is not allowed in the Web Service Extensions in IIS. Please allow ASP.NET 2.0 Web Service Extension and click Next button to continue with the installation.");
                        ret = false;
                    }
                }
            }
            catch (Exception ex)
            {
                // you cannot enumerate metabase properties unless you are using Windows XP Professional with Service Pack 2 or Windows Server 2003 with Service Pack 1.
                Log.WriteError("IIS metabase error", ex);
                ret = true;
            }
            return(ret);
        }
示例#4
0
        public static WebExtensionStatus GetAspNetWebExtensionStatus_Iis6(SetupVariables setupVariables)
        {
            WebExtensionStatus status = WebExtensionStatus.Allowed;

            if (setupVariables.IISVersion.Major == 6)
            {
                status = WebExtensionStatus.NotInstalled;
                string path;
                if (Utils.IsWin64() && !Utils.IIS32Enabled())
                {
                    //64-bit
                    path = Path.Combine(OS.GetWindowsDirectory(), @"Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll");
                }
                else
                {
                    //32-bit
                    path = Path.Combine(OS.GetWindowsDirectory(), @"Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll");
                }
                path = path.ToLower();
                using (DirectoryEntry iis = new DirectoryEntry("IIS://LocalHost/W3SVC"))
                {
                    PropertyValueCollection values = iis.Properties["WebSvcExtRestrictionList"];
                    for (int i = 0; i < values.Count; i++)
                    {
                        string val = values[i] as string;
                        if (!string.IsNullOrEmpty(val))
                        {
                            string strVal = val.ToString().ToLower();

                            if (strVal.Contains(path))
                            {
                                if (strVal[0] == '1')
                                {
                                    status = WebExtensionStatus.Allowed;
                                }
                                else
                                {
                                    status = WebExtensionStatus.Prohibited;
                                }
                                break;
                            }
                        }
                    }
                }
            }
            return(status);
        }