728x90 반응형 전체 글303 ASP.NET Core] Tag Helper Tag helper는 Razor Syntax에서 HTML elements를 쉽게 만들고 렌더링하는데 사용된다. HTML element처럼 보이지만, 서버 쪽 Razor engine에 의해 처리된다. 예를들어 아래의 form tag는 이렇게 쓸 수 있다. asp-action과 asp-controller는 Form Tag Helper의 attribute이다. 위의 Form Tag Helper는 아래와 같이 태그를 생성한다. 목적 Tag Helper 없이, form을 만들 수 있다. 하지만 Tag Helper는 html 태그를 생성하는데 필요한 코드를 단순하게 한다. 사용법 Microsoft.AspNetCore.Mvc.TagHelpers를 add한다. '*' 는 모든 Tag Helper를 의미한다. @addT.. 2022. 1. 25. ASP.NET Core 6] Route Constraints 경로 제약 조건 참조문서 : https://www.tektutorialshub.com/asp-net-core/asp-net-core-route-constraints/ Route 제약조건을 추가할 수 있는 방법은 2가지이다. Inline with the URL Parameter MapRoute 함수의 Constraint argument를 사용 Route Constraints Program.cs app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); HomeController.cs public string Index(int id) { return "I got" + id.ToString(); } /Home/Index.. 2022. 1. 25. ASP.NET Core 6] ASPNETCORE_ENVIRONMENT ASP.NET COre는 환경 변수를 사용하여 런타임 환경에 따라 앱 동작을 구성한다. 다음 환경 변수로 runtime 환경을 확인한다. 1. DOTNET_ENVIRONMENT 2. WebApplication.CreateBuilder 함수가 호출될 때, ASPNETCORE_ENVIRONMENT를 호출하고, DOTNET_ENVIRONMENT를 override한다. IHostEnvironment.EnvironmentName 기본제공 값 Development : launchSettings.json 파일은 로컬 컴퓨터에서 ASPNETCORE_ENVIRONMENT를 Development로 설정한다. Staging Production : DOTNET_ENVIRONMENT 및 ASPNETCORE_ENVIRONMENT.. 2022. 1. 20. ASP.NET Core 6] 환경변수에서 ConnectionString 관리 참조자료 : Configuration https://bigexecution.tistory.com/103 ASP.NET Core] Configuration Configuration Source ASP.NET Core는 아래 구성 소스에서 configuration value를 읽는다. Setting Json files(예: appsettings.json ) Environment variables Azure Key Vault Command-line arguments Default.. bigexecution.tistory.com 참조자료 : appsettings.json으로 db 연결 https://bigexecution.tistory.com/84 ASP.NET Core] Entity Framework Core.. 2022. 1. 20. ASP.NET Core] Configuration Configuration Source ASP.NET Core는 아래 구성 소스에서 configuration value를 읽는다. Setting Json files(예: appsettings.json ) Environment variables Azure Key Vault Command-line arguments Default Configuration 기본 구성은 아래 순서대로 configuration을 로딩한다. appsettings.json appsettings.Environment.json 앱이 Development 환경에서 실행되는 경우 App secrets(secrets.json) Enverionment Variables Command-line arguments Key가 중복되는 경우, 나중 Val.. 2022. 1. 20. ASP.NET Core 6] Kestrel vs IIS, Hosting Model Kestrel ASP.NET Core를 위한, cross-platform, open-source web server이다. ASP.NET Core에 기본으로 포함되어 있다. ASP.NET Core가 지원하는 모든 platforms, versions에서 사용이 가능하다. Kestrel는 ASP.NET Core application 서비스가 가능하지만, MS는 Apache, IIS, Nginx와 같은 reverse proxy server와 같이 사용하길 권장한다. .NET Core CLI로 .NET Core application을 실행하면 Kestrel을 웹 서버로 사용한다. Window Command Prompt가 실행된다. IIS (Internet Information Service) .NET Core를 .. 2022. 1. 18. 이전 1 ··· 35 36 37 38 39 40 41 ··· 51 다음 728x90 반응형