Raven.Server.exe Failed to grant rights for listening to http
Asked Answered
C

2

5

I have installed RavenDB 2.5.0 as Windows Service. When I try to run Raven.Server.exe as Administrator or not I receive this:

Trying to revoke rights for http.sys
runas netsh http delete urlacl url=https://+:8080/
Trying to grant rights for http.sys
runas netsh http add urlacl url=http://+:8080/ user="Endri-PC\Endri"
Failed to grant rights for listening to http, exit codes: (1 and 1)
A critical error occurred while starting the server. Please see the exception de
tails bellow for more details:
System.InvalidOperationException: Could not write to location: C:\RavenDB\Databa
se\System. Make sure you have read/write permissions for this path. ---> Microso
ft.Isam.Esent.Interop.EsentFileAccessDeniedException: Cannot access file, the fi
le is locked or in use
   at Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator uuidGen
erator, OrderedPartCollection`1 documentCodecs)
   --- End of inner exception stack trace ---
   at Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator uuidGen
erator, OrderedPartCollection`1 documentCodecs)
   at Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configura
tion, TransportState transportState)
   at Raven.Server.RavenDbServer..ctor(InMemoryRavenConfiguration settings)
   at Raven.Server.Program.RunServerInDebugMode(RavenConfiguration ravenConfigur
ation, Boolean launchBrowser)
   at Raven.Server.Program.RunInDebugMode(Nullable`1 anonymousUserAccessMode, Ra
venConfiguration ravenConfiguration, Boolean launchBrowser, Boolean noLog)
   at Raven.Server.Program.<>c__DisplayClass34.<InteractiveRun>b__1b()
   at Raven.Server.Program.InteractiveRun(String[] args)
   at Raven.Server.Program.Main(String[] args)
Press any key to continue...

Any idea what to do ?

Cofferdam answered 10/2, 2014 at 13:19 Comment(0)
A
10

I just had this same problem while I was following the "Basic Concepts" section of the RavenDB documentation, with the following output:

C:\RavenDB>Raven.Server.exe
Trying to grant rights for http.sys
runas netsh http add urlacl url=http://+:8080/ user="User-PC\User"
Failed to grant rights for listening to http, exit codes: (0 and 1)
A critical error occurred while starting the server. Please see the exception details bellow for more details:
System.InvalidOperationException: Could not write to location: C:\RavenDB\Data.
Make sure you have read/write permissions for this path. ---> Microsoft.Isam.Esent.Interop.EsentFileAccessDeniedException: Cannot access file, the file is locked or in use
<stack trace follows>

The issue was that the RavenDB installer had automatically started the RavenDB Server as a Windows Service, preventing the command-line Raven.Server.exe from being able to access the right directory. I just opened the Services control panel (Start menu -> services.msc) and stopped the RavenDB service. After that, starting Raven.Server.exe from the command line worked as demonstrated in the documentation.

Note that this is running on a Windows 7 x64 Professional machine in Development mode with RavenDB 2.5.2851.

Aerospace answered 4/4, 2014 at 15:38 Comment(1)
Just to note that since the service is running you need not run the console app at all. Just open the browser with localhost:8080 and you'll see the RavenDB databases, all working as expected. (Empty as default)Fibriform
T
0

You have neither the permission to access port 8080 nor the database folder. If you want to run RavenDB on your account, give yourself permissions for the folder C:\RavenDB\Database\System and run this command in an elevated console:

netsh http add urlacl url=http://+:8080/

Tinfoil answered 10/2, 2014 at 13:37 Comment(4)
I have already given full control to my account, the Administrator account still has it too, but still the same error ...Cofferdam
The exception says that the used account is not Administrator but Endri-PC\EndriTinfoil
again, i have given full rights to my account Endri-PC\Endri, also to Administrator account, also i've tried to run the above command on CMD with Run As Administrator, but still the same. these are elementary things in a computer to know about ...Cofferdam
also, it is not uncommon to receive an exception that's unrelated to the real problemCofferdam

© 2022 - 2024 — McMap. All rights reserved.