ASP.NET Web Pages - Publish a Website
- Previous Page WebPages PHP
- Next Page WebPages Example
Learn how to publish Web Pages applications without using WebMatrix.
Publish Your Application Without Using WebMatrix
You can use the Publish command in WebMatrix (or Visual Web Developer or Visual Studio) to publish an ASP.NET Web Pages application to a remote server.
This feature will copy all application files, cshtml pages, images, and all necessary DLL files, which are used for Web Pages, Razor, Helpers, and SQL Server Compact (if a database is used).
Sometimes we do not want to use these options. Maybe your hosting provider only supports FTP? Maybe your website is based on ASP? Maybe you want to copy these files yourself? Or maybe you want to use other publishing software?
Will you encounter any problems? Yes, you will. But we can solve it.
If you need to copy a site, you need to know how to reference the correct files, copy which DLL files, and where to place them.
The following are the specific steps:
1. Use the latest version of ASP.NET
Before you continue, make sure that your host is running the latest ASP.NET version (4.0 or 4.5).
2. Copy the Web Folder
Copy the website (all folders and content) from the development machine to the application folder on the remote host (server).
If your application contains dataDo not copy this data(See the following steps 4).
3. DLL Files
Ensure that the bin folder on the remote host contains the same dll files as on the development machine.
After copying the bin folder, it should contain these 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 Data
If your application contains data or database. For example, SQL Server Compact database (.sdf file in the App_Data folder), consider the following:
Do you want to publish the test data to the remote server?
Generally, it is not needed.
If there is test data on your development machine, it may overwrite the data on the remote host.
If you have to copy SQL database (.sdf file), you may want to delete all data in the database and then copy this empty .sdf file from the development computer to the server.
That's all. Good luck!
- Previous Page WebPages PHP
- Next Page WebPages Example