Publishing ASP.NET MVC2 Application on Windows Server 2008 IIS 7 with Visual Studio 2008 on platform .NET 3.5 SP1

Prepare you server:

1. Go to Server Manager and select Add Roles, and install Web Server

2. Mark ASP.NET and install

3. Confirm the CLR of ASP.NET has been installed

4. Install .NET Framework 3.5 and .NET Framework 3.5 SP1

5. Let’s create a directory where we stick our MVC2 application. In my case it is C:\www\windows.amk

6. Once you are done go to the Security properties of that directory and add read and write permissions for group IIS_IUSRS

7. Go back to IIS Manager and Add Site

8. In Application Pool double click pool of your site and make sure that Managed pipeline mode is Integrated

Now the server is prepared to run MVC2 web application!

Prepare your project to be published

1. Go to your project properties and mark Release

2. Go to References and and change Property Copy Local to true for

System.ComponentModel.DataAnnotations.dll
System.Web.Mvc.dll

If you are running .NET Framework 3.5 NOT .NET Framework 3.5 SP1 change properties for all these.

System.ComponentModel.DataAnnotations.dll
System.Web.Abstractions.dll
System.Web.Mvc.dll
System.Web.Routing.dll

6. In Web.config change lines

<compilation debug="true">

to

<compilation debug="false">

And uncomment this bit:

        <customerrors mode="RemoteOnly" defaultredirect="GenericErrorPage.htm">
            <error statuscode="403" redirect="NoAccess.htm" />
            <error statuscode="404" redirect="FileNotFound.htm" />
        </customerrors>

 

7. Generate and upload files to directory on the server in my case c:\www\windows.amk

* What we need:
- Configuration and settings files (e.g., Web.config and any *.settings files)
- Uncompiled view templates (*.aspx, *.ascx, and *.Master)
- Global.asax (this tells ASP.NET which compiled class represents your global HttpApplication)
- Any static files (e.g., images, CSS files, and JavaScript files)
- Optionally, the *.pdb files in your \bin folder, which enable extra debugging information (these are rarely deployed to production servers)

* We don’t need:

- C# code files (*.cs, including Global.asax.cs or any other ‘code behind’ files)
- Project and solution files (*.sln, *.suo, *.csproj, or *.csproj.user)
- The \obj folder
- Anything specific to your source control system (e.g., .svn folders if you use Subversion, or the .hg or .git folders if you use Mercurial or Git)

Good Luck!

You may also like...