跳到正文
cccskills
免费在 GitHub 公开

windows-local-ai-services

Run local AI services on Windows — port binding, firewall, WSL2 networking, and common pitfalls.

中文简介正在准备中。当前显示原文说明。

实测评分 未实测

查看安装方法

包含的文件(3)

  • SKILL.md5.0 KB
  • references/headless-gui-apps.md3.3 KB
  • references/windows-port-restrictions.md3.6 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Windows Local AI Services

Running local AI services (enowxai, Ollama, LM Studio, vLLM, llama.cpp servers) on Windows has specific networking and port binding pitfalls. This skill covers setup, troubleshooting, and WSL2 cross-OS access.

References

  • references/windows-port-restrictions.md — Windows reserved port ranges and binding errors
  • references/headless-gui-apps.md — Running GUI apps in headless WSL2 with Xvfb

Common Pitfalls

1. Port Binding Failures

Symptom: Service crashes immediately with:

ERROR failed to start error="listen tcp4 127.0.0.1:1430: bind: An attempt was made to access a socket in a way forbidden by its access permissions."

Root Cause: Windows reserves certain port ranges for system services (Hyper-V, WinNAT, dynamic port allocation). Ports in these ranges cannot be bound by user applications.

Fix:

  1. Change the port (easiest):

    # Use a port outside reserved ranges (8000-9000 is usually safe)
    service start --port 8430
    
  2. Check reserved ranges:

    netsh int ipv4 show dynamicport tcp
    netsh int ipv4 show excludedportrange protocol=tcp
    
  3. Exclude a specific port (risky, can conflict with system services):

    netsh int ipv4 add excludedportrange protocol=tcp startport=1430 numberofports=1
    

Never kill svchost.exe — it's a Windows system service host. If netstat shows svchost using your target port, the port is reserved by Windows.

2. WSL2 Cross-OS Networking

Symptom: Service runs on Windows but WSL2 cannot connect via localhost.

Root Cause: WSL2 uses a virtualized network. localhost in WSL2 points to the WSL2 VM, not the Windows host.

Fix:

  1. Use Windows host gateway IP from WSL2:

    # Get Windows host IP (usually 172.17.16.1, but can change on reboot)
    ip route show default | awk '{print $3}'
    
    # Test connection
    curl http://172.17.16.1:8430/v1/models
    
  2. Ensure Windows service listens on 0.0.0.0 (not 127.0.0.1):

    # Check listening address
    netstat -ano | findstr :8430
    
    # Should show 0.0.0.0:8430, not 127.0.0.1:8430
    
  3. Configure Windows Firewall:

    # Allow inbound on the service port
    New-NetFirewallRule -DisplayName "AI Service Port 8430" -Direction Inbound -LocalPort 8430 -Protocol TCP -Action Allow
    

3. Process Already Running

Symptom: Service says "port already in use" but Get-Process shows nothing.

Diagnosis:

# Find what's using the port
netstat -ano | findstr :8430

# Get process details (replace 1234 with PID from netstat)
Get-Process -Id 1234 | Select-Object Name, Id, Path

Fix:

  • If it's your service from a previous run: kill it and restart
  • If it's svchost or another system service: change your service's port

4. Service Crashes Silently

Always check logs first:

# Common log locations
Get-Content ~\.service-name\service.log -Tail 50
Get-Content $env:APPDATA\service-name\logs\latest.log -Tail 50

Common causes:

  • Missing dependencies (Python, CUDA/ROCm, Visual C++ Redistributable)
  • Config file syntax errors
  • Permission issues (try running PowerShell as Administrator)

Setup Checklist

When setting up a new local AI service on Windows:

  1. Choose a safe port (8000-9000 range recommended)
  2. Configure to listen on 0.0.0.0 (not 127.0.0.1) if WSL2 access needed
  3. Add Windows Firewall rule for the port
  4. Test from Windows first: curl http://localhost:PORT/health
  5. Test from WSL2: curl http://$(ip route show default | awk '{print $3}'):PORT/health
  6. Save the gateway IP or add to WSL2 ~/.bashrc:
    export WINDOWS_HOST=$(ip route show default | awk '{print $3}')
    export AI_SERVICE_URL="http://$WINDOWS_HOST:8430/v1"
    

Verification

After setup, verify cross-OS connectivity:

# From WSL2
GATEWAY_IP=$(ip route show default | awk '{print $3}')
echo "Windows host IP: $GATEWAY_IP"

# Test connection
curl -s http://$GATEWAY_IP:8430/v1/models | jq .

# If it works, save to config
echo "export AI_SERVICE_URL=http://$GATEWAY_IP:8430/v1" >> ~/.bashrc

Rules

  1. Always check logs before guessing — most errors are explicit
  2. Never kill system processes (svchost, System, services.exe)
  3. Use gateway IP for WSL2 → Windows — never localhost
  4. Verify firewall rules before blaming the service
  5. Document the port — save it in config files, not just command-line flags

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Drives development with tests. Use when implementing any logic, fixing any bug, or changing any behavior. Use when you need to prove that code works, when a bug report arrives, or when you're about to modify existing functionality.

中文简介正在准备中。当前显示原文说明。

kevinnft/ai-agent-skills142026年8月1日 更新

airtable

免费

Airtable REST API via curl. Records CRUD, filters, upserts.

中文简介正在准备中。当前显示原文说明。

kevinnft/ai-agent-skills142026年8月1日 更新

Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.

中文简介正在准备中。当前显示原文说明。

kevinnft/ai-agent-skills142026年8月1日 更新

Build monitoring bots that poll APIs and send notifications on state changes (new listings, price alerts, status updates)

中文简介正在准备中。当前显示原文说明。

kevinnft/ai-agent-skills142026年8月1日 更新

REST/GraphQL API testing with automated validation — test endpoints, validate responses, check status codes, and ensure API contracts

中文简介正在准备中。当前显示原文说明。

kevinnft/ai-agent-skills142026年8月1日 更新

Manage Apple Notes via memo CLI: create, search, edit.

中文简介正在准备中。当前显示原文说明。

kevinnft/ai-agent-skills142026年8月1日 更新

查看 kevinnft 的全部技能

报告此技能的问题