ASP.NET Web Pages - Publish website


Learn how to publish a Web Pages application without using WebMatrix.


Publish your application without using WebMatrix

By using the publish command in WebMatrix (or Visual Studio), you can publish an ASP.NET Web Pages application to a remote server.

This feature copies all your application files, cshtml pages, images, and all necessary DLL files for Web Pages, Razor, Helpers, SQL Server Compact (if you use a database).

Sometimes you don't want to publish your application using WebMatrix. Maybe because your hosting provider only supports FTP, maybe you already have a website based on classic ASP, maybe you want to copy all the files yourself, or maybe you want to use some other publishing software like FrontPage, Expression Web, etc.

Will you encounter problems? Yes, you will. But you have a way to solve them.

To perform a website copy, you must know how to reference the correct files, which DLL files need to be copied, and where to store them.

Follow these steps:


1. Use the latest version of ASP.NET

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


2. Copy the Web folder

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

lamp

If your application contains data,Do not copy the data(See point 4 below for details.)


3. Copy the DLL files

Make sure that the bin folder on your remote host contains the same DLL files as on your development computer.

After copying the bin folder, it should contain the following files:

Microsoft.Web.Infrastructure.dll
NuGet.Core.dll
System.Web.Helpers.dll
System.Web.Razor.dll
System.Web.WebPages.Administration.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll
WebMatrix.Data.dll
WebMatrix.WebData


4. Copy your data

If your application contains data or a database. For example, a SQL Server Compact database (an .sdf file in the App_Data folder), consider the following:

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

Most of the time, you probably don't.

If there is test data on your development computer, it will overwrite the production data on your remote host.

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

That's it. GOOD LUCK!


Other Extensions