The ConnectionString property has not been initialized

The ConnectionString property has not been initialized

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


Bob Bedell posted on Monday, October 16, 2006

Hello,

I'm a not very expert inspired amateur trying to get CSLA 1.5 up and running for the first time. I've made it through the C# book to the point where I have completed the Login form in the PTWin project. I'm assuming that I should be able to login to the Security database at this point and authenticate a user. I feel like all my ducks are sort of in a row. When I click the login button, however, I get the following error message:

'The ConnectionString property has not been initialized.'

Can anyone shed any light on why this might be?

Thanks a lot,

Bob

guyroch replied on Monday, October 16, 2006

Please post your app.config file (and web.config if using remoting).  This way we can better troubleshoot your problem

Bob Bedell replied on Monday, October 16, 2006

Thanks much for the respose. Here is App.config:

<?xml version="1.0"?>

<configuration>

<appSettings>

<add key="Authentication" value="CSLA"/>

<!--<add key="DB:PTracker" value="data source=eliot;initial catalog=PTracker;user id=sa;password=password" />

<add key="DB:Security" value="data source=eliot;initial catalog=Security;user id=sa;password=passsword" />-->

<add key="PortalServer" value="http://localhost/MyCSLADataPortal/DataPortal.rem"/>

<add key="ServicedPortalServer" value="http://localhost/MyCSLADataPortal/ServicedDataPortal.rem"/>

<add key="DefaultBatchQueueServer" value="tcp://localhost:5050/cslabatch/batchqueue.rem"/>

</appSettings>

<startup>

<supportedRuntime version="v1.1.4322"/>

<requiredRuntime version="v1.1.4322" safemode="true"/></startup><runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705">

</assemblyBinding></runtime></configuration>

And here is Web.config:

<?xml version="1.0"?>

<configuration>

<appSettings>

<add key="Authentication" value="CSLA"/>

<!-- TODO: update connection strings as appropriate -->

<add key="DB:PTracker" value="data source=eliot;initial catalog=PTracker;user id=sa;password=password"/>

<add key="DB:Security" value="data source=eliot;initial catalog=Security;user id=sa;password=password"/>

<!--

<add key="DB:PTracker" value="data source=ineroth;initial catalog=PTracker;integrated security=SSPI" />

<add key="DB:Security" value="data source=ineroth;initial catalog=Security;integrated security=SSPI" />

-->

</appSettings>

<system.runtime.remoting>

<application>

<service>

<wellknown mode="SingleCall" objectUri="DataPortal.rem" type="CSLA.Server.DataPortal, CSLA.Server.DataPortal"/>

<wellknown mode="SingleCall" objectUri="ServicedDataPortal.rem" type="CSLA.Server.ServicedDataPortal.DataPortal, CSLA.Server.ServicedDataPortal"/>

</service>

<channels>

<channel ref="http">

<serverProviders>

<provider ref="wsdl"/>

<!-- TODO: comment the following two lines for .NET 1.0 -->

<formatter ref="soap" typeFilterLevel="Full"/>

<formatter ref="binary" typeFilterLevel="Full"/>

</serverProviders>

</channel>

</channels>

</application>

</system.runtime.remoting>

<system.web>

<!-- DYNAMIC DEBUG COMPILATION

Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to

false will improve runtime performance of this application.

Set compilation debug="true" to insert debugging symbols (.pdb information)

into the compiled page. Because this creates a larger file that executes

more slowly, you should set this value to true only when debugging and to

false at all other times. For more information, refer to the documentation about

debugging ASP.NET files.

-->

<compilation defaultLanguage="c#" debug="false"/>

<!-- CUSTOM ERROR MESSAGES

Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.

Add <error> tags for each of the errors you want to handle.

"On" Always display custom (friendly) messages.

"Off" Always display detailed ASP.NET error information.

"RemoteOnly" Display custom (friendly) messages only to users not running

on the local Web server. This setting is recommended for security purposes, so

that you do not display application detail information to remote clients.

-->

<customErrors mode="RemoteOnly"/>

<!-- AUTHENTICATION

This section sets the authentication policies of the application. Possible modes are "Windows",

"Forms", "Passport" and "None"

"None" No authentication is performed.

"Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to

its settings for the application. Anonymous access must be disabled in IIS.

"Forms" You provide a custom form (Web page) for users to enter their credentials, and then

you authenticate them in your application. A user credential token is stored in a cookie.

"Passport" Authentication is performed via a centralized authentication service provided

by Microsoft that offers a single logon and core profile services for member sites.

-->

<authentication mode="Windows"/>

<!-- AUTHORIZATION

This section sets the authorization policies of the application. You can allow or deny access

to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous

(unauthenticated) users.

-->

<authorization>

<allow users="*"/>

<!-- Allow all users -->

<!-- <allow users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

<deny users="[comma separated list of users]"

roles="[comma separated list of roles]"/>

-->

</authorization>

<!-- APPLICATION-LEVEL TRACE LOGGING

Application-level tracing enables trace log output for every page within an application.

Set trace enabled="true" to enable application trace logging. If pageOutput="true", the

trace information will be displayed at the bottom of each page. Otherwise, you can view the

application trace log by browsing the "trace.axd" page from your web application

root.

-->

<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/>

<!-- SESSION STATE SETTINGS

By default ASP.NET uses cookies to identify which requests belong to a particular session.

If cookies are not available, a session can be tracked by adding a session identifier to the URL.

To disable cookies, set sessionState cookieless="true".

-->

<sessionState mode="Off" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="20"/>

<!-- GLOBALIZATION

This section sets the globalization settings of the application.

-->

<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>

</system.web>

<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v1.0.3705">

</assemblyBinding></runtime></configuration>

Thanks again for your time.

Bob

Bob Bedell replied on Tuesday, October 17, 2006

Got it figured out. Phew.

I was passing the wrong database name to the DB method that initializes the SQLConnection object in BusinessIdentity's DataPortal_Fetch method. I'm logged in and all is well, for now.

I've been intending to build CSLA ever since I got my hands on a copy of the VB6 edition of the book, and just never got around to it. Lots of stuff was just way beyond my comprehension back then, but I knew just enough to be thoroughly impressed by what I was looking at. Feels good to finally get it up and running. Pretty exciting.

Thanks again for the reply.

Bob

guyroch replied on Tuesday, October 17, 2006

Glad to see you up and running, I was just about to look into your config file but I guess I won't have too.  Have a great one :)

Copyright (c) Marimer LLC