Latest web development tutorials

ASP.NET MVC - Post

Learn how to publish MVC application without using the Visual Web Developer.


In the case without using Visual Web Developer publish your application

By WebMatrix, Visual Web Developer or Visual Studio, use the Publish command, you can publish an ASP.NET MVC application to a remote server.

This function will copy all of your application files, controllers, models, images and all necessary DLL files for MVC, Web Pages, Razor, Helpers, SQL Server Compact (if using a database).

Sometimes you do not want to use these options. Maybe your hosting provider only supports FTP? Perhaps your site is based on the classic ASP? Perhaps you'd like to hand copies of these documents? Or perhaps you want to use Front Page, Expression Web and some other publishing software?

You have a problem? Yes, it will. But you have a way to solve it.

To perform the site copy, you must know how to refer to the correct file, which DLL files you want to copy and store them where they are.

Follow these steps:


1. Using the latest version of ASP.NET

Before you proceed, make sure that your host is running the latest version of ASP.NET (4.0 or 4.5).


2. Copy the Web Folders

Copy your website (all the folders and content) to the application file on the remote host (server) from a folder on your development computer.

If your App_Data folder contains the test data, please do not copy the App_Data folder (see point 5 below).


3. Copy the DLL files

On a remote server application root directory, create bin folder. (If you have installed Helpers, the bin folder already exists)

Copy the following folders all files:

C: Program Files (x86) Microsoft ASP.NETASP.NET Web Pagesv1.0Assemblies

C: Program Files (x86) Microsoft ASP.NETASP.NET MVC 3Assemblies

To the application on your remote server bin folder.


4. Copy the SQL Server Compact DLL files

If your application uses a SQL Server Compact database (a .sdf file in the App_Data folder), you must copy the SQL Server Compact DLL files:

Copy the following folders all files:

C: Program Files (x86) Microsoft SQL Server Compact Editionv4.0Private

To the application on your remote server bin folder.

Create (or edit) the application's Web.config file:

Examples of C #

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />

<add invariant="System.Data.SqlServerCe.4.0"
name="Microsoft SQL Server Compact 4.0"
description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.1,Culture=neutral, PublicKeyToken=89845dcd8080cc91" />

</DbProviderFactories>
</system.data>
</configuration>


5. Copy the SQL Server Compact data

Your App_Data folder has .sdf file does not contain test data?

Do you want to publish your test data to a remote server?

Most of the time generally is not desirable.

If you must copy the SQL data files (.sdf file), then you should delete all the data in the database, then copy an empty .sdf file from your development computer to the server.

That's it. GOOD LUCK!