ASP. NET MVC-publishing Web site

Source: Internet
Author: User
Tags compact classic asp

Original address: http://www.w3school.com.cn/aspnet/mvc_publish.asp

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

Publish your application without using Visual Web Developer

You can publish an ASP. NET MVC application to a remote server by using the Publish command in WebMatrix, Visual Web Developer, or Visual Studio.

This feature copies all application files, controllers, models, images, and all required DLL files that may be used for MVC, Web Pages, Razor, Helpers, SQL Server Compact (if a database is used).

Sometimes you don't want to use this option. Perhaps your hosting provider only supports FTP? Maybe your website is based on classic ASP? Maybe you want to copy the files yourself? Maybe you're using a different publishing software?

Are you experiencing problems? Yes, it will. But we can fix it.

To perform site replication, you must know how to reference the correct files, which DLL files to copy, and where to store them.

Follow these steps:

1. Use the latest version of ASP.

Before continuing, make sure that your host is running the latest version of ASP. NET (4.0).

2. Copying Web folders

Copy your Web site (all folders and content) from the development machine to the application folder on the remote host (server).

If your app_data folder contains test data, do not copy this App_Data folder.

3. Copying DLL files

Create the Bin folder in the application root directory on the remote server. (If you have installed the helper, the bin folder already exists)

Copy all of the following files from your folder:

C:\Program Files (x86) \microsoft Asp.net\asp.net Web Pages\v1.0\assemblies

C:\Program Files (x86) \microsoft Asp.net\asp.net MVC 3\assemblies

To the Bin folder on the remote server.

4. Copy the SQL Server Compact DLL file

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

Copy all of the following files from your folder:

C:\Program Files (x86) \microsoft SQL Server Compact edition\v4.0\private

To the Bin folder on the remote server.

To create or edit a Web. config file in an application:

Example 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. Replicating SQL Server Compact data

Is there an. sdf file in your App_Data folder that contains test data?

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

Most of the time is not desirable.

If you have to copy a SQL data file (SDF file), you should delete all data from the database and then copy the empty. sdf file from the development machine to the server.

ASP. NET MVC-publishing Web site

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.