Not duplicate since it has a catch.
So As per previous questions I am using ~/
for mapping.So I use:
private static readonly Configuration _config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/xxx")
I can also use
private static readonly Configuration _config = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(HttpRuntime.AppDomainAppVirtualPath" + /xxx")
// Which doesn't work as expected
The issue is that web.config
is not at the root and I want to read a web.config
which is in a sub directory. You might ask why? It's because I'm using Orchard CMS and I only want to read my own module's web.config
. This works just fine all the time except for NUnit testing. When I want to test it cannot find my web.config
. Now where should I place this file for tests to be able to read it?
And how do I get rid of that error while it works on my tests and the actual application?
Aucun commentaire:
Enregistrer un commentaire