Repository navigation
Description
I am not an Administrator on my laptop, and previously HASS.Agent worked fine, however after running the latest update (2212.0.7.0 according to the installer. 2022.12.0 in the app), I now get these errors in the log:
2022-06-22 08:31:04.939 -04:00 [INF] [MQTT] Initial registration completed
2022-06-22 08:31:05.700 -04:00 [FTL] An unexpected error occurred when attempting to start the server
System.Net.HttpListenerException (5): Access is denied.
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-06-22 08:31:05.701 -04:00 [FTL] [LOCALAPI] Error trying to bind the API to port 5115: 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()
2022-06-22 08:53:08.616 -04:00 [INF] [SYSTEMSTATE] Session ending: system shutting down
Additionally, the firewall rule wasn't put in place during the install (to allow port 5115 inbound), but I added that manually.
On the Local API config page, I clicked the Execute Port Reservation button, and manually ran the command:
netsh http add urlacl url=http://+:5115/ user="DOMAIN\USER"
(It was ran as DOMAIN\ADMINUSER. And gave me an Error 183, Cannot create a file when that file already exists.)
I'm wondering if this is an issue due to me running HASS,Agent as non-admin, and a different user account with admin irights installing it. (I did make the mistake of initially installing in the Admin user Appdata on update, so I had to uninstall and redo the install correctly to point to my non-admin appdata.)
Activity
LAB02-Admin commentedon Jun 23, 2022
That's odd, I'll look into it and let you know
LAB02-Admin commentedon Jun 24, 2022
Could you please run:
netsh http delete urlacl url=http://+:5115/It should say:
URL reservation successfully deletedAfterwards run yours again:
netsh http add urlacl url=http://+:5115/ user="DOMAIN\USER"Which should then say:
URL reservation successfully addedAnd afterwards, after restarting HASS.Agent, it should work.
I'll change the reservation to allow for all users, but I have to make sure that'll work in all UI languages. Your setup (a different admin user) is actually really smart, so HASS.Agent should be able to work with that.
Created a ticket: [hassagent-105]
JvdMaat commentedon Jun 24, 2022
Worked like a charm.
I'm guessing this is because I accidentally installed it in the AdminUser AppData, and it added the URL reservation for the AdminUser, and then upon uninstall that did not get removed? (So there was a URL reservation for DOMAIN\ADMINUSER, which prevented me from adding it as DOMAIN\USER)
LAB02-Admin commentedon Jun 24, 2022
That's exactly right :)
I have the fix ready for the next beta - it'll now reserve the port for any user, so hopefully it won't be a problem for you anymore in the coming versions.
nferch commentedon Jun 24, 2022
I seem to be having a similar problem, I get the "Error trying to bind the API to port 5115" error and this in the log:
I've checked via netstat and Process Explorer that nothing else is using port 5115.
It doesn't appear that the automatic port reservation is working, and even when I do it manually with
netsh http add urlacl url=http://+:5115/ user=EveryoneI get the same error.LAB02-Admin commentedon Jun 24, 2022
Hey @nferch,
What Windows version are you using?
Perhaps try rebooting, then delete the rule and add it afterwards (from an elevated cmd prompt).
nferch commentedon Jun 25, 2022
@LAB02-Admin Thanks, that did the trick.
Am using Windows 10.0.19043.1766
LAB02-Admin commentedon Jun 26, 2022
Great :)