본문 바로가기

카테고리 없음

CDN




1-1. Azure Storage Explorer 설치

목표: Azure Storage 계정/Emulator 연결 관리


Azure Storage Explorer download

설치 후 할 일
• Azure 계정 로그인
• Emulator 연결해서 컨테이너 생성/확인 연습

힌트
• “Connect to Azure Storage Emulator from Storage Explorer” 로 검색하면 Emulator 연동법 나옴



1-2. Azure Storage Emulator(Azurite) 설치

목표: 로컬에서 Blob, Fileshare 에뮬레이션

구글 검색 키워드

Azurite Azure Storage Emulator install

설치법 예시
• npm 사용:

npm install -g azurite
azurite


• Docker 사용:

docker run -p 10000:10000 -p 10001:10001 -p 10002:10002 mcr.microsoft.com/azure-storage/azurite



추가 검색어 예시

Azurite quickstart guide




1-3. MSSQL Developer 설치

목표: 로컬 DB 서버 준비

구글 검색 키워드

SQL Server 2022 Developer Edition download

설치 후 할 일
• SSMS(Management Studio) 설치 권장
• DB, 계정 생성
• 샘플 테이블 만들어 보기

예시 검색어

Create database and table in SQL Server




DB 설계

목표: 업로드된 파일 메타데이터 저장 테이블 설계

검색 키워드

Design SQL table for file metadata

설계 예시 컬럼
• Id (PK)
• FileName
• StorageType (enum 형태로 구분)
• PathOrUrl
• ExpireAt
• Encrypted
• CreatedAt

추가 검색어

SQL Server create table script




ASP.NET Core 8 Web API 프로젝트 생성

Web API 뼈대 프로젝트 만들기

검색 키워드

dotnet new webapi

Create ASP.NET Core 8 Web API project

예시 명령어

dotnet new webapi -n FileStorageApi

프로젝트 구조 참고 검색어

ASP.NET Core Web API folder structure best practice




DTO 및 모델 설계

업로드 옵션과 파일 메타데이터 모델 만들기

검색 키워드

ASP.NET Core create DTO class

예제

public enum StorageType
{
    FileShare,
    Blob,
    OnPremise
}

public class UploadOption
{
    public DateTime? Expire { get; set; }
    public bool Encrypt { get; set; }
    public StorageType Type { get; set; }
}




DB 연결 및 Repository 패턴
MSSQL에 데이터 읽고/쓰는 코드 작성

검색 키워드

ASP.NET Core Entity Framework Core MSSQL setup

ASP.NET Core Repository pattern example

구현 힌트
• DbContext 생성
• Appsettings에 ConnectionString
• Migration으로 테이블 생성



Storage Service 인터페이스 설계

목표: 업로드/다운로드/삭제/목록조회 메서드 설계

검색 키워드

ASP.NET Core interface and implementation

Azure Blob Storage C# SDK example

Azure File Share C# SDK example

예제 인터페이스

public interface IStorageService
{
    Task UploadAsync(IFormFile file, UploadOption option);
    Task<Stream> DownloadAsync(string id);
    Task CopyAsync(string sourceId, string targetPath);
    Task RemoveAsync(string id);
    Task MoveAsync(string id, string newPath);
    Task<IEnumerable<string>> GetDirectories();
    Task<IEnumerable<string>> GetFiles(string directory);
    Task<FileDetail> GetFile(string id);
    Task<DirectoryDetail> GetDirectory(string id);
}




Azure Blob/Fileshare 연동

목표: Storage Emulator와 실제 업로드/다운로드 구현

검색 키워드

C# Azure Blob Storage upload download

C# Azure File Share upload download

Azurite connection string

힌트
• Emulator 연결 문자열:

DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDx1I4...==
BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;





환경 분기 처리

목표: 로컬/배포 환경 분기

검색 키워드

ASP.NET Core IHostEnvironment example

ASP.NET Core appsettings environment specific

구현 힌트

if (_env.IsDevelopment())
{
    // 실제 Azure Emulator에 저장
}
else
{
    // DB 메타데이터만 저장
}




클라이언트 콘솔 앱

Web API 호출 클라이언트 개발

검색 키워드

C# HttpClient call Web API example

C# console app user input

예제 흐름
• 사용자 입력: upload, download, copy 등 명령
• HTTP 요청 전송
• 응답 출력



환경설정 파일

Emulator/Production 각각 설정

검색 키워드

ASP.NET Core appsettings.Development.json

ASP.NET Core IConfiguration usage

예시

{
  "ConnectionStrings": {
    "StorageEmulator": "UseDevelopmentStorage=true",
    "SqlServer": "Server=localhost;Database=FileDb;..."
  }
}




배포

목표: 실제 서버에서 Emulator 제거, DB 저장만

검색 키워드

ASP.NET Core environment variables deployment

Disable Azure Storage upload in production






역할 검색 키워드 예시
MSSQL  SQL Server install, create table script
Web API ASP.NET Core Web API tutorial, EF Core setup
Blob/Fileshare Azure Blob Storage C# SDK, Azure File Share C# SDK
OnPremise C# file system read write
클라이언트 C# HttpClient example, C# console app




전체 요약

준비
• Storage Explorer + Emulator 설치
• MSSQL 설치, DB 생성

설계
• DB 테이블
• DTO/인터페이스

개발
• ASP.NET Core Web API 생성
• StorageService 구현
• 환경 분기 처리

클라이언트
• 콘솔 앱으로 테스트

테스트
• Emulator 연결 → 실제 업로드/다운로드
• Production 환경 → DB만