Connection String - HELP ME PLEASE

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

11/16/2016 5:08:22 PM
Gravatar
Total Posts 1

Connection String - HELP ME PLEASE

Hello! So I have migrated an install from a 2003 server to a 2008 server and I cannot get connected to the SQL DB correctly. I have verified that the remote connection is enabled and the SQL server browser is started. I have tried a ton of permutations of the connection string setting but I am not even sure I am editing it in the correct area?

Here is the error I am getting:

The system cannot connect to the MSSQL database. Please check your connection string.

 

System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at mojoPortal.Data.DBPortal.DatabaseHelperGetConnectionError(String overrideConnectionInfo) ClientConnectionId:00000000-0000-0000-0000-000000000000 Error Number:-1,State:0,Class:20

 

Here is my connection string statement in the web.config:

<connectionStrings>
    <add key="MSSQLConnectionString" value="server=corpnet3;UID=mojouser;PWD=thepassword;database=corpnet3\mojoportal" />
  </connectionStrings>

Here is the statement in the user.config:

<add key="MSSQLConnectionString" value="Data Source=.\SQLExpress;Database=mojoportal;uid=mojouser;Pwd=thepassword;" />

I am using the full SQL install not MySQL. Can anyone tell me what I am doing wrong???

Thank you!

 

12/13/2016 10:10:24 AM
Gravatar
Total Posts 1991

Re: Connection String - HELP ME PLEASE

The user.config overrides what is in the web.config but the user.config isn't reloaded when it is changed. So, make sure the user.config connection string is correct and then touch the web.config.

If SQL Server is installed on the same machine as IIS running your website, your connection string should probably look like this:

<add key="MSSQLConnectionString" value="Server=.\;Database=mojoportal;User Id=mojouser;
Password=thepassword;"/>

If you are using a named instance of sql server on the same machine as IIS running your website, you connection would look like this:

<add key="MSSQLConnectionString" value="Server=.\NAMEOFINSTANCE;Database=mojoportal;User Id=mojouser;
Password=thepassword;"/>