Thursday, March 22, 2012

error: 25 - Connection string is not valid -- HELP Please!

I have been having a problem trying to connect to a SQL Server. I have installed the Developer edition on an MS Small Business edition 2003 server

I also installed MS Sql Manager and I was able to create a database and connect to it. The database server is in the same PC. I used the surface configuration to enable remote connections using TCP /IP and pipe lines.

My application runs without a problem on my development machine but when I deployed on this server I get theprovider: SQL Network Interfaces, error: 25 - Connection string is not valid Error.

this is my config file setup

<connectionStrings>
<add name="Diamond_dbConnectionString" connectionString="Data Source=192.168.1.104\MSSQLSERVER;Initial Catalog=Diamond_db;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

I have google and yahoo this error I found a lot of information I've tried many of them but still having the problem. I will appreciate your help solving this problem. I have a customer waiting since last week to see this site and I'm still stuck.

Tia

Charles

PS. Below I pasted the complete error info I get.

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)

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: 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)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SqlException (0x80131904): 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)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734995 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121 System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162 System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +107 DiamondTableAdapters.COUNTRIES_TEMPLATETableAdapter.GetContriesTemplate() +108[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0 System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +296 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29 System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +482 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +2040 System.Web.UI.WebControls.BaseDataList.GetData() +53 System.Web.UI.WebControls.DataList.CreateControlHierarchy(Boolean useDataSource) +284 System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) +56 System.Web.UI.WebControls.BaseDataList.DataBind() +72 System.Web.UI.WebControls.BaseDataList.EnsureDataBound() +55 System.Web.UI.WebControls.BaseDataList.CreateChildControls() +63 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +41 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360



Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Do you have ISA running on the server? Can you connect through Server Manager to the server using the same credentials?

Jeff

|||

Jeff,

I'm using EMS SQL Manager for SQL Server

http://sqlmanager.net/products/mssql/manager/

to create and manage my SQL server. I can connect to the server using windows credentials but when I try with the ASP application I can't

Thanks

Charles

|||

Is the ASP.NET app using the same Windows account to access the database, or is it using the ASP.NET process account?

Jeff

|||

Jeff,

Honestly I'm very green regarding ASP.NET and MS-SQL Server

When I installed the server I asigned the Windows account to gain access to the SQL Server. When I created the database in question I also used the Windows Account.

When I registered the database with MS Server manager tool I also used the same Windows Account.

How can I check If I'm using the ASP.NET process account instead of the Windows Account?

I will appreciate your inputs.

Tia

Charles

|||

The ASP.NET process account, unless you have set it or changed it, is ASPNET or NETWORK SERVICE depending on operatiing system. It is unlikely you chose this account for access to SQL. But normally you would get a mdifferent error if that was the problem.

Take a look at connectionstrings.com for some possibilities in changing your connection string. You may want to use a standard authentication with SQL user and password rather than rely on a trusted connection.

Is your SQL on a different server than the web server? I wouldn't think so but you use the IP address of the SQL server in your connection. You should just need to enable TCP/IP, which you said you've done.

Jeff

|||Are you sure the MSSQLSERVER is the name of the named (not default) instance? It seems to be the SQL service name of default instance. If you're trying to connect to a default SQL instance on a remote server, just set the Data Source to the IP address of the remote server is ok.sql

No comments:

Post a Comment