IIS 7.5 and IIS 8.0 European Hosting

BLOG about IIS 7.5 Hosting, IIS 8.0 Hosting and Its Technology - Dedicated to European Windows Hosting Customer

IIS 8.0 Hosting UK - HostForLIFE.eu :: How To Remove IIS On Windows Server 2012

clock November 17, 2023 08:07 by author Peter

Today's article will teach you how to uninstall Internet Information Services 8 (IIS8) from Windows Server 2012.


Step 1
To begin, enter your password into your Windows Server 2012 as Administrator. If your Server Manager does not launch automatically after logging in, open it by clicking the first button in the task bar.

When you launch the Server Manager, the following window will appear:

Step 2
On the Server manager you will see that IIS is already installed.

To remove the IIS go to the Manage option on the upper right hand corner and click on "Remove Rolls and Features".

Step 3
Now a Window will be opened that will inform you that you are going to removing the section. Just click on "Next" to proceed.

After that you must select a Server from the Server Pool. Since I have only one Server in this article, my default Server is Automatically selected.


Step 4
Once you click Next you will get a list (Rolls) from which click on the Web Server (IIS).

Now click "Next", then one more Window will open that will ask for permission to remove the features.

Step 5
You can select the features that are associated with IIS to be removed.

After clicking Next you must give permission to restart the server automatically if it's considered necessary, then click on "Next".

Step 6
Click on the "Remove" button and the process will begin.


When the removal process is complete, your Windows Server 2012 will be restarted because you already granted permission to do so.

Step 7
After restarting it will automatically show that the removal process had completed successfully.

You can also check this on the Flag that is present on the above right hand corner. Click on the Flag and following confirmation will be shown,



IIS 8 Hosting - HostForLIFE :: Programmatically Create IIS Website and Application Pool Using C#

clock November 16, 2023 09:25 by author Peter

In this post, we will look at how to use a C# console application to create an IIS website and accompanying application pool programmatically. These tasks are typically performed by an IIS administrator.

We can use this application to automate those tasks. In Visual Studio 2010, construct a console application named IISAutomation and target.NET 3.5, as seen below.

Add a reference to Microsoft.Web.Administration, which may be found at C:WindowsSystem32inetsrv [IIS installation directory]. This assembly contains classes that can be used by a developer to administer the IIS Manager. First, we'll build an application pool with the code below:

private static void CreateAppPool(string pool name,bool enable32bitOn64, ManagedPipelineMode mode,string runtimeVersion="v4.0")
{
    using (ServerManager serverManager = new ServerManager())
    {
        ApplicationPool newPool = serverManager.ApplicationPools.Add(poolname);
        newPool.ManagedRuntimeVersion = runtimeVersion;
        newPool.Enable32BitAppOnWin64 = true;
        newPool.ManagedPipelineMode = mode;
        serverManager.CommitChanges();
    }
}


Here, we created an application pool by creating an instance of the application pool object. Then, we set the properties of the application pool, like the name, the .NET version to be used, and the committed changes by calling CommitChanges(). Similarly, we will create a website using the following code:
private static void CreateIISWebsite(string website name, string hostname, string phyPath, string app pool)
{
    ServerManager iisManager = new ServerManager();
    iisManager.Sites.Add(websiteName, "http", "*:80:" + hostname, phyPath);
    iisManager.Sites[websiteName].ApplicationDefaults.ApplicationPoolName = appPool;

    foreach (var item in iisManager.Sites[websiteName].Applications)
    {
        item.ApplicationPoolName = appPool;
    }

    iisManager.CommitChanges();
}

Here, we created a new website by creating an instance of ServerManager, adding it to the Sites collection setting its properties like name, physical path, and so on and committed the changes.

We will use the preceding methods in our Main method and create an application pool and a website using the following code:

static void Main(string[] args)
{
    Console.WriteLine("Do you want to create an Application Pool:y/n");
    string response = Console.ReadLine();
    if (response.ToString() == "y")
    {
        Console.Write("Please enter Application Pool Name:");
        string poolname = Console.ReadLine();
        bool isEnable32bit = false;
        ManagedPipelineMode mode = ManagedPipelineMode.Classic;
        Console.Write("Need to enable 32 bit on Windows 64 bit?y/n [Applicable for 64 bit OS]: y/n?");
        string enable32bit = Console.ReadLine();
        if (enable32bit.ToLower() == "y")
        {
            isEnable32bit = true;
        }
        Console.Write("Please select Pipeline Mode: 1 for Classic, 2 for Integrated:");
        string pipelinemode = Console.ReadLine();
        if (pipelinemode.ToLower() == "2")
        {
            mode = ManagedPipelineMode.Integrated;
        }
        Console.Write("Please select Runtime Version for Application Pool: 1 for v2.0, 2 for v4.0:");
        string runtimeVersion = Console.ReadLine()== "1" ? "v2.0" : "v4.0";

        CreateAppPool(poolname, isEnable32bit, mode, runtimeVersion);
        Console.WriteLine("Application Pool created successfully...");
    }
                Console.WriteLine("Do you want to create a website:y/n");
    response = Console.ReadLine();
    if (response.ToString() == "y")
    {
        Console.Write("Please enter website name:");
        string websiteName = Console.ReadLine();
        Console.Write("Please enter host name:");
        string hostname = Console.ReadLine();
        Console.Write("Please enter physical path to point for website:");
        string phypath = Console.ReadLine();
        Console.WriteLine("Please enter Application pool Name:");
        foreach(var pool in new ServerManager().ApplicationPools)
        {
            Console.WriteLine(pool.Name);
        }
        Console.WriteLine("");
        Console.Write("Please enter Application pool Name for web site:");
        string poolName = Console.ReadLine();
        CreateIISWebsite(websiteName,hostname,phypath,poolName);
        Console.WriteLine("Web site created successfully...");
        Console.ReadLine();
    }
}


Here, we set the attributes necessary for website and application creation by getting input from the console. Let's run the application and input the details as shown below:

We can develop websites and application pools more quickly and easily using this program. I'm wrapping things up here. I've attached the source code for your convenience. I hope everyone finds this article useful.



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in