Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...Can't connect to SQL Server from custom module.Can't connect to SQL Server from custom module.
Previous
 
Next
New Post
12/4/2013 7:08 PM
 

DNN 6.01.02(98)  On Windows Server 2008 R2 Standard, SP1

.NET 4.0

SQL Server 2005 Standard on Windows 2003 R2 Standard, SP2

I'm trying to load a custom module written by one of our developers to run in our production environment. The module loads fine without any errors. When I add the module to a page, the module fails indicating there is a problem connecting with the SQL Server.

I loaded a fresh version of DNN on ServerA pointing to the DNN database on ServerB. Everything works fine. On ServerB is another database which the custom module accesses. I get an error (listed below). It seems to be a SQL Connection error. I have double/triple/quadruple checked the connection string in the Web.config file, and all seems to be in order. I can successfully create an ODBC connection from ServerA using the exact same connection string parameters if I have the client configured for TCP/IP.  

I noticed that the error below referenced Named Pipes.  If the ODBC client is configured for Named Pipes, it fails. The SQL Server is listening on both TCP/IP and Named Pipes. Is there something within the CS code that should be using TCP/IP instead of Named Pipes?

BTW, this is a second attempt using a fresh DNN installation. I had the same issue on another DNN instance on the same web server. On that instance we have an unrelated SGSV module that makes a connection to a third database on ServerB with no problems. Every database connection uses the "System.Data.SqlClient" provider. Only the custom module isn't connecting.  I'm pulling my hair out.

Error: Property Activity is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.Data.SqlClient.SqlException: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) at System.Data.SqlClient.SqlInternalConnection. (SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user) at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe() at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode() at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at org.santaana.dnn.PropertyActivity.LinqPropertyActivityDataContext.cpS_get_parcel_info(Nullable`1 property_id) at org.santaana.dnn.PropertyActivity.View.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace ---

 
New Post
12/4/2013 7:50 PM
 
The source code of your written DataProvider would be helpfull. 
 
New Post
12/4/2013 8:26 PM
 
Thanks Matthias.  I'll grab it from the developer.

 
New Post
12/5/2013 9:38 AM
 
It's going to be one of 2 things: your sql server has not enabled the necessary network libraries i.e. only shared memory is enabled, and not tcp/ip and named pipes- as shared memory only works on the local machine attempts to connect to that machine from another machine will fail (http://technet.microsoft.com/en-us/li...). The 2nd possibility is that the sql server is on a different machine and it has not been configured for remote connections - http://support.microsoft.com/kb/91427... . Finally the fact that DNN works and the module doesn't suggests the developer has configured their own connectionstring somewhere and this may well be pointing to their test setup (and not yours) so I'd check that also

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...Can't connect to SQL Server from custom module.Can't connect to SQL Server from custom module.


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out