AngularJS v6.0.3 + Asp.Net Core 2.1

//AngularJS v6.0.3 + Asp.Net Core 2.1

AngularJS v6.0.3 + Asp.Net Core 2.1

Visual Studio 2019 -> File -< New Project -> Asp.Net Core Web Application -> Next -> Project Name: API-AspNetCore2.1 -> Create -> API -> Create (.NET Core 2.1)
Another Project
Visual Studio 2019 -> File -< New Project -> Asp.Net Core Web Application -> Next -> Project Name: AngularJS-AspNetCore2.1 -> Create -> Empty -> Create
Access VSCode and go to the folder AngularJS-AspNetCore2.1 -> Open Terminal -> type -> ng new devramp -> cd .\devramp\ -> npm install rxjs@6.3.3 –save -> ng serve –open -> it is working
Open on VSCode file angular.json and edit field: “outputPath”: “../../API-AspNetCore2.1-v1/wwwroot”,
Access VSCode and on the folder AngularJS-AspNetCore2.1 open a terminal a build the project -> ng build
After that all built files will be on API-AspNetCore2.1/wwwroot

On Visual Studio 2019 open project API-AspNetCore2.1 and edit file: Startup.cs

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Use(async (context, next) =>
            {
                await next();
                if (context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
                {
                    context.Request.Path = "/index.html";
                    await next();
                }
            });

            app.UseDefaultFiles();

            app.UseStaticFiles();

            app.UseMvc();
        }

Next step right click on this project and select Properties -> Tab Debug -> Copy value from field App URL to Launch Browser “http://localhost:63415”

Publish on IIS: Project Tab -> Publish -> Deploy in a folder -> Target Framework -> netcoreapp2.1

By |2020-08-11T22:16:05-06:00August 11th, 2020|Web Developer|Comments Off on AngularJS v6.0.3 + Asp.Net Core 2.1

About the Author: