RavenDB version 2.0. Other versions:

Deploying as an IIS application

RavenDB can be run as an IIS application, or from a virtual directory under an IIS application.

Setting up a RavenDB IIS application

  1. Download the distribution zip, and extract the "Web" folder.
  2. In IIS Manager, create a new website and point it's physical path to the "/Web" folder you extracted. Alternatively, point a virtual directory under an existing website to that folder.
  3. Set the Application Pool for the IIS application you will be using to "ASP.Net v4.0", or create a new Application Pool set to .NET 4.0 Integrated Pipeline.
  4. Set port and host if needed.
  5. Make sure that the user you set for the website has write access to the physical database location.
  6. Make sure to disable "Overlapped Recycle" in App Pool Advanced Settings. (Otherwise, you may have two concurrent RavenDB instances competing for the same data directory, which is going to generate failures).

Setting up with IIS 7.5 and 8.0

  • Remove the WebDAVModule from the installed Modules on your IIS server
  • If you wish to run RavenDB with authentication:
    • Ensure that IIS "Windows Authentication" security module is installed (by default it is not). This can be checked under Programs and Features > Turn Windows features on or off > Internet Information Services > World Wide Web Services > Security.
    • Enable "Windows Authentication" for the RavenDB website.
    • In the web.config file, set the app settings value Raven/AnonymousUserAccessMode to Get or None
  • If you wish to run with no authentication:
    • In the web.config file, set the app settings value Raven/AnonymousUserAccessMode to All

Setting up with IIS 7

You may get a "405 Method Not Allowed" error when trying to create an index from the Client API when RavenDB is running in IIS 7.

This usually happens when you are running RavenDB from a virtual directory. The problem is a conflict that occurs with the WebDAV module. To resolve that, you need to edit the web.config file in the parent directory and add:

    <system.webServer>
   <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule" />
   </modules>
 </system.webServer>

That will remove the WebDAV module and resolve the conflict.

This modification is not to the RavenDB's web.config file, it is to the web.config of the parent application.

Setting up with IIS 6

When using IIS 6, you need to make sure all requests are mapped to the ASP.NET DLL, and modify the Web.config file and remove the system.webServer element and add the following system.web element:

    <system.web>
   <httpHandlers>
      <add path="*" verb="*" 
         type="Raven.Web.ForwardToRavenRespondersFactory, Raven.Web"/>
   </httpHandlers>
</system.web>

If you are experiencing problems with accessing the Studio, try this step: Home Directory > Configuration > Wildcard application maps > Insert c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll, and Uncheck Verify file exists.

Web Configuration

Many configuration options are available for tuning RavenDB and fitting it to your needs. See the Configuration options page for complete info.

RavenDB isn't a typical web site because it needs to be running at all times. In IIS 7.5, you can set this using the following configuration settings:

  • If you created a dedicated application pool for RavenDB, change the application pool configuration in the application host file (C:\Windows\System32\inetsrv\config\applicationHost.config) to:
    <add name="RavenApplicationPool" managedRuntimeVersion="v4.0" startMode="AlwaysRunning" />
  • If Raven runs in an application pool with other sites, modify the application host file (C:\Windows\System32\inetsrv\config\applicationHost.config) to:
    <application path="/Raven" serviceAutoStartEnabled="true" />

HTTP Error 503

You may hit an HTTP Error 503 - "The service is unavailable" - when deploying to IIS, with nothing written to the Event Log.

This problem usually occurs when you are trying to run the RavenDB's IIS site on port 8080 after you have run RavenDB in executable mode. The problem stems from RavenDB reserving the http://+:8080/ namespace for your user, and when IIS attempts to start a site on the same endpoint, it errors.

You can resolve this problem by executing the following on the command line:

netsh http delete urlacl http://+:8080/

You can also see all existing registrations with the following command:

netsh http show urlacl

IISReset

Another issue that is worth mentioning is a IISReset problem. By default it gives the IIS server 20 seconds to restart, 60 seconds to stop and 0s to reboot, after that period of time it aborts the thread of the application by using Thread.Abort() (in context of a RavenDB it means that we will have to run recovery process next time we start, so it will take even longer). In most cases the amount of time might be enough, but when we consider a multi-tenancy feature and possibility of a database recovery process, then the given time might not be enough.

To handle the problematic IIS behavior we have redesigned the RavenDB startup process to handle Thread.Abort() more robustly and moved the DB initialization process to a separate, non-dependent by IIS process. More details about the issue and our solution can be found here.

Comments add new comment

The comments section is for user feedback or community content. If you seek assistance or have any questions, please post them at our support forums.

bbqchickenrobot
REPLY Posted by bbqchickenrobot on

What advantage does this provide? Just for the authentication? Not really sure I understand why this would be helpful? Although I'm sure there is a reason...

Oren Eini
REPLY Posted by Oren Eini on

I am not sure that I am following your question. What is this "this" that you refer to? Deploying to IIS? Or is it something more specific?

Andrei Volkov
REPLY Posted by Andrei Volkov on

Yeah, would be nice to see the pros and cons of Windows Service vs. IIS. Also, what's the story with upgrades in both scenarios?

Trey
REPLY Posted by Trey on

I think "this" meant specifically the deployment of Raven as an IIS Website. What are the pros/cons of doing so over the traditional Windows Service deployment.

Oren Eini
REPLY Posted by Oren Eini on

On IIS, you get the full benefits of being managed in IIS. You can set memory limits, monitor via standard tools, use SSL, etc. Using the service, you have far simpler configuration story, and you can get started in under a minute.

Both are supported, and it is mostly about how your own IT feels about things. If they are good in IIS setup & monitoring, they should go there. If they want to do the simplest thing, they setup as a service and forget about it.

EMil
REPLY Posted by EMil on

How can we setup RavenDB on Windows Azure?

Ayende Rahien
REPLY Posted by Ayende Rahien on

Hi, You can do that using:

http://astrunota.com/rant/RunningRavenDBinWindowsAzure.html

See code for this here:

https://github.com/jalchr/Azure-IIS-Hosted-RavenDb

ADEBISI Foluso A.
REPLY Posted by ADEBISI Foluso A. on

The link: http://astrunota.com/rant/RunningRavenDBinWindowsAzure.html is broken.

Thanks for Raven, though. It rocks!

Itamar Syn-Hershko
REPLY Posted by Itamar Syn-Hershko on

Apparently it was moved to http://astrunota.com/rant/RunningRavenDBinWindowsAzure.html

Itamar Syn-Hershko
REPLY Posted by Itamar Syn-Hershko on

Argh. Put underscored between the words after /rant/

http://astrunota.com/rant/Running_RavenDB_in_Windows_Azure.html

Daniel Schilling
REPLY Posted by Daniel Schilling on

This link appears to be dead again. I can't get astrunota.com to resolve. nslookup gives me nothing.

Emil
REPLY Posted by Emil on

Is installing RavenDB in IIS8 identical to IIS7.5?

-glenn-
REPLY Posted by -glenn- on

Just worked for me using the IIS 7.5 instructions above.

-glenn-
REPLY Posted by -glenn- on

Ooops, sorry, I was on an IIS 7.5 server (don't have Server 2012 installed yet). Sorry about that.

James
REPLY Posted by James on

RavenDB doesn't seem to work on IIS 8. Perhaps Ayende and co will give some guidance on this or provide a fix soon if there is a bug.

Maneesh
REPLY Posted by Maneesh on

couple of grammar mistakes here. 1. Ensure that "Windows Authentication" is installed support to IIS 7.5 (by default it is not) What do you mean by windows Authentication is installed support? 2.If you with to run with no authentication: isn't that "wish" instead of "with"

Under, "Setting up with IIS 7.5", You mentioned about removing the WebDAVModulse from the installed Modules in the server. Where can i see the installed modules in the server? Except for studio, I don't know how to interact with raven server. Kindly point me in the right direction.

Brian
REPLY Posted by Brian on

HTTP Error 503, IIS7, Windows7, tried all above, no joy. port 8080 is not reserved. (I checked). Windows Authentication is on, anon is off, etc. Yes, the folder exists. WebDav module is removed from config. Please elaborate on other possible causes. Found several others on other forums with same prob and no solution found.

Yurps
REPLY Posted by Yurps on

Terribly inadequate documentation. Even after finding another website with some pictures there was still security error after error....I thought Raven would be a good option but Mongo is much easier.

Jim DeCicco
REPLY Posted by Jim DeCicco on

I agree. The documentation tends to be a collection of notes about interesting aspects of the features, rather than a simple, systematic outline of what one would really want to do. For example, getting auth. information for running as a Windows Service has left me extremely frustrated.

Using RavenDB from C# code has been mostly awesome, though again, the documentation around indexing has left me wanting.

Antoenette Fernandes
REPLY Posted by Antoenette Fernandes on

Could you please tell me how to prepare a file for submission to CMS

SUBMIT COMMENT