IIS is formerly known for “Internet Information Services.” IIS is a web server software created by Microsoft for windows server. As a system administrator, we know that to manage IIS is easy from GUI. A few times we get tasks to create a large number of websites under IIS or create a site in IIS. This article will help you in the best way to create a WebSite/AppPool in IIS using Command-Line.
Before start creating the WebSite/AppPool, start the command prompt as administrator. So that you can privileges to execute all the commands. After that access below location in command prompt.
# cd c:\Windows\System32\inetsrv
Create Website in IIS:
Now, We are going to create a website using the command line. We are creating http://windows.techoism.net website with document root C:\sites\windows.techoism.net
# appcmd add site /name:windows.techoism.net /bindings:http://*:80 /physicalpath:”C:\sites\windows.techoism.net”
Create Subdirectory Application:
You can also create the subdirectory application to your existing website. In other words If you want to configure URL like http://windows.techoism.net/blog then /blog is he subdirectory application. We are creating the document root for blog is c:\sites\blog.
An application pool fills in as a container for your applications in IIS. It’s a combination of at least one URLs that can be served by a worker process. IIS App Pool used for the gathering of sites to use similar configuration settings or prevent different applications to use resources of one application by different applications.
App Pool with Default Settings:
Use the following command to create Application Pool named “techpool” with default IIS settings.
# appcmd add apppool /name:techpool
App Pool with Specific Settings
If you want to use different settings for your App Pools, use mention command. Change managedRuntimeVersion as per your requirements v1.0, v1.1, v2.0 or v4.0.