スキップしてメイン コンテンツに移動

投稿

ラベル(.Net Core)が付いた投稿を表示しています

[ASP.NET Core][Angular] Integrate Angular app into ASP.NET Core app

Intro I had written Angular app and ASP.NET Core app separately. But because I had had to use some internal api at my work, I tried to integrate them. Prepare Angular (CLI ver. 8.3.21) ASP.NET Core (ver. 3.1.101) Because Microsoft.AspNetCore.SpaServices of ASP.NET Core had been obsoleted and changed to Microsoft.AspNetCore.SpaServices.Extensions. So there hadn't been so much documents. [Announcement] Obsoleting Microsoft.AspNetCore.SpaServices and Microsoft.AspNetCore.NodeServices #12890 Thus, I had generated sample program of Angular template. And I had followed it to integrate apps. dotnet new angular -n AngularSample Change Angular app Because of Microsoft.AspNetCore.SpaServices.Extensions, I hadn't needed changing the Angular app. Output Path The output path hadn't been same as Angular template's one. angular.json (Angular CLI) ... "outputPath": "dist/{PROJECT-NAME}", ... angular.json (ASP.NET Core) ... "outputPath...

[ASP.NET Core 3.0] Sign in with Identity

Today I tried authentication by ASP.NET Core Identity. What I did 1. Create custom IdentityUser 2. Create a route for authentication 3. After authentication, access authorized route Setup Most of all environments were same as previous post. I only installed Microsoft.AspNetCore.Identity.EntityFrameworkCore (ver.3.0.0) by NuGet. Add user table I added user table to DB. CREATE TABLE "User" ( "UserId" serial PRIMARY KEY, "Name" text not null, "Password" text not null ) 1. Create custom IdentityUser First, I created custom IdentityUser for signing in. Because the default IdentityUser had had so many properties. But I only wanted three things below. Id UserName Password ApplicationUser I could created custom user class by inheritting IdentityUser class. ApplicationUser.cs using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.AspNetCore.Identity; names...

Upgrade from ASP.NET Core 2.2 to 3.0

Conguratulations on the releasing .NET Core 3.0 and ASP.NET Core 3.0! Today's theme is about upgrading ASP.NET Core from ver.2.2 to ver.3.0. What I did Creating an empty ASP.NET Core project(ver.2.2.402) Adding EntityFrameworkCore by NuGet Adding some codes Upgrading to ver.3.0.100 Fixing some problems Setup Environments .NET Core : ver.2.2.402, ver.3.0.100 Microsoft.EntityFrameworkCore : ver.2.2.6, ver.3.0.0 Npgsql.EntityFrameworkCore.PostgreSQL : ver.2.2.4, ver.3.0.1 Windows10 : ver.1903 Rider : ver.2019.2.3 PostgreSQL : ver.12.0 Creating the base project UpgradeSample.csproj <Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.2</TargetFramework> <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel> </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include=...