Running RavenDB in embedded mode with HTTP enabled

961 views
Skip to first unread message

marcus

unread,
Mar 10, 2011, 2:40:19 AM3/10/11
to ravendb
When running RavenDB in embedded mode with HTTP enabled I get an
System.Net.HttpListenerException: Access is denied. I have found some
discussions here and what I understand is that doing something like
below should solve this problem but it doesn't. If I change the the
application pool identity to an account with admin rights it works.
Any ideas?

NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8000);
var documentStore = new EmbeddableDocumentStore
{
ConnectionStringName =
"RavenConStr",
UseEmbeddedHttpServer = true
};

documentStore.Initialize();

Ayende Rahien

unread,
Mar 10, 2011, 6:56:03 AM3/10/11
to ravendb, marcus
Yes, using the http server requires either being admin or granting rights. 

This should do it
 NonAdminHttp.EnsureCanListenToWhenInNonAdminContext(8000);

Did you authorize the application when this popped up the UAC?

marcus

unread,
Mar 10, 2011, 7:43:09 AM3/10/11
to ravendb
I have the UAC disabled on my computer so I guess that it should just
work?
Message has been deleted

Frank Schwieterman

unread,
Mar 10, 2011, 1:07:01 PM3/10/11
to rav...@googlegroups.com
I struggled with this in a case where I was running the site
listening on a particular host, but the urlacl permission was not for
a specific host. It was odd... You may want to look at the urlacl
permissions and see if there are any potential problems.
EnsureCanListenWhenInNonAdminContext() modifies this list for you.
Start by running "netsh http show urlacl" and see if the url
permissions make sense for your scenario. There are other netsh http
commands to modify the permissions list.

If I recall correctly, I think in the case I had a problem, I was
listening on hostname:8080, and there was a rule for the current user
at hostname:8080, but there was a rule for a different user on *:8080.
I had to delete the *:8080 rule before the hostname:8080 rule worked.
From my perspective there's no reason the one rule should prevent the
other from working, but thats what happened.


On Thu, Mar 10, 2011 at 4:47 AM, marcus <mar...@meridium.se> wrote:
> I have the UAC disabled on my computer so I guess it should just work
> then?


>
> On Mar 10, 12:56 pm, Ayende Rahien <aye...@ayende.com> wrote:

Ayende Rahien

unread,
Mar 10, 2011, 4:19:33 PM3/10/11
to ravendb, marcus
It might not, try executing the command manually.

On Thu, Mar 10, 2011 at 2:47 PM, marcus <mar...@meridium.se> wrote:
I have the UAC disabled on my computer so I guess it should just work
then?

On Mar 10, 12:56 pm, Ayende Rahien <aye...@ayende.com> wrote:

The Bitland Prince

unread,
Mar 11, 2011, 12:10:42 PM3/11/11
to ravendb
On my Windows2008 Dev machine I couldn't just
EnsureCanListenToWhenNonInAdminContext when running under IIS in a non-
admin context (which is my defult behaviour, by the way). I had to
give user an explicit permission to be able to bind and listen to a
specific port. I usually use this command on my *DEVELOPMENT* machine
to get rid of permissions problem. ** THIS IS NOT RECOMMENDED FOR A
LIVE/PRODUCTION MACHINE**

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

Assuming that you want to let Raven server start listening on port
8080. That allows Everyone (hint: not recommended) bind and listen to
that address/port. Tested on Windows2008.

Hope this helps.

marcus

unread,
Mar 12, 2011, 7:54:43 AM3/12/11
to ravendb
Thank you, that solved the problem on my ws. What is the preferred way
to run raven in production, maybe not running the embedded http server
at all?

On Mar 11, 6:10 pm, The Bitland Prince <thebitlandpri...@gmail.com>
wrote:

Ayende Rahien

unread,
Mar 13, 2011, 3:30:39 AM3/13/11
to rav...@googlegroups.com, marcus
In production, you can run it either as a service or under IIS.
Reply all
Reply to author
Forward
0 new messages