Web Pages publishing
ASP.NET Web Pages - Publishing a Website
Learn how to publish a Web Pages application without using WebMatrix.
Publish your application without using WebMatrix
You can publish an ASP.NET Web Pages application by using the publish command in WebMatrix (or Visual Studio) to the 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 using a database).
Sometimes you don't want to use WebMatrix to publish your application. Maybe it's because your hosting 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 Front Page, Expression Web, or some other publishing software.
Will you encounter problems? Yes, it will. But you have a way around it.
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.
Please follow the steps below:
1. Use the latest version of ASP.NET
Before you proceed, make sure your host is running the latest version of ASP.NET (4.0 or 4.5).
2. Copy Web Folder
Copy your website (all folders and content) from your development computer to the application folder on the remote host (server).
If your application contains data, Do not copy the data (see below for details Point 4). |
3. Copy the DLL file
Make sure that the bin folder on your remote host contains the same dll file 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, for a SQL Server Compact database (a .sdf file in the App_Data folder), consider the following:
Do you want to publish your test data to a remote server?
Most of the time, I generally don’t want it.
If you have test data on your development machine, it will overwrite the production data on your remote host.
If you must copy the SQL database (.sdf file), then you should delete all data in the database and copy an empty .sdf file from your development computer to the server.
That's it. GOOD LUCK!