Remote Deployment of ASP. net mvc 5 Project

Source: Internet
Author: User
Tags sql management studio sql server express

Additional Words:

Because I felt that my machine was slow and poorly configured, I recently wanted to deploy my previous project on a lab server. However, since I often don't work in the lab, I was wondering if I could remotely deploy my machine. Therefore, I have studied the specific process and will share it with you. I am a newbie. I also hope you don't need to spray prawns. What's the problem? I also hope you have a high finger.

I. experiment environment:

Windows Server 2012 R2

SQL Server 2012 Express

Visual Studio 2013

Project: ASP. net mvc 5.0, using LocalDB Database

Ii. Web Deploy remote deployment conditions

Web Deploy can be used to Deploy Web projects locally and remotely. Web Deploy has the following requirements:

1. You need to install Web Deploy, the address below: http://www.iis.net/downloads/microsoft/web-deploy

 

2. After Web Deploy is installed, you must enable --Management ServiceOpen the Server Manager of Windows Server and click Add role and function:

Then click Next:

You need to check "manage services" here. This step is very important.

Next, wait until the configuration is complete. After completion, the Web Management Service will be added to the Service list, and make sure the Service is started.

Note: If the service is not started or the "Management Service" function is not enabled, the following error occurs when you Deploy a project using Web Deploy: "unable to connect to a remote computer, make sure that you have installed Web Deploy on a remote computer and started the required process ("Web Management Service ")":

3. After the management service is configured, you need to go to IIS and set it through the Management Service:

After we enable the management service, go to IIS and there will be more management service options:

Double-click Management Service to configure IIS. Here, I keep the default settings. You can set them as needed:

4. Configure the account for the remote deployment Web Project

Based on security considerations, it is best to provide a separate account to deploy Web projects. For sites in IIS, you can specify which users have the permission to deploy applications to this site.

First click "IIS Manager User ":

Then click "Add User ":

Configure the account name and password:

After the configuration is complete, set the site user permissions.

5. Configure site User Permissions

First, click the Site to which your program will be published. For example, this article is Default Web Site. Then, click "IIS manager permission" in the management options ":

Then click "allow user ":

 

Add the previously added iepi user to the selected site permissions:

 

Click OK. The configuration is complete.

3. Remote project deployment using Visual Studio 2013

Before releasing a project, we need to configure some permissions for the root directory of the Site to be released (for example, the Default Web Site here. That is, the "Local Service" account must have the permission to modify the site directory. Here, the "Default Web Site" directory is:

C: \ inetpub \ wwwroot. Therefore, right-click the wwwroot file, select Properties-security-edit, add the Local Service account, and select modify permission.

 

If the preceding permission configuration is not performed, the system prompts that the file cannot be created under the Physical directory of the site at the time of release, but the file creation permission is not available.

After configuring the physical directory permissions of the site, we began to release the web Project:

 

Right-click the project and select "publish ":

 

Create a configuration file. You can also select the previous one. We recommend that you create a new one.

Click Next to configure Web Deploy:

Note: SERVER: Enter the IP address.

Site name: in the format of "site name"/"Application name"

The user password is the user password we configured above.

Target URL: General Format: http: // ip: Port Number/y Application name. After the release is complete, the browser automatically opens the url.

Click "verify". The message is displayed, indicating that the information is correct and can be published. Next, click "Next" until the release is complete. Because we use LocalDB, we do not need to configure the database.

4. Configure the LocalDb Database

LocalDB is a lightweight database engine of SQL Server Express. It starts and runs in user mode. LocalDB runs in a special SQL Server Express execution mode, so you can use the MDF file database. Generally, the database files of LocalDB are stored in the App_Data folder of the web project.

Note:SQL Server Express is not recommended for Web applications in the production environment. In particular, LocalDB should not be used in the production environment of Web applications because it is not required at the beginning of design.IIS. However, LocalDB databases can be easily migrated to SQL Server or SQL Azure-from ASP. net mvc 5-create Connection String and use SQL Server LocalDB.

After learning about LocalDB, how can we make our ASP. net mvc project accessible? First, we need to set up our project to include database files in the project:

And then release again.

Then there will be an App_Data folder under the application directory of the physical path of the site, which contains our database files.

Then open SQL Management Studio and use (LocalDb) \ v11.0 for Windows Authentication login, and then attach the database of our project.

In IIS, modify the application pool ID of the project to "Local System ". For the reason, refer to here.

 

After completing all the above steps, all our work has been completed, and you can access our Web by entering the address in the browser. Two images:

Related Article

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.