ContextManager cannot find connection string from web.config

ContextManager cannot find connection string from web.config

Old forum URL: forums.lhotka.net/forums/t/5257.aspx


lublenok posted on Monday, August 18, 2008

Hi all,

I am new to CSLA.NET, but I've already been impressed by the features it offers. I have the following problem:

I am using .Net 3.5 SP1 + VS2008 SP1 + CSLA.Net 3.5.1

I've developed a business layer and data access layer using LINQ-to-SQL pretty much the same way as shown in the reference project (ProjectTrackerCS). I've set up a unit test project, and unit tests work fine. Now, I have a web project, which I configured as follows:

<appSettings>
   <
add key="CslaAuthentication" value="Csla"/>
   <!--
<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/>-->
</
appSettings>

<connectionStrings>
   <
add name="App" connectionString="..." providerName="System.Data.SqlClient" />
   <
add name="Security" connectionString="..." providerName="System.Data.SqlClient" />
</
connectionStrings>

When I try to run a test page in the web project, I get a null reference exception. When I debug this error, it turns out that it occurs in Csla.Data.ContextManager, line 62:

var conn = ConfigurationManager.ConnectionStrings[database].ConnectionString;

In the watch window I can see that the ConfigurationManager.ConnectionStrings collection consists of only one element (some default db connection), but it does not see my two connection strings. Nor does it see any app settings. It seems that it doesn't see my web.config at all. The value of the database variable is correct.

I also tried to uncomment <add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/>, but to no avail

Do you have any idea what I am doing wrong?

Thanks a lot in advance!
Leonid

 

Copyright (c) Marimer LLC