error 25: Connection String is not valid

Last post 09-18-2008 7:09 PM by Bruce L. 3 replies.

Sort Posts:

  • error 25: Connection String is not valid

    09-18-2008, 3:45 PM
    • Member
      1 point Member
    • brucesinner
    • Member since 08-22-2008, 12:08 AM
    • Los Angeles, CA
    • Posts 48

    Hi folks,

     I'm developing an ASP.NET MVC application in VS2008 SP1 and SQL Server 2005 Express and trying to deploy my application to production web server.

    There I'm pretty sure that they have .NET 3.5 Framework installed (although when you go to the about box from SQL Server Studio Management you see .NET Framework 2.0) and they have SQL Server 2005 (not express i think) installed.

     I created a database, created a user with pass and when I run my application I'm getting the following error:

    An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

    No matter what I try I'm stuck with this error forever. The best thing I could get was changing the errror do 26: Could not locate instance name when I changed the instance name on my connection string. Btw, my connection string is below and I'm pretty sure its valid:

    <add name="automotorConnectionString" connectionString="Data Source=.\MSSQLSERVER;Initial Catalog=automotor;User Id=autos;Password=mypassword" providerName="System.Data.SqlClient" />

    Instead of using the dot "." in the server name I tried with the machine name, i tried with IP, etc...

    I tried the instance name with SQLEXPRESS too although I look at the services.msc and made sure that the instance name is MSSQLSERVER.

    I tried everything! I read ZILLIONS of posts through the web, did all the configuration changes to the SQL Server to make it allow remote connections, tried to install the Providers SQL for ASP.NET in the database (aspnetdb), trid everything possible. The weird thing is that i created a udl file and through there i was able to connect :(

    I don't know what else i can do, im on this for over 15 hours and feels a lot stressed, why a deploy that should be so simple is getting so long ? Has anything to do with ASP.NET MVC framework perhaps?

    thanks for any help

  • Re: error 25: Connection String is not valid

    09-18-2008, 5:18 PM
    • Star
      11,278 point Star
    • Bruce L
    • Member since 02-08-2007, 1:53 PM
    • Posts 1,895

    I am a little lost.  Do you mean your application runs fine in development and fails on the server?

    Are you connecting to SQL or SQL Express?

    Bruce
    DiscountASP.NET - ASP.NET Hosting Experts
    Voted 2009 "Best ASP.NET Hosting" by asp.netPRO Magazine
    Win2008/IIS7.0, ASP.NET 2.0/3.5 SP1, MVC, AJAX, Silverlight, SQL 2008/2005
  • Re: error 25: Connection String is not valid

    09-18-2008, 5:27 PM
    Answer
    • Member
      1 point Member
    • brucesinner
    • Member since 08-22-2008, 12:08 AM
    • Los Angeles, CA
    • Posts 48

    Development Machine->.NET Framework 3.5, SQL Server 2005 EXPRESS , VS2008 SP1, ASP.NET MVC

    Production->;NET Framework 3.5, SQL Server 2005 (NOT EXPRESS), ASP.NET MVC

     

    Well, actually i fixed it in the most stupid way possible.

    I changed my connection string to this:

    <add name="automotorConnectionString" connectionString="Server=99.99.999.99;Initial Catalog=automotor;User Id=autos;Password=mypass" providerName="System.Data.SqlClient" />


    Changed "Data Source=Name of machine\MSSQLSERVER" to "Server=IP" and it worked!

    It took me long 15 hours to discover such little thing! I'm pissed!

    Now I would like to understand why it can't translate the machine name to the IP and I need to put the IP directly...

    thanks

     

  • Re: error 25: Connection String is not valid

    09-18-2008, 7:09 PM
    • Star
      11,278 point Star
    • Bruce L
    • Member since 02-08-2007, 1:53 PM
    • Posts 1,895

    Try ping the servername on the server itself.  It if doesn't resolve, check the domain's DNS server.

     

    Bruce
    DiscountASP.NET - ASP.NET Hosting Experts
    Voted 2009 "Best ASP.NET Hosting" by asp.netPRO Magazine
    Win2008/IIS7.0, ASP.NET 2.0/3.5 SP1, MVC, AJAX, Silverlight, SQL 2008/2005
Page 1 of 1 (4 items)