TrueWatch
Mulai Sekarang
Workshop

Workshop TrueWatch: Deployment & Instrumentasi eShopOnWeb

Angus Lim
·6 Agu 20254 menit baca
TrueWatch Workshop eShopOnWeb Deployment Instrumentation

Ikhtisar & Cakupan

Workshop ini memandu Anda men-deploy contoh aplikasi eShopOnWeb ASP.NET Core 8.0 di Windows IIS, lalu melakukan instrumentasi dengan TrueWatch.

  • Bagian A (Opsional): Penyiapan baru lingkungan Windows IIS & .NET, deployment aplikasi secara penuh.
  • Bagian B: Onboarding dan instrumentasi TrueWatch untuk aplikasi IIS yang sudah ada.

Siapa yang sebaiknya mengikuti bagian yang mana?

  • Baru mengenal IIS & .NET? Mulai dari Bagian A.
  • Aplikasi Anda sudah berjalan di IIS? Lewati Bagian A dan langsung ke Bagian B.

Ketuk di sini untuk tutorial video — TrueWatch Workshop eShopOnWeb Deployment & Instrumentation

Pendahuluan

Setelah menyelesaikan panduan ini, Anda akan memiliki:

  • Aplikasi ASP.NET Core 8.0 (eShopOnWeb) yang dipublikasikan dan di-hosting oleh Windows IIS

Prasyarat Lingkungan

PersyaratanCatatan
Workspace TrueWatchDaftar di https://id1-auth.truewatch.com/businessRegister
Windows Server (mis., 2025)Di AWS EC2, Parallels, VMware, atau bare metal
Akses RDP AdminPort 3389 terbuka dari IP Anda

Bagian A – Penyiapan Lingkungan & Deployment

A.1 Jalankan PowerShell sebagai Administrator dan Instal Git serta .NET

# Install Git 
winget install --id Git.Git -e --source winget
 
# Install .NET 8 SDK
winget install --id Microsoft.DotNet.SDK.8 -e
 
# Relaunch PowerShell as Admin and Verify
git --version
dotnet --version

A.2 Clone & publikasikan contoh aplikasi

git clone https://github.com/dotnet-architecture/eShopOnWeb.git C:\inetpub\wwwroot\eShopOnWeb
 
cd C:\inetpub\wwwroot\eShopOnWeb\src\Web    
 
dotnet publish -c Release -o C:\inetpub\wwwroot\eShopOnWeb\publish

A.3 Instal dan Daftarkan AspNetCoreModuleV2

Unduh "ASP NET Core Runtime 8.0 Hosting Bundle" dari https://dotnet.microsoft.com/download/dotnet/8.0/runtime dan simpan ke C:\Downloads.

# 1. Install silently (as Admin)
Start-Process -FilePath C:\Downloads\dotnet-hosting-8.0.18-win.exe `
  -ArgumentList '/quiet','/norestart' -Wait -Verb RunAs
 
# 2. Verify registration
Import-Module WebAdministration
Get-WebGlobalModule AspNetCoreModuleV2 | Select Name, Image
 
# 3. Restart IIS
iisreset /restart

A.4 Buat direktori logs & ACL

$pub = 'C:\inetpub\wwwroot\eShopOnWeb\publish'
New-Item -ItemType Directory -Path "$pub\logs" -Force
$pool='eShopOnWebPool'
icacls "$pub\logs" /grant "IIS_IUSRS:(M)" /T

A.5 Instal Role IIS Web Server

# Install the full IIS role (Web Server) plus Management tools
Install-WindowsFeature -Name Web-Server -IncludeManagementTools
 
# Now these should show up and be Running (or Stopped if you haven’t started them yet):
Get-Service W3SVC, WAS | Select-Object Name, Status
 
# If they’re stopped, start them:
Start-Service WAS
Start-Service W3SVC

A.6 Konfigurasi Site & App Pool

Install-WindowsFeature Web-Scripting-Tools -IncludeManagementTools
Import-Module WebAdministration
New-WebAppPool $pool
Set-ItemProperty "IIS:\AppPools\$pool" -Name startMode -Value AlwaysRunning
Set-ItemProperty "IIS:\AppPools\$pool" -Name processModel.loadUserProfile -Value True
 
New-Website -Name eShopOnWeb `
  -PhysicalPath $pub `
  -Port 5000 -ApplicationPool $pool

A.7 Unduh dan Instal SQL Server Express 2022

Kunjungi https://www.microsoft.com/en-za/sql-server/sql-server-downloads dan unduh SQL Server 2022 Express. Pilih metode Basic Installation.

TrueWatch eshoponweb SQL Server 2022 Express Installation Setup

Instal SSMS saat diminta.

A.8 Siapkan Database

Install-WindowsFeature Web-Scripting-Tools -IncludeManagementTools
Import-Module WebAdministration
New-WebAppPool $pool
Set-ItemProperty "IIS:\AppPools\$pool" -Name startMode -Value AlwaysRunning
Set-ItemProperty "IIS:\AppPools\$pool" -Name processModel.loadUserProfile -Value True
 
New-Website -Name eShopOnWeb `
  -PhysicalPath $pub `
  -Port 5000 -ApplicationPool $pool
  1. Buka SQL Server Management Studio (SSMS)

TrueWatch eshoponweb SQL Server Management Studio (SSMS) Setup

  1. Buat Windows Login
  • Buka Security → Logins, klik kanan New Login…
  • Login name: IIS APPPOOL\eShopOnWebPool
  • Klik Save
  1. Buat Database CatalogDb
  • Pilih New Query
  • Tempel dan jalankan

CREATE DATABASE [CatalogDb]; GO

TrueWatch eshoponweb CatalogDb

A.9 Recycle IIS & Verifikasi

iisreset /restart
Invoke-WebRequest http://localhost:5000/ -UseBasicParsing

Buka http://localhost:5000/ di browser Anda — halaman landing eShopOnWeb akan muncul.

Bagian B – Instrumentasi TrueWatch

B.1 Instal TrueWatch DataKit Agent

  • Di konsol TrueWatch: Integrations → DataKit → Windows, salin skrip instalasi.
  • Jalankan di PowerShell sebagai Admin.
  • Verifikasi host di Infrastructure → Hosts.

TrueWatch eshoponweb Infrastructure Hosts

TrueWatch eshoponweb Infrastructure Hosts 2

B.2 Aktifkan Modul DataKit

Edit C:\Program Files\datakit\conf.d\datakit.conf:

default_enabled_inputs = ["cpu", "disk", "diskio", "mem", "swap", "system", "hostobject", "net", "host_processes", "dk", "statsd", "ddtrace", "windows_event"]

Mulai ulang DataKit:

datakit service -R

B.3 Perbarui web.config untuk TrueWatch

Buka C:\inetpub\wwwroot\eShopOnWeb\publish\web.config dan tambahkan:

<environmentVariable name="DD_AGENT_HOST" value="127.0.0.1" />
<environmentVariable name="DD_TRACE_AGENT_PORT" value="9529" />
<environmentVariable name="DD_RUNTIME_METRICS_ENABLED" value="1" />
<!-- other DD_ vars as needed -->

B.4 Aktifkan RUM (Real User Monitoring)

  1. Di TrueWatch: RUM → Create Application, salin snippet.
  2. Edit _Layout.cshtml di C:\inetpub\wwwroot\eShopOnWeb\src\Web\Views\Shared_Layout.cshtml, tempel di bawah head.

TrueWatch eshoponweb Enable RUM 1

TrueWatch eshoponweb Enable RUM 2

B.5 Siapkan Tracing .NET APM

  1. Instal .NET Tracer MSI (mis., datadog-dotnet-apm-3.21.0-x64.msi).
  2. Mulai ulang IIS:
net stop was; net start w3svc
  1. Konfirmasi trace di TrueWatch APM

TrueWatch eshoponweb APM

3 Catatan Tambahan

Publikasi Ulang Setelah Perubahan Kode

cd C:\inetpub\wwwroot\eShopOnWeb\src\Web
dotnet publish -c Release -o C:\inetpub\wwwroot\eShopOnWeb\publish
Restart-WebAppPool eShopOnWebPool
Oleh Angus Lim

Angus Lim is TrueWatch's Presales Solution Architect. He turns TrueWatch product demos into practical, step-by-step guides. His articles are based on the walkthrough videos on TrueWatch's YouTube channel, so engineers can follow along and try the same setup in their own environment.

Artikel unggulan

Melampaui observabilitas bersama TrueWatch hari ini.