Run Vue on an ASP. NET core application and deploy on IIS

Source: Internet
Author: User

Objective

Starting with. NET Core 1.0, we've applied it to the project, but I haven't even begun to work on some of the principles of ASP. But there are a lot of articles in the garden, and we have some free time to talk about how to use ASP. Core combines Vue to run on IIS.

ASP. NET core with Vue deployed in IIS

about installing Vue and Webpack are no longer described, we directly create an ASP. NET core application or create an ASP. NET core application through dotnet new MVC

Next, under the above application, create the Vue template with the following command

Vue Init webpack my-projectcd My-projectnpm Install

Next we use NPM run dev to start the Vue.

At this point Vue is also running, and we can have a good local test. The first step was completed, and then we separated before and after the production environment, deploying the ASP. NET core application to IIS as a separate site, while Vue was also used as a separate site. Next we deploy the above application to IIS.

For site Aspnetcore created on IIS, the application pool in its basic settings is of course unmanaged code, and if not, download. NET Core Run time yourself.

What we need to do now is to modify the Vue configuration file and modify the Index.js file in the generated Vue Template Project Config folder to configure the directory where the generated files are located, as follows:

Next, run the NPM Run build command to generate the Vue file under the Wwwroot folder.

Then we create a front-end site to put the generated files above that site, for example, I created a vuedemo.

is not everything seems so simple and easy, you may have a lot of problems when you test, I just did not do a detailed explanation, such as no access Ah, then given permission Connaught, by default, site permissions for IIS Apppool\defaultapppool, If you have insufficient permissions to configure NET service or every one, or if you create a Vue site that does not have access to the corresponding error code, you need to install the routing rewrite program through the Web platform.

Summarize

In this section we briefly describe how to implement the separation of an ASP. NET core application from the front-end framework (such as Vue), followed by Vue's interface call, and time to update the AJAX request with Vue for the ASP. If there are any pits in the above creation process can not be resolved directly to the private messages I, one for you to answer. See U.

Run Vue on an ASP. NET core application and deploy on IIS

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.