Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I deploy MVC3 Hello World App to localhost and configure IIS

I am having some trouble deploying my MVC3 application to my localhost. I am looking for details to build and deploy a ASP MVC 3 application to my local system. I've tried to deploy this, but have run into problem after problem. Instead of tracking each problem down separately (and I may have to do this anyways) I would like to create a one stop guide for myself and others that see this post.

I'm looking for steps including libraries to install (ASP MVC3, IIS, etc) on a Win7 SP1 machine with VS2010 installed. Also how do I set up IIS, and how do I publish? The goal will be to deploy this web app to another Win7 machine in the house, but localhost will be the first step. In addition, it would be helpful to know whatever steps are necessary to make the website accessible from another machine on the same network.

Here is what I have done so far:

  1. Created an ASP MVC 3 application with VS2010
  2. Built and Run
  3. Installed IIS
  4. In IIS - "Added Application" on "Default Web Site" with the Alias: "Hello"

    4a. "Hello" runs on the DefaultAppPool, .Net 4.0; Integrated Pipeline

    4b. "Hello" has the physical path C:\inetpub\Hello

  5. In VS2010 - right clicked the project and selected "Publish", using FTP
  6. web browser: navigate to "localhost/Hello"

500.19 - Internal Server error:

Config Error: This configuration section cannot be used at this path. This happens when
the section is locked at a parent level. Locking is either by default 
(overrideModeDefault="Deny"), or set explicitly by a location tag with 
overrideMode="Deny" or the legacy allowOverride="false"

Config File:

\\?\C:\inetpub\wwwroot\web.config

Requested URL:

http://localhost:80/Hello

Physical Path:

C:\inetpub\Hello

Config Source:

68: <validation validateIntegratedModeConfiguration="false" />

69: <modules runAllManagedModulesForAllRequests="true" />

70: </system.webServer>

like image 834
MedicineMan Avatar asked Dec 14 '11 06:12

MedicineMan


1 Answers

Download and install ASP MVC 3

Create an MVC3 Hello World App in Visual Studio

Install IIS from the “Windows Features” / “Turn Windows features on or off” in Windows.

Next, you need to configure a website in IIS. I created one on port 81. Open IIS Manager, and “Add a Website” to the “Sites” node.

For this website, I created this on D:\WebSite, and configured it to run on DefaultAppPool, configured for .NET 4.0, on port 81.

Most of the time, IIS is installed after installing the .NET Framework, so you’ll need to run some commands to register ASP.NET on IIS.

start cmd.exe as an administrator and run aspnet_regiis -i in C:\Windows\Microsoft.NET\Framework64\v4.0.30319

Initially, I had some trouble publishing the project to the destination but for whatever reason, Publish method: “FTP” to Target Location “D:\WebSite” seems to work quite well and publish only the minimum required files.

like image 59
MedicineMan Avatar answered Sep 28 '22 08:09

MedicineMan