ELMAH with SQL Server and very limited access

48 views
Skip to first unread message

Brooky

unread,
Jun 24, 2009, 6:48:56 AM6/24/09
to ELMAH
Hi everyone,

first of all, i've recently started using ELMAH on a project i'm
working on and it's been a great asset to the development phase (for
ease of setup i've been using the SQLite option)

I'm now at a stage where i want to deploy my project. My deployment
environment is a load balanced webfarm to which i have essentially no
access, i'll be handing the project to somebody else to deploy.

I'll want to lock down the ELMAH.axd so nobody can see it apart from
those that need to see it (mainly me) and also i want to make sure
it's going to log all the errors from all of the multiple servers it
will be installed on.

I've initally decided to use the SQL Server option for deployment as
we have one main dedicated SQL box that is common to all web servers
in the farm, i think this will mean all the errors are logged in the
same place with a different server source (which is ideal).

So far so good. Now, as i don't have access to the live server, i
can't remote onto the machine to view the ELMAH.axd and i can't leave
it open for everyone to see. I've seen there are other options such as
Integrated Windows Authentication but i don't think i can use this
because the web farm and me are not on the same domain (As best i
understand it). I wanted to avoid ASP.NET authentication because i've
been promoting ELMAH as something which won't require any development
to our project (and as best i understand it i'd probably need to
implement some kind of logon form etc).

I do though have access to the backend SQL server where the errors are
going to be logged. So my question (eventually) is whether there is
any way to get the same ELMAH interface on top of those errors using a
version of ELMAH that isn't deployed on my live servers alongside the
project but is perhaps installed somewhere internally that only i can
see and monitor but can access the same SQL server?.... phew. I hope
that makes sense.

Apologies for the long post but i believe in 'showing my working out'
- you used to get points for that in exams... :)

thanks
Brooky

Atif Aziz

unread,
Jun 24, 2009, 8:55:25 AM6/24/09
to el...@googlegroups.com
This should be possible. Just make sure that you configure the same "application name" everywhere because the SQL Server log implementation uses the application name to provide isolation where the same DB is being shared across several applications. However, here it seems we're talking about the same "logical" web application. In the farm where you don't want any viewing possible, don't even bother registering the HTTP handler (that is, Elmah.ErrorLogPageFactory) in the configuration for added security. You only need to register the logging module and if desired, also the one for e-mailing. Then on the so-called monitoring box, register the HTTP handler, but none of the modules. Configure the SqlErrorLog to use the same connection string and application name as the farm. Hope it's clear.

- Atif

Brooky

unread,
Jun 25, 2009, 3:39:53 AM6/25/09
to ELMAH
this sounds like the perfect solution for my hosting environment.

thanks for your quick response.
Brooky
> > Brooky- Hide quoted text -
>
> - Show quoted text -

Brooky

unread,
Jul 15, 2009, 3:44:58 AM7/15/09
to ELMAH
Hey Atif,

This took me a while to realise - but in you mention making sure that
the application name is configured to be the same. I had assumed at
the time that there was a configuration element in the elmah config
somewhere that would allow me to specify the application name. I can't
see anything like this at the moment... does such a value exist?

I've set my test version up to use SQL Server now and it logs fine, on
my development machine the application is logged as "/" - presumably
because i'm running the software under the ASP.NET development server,
so it's under the root. So i'm thinking i might run into a problem
when i deploy my site live and then when i want to deploy my "log
reader" site on a different machine i'm not sure i'll be able to make
sure that the application name is the same.

thanks,
Brooky


On Jun 24, 1:55 pm, Atif Aziz <aziza...@gmail.com> wrote:

James_2JS

unread,
Jul 15, 2009, 6:30:29 AM7/15/09
to ELMAH
Hi Brooky,

You add the applicationName attribute to the errorLog element in your
configuration... e.g.

<elmah>
<errorLog
type="Elmah.SqlErrorLog, Elmah"
connectionStringName="NameOfConnectionStringToUse"
applicationName="xxx" />
</elmah>

Hope this helps!

Cheers,

James
> > - Show quoted text -- Hide quoted text -

Atif Aziz

unread,
Jul 15, 2009, 6:37:28 AM7/15/09
to el...@googlegroups.com
The application name is set via an attribute on the <errorLog> element for SqlErrorLog. For example:

<errorLog type="Elmah.SqlErrorLog, Elmah" applicationName="foo" ... />

- Atif

Atif Aziz

unread,
Jul 15, 2009, 6:40:30 AM7/15/09
to el...@googlegroups.com
Oops, looks like James and I both replied at the same time and fortunately consistent in response. :)

Brooky

unread,
Jul 16, 2009, 6:15:03 AM7/16/09
to ELMAH
Good stuff :)

Thanks Atif and James

I'm actually looking forward to this project going live now so I can
see the errors trickling in... (hopefully 'trickling' rather than
'flooding')

Brooky

On Jul 15, 11:40 am, Atif Aziz <aziza...@gmail.com> wrote:
> Oops, looks like James and I both replied at the same time and fortunately
> consistent in response. :)
>
Reply all
Reply to author
Forward
0 new messages