Around a year ago, Exceptionless launched - this is a product provided by CodeSmith which has a fairly simple goal - to capture, log and allow reporting on Exceptions that occur within your deployed applications.
Exceptionless recently published their source onto GitHub, so now in addition to their (exceptionally good value) hosting, you can now host it internally if you need to. While it might sound odd, I'm inclined to use their public hosted service for Internet connected scenarios, but I regularly come across environments and situations where it's not permissible for information such as errors (especially with stack traces) to be transmitted off site.
So that's where you have to start considering to host this sort of infrastructure yourself.
Getting the Code
Head over to the GitHub site of Exceptionless and download the code (click on download zip on the right). Decompress this onto your computer.
Now open up the Exceptionless.sln file, and we will check it compiles.
You might see a prompt for "Security Warnings" as the project has been downloaded from the internet; make sure the "Ask me for every project in this solution" is unticked and hit OK.
There are many projects in the Exceptionless solution, but the one we are most interested in is
Exceptionless.App; this is the actual main website / core of
Exceptionless. Right click on it and select Build. During the compilation, you might notice that some NuGet packages are downloaded - if the build fails, re-run it before trying to debug as usually these get resolved due to these packages getting installed.
Deploying the Code
The easiest way to publish the web app is to simply create a Publish Profile for the
To do this - right click on the
Exceptionless.App project, select Publish.
Select New Profile from the drop down and enter a name.
Set the method depending on where you want the project published; personally, I prefer to publish these things locally so I can arrange moving them onto the server manually - at least, until I build a release pipeline to do all this automatically for me!
Once you have the code published, you will need to (possibly!) copy it up onto your server - ensure your IIS site is running .NET 4.5.1.
You'll also need to install the MongoDB and Redis Services. While both of these services perform better under Linux than they do Windows, I've opted to put my small installation on a Windows server (at least for now), and ended up using the Redis and MongoDB Windows Service installers that are available on the net.
* Install Redis 2.6: Redis 2.6 is not as simple as 2.4 to install on Windows, as no-one has released a service installer (yet). I'd recommend following this CodeProject article to get Redis installed and running: http://www.codeproject.com/Articles/715967/Running-Redis-as-a-Windows-Service
Redis has no configuration changes that need to be made, however, for Mongo there are a few more steps to get it working.
* Install MongoDB Service by downloading and decompressing MongoDB from here: http://www.mongodb.org/
Once you have MongoDB decompressed, you will want to place it somewhere on your server - such as c:\mongodb. Create a data\db and a log directory alongside the bin one that was in the zip (so you end up with c:\mongodb\bin, c:\mongodb\log and c:\mongodb\data\db).
Then you need to create the config file - create a file called mongodb.cnf in the bin folder and place the following lines in it:
Now to install the service! Make sure you have a suitable user account before you try this.
Open up a Command Prompt as an administrative user, and change into the bin folder (c:\mongodb\bin).
Enter the following command:
mongod --install --serviceName mongodb ---serviceUser <username> <br />--servicePassword <password> -f c:\mongodb\bin\mongodb.cnf
This should complete without error, and will register the MongoDB Service with the specified user account and config file.
You will want to pop into Administrative Tools \ Services to make sure that both of the newly installed services are running - Redis and MongoDB.
Open up the web.config for your deployed Exceptionless project, and start by finding the
appSettings section - there are a few elements here you will want to change:
- Change the Base URL
- Set whether SSL should be enforced or not (if you haven't installed a certificate on your site, don't set this)
- Set the
mailSettings, set an appropriate entry for your mail server.
machineKey, generate a new machine key and replace the value that is here.
Save the file, and you should be able to hit your new error capture website - the first account that you register will become an Admin account, so don't leave it sitting at this point.
Hooking Up Your Application
By this point, the web component is fully operational, but how do you get your error data into it?
Well, the absolute easiest way is to install a NuGet package into your project, but the best place to get the information on what to do is actually IN Exceptionless:
Follow the instructions there, and once you have open you applications config file - look for the exceptionless section.
As well as specifying the API key here, you need to add serverURL; so you should end up with something like:
<exceptionless apikey="blahblah" serverurl="https://errors.yourco.co.uk" />
Note that if your Exceptionless installation is not running on HTTPS / SSL, you will need to specify the http:// url instead.
And that's it! Any untrapped errors in your application will now be sent to your Exceptionless installation!
If you want to know more about Exceptionless, or how to use it after you've got it installed, I'd recommend you take a look at their documentation.
This guide can be used to install Exceptionless on-premise, on a dedicated server at your web host, or even on EC2 or Azure's Virtual Machines.
- 12 Apr 14: Updated for Redis 2.6, removed the error regarding
SimpleInjector as it is no longer applicable
- 13 Mar 14: Complete first release
- 05 Mar 14: First draft