Part 2 will configure the web application to communicate with the RavenDB cluster via IIS. We'll also see whats required if you are running your application as a windows service.

RavenDb 4 Part 2 - Client Configuration

You are looking at revision 7 of this page, which may be out of date. View the latest version.  

Part 1 of this article can be found here

Architecture Diagram

mraven-network.png

Now we have our RavenDb servers set up lets create a web app from scratch that will communicate with the RavenDb cluster.

dotnet new webapp -o ravendemo
dotnet add package RavenDB.Client --version 4.1.5
dotnet add package Microsoft.AspNetCore.Hosting.WindowsServices

We need our web app to be able to run as a service so in Program.cs replace CreateWebHostBuilder(args).Build().Run with:

var host = CreateWebHostBuilder(args).Build();
var isService = args.Contains("--service");
if (isService)
{
	var baseDirectory = new FileInfo(Assembly.GetEntryAssembly().Location).Directory.FullName;
	Directory.SetCurrentDirectory(baseDirectory);
}
if (isService)
{
	ServiceBase.Run(new WebHostService(host));
}
else
{
	host.Run();
}
Posted by: Wallace Turner
Last revised: 27 May, 2019 05:39 AM History
You are looking at revision 7 of this page, which may be out of date. View the latest version.

Comments

No comments yet. Be the first!

No new comments are allowed on this post.