egametang/ET · error · Exception
请先在cmd中运行: netsh http add urlacl url=http://*:你的address中的端口/
Error message
请先在cmd中运行: netsh http add urlacl url=http://*:你的address中的端口/ user=Everyone, address: {address} What it means
HttpComponentSystem.Awake (line 32) catches HttpListenerException from HttpListener.Start() and rethrows a guidance Exception telling the operator to register a URL reservation via netsh. HttpListener throws this when the process lacks permission for the configured prefix, the prefix/port is invalid or already bound, or the host wildcard requires admin/urlacl.
Source
Thrown at Packages/cn.etetet.http/Scripts/Hotfix/Server/HttpComponentSystem.cs:32
{
self.Listener = new HttpListener();
foreach (string s in address.Split(';'))
{
if (s.Trim() == "")
{
continue;
}
self.Listener.Prefixes.Add(s);
}
self.Listener.Start();
self.Accept().Coroutine();
}
catch (HttpListenerException e)
{
throw new Exception($"请先在cmd中运行: netsh http add urlacl url=http://*:你的address中的端口/ user=Everyone, address: {address}", e);
}
}
[EntitySystem]
private static void Destroy(this HttpComponent self)
{
if (self.Listener == null)
{
return;
}
try
{
if (self.Listener.IsListening)
{
self.Listener.Stop();
}
}
catch (Exception)View on GitHub (pinned to 5cab01f7a8)
Solutions
- Run the documented netsh command as admin: netsh http add urlacl url=http://*:PORT/ user=Everyone (replace PORT with the value in the address string).
- Confirm the port is free: netstat -ano | findstr :PORT.
- Ensure the prefix string is well-formed (scheme + host + trailing slash) and uses the same form as the urlacl.
- Run the server under an account that has the reservation, or reserve for the specific account instead of Everyone.
- On stop, also run netsh http delete urlacl url=... to clean up.
Example fix
// before (prefix must match urlacl exactly) http://+:8080/ rem after: register reservation as admin netsh http add urlacl url=http://+:8080/ user=Everyone netsh http add urlacl url=http://*:8080/ user=Everyone
Defensive patterns
Strategy: try-catch
Try / catch
try { /* Awake binds HttpListener */ }
catch (HttpListenerException e) { Log.Error($"http bind failed (needs urlacl): {e.Message}"); throw; } Prevention
- Pre-register urlacl via netsh as part of deployment.
- Verify the port is unused before start.
- Run under an account that owns the reservation.
- Keep the prefix string identical to the urlacl (incl. trailing slash and host wildcard).
When it happens
Trigger: self.Listener.Start() on Windows where no urlacl grants the user the http://+:port/ prefix, a port already in use, a malformed prefix string, or running as non-admin without the reservation.
Common situations: First run of an HTTP server process on a fresh machine, switching the bind address/port, running the server as a non-privileged service account, port conflict with another process, prefix missing the trailing slash.
Related errors
- http request fail: {link.Substring(0,link.IndexOf('?'))}\n{e
- http request fail: {link.Substring(0,link.IndexOf('?'))}\n{e
- RouterManager dynamic http bind failed after 10 attempts.
- Only IPv4 addresses are supported
- default conn throw Exception! {channelId}
AI-assisted analysis of egametang/ET@5cab01f7a8 (2026-08-13).
Data as JSON: /api/errors/22c878393646f996.
Report an issue: GitHub.