Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Articles Author
Sat, 26-Jul-2014 Authors
All Time Authors
Sourav.Kayal
39750
Sheonarayan
37300
Niladri.Biswas
33350

Latest members | More ...


(Statistics delayed by 5 minutes)
Ads

How to host asp.net application on the web server (IIS)

SheoNarayan
Posted by under ASP.NET category on for Beginner level | Points: 250 | Views : 224583 red flag
If you found plagiarised (copied) or inappropriate content,
please let us know the original source along with your correct email id (to communicate) for further action.
Rating: 4.67 out of 5
6 vote(s)
In this article, I am going to show how to host an asp.net application on IIS 7 (I have shown this example on Windows 7 Home Premium OS), however similar steps can be followed to host the application on the Windows Server 2008 R2 as well.

Introduction

In general hosting part of the application is not done by developer however in some scenario where the team size is small or we need to host the application on the local server, we developer does all the work. In this article, I am going to show how to host an asp.net application on IIS 7.5 in Windows 7 Home Premium Operating System.

Step 1

Open the IIS either from the Start Menu by writing the "inetmgr" command in the search box or at the command window (you must have the administrative priviledge).

You can also achieve the same by going to Control Panel and clicking on Administrative Tools > Internet Information Services (IIS) Manager as displayed in the picture below.

If you are not able to see the Internet Information Service (IIS) Manager, your computer might not have IIS installed. To install the IIS, follow below steps.

Installing IIS on Windows 7

Go to Control Panel > Programs > Turn Windows Features on or off as displayed in the picture below.

Ensure that from the Tree View, the Checkboxes against the Internet Information Services (IIS) is checked, even explore the depth of this root folder and check almost all checkboxes as displayed in the picture below. Checking almost all checkboxes will install more than enough (extra components as well that is not required for web hosting) component to get started and you may not use all the components. However later on you can uncheck to un-install those.

I have written hundreds of .NET How to's solution (ebook + source code + video) series based on real time project problems, click here to get it.

Step 2

Once you have opened the Internet Information Service (IIS) Manager, your screen should look like below (displayed the left panel in the below picture).

Now, right click the Sites and select Add Web Site ... and your screen should look like below

Enter the Site Name (in my case its SampleWebSite), select the physical folder where you have kept your website files (this may be your Visual Studio solution folder if you are setting it up at your local machine or the unpackaged folder path or the root folder of the website or web application). Now you can click on the OK button.

Clicking OK button may give you above alert box, complaining about the port you are going to use as by default port 80 is used for the default website of your IIS so you might want to change it. Click on No button at above alert box and change the port. I have changed the port to 8123 as displayed below and clicked on OK button.

Clicking OK should give you a screen something similar to below picture where you will have a SampleWebSite created (notice at the left panel).

Step 3

Now, you may click on the Advance Settings ... from the right panel and modify some settings that you want to modify. In general it is not needed and you can keep it default.

Step 4

Now, your website is ready to be browsed, you can right click on the website name (SampleWebSite in my case) and go to Manage Web Site > Browse and you should have an Internet Explorer window open displaying the default page of your website or web application.

Below is the screenshot of the default page of my SampleWebSite.

Step 5 (Optional)

Notice: Your website may not work if you have developed your it Visual Studio 2010 as your web.config file may have some tags that is not identified by the IIS. This is becuase creating the website the way we created just now will host your website in its own application pool that will have .NET Framework version 2 as target version. So you will need to change to the .NET Framework 4.0 version.

Click on Application Pools from the left panel and double click the Application pool for your webiste (generally application pool for your website is your website name so in my case SampleWebSite) and you should see a dialogue box similar to above. Select .NET Framework v4.xxx from the .NET Framework version dropdown and click OK. Now follow the Step 4 above again and your should see the default page.

Conclusion

Hope these 5 steps of hosting an application to the IIS will be helpful. Thanks for reading and keep sharing your knowledge. Pleaase me know your comment or feedback.

Page copy protected against web site content infringement by Copyscape
About the Author

SheoNarayan

Full Name: Sheo Narayan
Member Level: HonoraryPlatinum
Member Status: Microsoft_MVP,Administrator
Member Since: 7/8/2008 6:32:14 PM
Country: India
Regards, Sheo Narayan The Founder http://www.dotnetfunda.com
http://www.snarayan.com

Microsoft MVP, Author, Writer, Mentor & architecting applications since year 2001. Connect me on http://www.facebook.com/sheo.narayan | https://twitter.com/sheonarayan | http://www.linkedin.com/in/sheonarayan
Login to vote for this post.
Found interesting? Add this to:


Comments or Responses

Posted by: Prabhakar on: 3/10/2011 | Points: 25

Gud and very use full article . . .

Posted by: Raja on: 3/10/2011 | Points: 25

Thanks, much awaited topic and very well explained.

Keep it up Sir.

Posted by: Akiii on: 3/10/2011 | Points: 25

Thank you Sir for the tutorial regarding "how to host asp.net application on the web server IIS", but can you please explain the advance setting panel ?
There are many things and i want to know it.

Thanks and Regards
Akiii

Posted by: Jthakker on: 3/11/2011 | Points: 25

Thank u sir for providing us with such a nice and useful article.
I have a question for my already existing site hosted on iIS 7.5 and .net framework version 3.5.

I hosted the same site again with the mentioned steps whereby changing framework to 4.0 now.Can you please help me know what other steps need to be followed making work such site like changes in web.config and all. I changes the version of sections included in web. config to 4.0 but didn't work.

Many Thanks once again,

Posted by: SheoNarayan on: 3/11/2011 | Points: 25

Thanks Akiii,

The Advance Settings dialogue box has many settings and if you look at it carefully, you will feel that it is self explanatory. Also it gives you description of each settings at the bottom of the dialogue (above the Ok and Cancel buttons).

Just few of them that is important to focus normally are
1. Application Pool - you will be able to change the application pool if you want.
2. ID : ID of the website, not important for you, used to log files and trace files
3. Physical Path - Physical root path of your application
4. .. Logon credentials .. - in case your physical path is at remote locations etc.
5. Start Automatically - if you want to start the the website automatically when IIS starts.
6. Connection Limits - Maximum number of seconds a connection can remain active
7. Max. Bandwidth - To control the bandwidth consumption of your website
8. Max. Concurrent Connections - Maximum number of concurrent connections your website can accepts
9. Enable Protocols - Helps you to setup the protocol used to access your website (useful when you want to host your wcf services on IIS - WAS), for example you can mention "http,net.tcp" in this case your website will be accessible over http as well as net.tcp connection.
10. Rest three are related with tracing of your web site in case of failure.

Hope this helps.

@Jthakker,

What error you are getting ?



Posted by: Akiii on: 3/11/2011 | Points: 25

Thank you very much Sir for your prompt reply. I have read and understood itl. I have also made a web application and hosted it by the help of your tutorial. It helped me a lot.

Looking for more good stuffs.

Thanks and Regards
Akiii

Posted by: Tripati_tutu on: 3/12/2011 | Points: 25

Nice one. Well this is helpful for us.

Posted by: Binary0018 on: 5/3/2011 | Points: 25

Not sure if this off-topic.

Since they're inside the same machine, is there a need to secure communication betw web & app server? ... Assuming we want to take precautions in the production environment. Thks

Posted by: Reddrakon on: 5/3/2011 | Points: 25

Thank you very much Sir. I have some questions.
1. How can I access to my web site with , for example, www.SampleWebSite.com and SampleWebSite.com, and maybe with another name?
2. What is difference between Web site and Web application?
Thanks.


Posted by: Ps2011 on: 5/20/2011 | Points: 25

Hello Mr Siba Narayan,

I need WCF related videos , can you please help me in this regard.

Thanks,
Partha S.

Posted by: Deepu.Oct5 on: 4/4/2012 | Points: 25

I did the same process sir..But, when i select the browse option it is showing an error as follows:
HTTP Error 500.19-Internal Server Error
Error code: 0x80070005
The requested page cannot be accessed because the related configuration data for the page is invalid.
Plz help me to recover this..Thank u.

Posted by: Abhishek.Chakladar on: 6/3/2012 | Points: 25

Hi

Thanks a lot. It worked for me.


Posted by: Jayakumarv on: 7/13/2012 | Points: 25

Thanks, it work fine,
I want to invoke my site on my remote system, and i typed my system name and host name, but it thrown error (404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.)


Regards,
Jai

Posted by: Jtan on: 8/4/2012 | Points: 25

Hi Sir,
I am new to this and is the first time i am going to build my own website.
I have now subscribed to a host godaddy. And its a virtual dedicated.

Unfortunately i do not have a clue how to get it up and running so people around the world can
see my website. It is on a windows server 2008.

1. I think your steps here could work for me. But I see that your site is local host. For a website to
be accessed by the world, is it the same steps as u have described above?
2. Would u advise me where (as in which folder) i should copy my website files to?

Pls advise and thanks in advance.

Posted by: Jtan on: 8/4/2012 | Points: 25

I have tried these steps, still not able to pull up my home page.
I am trying to run nopcommerce, which is a .net4 and mvc 3 open source cart.

I am not able to follow step 5 as well. in the app pool, my site is not in it.

Posted by: Jayakumars on: 7/10/2013 | Points: 25

hi

sheo Good One For Hosting Peoples . But i tried like this but my images correct path have but did not show properly
can you solve them

Login to post response

Comment using Facebook(Author doesn't get notification)