Files
xSaherelmWorkspace/Documents/Docs/Developer/Register LLM Serve Service in Windows.html
T
2026-10-15 00:05:32 +03:30

888 lines
32 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>راهنمای ثبت سرویس Qwen9BService | اجرای خودکار llamafile در ویندوز ۱۱</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
:root {
--primary: #1a365d;
--primary-light: #2c5282;
--accent: #c9a961;
--accent-dark: #a8893f;
--bg: #faf9f6;
--card-bg: #ffffff;
--text: #1a202c;
--text-muted: #4a5568;
--border: #e2e8f0;
--success: #38a169;
--danger: #e53e3e;
--warning: #dd6b20;
--code-bg: #1a202c;
--code-text: #e2e8f0;
--shadow: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(26,54,93,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Vazirmatn', Tahoma, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.9;
font-size: 15px;
padding: 30px 15px;
}
.document-container {
max-width: 950px;
margin: 0 auto;
background: var(--card-bg);
box-shadow: var(--shadow);
border-radius: 12px;
overflow: hidden;
}
.document-header {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
color: white;
padding: 50px 40px 40px;
position: relative;
border-bottom: 4px solid var(--accent);
}
.document-header::before {
content: '';
position: absolute;
top: 0; right: 0;
width: 200px; height: 200px;
background: radial-gradient(circle, rgba(201,169,97,0.15) 0%, transparent 70%);
border-radius: 50%;
transform: translate(50%, -50%);
}
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
position: relative;
z-index: 1;
}
.company-badge {
display: flex;
align-items: center;
gap: 12px;
}
.company-logo {
width: 60px; height: 60px;
background: var(--accent);
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.doc-meta {
text-align: left;
font-size: 12px;
opacity: 0.9;
}
.doc-meta div { margin-bottom: 3px; }
.document-title {
text-align: center;
position: relative;
z-index: 1;
padding: 20px 0;
}
.document-title .label {
display: inline-block;
background: rgba(201,169,97,0.2);
color: var(--accent);
padding: 4px 16px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
margin-bottom: 15px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-title h1 {
font-size: 28px;
font-weight: 800;
margin-bottom: 10px;
letter-spacing: -0.5px;
}
.document-title h2 {
font-size: 16px;
font-weight: 400;
opacity: 0.9;
}
.document-body {
padding: 40px;
}
.intro-text {
background: linear-gradient(to left, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin-bottom: 35px;
font-size: 14px;
color: var(--text-muted);
}
.section {
margin-bottom: 40px;
page-break-inside: avoid;
}
.section-header {
display: flex;
align-items: center;
gap: 15px;
padding-bottom: 12px;
border-bottom: 2px solid var(--border);
margin-bottom: 20px;
}
.section-number {
width: 50px; height: 50px;
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 20px;
flex-shrink: 0;
box-shadow: 0 4px 10px rgba(26,54,93,0.2);
}
.section-title { flex: 1; }
.section-title h3 {
font-size: 19px;
font-weight: 700;
color: var(--primary);
margin-bottom: 2px;
}
.section-title .subtitle {
font-size: 12px;
color: var(--text-muted);
}
.section-content {
padding-right: 10px;
}
.section-content p {
margin-bottom: 12px;
text-align: justify;
text-indent: 20px;
}
.section-content p.no-indent { text-indent: 0; }
.highlight-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #f6e05e;
border-right: 4px solid var(--accent);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.highlight-box strong {
color: var(--accent-dark);
}
.info-box {
background: linear-gradient(to left, #ebf8ff, #e6f6ff);
border: 1px solid #90cdf4;
border-right: 4px solid var(--primary-light);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.success-box {
background: linear-gradient(to left, #f0fff4, #e6fffa);
border: 1px solid #9ae6b4;
border-right: 4px solid var(--success);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.warning-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #fbd38d;
border-right: 4px solid var(--warning);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.danger-box {
background: linear-gradient(to left, #fff5f5, #fed7d7);
border: 1px solid #feb2b2;
border-right: 4px solid var(--danger);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.styled-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.styled-table thead {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
}
.styled-table th {
padding: 14px 16px;
text-align: right;
font-weight: 600;
font-size: 13px;
}
.styled-table td {
padding: 13px 16px;
border-bottom: 1px solid var(--border);
font-size: 13px;
}
.styled-table tbody tr:last-child td { border-bottom: none; }
.styled-table tbody tr:nth-child(even) { background: #f8fafc; }
.styled-table .highlight-row {
background: #fffaf0 !important;
font-weight: 600;
}
.code-block {
background: var(--code-bg);
color: var(--code-text);
padding: 20px 22px;
border-radius: 8px;
margin: 20px 0;
font-family: 'Consolas', 'Courier New', monospace;
font-size: 13px;
direction: ltr;
text-align: left;
line-height: 1.7;
overflow-x: auto;
border-right: 4px solid var(--accent);
white-space: pre;
}
.code-block .comment {
color: #68d391;
}
.code-block .keyword {
color: #63b3ed;
font-weight: 600;
}
.code-block .string {
color: #f6ad55;
}
.code-inline {
background: #edf2f7;
color: var(--danger);
padding: 2px 8px;
border-radius: 4px;
font-family: 'Consolas', 'Courier New', monospace;
font-size: 13px;
direction: ltr;
display: inline-block;
}
.conclusion-box {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 30px;
border-radius: 12px;
margin: 30px 0;
text-align: center;
box-shadow: 0 8px 20px rgba(26,54,93,0.3);
}
.conclusion-box h3 {
font-size: 22px;
font-weight: 800;
margin-bottom: 15px;
color: var(--accent);
}
.conclusion-box p {
font-size: 14px;
line-height: 1.8;
text-indent: 0 !important;
margin-bottom: 15px;
}
.conclusion-box .highlight {
background: rgba(201,169,97,0.2);
padding: 15px 20px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid rgba(201,169,97,0.4);
}
.steps-list {
list-style: none;
padding: 0;
counter-reset: step-counter;
}
.steps-list li {
position: relative;
padding: 18px 60px 18px 20px;
margin-bottom: 15px;
background: #f8fafc;
border-radius: 8px;
border-right: 3px solid var(--primary-light);
counter-increment: step-counter;
font-size: 14px;
}
.steps-list li::before {
content: counter(step-counter);
position: absolute;
right: 15px;
top: 50%;
transform: translateY(-50%);
width: 32px;
height: 32px;
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 14px;
}
.document-footer {
background: var(--primary);
color: white;
padding: 25px 40px;
text-align: center;
font-size: 12px;
margin-top: 40px;
}
.document-footer .footer-brand {
font-weight: 700;
color: var(--accent);
margin-bottom: 5px;
font-size: 14px;
}
.footer-divider {
width: 60px;
height: 2px;
background: var(--accent);
margin: 10px auto;
}
.page-info {
text-align: center;
padding: 15px;
font-size: 11px;
color: var(--text-muted);
border-top: 1px solid var(--border);
margin-top: 30px;
}
@media print {
body { background: white; padding: 0; }
.document-container { box-shadow: none; border-radius: 0; }
.section { page-break-inside: avoid; }
}
@media (max-width: 768px) {
.document-body { padding: 25px 20px; }
.document-header { padding: 30px 20px; }
.header-top { flex-direction: column; gap: 15px; }
.doc-meta { text-align: center; }
.steps-list li { padding: 15px 55px 15px 15px; }
}
</style>
</head>
<body>
<div class="document-container">
<header class="document-header">
<div class="header-top">
<div class="company-badge">
<div class="company-logo"></div>
</div>
<div class="doc-meta">
<div>شماره مستند: DEPLOY-1405-002</div>
<div>نسخه: ۱.۰</div>
<div>تاریخ تهیه: مهر ۱۴۰۵</div>
<div>طبقه‌بندی: محرمانه</div>
</div>
</div>
<div class="document-title">
<span class="label">DEPLOYMENT GUIDE</span>
<h1>راهنمای ثبت سرویس Qwen9BService</h1>
<h2>اجرای خودکار llamafile در ویندوز ۱۱ با استفاده از sc.exe</h2>
</div>
</header>
<div class="document-body">
<div class="intro-text">
<strong>کارفرمای محترم،</strong><br>
این مستند به‌عنوان راهنمای جامع و گام‌به‌گام برای ثبت و راه‌اندازی سرویس خودکار مدل زبانی Qwen3.5-9B با استفاده از ابزار بومی <span class="code-inline">sc.exe</span> در ویندوز ۱۱ تهیه شده است. با اجرای این مراحل، مدل شما به‌صورت خودکار در هر بار روشن شدن سیستم راه‌اندازی شده و به عنوان یک API محلی در دسترس خواهد بود.
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۱</div>
<div class="section-title">
<h3>خلاصه اجرایی</h3>
<div class="subtitle">Executive Summary</div>
</div>
</div>
<div class="section-content">
<p>ابزار <span class="code-inline">sc.exe</span> (Service Control) یکی از ابزارهای بومی و قدرتمند ویندوز است که امکان ثبت، مدیریت و پیکربندی سرویس‌های سیستمی را فراهم می‌کند. برخلاف NSSM که یک ابزار جانبی است، <span class="code-inline">sc.exe</span> به‌صورت پیش‌فرض در تمام نسخه‌های ویندوز وجود دارد و نیازی به نصب نرم‌افزار اضافی ندارد.</p>
<div class="info-box">
<strong>💡 چرا sc.exe؟</strong> این ابزار بخشی از هسته ویندوز است، سرویس‌ها را در سطح سیستم ثبت می‌کند و از پایداری و امنیت بالاتری نسبت به راه‌حل‌های جانبی برخوردار است.
</div>
<table class="styled-table">
<thead>
<tr>
<th>شاخص</th>
<th>مقدار / تنظیم</th>
</tr>
</thead>
<tbody>
<tr>
<td>نام سرویس</td>
<td style="color: var(--success); font-weight: 600;">Qwen9BService</td>
</tr>
<tr>
<td>ابزار ثبت</td>
<td><span class="code-inline">sc.exe</span> (بومی ویندوز)</td>
</tr>
<tr>
<td>نوع شروع</td>
<td>Automatic (خودکار در بوت)</td>
</tr>
<tr>
<td>پورت سرویس</td>
<td><span class="code-inline">1114</span></td>
</tr>
<tr>
<td>حالت بارگذاری</td>
<td>mmap (استفاده از حافظه موقت)</td>
</tr>
<tr>
<td>لایه‌های GPU</td>
<td>۵ لایه (مصرف بهینه VRAM)</td>
</tr>
<tr class="highlight-row">
<td><strong>نتیجه نهایی</strong></td>
<td style="color: var(--success); font-weight: 700;"><strong>اجرای خودکار، پایدار و بهینه</strong></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۲</div>
<div class="section-title">
<h3>پیش‌نیازها و آماده‌سازی</h3>
<div class="subtitle">Prerequisites & Preparation</div>
</div>
</div>
<div class="section-content">
<p>قبل از شروع فرآیند ثبت سرویس، اطمینان حاصل کنید که موارد زیر آماده هستند:</p>
<ul class="steps-list">
<li>
<strong>فایل اجرایی llamafile:</strong> فایل <span class="code-inline">llamafile.exe</span> باید در مسیر مشخصی قرار داشته باشد. در این مستند فرض بر این است که در مسیر <span class="code-inline">C:\llamafile\</span> قرار دارد.
</li>
<li>
<strong>فایل مدل GGUF:</strong> فایل مدل <span class="code-inline">Qwen3.5-9B-The-Defiant-Fable-Uncnr-Heretic-NEO-MAX-MTP-Q6_K.gguf</span> در مسیر <span class="code-inline">C:\llamafile\Prepared\Qwen3.59b\Model\</span> قرار دارد.
</li>
<li>
<strong>فایل mmproj (برای پشتیبانی از تصویر):</strong> فایل <span class="code-inline">mmproj-BF16.gguf</span> در همان مسیر مدل قرار دارد.
</li>
<li>
<strong>دسترسی Administrator:</strong> برای ثبت سرویس، حتماً باید با دسترسی ادمین وارد شده باشید.
</li>
</ul>
<div class="warning-box">
<strong>⚠️ نکته مهم:</strong> مسیرهای فایل‌ها را با مسیر واقعی سیستم خود جایگزین کنید. در دستور <span class="code-inline">sc.exe</span>، مسیرها باید به صورت <strong>مطلق (Absolute)</strong> نوشته شوند.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۳</div>
<div class="section-title">
<h3>کانفیگ نهایی سرویس</h3>
<div class="subtitle">Final Service Configuration</div>
</div>
</div>
<div class="section-content">
<p>پارامترهای زیر برای اجرای بهینه مدل Qwen3.5-9B روی سیستم شما (۶۴GB RAM و AMD RX 5700 8GB) تنظیم شده‌اند:</p>
<table class="styled-table">
<thead>
<tr>
<th>پارامتر</th>
<th>مقدار</th>
<th>توضیح</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="code-inline">--server</span></td>
<td>فعال</td>
<td>اجرای حالت سرور و API</td>
</tr>
<tr>
<td><span class="code-inline">--gpu auto</span></td>
<td>خودکار</td>
<td>تشخیص خودکار GPU (AMD)</td>
</tr>
<tr>
<td><span class="code-inline">--threads 8</span></td>
<td>۸ رشته</td>
<td>استفاده بهینه از CPU</td>
</tr>
<tr>
<td><span class="code-inline">--port 1114</span></td>
<td>۱۱۱۴</td>
<td>پورت دسترسی به API</td>
</tr>
<tr>
<td><span class="code-inline">--ctx-size 0</span></td>
<td>خودکار</td>
<td>استفاده از حداکثر Context ممکن</td>
</tr>
<tr>
<td><span class="code-inline">--host 0.0.0.0</span></td>
<td>همه رابط‌ها</td>
<td>دسترسی از شبکه</td>
</tr>
<tr>
<td><span class="code-inline">--load-mode mmap</span></td>
<td>mmap</td>
<td>استفاده از حافظه موقت (Memory Mapping)</td>
</tr>
<tr>
<td><span class="code-inline">--n-gpu-layers 5</span></td>
<td>۵ لایه</td>
<td>مصرف بهینه VRAM (زیر ۳ گیگ)</td>
</tr>
<tr class="highlight-row">
<td><span class="code-inline">--spec-type draft-mtp</span></td>
<td>MTP فعال</td>
<td>تسریع تولید توکن با Multi-Token Prediction</td>
</tr>
</tbody>
</table>
<div class="success-box">
<strong>✓ بهینه‌سازی انجام شده:</strong> ترکیب <span class="code-inline">--load-mode mmap</span> با <span class="code-inline">--n-gpu-layers 5</span> باعث می‌شود حافظه GPU شما زیر ۳ گیگابایت باقی بماند و همزمان از حافظه موقت سیستم برای بارگذاری بخش‌های دیگر مدل استفاده شود.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۴</div>
<div class="section-title">
<h3>دستور ثبت سرویس با sc.exe</h3>
<div class="subtitle">Service Registration Command</div>
</div>
</div>
<div class="section-content">
<p class="no-indent">برای ثبت سرویس، مراحل زیر را به ترتیب انجام دهید:</p>
<ul class="steps-list">
<li>
<strong>باز کردن CMD با دسترسی ادمین:</strong> روی منوی Start کلیک راست کرده و گزینه <span class="code-inline">Terminal (Admin)</span> یا <span class="code-inline">Command Prompt (Admin)</span> را انتخاب کنید.
</li>
<li>
<strong>اجرای دستور ثبت سرویس:</strong> دستور زیر را به‌صورت کامل کپی کرده و در CMD وارد کنید:
</li>
</ul>
<div class="code-block"><span class="comment">REM ثبت سرویس Qwen9BService با تنظیمات اختصاصی</span>
sc.exe create <span class="string">"Qwen9BService"</span> binpath= <span class="string">"C:\llamafile\llamafile.exe --server --gpu auto --threads 8 --port 1114 --ctx-size 0 --host 0.0.0.0 --load-mode mmap --n-gpu-layers 5 --spec-type draft-mtp --mmproj \"C:\llamafile\Prepared\Qwen3.59b\Model\mmproj-BF16.gguf\" --model \"C:\llamafile\Prepared\Qwen3.59b\Model\Qwen3.5-9B-The-Defiant-Fable-Uncnr-Heretic-NEO-MAX-MTP-Q6_K.gguf\""</span> start= <span class="keyword">auto</span> DisplayName= <span class="string">"Qwen 9B LLM Service"</span></div>
<div class="danger-box">
<strong>🚨 نکات حیاتی در دستور بالا:</strong>
<ul style="padding-right: 20px; margin-top: 10px;">
<li>بعد از <span class="code-inline">binpath=</span> و <span class="code-inline">start=</span> و <span class="code-inline">DisplayName=</span> حتماً <strong>یک فاصله</strong> وجود داشته باشد. در غیر این صورت دستور با خطا مواجه می‌شود.</li>
<li>کل دستور باید در <strong>یک خط</strong> نوشته شود (شکستن خط باعث خطا می‌شود).</li>
<li>مسیرها باید <strong>مطلق</strong> باشند (نه نسبی).</li>
<li>از بک‌اسلش دوتایی <span class="code-inline">\\</span> در ابتدای مسیرها استفاده نکنید.</li>
</ul>
</div>
<div class="info-box">
<strong>💡 توضیح پارامترها:</strong>
<ul style="padding-right: 20px; margin-top: 10px;">
<li><span class="code-inline">create</span> : ایجاد سرویس جدید</li>
<li><span class="code-inline">binpath=</span> : مسیر فایل اجرایی و تمام آرگومان‌ها</li>
<li><span class="code-inline">start= auto</span> : شروع خودکار در بوت سیستم</li>
<li><span class="code-inline">DisplayName=</span> : نام نمایشی سرویس در Services.msc</li>
</ul>
</div>
<ul class="steps-list">
<li>
<strong>شروع سرویس برای بار اول:</strong> پس از ثبت موفق، سرویس را به‌صورت دستی استارت بزنید:
</li>
</ul>
<div class="code-block"><span class="comment">REM شروع سرویس</span>
sc.exe start <span class="string">"Qwen9BService"</span></div>
<ul class="steps-list">
<li>
<strong>بررسی وضعیت سرویس:</strong> برای اطمینان از اجرای صحیح، وضعیت سرویس را بررسی کنید:
</li>
</ul>
<div class="code-block"><span class="comment">REM بررسی وضعیت سرویس</span>
sc.exe query <span class="string">"Qwen9BService"</span></div>
<div class="success-box">
<strong>✓ خروجی موفق:</strong> در خروجی باید <span class="code-inline">STATE : 4 RUNNING</span> مشاهده کنید. همچنین می‌توانید در مرورگر آدرس <span class="code-inline">http://localhost:1114/health</span> را باز کنید.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۵</div>
<div class="section-title">
<h3>مدیریت و نگهداری سرویس</h3>
<div class="subtitle">Service Management & Maintenance</div>
</div>
</div>
<div class="section-content">
<p>پس از ثبت موفق سرویس، می‌توانید از دستورات زیر برای مدیریت آن استفاده کنید:</p>
<table class="styled-table">
<thead>
<tr>
<th>عملیات</th>
<th>دستور</th>
</tr>
</thead>
<tbody>
<tr>
<td>شروع سرویس</td>
<td><span class="code-inline">sc.exe start "Qwen9BService"</span></td>
</tr>
<tr>
<td>توقف سرویس</td>
<td><span class="code-inline">sc.exe stop "Qwen9BService"</span></td>
</tr>
<tr>
<td>بررسی وضعیت</td>
<td><span class="code-inline">sc.exe query "Qwen9BService"</span></td>
</tr>
<tr>
<td>حذف سرویس</td>
<td><span class="code-inline">sc.exe delete "Qwen9BService"</span></td>
</tr>
<tr>
<td>ویرایش تنظیمات</td>
<td><span class="code-inline">sc.exe config "Qwen9BService" start= auto</span></td>
</tr>
<tr class="highlight-row">
<td><strong>تغییر مسیر اجرایی</strong></td>
<td>ابتدا <span class="code-inline">delete</span> سپس <span class="code-inline">create</span> مجدد</td>
</tr>
</tbody>
</table>
<div class="warning-box">
<strong>⚠️ نکته مهم:</strong> برای تغییر مسیر فایل اجرایی یا آرگومان‌ها، باید سرویس را حذف و مجدداً با مسیر جدید ثبت کنید. برای تغییرات جزئی می‌توانید از <span class="code-inline">sc.exe config</span> استفاده کنید.
</div>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">تنظیمات پیشرفته (اختیاری):</h4>
<div class="code-block"><span class="comment">REM تنظیم ری‌استارت خودکار در صورت کرش</span>
sc.exe failure <span class="string">"Qwen9BService"</span> reset= 86400 actions= restart/5000/restart/10000/restart/30000
<span class="comment">REM تنظیم تأخیر شروع (برای جلوگیری از تداخل با سرویس‌های دیگر)</span>
sc.exe config <span class="string">"Qwen9BService"</span> start= delayed-auto</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۶</div>
<div class="section-title">
<h3>عیب‌یابی و رفع مشکلات رایج</h3>
<div class="subtitle">Troubleshooting</div>
</div>
</div>
<div class="section-content">
<p>در صورت بروز مشکل، موارد زیر را بررسی کنید:</p>
<table class="styled-table">
<thead>
<tr>
<th>مشکل</th>
<th>راه‌حل</th>
</tr>
</thead>
<tbody>
<tr>
<td>خطای <span class="code-inline">[SC] OpenSCManager FAILED 5</span></td>
<td>CMD را با دسترسی Administrator اجرا کنید</td>
</tr>
<tr>
<td>خطای <span class="code-inline">The specified service does not exist</span></td>
<td>دستور create را با دقت و کامل اجرا کنید</td>
</tr>
<tr>
<td>سرویس شروع می‌شود اما متوقف می‌شود</td>
<td>مسیر فایل‌ها و آرگومان‌ها را بررسی کنید. از <span class="code-inline">--nobrowser</span> استفاده کنید</td>
</tr>
<tr>
<td>پورت ۱۱۱۴ اشغال است</td>
<td>پورت را در کانفیگ تغییر دهید یا سرویس‌های دیگر را متوقف کنید</td>
</tr>
<tr>
<td>مدل بارگذاری نمی‌شود</td>
<td>مسیر فایل GGUF و mmproj را بررسی کنید. فضای RAM کافی باشد</td>
</tr>
<tr class="highlight-row">
<td><strong>مشاهده لاگ‌های سرویس</strong></td>
<td>در Event Viewer → Windows Logs → Application</td>
</tr>
</tbody>
</table>
<div class="info-box">
<strong>💡 نکته عیب‌یابی:</strong> برای مشاهده لاگ‌های دقیق، می‌توانید آرگومان <span class="code-inline">--log-file "C:\llamafile\service.log"</span> را به binpath اضافه کنید.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۷</div>
<div class="section-title">
<h3>جمع‌بندی و پیشنهاد نهایی</h3>
<div class="subtitle">Final Summary & Recommendation</div>
</div>
</div>
<div class="section-content">
<p>با اجرای مراحل این مستند، سرویس <strong>Qwen9BService</strong> به‌صورت خودکار در هر بار روشن شدن ویندوز ۱۱ اجرا شده و مدل Qwen3.5-9B به‌عنوان یک API محلی در پورت ۱۱۱۴ در دسترس خواهد بود.</p>
<table class="styled-table">
<thead>
<tr>
<th>مزیت</th>
<th>توضیح</th>
</tr>
</thead>
<tbody>
<tr>
<td>اجرای خودکار</td>
<td style="color: var(--success); font-weight: 600;">شروع خودکار در بوت سیستم</td>
</tr>
<tr>
<td>پایداری بالا</td>
<td style="color: var(--success); font-weight: 600;">ثبت در سطح سیستم با sc.exe</td>
</tr>
<tr>
<td>مصرف بهینه VRAM</td>
<td style="color: var(--success); font-weight: 600;">زیر ۳ گیگابایت با -ngl 5</td>
</tr>
<tr>
<td>استفاده از حافظه موقت</td>
<td style="color: var(--success); font-weight: 600;">فعال با --load-mode mmap</td>
</tr>
<tr>
<td>تسریع با MTP</td>
<td style="color: var(--success); font-weight: 600;">فعال با --spec-type draft-mtp</td>
</tr>
<tr class="highlight-row">
<td><strong>دسترسی از شبکه</strong></td>
<td style="color: var(--success); font-weight: 700;"><strong>با --host 0.0.0.0</strong></td>
</tr>
</tbody>
</table>
<div class="conclusion-box">
<h3>🎯 پیشنهاد نهایی</h3>
<p>استفاده از <span class="code-inline" style="background: rgba(255,255,255,0.2); color: white;">sc.exe</span> برای ثبت سرویس، بهترین گزینه برای کاربرانی است که به دنبال راه‌حلی <strong>بومی، پایدار و بدون وابستگی</strong> هستند.</p>
<p>این روش برخلاف NSSM، نیازی به نصب ابزار جانبی ندارد و مستقیماً از هسته ویندوز استفاده می‌کند.</p>
<div class="highlight">
<strong>💎 ارزش پیشنهادی:</strong><br>
اجرای خودکار و پایدار + مصرف بهینه منابع + دسترسی آسان از شبکه + بدون نیاز به نرم‌افزار جانبی
</div>
</div>
<div class="info-box">
<strong>📞 گام بعدی:</strong> پس از اجرای موفق سرویس، می‌توانید از طریق آدرس <span class="code-inline">http://localhost:1114/v1</span> به API متصل شوید و از مدل در برنامه‌های خود استفاده کنید.
</div>
</div>
</div>
<div class="page-info">
این مستند محرمانه بوده و صرفاً جهت ارائه به کارفرمای محترم تهیه شده است. هرگونه کپی‌برداری یا افشا بدون اجازه کتبی ممنوع است.
</div>
</div>
<footer class="document-footer">
<div class="footer-brand">طراحی و توسعه: هادی خزاعی اصل</div>
<div class="footer-divider"></div>
<div>تاریخ تهیه: مهر ۱۴۰۵ &nbsp;|&nbsp; نسخه: ۱.۰ &nbsp;|&nbsp; طبقه‌بندی: محرمانه</div>
</footer>
</div>
</body>
</html>