Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

ASP.NET Web Pages - Publish


May 12, 2021 ASP.NET


Table of contents


ASP.NET Web Pages - Publishing Site

WebMatrix is Microsoft's latest Web development tool that contains all the elements you need to build a Web site, but this section explains how not to use it WebMatrix to publish applications.

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


Publish your application without using WebMatrix

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

This feature copies all your application files, cshtml pages, images, and all required 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 it's because your hosting service provider only supports FTP, maybe you already have a classic ASP-based website, maybe you want to copy all the files yourself, maybe you want to use other publishing software like Front Page, Expression Web, and so on.

Are you going to have a problem? Y es, it will. But you have a way to fix it.

To perform site replication, 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 proceed, make sure that your host is running the latest version of the 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).

ASP.NET Web Pages - Publish

If your application contains data, do not copy the data (see point 4 below).


3. Copy the DLL file

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, the SQL Server Compact database App_Data file in the .sdf folder, consider the following:

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

Most of the time it's generally not desirable.

If you have test data on your development computer, it overrides production data on your remote host.

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

That's it. GOOD LUCKļ¼

This is where you publish the entire contents of your Web Pages application without using WebMatrix.