"Asp.net core mvc"의 두 판 사이의 차이

wwiki
이동: 둘러보기, 검색
 
(같은 사용자의 중간 판 19개는 보이지 않습니다)
1번째 줄: 1번째 줄:
===MySQL에서 마이그레이션 히스토리 테이블 생성===
+
==MySQL==
 
+
===마이그레이션 히스토리 테이블 생성===
====에러메시지====
+
다음 에러메시지가 출력되는 경우에
EFMigrationsHistory' doesn't exist
+
EFMigrationsHistory' doesn't exist
 
+
다음 쿼리문을 사용하여 테이블을 생성한다.<syntaxhighlight lang="sql">
====쿼리문====
 
 
CREATE TABLE IF NOT EXISTS __EFMigrationsHistory (
 
CREATE TABLE IF NOT EXISTS __EFMigrationsHistory (
 
+
  MigrationId varchar(150) NOT NULL,
MigrationId varchar(150) NOT NULL,
+
  ProductVersion varchar(32) NOT NULL,
 
+
  CONSTRAINT PK___EFMigrationsHistory PRIMARY KEY (MigrationId)
ProductVersion varchar(32) NOT NULL,
 
 
 
CONSTRAINT PK___EFMigrationsHistory PRIMARY KEY (MigrationId)
 
 
 
 
);
 
);
 +
</syntaxhighlight>
  
===MySQL Identity 적용===
+
===Identity 적용===
  
 
====에러메시지====
 
====에러메시지====
 
InvalidOperationException: No coercion operator is defined between types 'System.Int16' and 'System.Boolean'.
 
InvalidOperationException: No coercion operator is defined between types 'System.Int16' and 'System.Boolean'.
  
===PostgreSQL===
+
===모델===
 +
 
 +
===컨트롤러===
 +
 
 +
===Lazor===
  
====nuget package====
+
==dotnet명령어==
Install-Package Npgsql.EntityFrameworkCore.PostgreSQL
+
===실행===
 +
$ /[[usr]]/bin/dotnet run
  
====connection string====
+
==[[Service|서비스]] 등록 (for linux)==
"User ID=damienbod;Password=1234;Host=localhost;Port=5432;Database=damienbod;Pooling=true;"
+
참고 사이트: https://docs.microsoft.com/ko-kr/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2
  
===마이그레이션 명령===
+
===서비스 정의 파일 생성===
 +
$ sudo nano /etc/systemd/system/kestrel-helloapp.service
  
====복원====
+
===서비스 파일 정의===
PM> Update-Database 20161012160749_AddedOrderToCourse
+
<syntaxhighlight lang="ini">
 +
[Unit]
 +
Description=Example .NET Web API App running on Ubuntu
  
=== 모델 ===
+
[Service]
 +
WorkingDirectory=/var/www/helloapp
 +
ExecStart=/usr/bin/dotnet /var/www/helloapp/helloapp.dll
 +
Restart=always
 +
# Restart service after 10 seconds if the dotnet service crashes:
 +
RestartSec=10
 +
KillSignal=SIGINT
 +
SyslogIdentifier=dotnet-example
 +
User=www-data
 +
Environment=ASPNETCORE_ENVIRONMENT=Production
 +
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
  
=== 컨트롤러 ===
+
[Install]
 +
WantedBy=multi-user.target
 +
</syntaxhighlight><br />
  
=== Lazor ===
+
[[분류:Asp.net]]

2022년 11월 14일 (월) 02:23 기준 최신판

MySQL[편집 | 원본 편집]

마이그레이션 히스토리 테이블 생성[편집 | 원본 편집]

다음 에러메시지가 출력되는 경우에

EFMigrationsHistory' doesn't exist

다음 쿼리문을 사용하여 테이블을 생성한다.

CREATE TABLE IF NOT EXISTS __EFMigrationsHistory (
  MigrationId varchar(150) NOT NULL,
  ProductVersion varchar(32) NOT NULL,
  CONSTRAINT PK___EFMigrationsHistory PRIMARY KEY (MigrationId)
);

Identity 적용[편집 | 원본 편집]

에러메시지[편집 | 원본 편집]

InvalidOperationException: No coercion operator is defined between types 'System.Int16' and 'System.Boolean'.

모델[편집 | 원본 편집]

컨트롤러[편집 | 원본 편집]

Lazor[편집 | 원본 편집]

dotnet명령어[편집 | 원본 편집]

실행[편집 | 원본 편집]

$ /usr/bin/dotnet run

서비스 등록 (for linux)[편집 | 원본 편집]

참고 사이트: https://docs.microsoft.com/ko-kr/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2

서비스 정의 파일 생성[편집 | 원본 편집]

$ sudo nano /etc/systemd/system/kestrel-helloapp.service

서비스 파일 정의[편집 | 원본 편집]

[Unit]
Description=Example .NET Web API App running on Ubuntu

[Service]
WorkingDirectory=/var/www/helloapp
ExecStart=/usr/bin/dotnet /var/www/helloapp/helloapp.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-example
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target