How to Host a Website On IIS?

0
301
How to Host a Website On IIS

Many developers are choosing the IIS or Windows hosting platform to create .NET applications. Why? Because the platform makes it possible to create excellent applications with advanced features.

Users often wonder if it is possible to host an integrated and unique website on IIS. And we would love to tell them that yes, it’s completely possible and also quite convenient to host a website on IIS.

Here, we will discuss the techniques that will come in handy if you are willing to host a website on IIS. We will share a step-by-step guide in this post along with other vital information you need to know.

What is IIS?

IIS is the abbreviation of Internet Information Server that developers use to host .NET web applications. It is also known as a Windows web server in some contexts. The server runs on the Windows operating system and can serve HTML documents.

When a user accesses a particular website, the website has to be hosted on a web server. The IIS server works with standard languages and protocols such as HTTP that exchanges data between the end-users and web servers. Different types of technologies need different types of web servers to operate on a certain basis.

What Are the Advantages of Hosting with IIS?

Before we learn how to host a website on IIS, you need to understand the advantages of using IIS. Have a look at the points given below:

  • IIS increases the authority of the hosted applications by providing them with process activation, health management, and recycling capabilities in an auction.
  • Due to the OS compatibility issues, sometimes certain websites fail to access data. But with the IIS hosting, this won’t be an issue anymore as Windows OS is compatible with these types of databases.
  • Windows is compatible with ASP.NET; therefore, all the applications that are hosted on the IIS are easily deployable and manageable.
  • IIS serves the ultimate advantages in large and corporate environments where people use Windows-based software programs the most.
  • Applications hosted on IIS come with an easy-to-use interface that most users find helpful to maneuver. It’s easy to monitor and operate these applications conveniently.

Now, since you have become familiar with the advantages offered by IIS, let’s move on to the process of hosting a website on IIS.

Prerequisites of Hosting a Website on IIS

Before we begin with the first stage of hosting a website on IIS, make sure you consider the following:

  1. A system with Windows Server 2012 installed
  2. Install the Internet Information Services (IIS) on your system
  3. Deploy a website in IIS

Follow the steps below to get going with the hosting on IIS operation.

How to Install Windows Server 2012?

If you don’t have Windows Server 2012 installed yet on your PC, follow this easy step-by-step guide to install it on your system. Windows 2012 Server is essential for installing IIS on your computer.

  • Step 1: Download Server 2012 from here
  • Step 2: Then configure the BIOS by following the step-by-step instructions given here
  • Step 3: Then Press ENTER to boot from DVD

Press Enter

  • Step 4: Wait while the files are loading. Then go to the default Language screen and click on Next

Windows Server 2012

  • Step 5: Click on Install now from the setup screen

setup screen

  • Step 6: Click on the GUI item that comes in the second line. Then click on Next.

GUI

  • Step 7: Check the box in front of “I accept the license terms”, and click on the Next button

I accept the license terms

  • Step 8: Click on Custom: Install Windows only (Advanced)

Click on Custom

  • Step 9: If you don’t see your system’s storage disk listed in there, click on the Load driver option. Select the disk on which you need to install the server, and click Next.
  • Step 10: You can create custom partitions by clicking on the Drive options

create custom partitions

  • Step 11 (Optional): You can add a drive using Native Boot To Vhd: SHIFT-F10

Note: You can use the “vdisk file=e:\BootDemo.vhd type=expandable maximum=40000” command on your command prompt window to add a drive. (Type CMD on your Windows search option) Run these commands in a single line and when done, click on Exit and Refresh.

add a drive using Native Boot

  • Step 12: Wait for the system to start and finish copying your files. It will take more than 20 minutes and when done, it’ll automatically reboot your computer.

reboot your computer

  • Step 13: A password box will appear after the process is done. Create a new password for your computer and re-enter it again to verify, then click Finish.

Create a new password

  • Step 14: Press Ctrl-Alt-Delete simultaneously, and the login screen will appear

Ctrl-Alt-Delete

  • Step 15: Enter your password and press Enter

Enter your password

  • Step 16: Now, the Desktop will appear on your display along with Server Manager

Server Manager

  • Step 17: Press Windows Key on your keyboard and Right-Click on Computer. Select Properties from the bottom of the screen.

Right-Click on Computer

  • Step 18: The system properties will look almost similar to the regular version of Windows, but you can change the computer’s name by going to Change Settings.

version of Windows

  • Step 19: Enter the new name and click OK

Enter the Computer name

  • Step 20: Click OK on both Information box and allow the Restart option
  • Step 21: Click on Restart Now. When the system starts, it will have a new name, and you then can log in.

Restart Now

After completing these steps successfully, you can move on to install IIS on your computer. Follow the next sections of this post to get started.

How to Download and Install IIS on a Windows Server?

Below are the steps that will guide you to install IIS on your system with ease. Follow each of them to get the job done.

  • Step 1: Your first step will be to send a request to the server to get the example.com application. Your request will be sent to the server of a webpage, for example, http://example.com/Default.aspx. Example.com is the name of the website hosted on the IIS server, and Default.aspx is a web page of the hosted website. You will have to enter that link on your web browser, and the request will be sent to the server.
  • Step 2: After sending the request, sit tight and let the server proceed with all the necessary operations to grant your request.
  • Step 3: After completing its operation, the IIS server will send the output back to you, which will be an HTML document that you can view on your web browser. After this, it’s time to install the IIS on your Windows server 2012.

Windows server 201

  • Step 4: Make sure you have tried your Windows server 2012 for 120 days before installing the IIS server.

installing the IIS server

  • Step 5: Open the Windows server 2012, and from its dashboard, click on ‘Add roles and features.’ It will let you install additional features on the server.

install additional features

  • Step 6: Another screen will appear where you will have to click on the Next button

click on the Next button

  • Step 7: Choose role-based or feature installation to begin the IIS installation and click on Next
  • Step 8: A screen will appear from where you will be able to see the name of the server where the installation will occur, and you will have to click on the Next button to continue.

Select Destination Server

  • Step 9: Choose the Web server option and click on the Next button again
  • Step 10: Another screen will appear; click on the Next button to continue.

Check Web Server Option

  • Step 11: A final screen will appear; click on the Install button to start the installation.

Click the install Button

After the installation, you can launch IIS from the Windows 2012 search option. For that, you will have to follow the steps below.

  • Step 1: Enter ‘inetmgr’ in the search box. ‘Inetmgr’ is the command for IIS.

Enter inetmgr

  • Step 2: Then click on Internet Information Services Manager when it appears below.
  • Step 3: After clicking, IIS will open up, and a new screen will appear. In the new window, you will find the Default Web Site page. You can visit http://localhost from your browser, which will show you a new screen. The screen means that your IIS server is running smoothly.

IIS Manager

After ensuring that your IIS server is good to go, you will have to deploy a website in IIS via a file copy. Check out the next section to do that.

How to Deploy a Website in IIS through FileCopy?

Since you have developed a web application to host on IIS, you will have to deploy it to complete the process. Also, the deployment in the IIS server allows other users to access the web application with ease. You can use the file copy method to deploy your web applications in IIS conveniently. Follow the steps below to do so:

Note: First make sure your application is opened in Visual Studio. Here we’ve created a demo application and opened it in Visual Studio. Once you’re done with that, you can continue to follow the steps mentioned ahead.

  • Step 1: Right-click on your asp.net web application and select the “Package/Publish Settings”

Package/Publish Settings

  • Step 2: In the configuration form, you will have to provide some important data about your system but avoid changing any settings in the meantime. Once done, click on properties.

click on properties

  • Step 3: Right-click on the web application and choose “Build Deployment Package.” Meantime, Visual Studio will create the deployment package in zip format and will store the content in a default location.

Build Deployment Package

  • Step 4: Open the Run box by pressing the Windows key and R together, then type and Enter ‘inetmgr’ in the empty run box.
  • Step 5: A new window will appear. From there, right-click on your target website or the site where you want to deploy your Asp.net application
  • Step 6: Then select deploy=>Import application.

WebTest Home

  • Step 7: If IIS does not show this deploy option, then you will have to add an extension on your browser for that. Go to https://www.iis.net/downloads/microsoft/web-deploy and hit on the Install this Extension button next to it.
  • Step 8: After installing the extension, you will get a message. And after that, you will be able to see the deploy options right there.
  • Step 9: Browse for the deployment package file, and once found, select it and click on the Next button.
  • Step 10: Click on Finish, and you will be able to browse your website from the IIS server.

Alternatively, How to Publish the Website from ASP.NET Website?

Here is another method to deploy your website in IIS. Following this method will help you have better control over the deployment process and also lets you specify the website.

However, if you’re using ASP.NET 4.0 or less than that, then the pool version should be 2.0, and you need to be careful with that. Follow the steps below to host the website effectively.

  • Step 1: Open Microsoft Visual Studio and right-click on the web application
  • Step 2: From the side menu, choose Publish
  • Step 3: Provide the basic information in the new form that appears. The information will include the target hostname and site/application name.
  • Note: The Publish method will be Web Deploy, the Destination URL will be “http://localhost”, and the Site/Application name will be the name of your website that you have created.
  • Step 4: Check the box next to the “Mark as IIS application on destination” option
  • Step 5: Click on the “Publish” option, and the web application will be published

Conclusion

The process of deploying and hosting a website on IIS is quite easy, but if you don’t pay close attention, you can make a mistake. If you encounter any error during the process, you can visit the official support page of Microsoft to find relevant solutions.

LEAVE A REPLY

Please enter your comment!
Please enter your name here