Asp.net core mvc 편집하기
편집을 되돌릴 수 있습니다.
이 편집을 되돌리려면 아래의 바뀐 내용을 확인한 후 저장해주세요.
최신판 | 당신의 편집 | ||
1번째 줄: | 1번째 줄: | ||
− | == | + | ===MySQL에서 마이그레이션 히스토리 테이블 생성=== |
− | === | + | |
− | + | ====에러메시지==== | |
− | + | EFMigrationsHistory' doesn't exist | |
− | + | ||
+ | ====쿼리문==== | ||
CREATE TABLE IF NOT EXISTS __EFMigrationsHistory ( | CREATE TABLE IF NOT EXISTS __EFMigrationsHistory ( | ||
− | + | ||
− | + | MigrationId varchar(150) NOT NULL, | |
− | + | ||
+ | ProductVersion varchar(32) NOT NULL, | ||
+ | |||
+ | CONSTRAINT PK___EFMigrationsHistory PRIMARY KEY (MigrationId) | ||
+ | |||
); | ); | ||
− | |||
− | ===Identity 적용=== | + | ===MySQL 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=== | ||
+ | |||
+ | ====nuget package==== | ||
+ | Install-Package Npgsql.EntityFrameworkCore.PostgreSQL | ||
+ | |||
+ | ====connection string==== | ||
+ | "User ID=damienbod;Password=1234;Host=localhost;Port=5432;Database=damienbod;Pooling=true;" | ||
+ | |||
+ | ===마이그레이션 명령=== | ||
+ | ====추가==== | ||
+ | PM> Add-Migration InitialCreate | ||
+ | |||
+ | ====복원==== | ||
+ | PM> Update-Database 20161012160749_AddedOrderToCourse | ||
+ | |||
+ | ====업데이트==== | ||
+ | PM> Update-Database | ||
===모델=== | ===모델=== | ||
24번째 줄: | 46번째 줄: | ||
==dotnet명령어== | ==dotnet명령어== | ||
===실행=== | ===실행=== | ||
− | $ / | + | $ ~/.dotnet/dotnet run |
− | == | + | ==서비스 등록 (for linux)== |
참고 사이트: https://docs.microsoft.com/ko-kr/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2 | 참고 사이트: 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] | [Unit] | ||
+ | |||
Description=Example .NET Web API App running on Ubuntu | Description=Example .NET Web API App running on Ubuntu | ||
[Service] | [Service] | ||
+ | |||
WorkingDirectory=/var/www/helloapp | WorkingDirectory=/var/www/helloapp | ||
+ | |||
ExecStart=/usr/bin/dotnet /var/www/helloapp/helloapp.dll | ExecStart=/usr/bin/dotnet /var/www/helloapp/helloapp.dll | ||
+ | |||
Restart=always | Restart=always | ||
− | # Restart service after 10 seconds if the dotnet service crashes: | + | |
+ | <nowiki>#</nowiki> Restart service after 10 seconds if the dotnet service crashes: | ||
+ | |||
RestartSec=10 | RestartSec=10 | ||
+ | |||
KillSignal=SIGINT | KillSignal=SIGINT | ||
+ | |||
SyslogIdentifier=dotnet-example | SyslogIdentifier=dotnet-example | ||
+ | |||
User=www-data | User=www-data | ||
+ | |||
Environment=ASPNETCORE_ENVIRONMENT=Production | Environment=ASPNETCORE_ENVIRONMENT=Production | ||
+ | |||
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false | Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false | ||
[Install] | [Install] | ||
+ | |||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
− | |||
− | |||
[[분류:Asp.net]] | [[분류:Asp.net]] |