segalle
segalle

Reputation: 446

Configuration system failed to initialize when trying to connect using c#

I am trying to connect from my app to SQL server and im getting the following error: "Configuration system failed to initialize".

this is my App.config file:

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <ConnectionString>
    <add name="ConStr" ConnectionString="Data Source=10.0.0.111;Initial Catalog=InfoDesk;User ID=sa" />
  </ConnectionString>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
</configuration>

and this is from the app:

SqlConnection sqc = new SqlConnection(ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);

Endless glory for a good answer

Thanks, Erez

Upvotes: 0

Views: 725

Answers (1)

Tomtom
Tomtom

Reputation: 9394

I've looked at this Page. There is an example for a connection-string for the sql-server 2005.

I'm not sure, but I think you have to specify the databaseprovider in your connectionstring.

Update:

Found something at connectionstrings.com for SQL-Server 2008:

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;
User ID=myUsername;Password=myPassword;

Take a look at this. Maybe you have a problem with the IP

Upvotes: 1

Related Questions