Introduction
This article explains how to host your MVC 5 App in IIS Express and store the data and information in the database created in SQL Server. Visual Studio uses the ASP.NET Development Server as a default and here I am using IIS Server to host a MVC 5 App. As you know, in Visual Studio 2013 Preview the ASP.NET Web Application uses a MVC5 project template and MVC5 uses the Bootstrap theme to display the application, so here I am using the Visual Studio 2013 Preview to develop an application using the MVC project template.
Prerequisites
The following are the prerequisites to develop a MVC 5 application:
- Visual Studio 2013 Preview
- SQL Server 2008 or 2012
Creating MVC 5 Application
Let's start to develop an application in MVC 5 using the following procedure.
Step 1
Open Visual Studio 2013 Preview

Step 2: Click on "New Project" and enter the application name.

Step 3: Select MVC project template to create the project.

Step 4: In your Solution Explorer, open the Web.Config file.
As you can see, the connection property is available on my file:
- <add name="DefaultConnection"connectionString="Data Source (LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-MvcIISDemo-20130911053147.mdf;Initial Catalog=aspnet-MvcIISDemo-20130911053147;Integrated Security=True"providerName="System.Data.SqlClient" />
Now, change the code above as shown below:

Step 5: Debug your application and click on the "Register Link" as shown below:

Step 6: Enter the details and click on the "Register" button.

You will see your UserName in your next page window:

Verify in SQL Server 2012
As you can see, I did not create a database nor any table in my SQL Server 2012. When I declared my connection string, it automatically created a database and table in my SQL Server. You do not need to worry about that.
Let's see my database in my SQL Server Object Explorer.

Select your database and open the Users Table. You can see the user information as shown below:

Publish Application
The next step is to host in IIS 8 (IIS Express). For that use the following procedure:
Step 1: In your Solution Explorer select your project and right-click to select Publish.


















nithinPosted Jun 20, 2016, 9:13 AM
i have hosted my application....:8080/foldername-->i dont need a foldername->i jst need a url->id:8080
Atefeh MohammadpoorPosted Apr 26, 2016, 4:25 AM
Hello Nimit. Thank you very much for your nice article. I've tried it but nothing is showing in IIS. You know, IIS doesn't change ever never!! :( I really become tired.. Whatever I do, it just shows me the Default Web Sit with no node! I'm using IIS8 and reinstalled the IIS and WAS many times but nothing changed :(. Would you please do me a favor and help?
Sr KarthigaPosted Feb 21, 2016, 11:14 PM
nice one
Sr KarthigaPosted Feb 21, 2016, 11:14 PM
Nice explanation
Rupali ShindePosted Dec 23, 2015, 1:33 AM
really useful article of IIS hosting.. can you please guide how to provide proper host name for web application ??
Ravi PatelPosted Nov 7, 2015, 5:26 AM
nice explained thanks for sharing sir
Kenneth BaledaPosted Nov 4, 2015, 12:54 PM
Hi, i've been looking for a tutorial on how to deploy my website mvc5 application onto web that has own hostname (www.sampleWebsite.com). should i follow this steps? or this is only available for local?
Sibeesh VenuPosted Nov 3, 2015, 12:18 AM
Congrats. Article Of the day Nov 3 2015 :)
prasad darwanPosted Oct 31, 2015, 1:56 AM
Using Visual Studio 2012
prasad darwanPosted Oct 31, 2015, 1:55 AM
how to publish MVC 4 Entity Framework using Sqlserver 2008 IIS 7.5 ............................please send me details
Suket ShahPosted Aug 20, 2015, 3:14 AM
nice one
abhi shahPosted Jul 13, 2015, 8:01 AM
[email protected] please send me mvc5 book
Prashant JaylePosted May 13, 2015, 4:32 AM
awesome tutorial sir thanx for sharing it....
Faruk ShaikhPosted Oct 9, 2014, 8:40 AM
how would i do the same thing for a domain like [email protected]
Murali krishnaPosted Oct 9, 2014, 12:42 AM
Nice Tutorial Sir
Saineshwar BageriPosted Oct 4, 2014, 3:46 AM
nice one sir