Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Windows Tutorials»How to Create a WebSite/AppPool in IIS via Command Prompt

    How to Create a WebSite/AppPool in IIS via Command Prompt

    By RahulFebruary 11, 20142 Mins ReadUpdated:August 5, 2022

    IIS (Internet Information Services) is a web server created by Microsoft for Windows systems. As a system administrator, we know that managing IIS is easy from GUI. Sometimes we get tasks to create a large number of websites under IIS or create a site in IIS using a windows batch script. This article will guide you on how to create a Website, Application, site binding, and Application Pool in IIS using the command line.

    Advertisement

    Before using the below commands, start the command prompt as administrator. So that you can get all the privileges to make changes. After that navigate to C:\Windows\System32\inetsrv directory.

    cd c:\Windows\System32\inetsrv
    

    Create Website in IIS

    For example we need to create a website named example.com with document root c:\sites\example.com.

    appcmd add site /name:example.com /id:1 /physicalPath:c:\sites\example.com /bindings:http/*:80:example.com
    

    add-site-in-iis-command-line

    Create Subdirectory Application

    You can add a subdirectory application to your existing website. For example, to configure a URL like http://example.com/blog, the /blog is the subdirectory application configured under the example.com website. To create this create execute the following command. Assuming the document root for blog is c:\sites\blog.

    appcmd add app  /site.name:example.com /path:/blog /physicalPath:c:\sites\blog
    

    Create Application Pool in IIS

    IIS App Pool is used for grouping sites to use similar configuration settings or prevent other applications to use resources of one application by other applications. Use one of the below options as per your requirements

    App Pool with Default Settings

    Use the following command to create Application Pool named “myAppPool” with default settings of IIS.

    appcmd add apppool /name:myAppPool
    

    App Pool with Specific Settings

    If you want to use different settings for your App Pools, use the command below. Change managedRuntimeVersion as per your requirements v1.0, v1.1, v2.0 or v4.0.

    appcmd add apppool /name:myAppPool /managedRuntimeVersion:v2.0 /managedPipelineMode:Integrated
    appcmd add apppool /name:myAppPool /managedRuntimeVersion:v2.0 /managedPipelineMode:Classic
    

    appcmd-add-app-pool-in-iis

    Change App Pool of Website

    You can also change the Application Pool of any website using appcmd command. Use following command to change application pool of site example.com and set App Pool to myAppPool

    appcmd set site /site.name:example.com /[path='/'].applicationPool:myAppPool
    

    To change the Application Pool for a subdirectory URL use the following command.

    appcmd set site /site.name:example.com /[path='/blog'].applicationPool:myAppPool
    

    appcmd-assign-app-pool-to-website-in-iis

    Conclusion

    You can perform any tasks related to IIS using appcmd command-line utility. This allows you to quick website configuration, easy backup, and restore.

    app pool appcmd command create site iis7 iis8 website
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Sed Command to Delete Lines in a File

    Sed Command to Delete Lines in a File

    4 Methods to Check .NET Framework Version on Windows

    Sort Command in Linux with Practical Examples

    View 1 Comment

    1 Comment

    1. Wahyu on September 1, 2017 4:19 pm

      This very useful

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.