{"id":7229,"date":"2020-12-02T15:55:13","date_gmt":"2020-12-02T10:25:13","guid":{"rendered":"https:\/\/www.h2kinfosys.com\/blog\/?p=7229"},"modified":"2026-01-06T06:47:09","modified_gmt":"2026-01-06T11:47:09","slug":"how-to-host-a-website-on-iis","status":"publish","type":"post","link":"https:\/\/www.h2kinfosys.com\/blog\/how-to-host-a-website-on-iis\/","title":{"rendered":"How to Host a Website on IIS?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Host a Website on IIS<\/h2>\n\n\n\n<p>IIS server (Internet Information Services server) is a Windows Server\u2013based web application used to Host a Website on IIS and deliver website content over the internet to end users. IIS uses .NET web application frameworks such as ASP.NET <a href=\"https:\/\/www.h2kinfosys.com\/blog\/what-is-mvc-architecture\/\">MVC <\/a>and Entity Framework; additionally, it also integrates with Visual Studio, all of which make it a popular choice for enterprises.<\/p>\n\n\n\n<p>Other key features of IIS are its user\u2019s ability to delegate control of the administration of the web site or web applications. It is great for the creation of access controls to different departments. For instance, your Web Developers may only need access to the front end of the Website, and your IT Technical teams only need access to the backend. IIS can easily integrate with API technology. IIS also scales very well; web site load balancing is a core feature and dynamic caching and compression.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Dotnet Frame Work Videos I dot net tutorials for beginners | online testing courses from H2Kinfosys\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/yg2LFkuhx_0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Download and Install IIS?<\/strong><\/h2>\n\n\n\n<p><strong>Step 1: <\/strong>Download Windows Server from the URL <a href=\"https:\/\/www.microsoft.com\/en-us\/evalcenter\/evaluate-windows-server-2019\" rel=\"nofollow noopener\" target=\"_blank\">https:\/\/www.microsoft.com\/en-us\/evalcenter\/evaluate-windows-server-2019<\/a> and try it for 180 days.<\/p>\n\n\n\n<p><strong>Step 2: <\/strong>Open Server Manager and click on Add roles and features.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/rMTbhEz5nVbR4MW07GF8e7W6Vf8aBjrwSbitjXofLPNvBCwIPnS1YIdJpEJJf5NUkMJoDYMcfn65tnYmA7T3L7Krpk0laTn9MndipbKtXSaaS_6eeqqxs7wZfiTIBBLaSr9z7Hrx9FncGlFK0A\" alt=\"Server Manager Add Roles And Features Windows Server 2019\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 3: <\/strong>On the window, Before you begin, click on the Next button.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/_2K32SYCPigeriOASxECoOLqoChYGoHIXbwidbhS_2jG_gt8LD79TCK1Pj8bipesTYbNYUDXZIyNq0g8is0GEkrye4NI-JpaYlFUmyW2dpSm1Spx2FJv8B8385CORRCOcfxbBeSVLcnlgnBxDA\" alt=\"Windows Server Manager 2019 Before you begin\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 4: <\/strong>On the Select installation type window, select Role-based or feature-based installation, and click on the Next.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/xuz8n9LQT5Oegxo9uMNl8x5hZpiMSvAvt5dmCHNdxhZWyf9luNHZRkkosYBY2dIitYMfX8VkTYmKl7W38fjELsMsWQfQI4a2hKNvv_0XxRGdMGYcW32xsvbYExvgroX3V6cpstrnNXaTRV-i6Q\" alt=\"Select Installation Type Windows Server 2019\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 5: <\/strong>As we are installing to our local machine, choose Select a server from the server pool having the current machine selected and click on the Next. Also, you can select another server that you are managing from here.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/kinAlw0dGlJCIgl7sFxx8LLtpUERMpEbue5ZaLjEZlBu8JYdWyhJ1dkLhO4mXkJmHReW8co9Cl8eog8_l1fxW6bw8SjdeyrGdlzdvAPfknGupnaKwhSJ6sxrR-i4hBsPuHSP3q8l3vQj7C_-1Q\" alt=\"Select Destination Server Windows Server 2019\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 6:<\/strong> From the window, Select server roles, check the box next to Web Server (IIS). It will open up a new window, advising that additional features are required. Click on the Add Features button to install these as well and then click Next back on the Select server roles menu once it is complete.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/D6jJXLBiqbom5Z9Nc5859hm38jRGNNznGI2mYJQKqXqTz6yokJ48pwgzubOL3AVQ2tGwr3wT66QnCW6MgDbR0IftaybRDjNIRseJdPeNvKPnnGgXcHig6hTZiLBpJVE9pTtx9NR363-8NaOyWw\" alt=\"Server Manager Select Server Roles\" title=\"\"><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/ezWBr_ANBcS3eoJy5sKp2vUTO1ORvVfrjlZ54280pT_OB7D-vhzSqwCI3JyL6avzAAiSiqliwXVe55mmj-5TxmoJAA5omWsr-gUvEEst32ioRExTfbfQSh82hmpI8-NB1-xus36-c407mz1Wvg\" alt=\"Add IIS Features\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 7: <\/strong>We will not be installing any additional features at this stage, so click Next on the window Select features.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/MsHXq1WoF8UkdqS7LatEntnvlnaPmEeKzens262QrgXMyAtLBJAFjx-soPQ3_il9P1xoPq5g0IkjPjpV8fkPrQxn1pLWFWfMpG8RbTbB2iptypzCAeHdzsd5sliEB-FzASGB64Vgns0K5UOgjw\" alt=\"Select Features to Install\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 8: <\/strong>Click Next on the Web Server Role (IIS) window after reading the information.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/E_8IOwgdOSKmxOgwFyWt4Oau4MhfJc5v6c5xbQAQVWm3DuChTkPUkx3whFLrAydnFCmJ_ly6oOL28ml5U3jYzviJPqPidH-g-l1mGjfjEqHrfu_MQqIkpGDb3pPDVEkpW2mSC9DsgKGBqtgRVQ\" alt=\"Install Web Server Role - Windows Server 2019\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 9:<\/strong> At this point on the Select role services window, you can also install additional services for IIS if required. You don&#8217;t need to concern about this now as you can always come back and add more later, so click Next for now to install the defaults.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/jBvpKgJgAs8T1158ax7yeSX_EG2navhdKHqrNYNKGQhZUTI2QVXhAp6i6w7oduGrzBW-QIsm6M43i-I21rhcIpY6tuOIVpcbzxDzuyE-wG79V8V2RJ7Y3ZXCA2O0nvEEKOgFc4iDTpMGV6zajw\" alt=\"Select Role Services - Windows Server 2019\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 10: <\/strong>Finally, on the Confirm installation selections window, review the items that are to be installed and click Install when you are ready to proceed with installing the IIS web server.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/FhvGNrI2aDkDEsF13j1S8HOnmWpbm4TQmp23ZDi8ustid1PzlgEhU7_oMHD9pSEGN6DB4y8JRrZrqBu6Crtf4NK0r0sHELum0aKnuKa24HYQM8Katfgs_4FVP8MCtyoq7om_Ao4nZkeXhwo-0g\" alt=\"Confirm Installation Selections - Windows Server 2019\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 11: <\/strong>Once the installation is finished, click the close button. At this point, IIS should be by default running on port 80 with the firewall rule <a href=\"https:\/\/en.wikipedia.org\/wiki\/World_Wide_Web\" rel=\"nofollow noopener\" target=\"_blank\">World Wide Web<\/a> Services (HTTP Traffic-In) as enabled in the Windows firewall automatically.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/0t5gbaz-Q4wlGaCSAbAFHURKvfUr8zw2S-NXXQKVFdbPIDM0D-a81I3jPpfqMVtbmviEgGrQL5-Df5jzGV2cHjhXcrcssC9VHsopmFvjmSbDnZIx1kNwsDYbQ06oKIhaJ9aOA_40vb1u5vhHEw\" alt=\"IIS Installation Progress - Windows Server 2019\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 12:<\/strong> You can perform a simple test by opening up a web browser and browsing to the server that you have installed IIS on. You should see the default IIS page.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/Ycrash_Pk0nsQDkZ2_2FaKCjNY6OpycmslPfHcOdJR34j6Kdec_9xxOqmF_XyvmvwLXXKmDAUnYY3dxBDqiCkgeoWv6gH5D_M5ZPPWQnUgT1CSQG_cfaAqSOxsOKkxJdSca-IZ2sX-bje6zV4w\" alt=\"Windows Server 2019 IIS default web page\" title=\"\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to Deploy a Website in IIS?<\/strong><\/h2>\n\n\n\n<p>After developing the web application, the next step is to deploy the web application. It needs to be deployed so that other users can access it. The deployment is done on an IIS Web server and there are two ways to deploy an application to the server:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using the File Copy method.<\/li>\n\n\n\n<li>Using the Web publish method.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Using the File Copy method:<\/strong><\/h3>\n\n\n\n<p><strong>Step 1:<\/strong> Let us first ensure we have our web application DemoApplication open in Visual Studio.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/dYh19bF0D7-wnVNzVP6_s4AmQ9XVOT0bZq-oc19m0_A4oqDesWKh8ySAvHguaRtQL2cP9hX6WgjLXq-H0uitrch3V6lobxVVylRFSlcxgZrQ7xF-dhYJf3SxJUdTo8aM3DwBC6XIual80rjHPQ\" alt=\"Deploying a website on IIS\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 2:<\/strong> Open the Demo.aspx file and enter the string &#8220;I am ASP.Net.&#8221;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;!DOCTYPE html&gt;\n&lt;html xmlns=\"https:\/\/www.w3.ore\/1999\/xhtml\"&gt;\n&lt;head runat=\"server\"&gt;\n&lt;title&gt;&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&nbsp; &lt;form id=\"form1\" runat=\"server\u201d&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ASP.Net\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/div&gt;\n&nbsp; &lt;\/form&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre>\n\n\n\n<p>Now run the application in Visual Studio to make sure it works.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Using the Web publish method:<\/strong><\/h3>\n\n\n\n<p>Another method to deploy web applications is via publishing a website. The main difference in this method is that<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You will have more control over the deployment.<\/li>\n\n\n\n<li>You can also specify to which Web site you want to deploy your application.<\/li>\n\n\n\n<li>For example, if you have two websites WebSite1 and WebSite2. If you use the Web publish method, then you can publish your application to any website. Also, you do not need to know the physical path of the Web site.<\/li>\n\n\n\n<li>In the FileCopy method, you need to know the physical path of the website.<\/li>\n<\/ul>\n\n\n\n<p><strong>Step 1:<\/strong> In this step, right-click the web project in the Solution Explorer and choose the option Publish from the context menu.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/kurjmD-zP2oG8wmc_mgjNS9C10llEdybDSz2m5xhzIXjHDuBY_qLdMXoonwysnseEqQM-tfMXRHsVt8Qp7EYkxN8phxQXRyIy4NVBCBOXsuomVgahIqmJF5Ij_j1bY6K6VKsGcQ3W1fpFdySOA\" alt=\"Image for post\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 2:<\/strong> In the next screen, select the New Profile option to create a new Publish profile. It will contain the settings for publishing the web application using Web Deploy.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/9mB2JmYKuploZdh_KWZU_-5KetSaCJUJQswv8G5y404TojxmGKD4JI29gJm-XKacw-rk3WArUapTcyAi91za6rQh-21gYAzlnhvc0w-LhGyLNFpSTbbdtVRUmaz1Tswx1xoNWkJDnu6aqpRDMA\" alt=\"Image for post\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 3:<\/strong> In the next screen, provide the details of the profile. Give a name for the profile and click the OK button to create the profile.<\/p>\n\n\n\n<p><strong>Step 4:<\/strong> In the next screen, give all the publishing process details. Choose the Publish method as Web Deploy. Select the Service URL as Localhost. Enter the site name as the Default Website \u2013 Note that this is the name of the IIS website. Enter the destination URL as http:\/\/localhost.<\/p>\n\n\n\n<p>Finally, click the Next button to proceed.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/VzfxjK_u4PulZqMoK9SAQRTB3kQeTHGpOQ2O_CXU6MJOWOqgGf1inVMtt0goAD4O_J9k5_JUuBSVZmAvNyJmk2DeJf2YRn7OpVFDhTW4HDvAq7du4Yzl1T2KoLVtwNom2yhdx3D7tJ76m4bKHA\" alt=\"Image for post\" title=\"\"><\/figure>\n\n\n\n<p>Click on the Validate Connection button at the bottom of the Connection section. You should get a green right mark. If you enter the incorrect site name, then it will give an error as below:<\/p>\n\n\n\n<p>Web Deployment task failed. (Site \u2018localhost\u2019 does not exist Learn more at: <a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=221672#ERROR_SITE_DOES_NOT_EXIST\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/go.microsoft.com\/fwlink\/?LinkId=221672#ERROR_SITE_DOES_NOT_EXIST<\/a>).<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/uCxukeHxCmyT3U9foN0ipLym2jW8DzU00rESZAGP0iTxUC_KV0R3q3QdrZfXSnPlUtkE2-XdaFOJnc0I-w2OQ7UrfHLQuTsc3OJpct9M7aXI85ATYi-s1uk7ASGzqFgyGAhYQEcJ9b80PHlsow\" alt=\"Image for post\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 5:<\/strong> Click on the Next button on the following screen to continue.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/cVSBPT-RUy1k64-oTTxzYc7FMu0IGxKP3X8o1zniMeALRk1UME-LPeGYcWAFz7rvbIjIKMypKFEErcQ3Ho7aI8I5IJm9Wrl-lTWrqnbrLYGobOuGtfcgJPGJuEHL0OOn8cicTK8ZNyZlQ2lLUA\" alt=\"Image for post\" title=\"\"><\/figure>\n\n\n\n<p><strong>Step 6:<\/strong> Finally, click on the Publish button to publish the Website.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/jH6VBv43c_fTBCRx5AIyB0RavJX2Gv3fRGvzlxtKDrUNLESKy3CCDUGLIflSWqoawdROg_u74Sqb-vUoYBXPIvUJrVcaZPdQaZ5loYZlyPBowrgq4FZfiVbCvU6_pNBZfT19dM6rO2leKIT3qA\" alt=\"Image for post\" title=\"\"><\/figure>\n\n\n\n<p>When all the above steps are executed, the following output is visible in Visual Studio.<\/p>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/vA74IOQDT3rzjjHdCfL5lTkA_LEkNgyoj6qS7NbSFj8d_hmbW-rbS9yO1IraApvsHlqD739Ru-hc6ZNcChvNYilxLsL1zzDtFvIywL6ULWlz9QV9cQySss1mS-gY-NyY5alLO2-T5-cwuQ1M6Q\" alt=\"Deploying a website on IIS\" title=\"\"><\/figure>\n\n\n\n<p>From the above output, you can now see that the Publish has succeeded.<\/p>\n\n\n\n<p>Now open the browser and navigate to the URL: http:\/\/localhost\/Demo.aspx<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/bDlmOH3UNb9rkSvxXmgnZP7i7KhaVJSn-lRYzIxcx-aEamydP5kPZgWqfOHKEvHIXx4lBfHjEPPswDYDsUHynbzseIIujIO6jl5CnoGBGvtNIORWrWWyWj26gS75k8EEj2w36S0M2pHbpCfc3g\" alt=\"\" title=\"\"><\/figure>\n\n\n\n<p>You can see from the above shown output that when you browse to http:\/\/localhost\/Demo.aspx, the following page appears. It also displays the text ASP.Net.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Host a Website on IIS IIS server (Internet Information Services server) is a Windows Server\u2013based web application used to Host a Website on IIS and deliver website content over the internet to end users. IIS uses .NET web application frameworks such as ASP.NET MVC and Entity Framework; additionally, it also integrates with Visual Studio, all [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7638,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[499],"tags":[],"class_list":["post-7229","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet-tutorials"],"_links":{"self":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/7229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/comments?post=7229"}],"version-history":[{"count":1,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/7229\/revisions"}],"predecessor-version":[{"id":33859,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/posts\/7229\/revisions\/33859"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media\/7638"}],"wp:attachment":[{"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/media?parent=7229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/categories?post=7229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.h2kinfosys.com\/blog\/wp-json\/wp\/v2\/tags?post=7229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}