I'm writing a small console app to support some background functionality in a 2.0 web app. I need to call some of the web code from the console app so I tired just adding a reference to the web's dll in the console app, not thinking it would work. Although all of the dll's for the web app got copied over to my console app's bin directory (understandable), I'm able to call quite a few utility routines successfully, even if I copy (just) the exe into the web server's bin directory.
There are only a few more routines in the web app that I need access to but they all use ConfigurationManager.AppSettings to read properties out of web.config, and these values are clearly not there when I call from the exe. It wouldn't take much for me to write my own web.config reader .... but I have a fairly nagging feeling I've lit a fuse here that is just waiting to take a turn for the worst.
Can anyone support or complain about this approach? Or suggest any alternative(s) to accessing web code from an executable.
Thanks for any feedback-
PS- I am not accessing any of the web's gui layer or even the code-behind pages, just logic, utility, and database tier (although they are all compiled into a single dll).