דרישות מקדימות
אופציונלי
- Visual Studio 2022 - לפיתוח ודיבוג
- SQL Server - למסד נתונים (אופציונלי, ניתן להשתמש ב-InMemory)
- FFmpeg - לקידוד וידאו H.264/VP8
שיטות התקנה
1
שכפל את הפרויקט
git clone https://github.com/levor/RemoteDesktop-CSharp.git
cd RemoteDesktop-CSharp
2
התקן תלויות
cd src
dotnet restore RemoteDesktop.sln
3
בנה את הפרויקט
dotnet build RemoteDesktop.sln -c Release
Build succeeded.
0 Warning(s)
0 Error(s)
4
הרץ את המבחנים
dotnet test RemoteDesktop.sln
Passed! - Failed: 0, Passed: 266, Skipped: 0
5
הפעל את הרכיבים
# בחלון נפרד - Server
dotnet run --project RemoteDesktop.Server
# בחלון נפרד - Agent (על המחשב המרוחק)
dotnet run --project RemoteDesktop.Agent
# בחלון נפרד - Client
dotnet run --project RemoteDesktop.Client
# חדש! AgentClient משולב (Agent + Client באותו חלון)
dotnet run --project RemoteDesktop.AgentClient
1
בנה לפרודקשן
# Build כל הרכיבים
dotnet publish RemoteDesktop.Server -c Release -o ./publish/Server
dotnet publish RemoteDesktop.Agent -c Release -o ./publish/Agent
dotnet publish RemoteDesktop.Client -c Release -o ./publish/Client
2
Self-Contained Build (אופציונלי)
לא דורש התקנת .NET על מחשב היעד
dotnet publish RemoteDesktop.Agent -c Release -r win-x64 --self-contained -o ./publish/Agent-SelfContained
3
Single-File Executable
קובץ בודד להפצה קלה
dotnet publish RemoteDesktop.Agent -c Release -r win-x64 --self-contained -p:PublishSingleFile=true -o ./publish/Agent-Single
טיפ: קבצי Self-Contained גדולים יותר (~80MB) אך לא דורשים .NET מותקן.
1
בנה Docker Image
# Server only (Agent requires Windows GUI)
docker build -t levor-remote-server -f Dockerfile.Server .
2
הרץ Container
docker run -d \
--name remote-server \
-p 5050:5050 \
-e JWT_SECRET=your-secret-key \
levor-remote-server
3
Docker Compose (עם SQL Server)
# docker-compose.yml
version: '3.8'
services:
server:
build: .
ports:
- "5050:5050"
environment:
- ConnectionStrings__DefaultConnection=Server=db;...
depends_on:
- db
db:
image: mcr.microsoft.com/mssql/server:2022-latest
environment:
- ACCEPT_EULA=Y
- SA_PASSWORD=YourPassword123!
שים לב: ה-Agent דורש Windows עם ממשק גרפי ולכן לא יכול לרוץ בקונטיינר Linux רגיל.
הגדרות
Server - appsettings.json
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=RemoteDesktop;..."
},
"Jwt": {
"Secret": "your-256-bit-secret-key-here",
"Issuer": "levor-remote-desktop",
"AccessTokenMinutes": 15,
"RefreshTokenDays": 7
},
"Kestrel": {
"Endpoints": {
"Https": {
"Url": "https://0.0.0.0:5050",
"Certificate": {
"Path": "./cert.pfx",
"Password": "cert-password"
}
}
}
}
}
משתני סביבה
| משתנה | רכיב | תיאור |
|---|---|---|
REMOTEDESKTOP_SERVER_URL |
Agent | כתובת השרת להתחברות |
JWT_SECRET |
Server | מפתח חתימה ל-JWT |
ASPNETCORE_ENVIRONMENT |
Server | Development / Production |
ASPNETCORE_URLS |
Server | כתובות האזנה |
אימות ההתקנה
Server
וודא שהשרת רץ:
curl https://localhost:5050/health
{"status":"Healthy"}
Agent
וודא שה-Agent מחובר:
- הודעת "Connected to server"
- מופיע ברשימת ה-Agents
Client
וודא חיבור תקין:
- רשימת Agents מופיעה
- Session מתחיל בהצלחה
הרצת מבחנים
dotnet test RemoteDesktop.sln --verbosity normal
Test summary:
Total tests: 266
Passed: 266
Failed: 0
Duration: ~15s
AgentClient משולב חדש!
AgentClient
יישום משולב Agent + Client באותו חלון:
dotnet run --project RemoteDesktop.AgentClient
- מצב Agent פעיל (מתג "Enable Agent Mode")
- מצב Client פעיל (בחר Agent ולחץ Connect)
- שני המצבים עובדים במקביל!
בעיות נפוצות
לפיתוח מקומי, הוסף תעודה עצמית:
dotnet dev-certs https --trust
שנה את הפורט ב-appsettings.json או:
dotnet run --project RemoteDesktop.Server --urls "https://localhost:5051"
המערכת תעבור אוטומטית ל-GDI+ fallback. אם אתה רוצה DXGI:
- וודא שאתה ב-Windows 10/11
- עדכן את ה-GPU drivers
- וודא ש-Desktop Composition פעיל