LAB02-Research / HASS.Agent

Windows-based client for Home Assistant. Provides notifications, quick actions, commands, sensors and more.
https://hassagent.lab02-research.org
MIT License
1.6k stars 74 forks source link

Misc: Error trying to bind the API to port 5115 #185

Closed Buttercream91 closed 2 years ago

Buttercream91 commented 2 years ago

That error message pops up after installing Hass.agent followed by "Make sure no other instance of HASS.Agent is running and the port is available and registered. 16656945932736519447572795274422

I don't know how to ensure the port is available and registered. I successfully installed Hass.Agent on another pc on the network, is that what it means by no other instances? Please send help.

youseeus commented 2 years ago

I have made sure there is no other process blocking the port. But I get the same error. the logs says following:


System.Net.HttpListenerException (5): Zugriff verweigert
   at System.Net.HttpListener.AddPrefixCore(String registeredPrefix)
   at System.Net.HttpListener.AddAllPrefixes()
   at System.Net.HttpListener.Start()
   at Grapevine.RestServer.Start()
   at Grapevine.MiddlewareExtensions.Run(IRestServer server)
   at HASS.Agent.API.ApiManager.Initialize()
2022-10-19 19:39:43.606 +02:00 [FTL] [LOCALAPI] Error trying to bind the API to port 5116: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
   at System.Net.HttpListener.CheckDisposed()
   at System.Net.HttpListener.Stop()
   at Grapevine.RestServer.Start()
   at Grapevine.MiddlewareExtensions.Run(IRestServer server)
   at HASS.Agent.API.ApiManager.Initialize()```
youseeus commented 2 years ago

if i start hass-agent as admin it starts two instances. local-api works now but mqtt doesn't (it alternates really fast between on and off)

LAB02-Admin commented 2 years ago

Can you please close all instances of hass.agent, then open an elevated command prompt, and run these commands:

netsh http delete urlacl http://+:5115/
netsh http add urlacl url=http://+:5115/ user=Everyone

Afterwards, restart hass.agent (as a normal user, no elevation required) and see if it's fixed

youseeus commented 2 years ago

ok user=Everyone didn't work: The SDDL could not be created. Error: 1789 but with my user (there is only one) it worked. thanks

Edit: if windows is German it need to be user=Jeder