Quantcast
Channel: Troubleshooting
Viewing all articles
Browse latest Browse all 1814

Issue with IIS and connecting to Microsoft SQL server 2008 R2, receving network path not found error

$
0
0

I'm using an instance of the SQL server and running a different port on IIS(8090) to access the website, as this is not the default website.

My SQL server is working, I've tested it using the following ways.

1. Connect to it directly from SQL management studio
2. connect to the server using VPN and using visual studio from my development machine to connect to run the website, no issues encounters and everything works.
3. Connect to the server using VPN using my test environment through IIS on a virtual machine, everything is working as intended.

All the connection methods in SQL configuration are enabled, and the firewall is turned off.


The issue occurs from my live server when trying to access the SQL through IIS, I'm using C# as my coding language.

I feel like the issue has to do with IIS, I've checked all the ports and permissions, but I can't figure out why this might be happening.



Here is the stack code that i receive.

   [Win32Exception (0x80004005): The network path was not found]

    [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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6568558
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +717
       System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +6595000
       System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +219
       System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6597311
       System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6597891
       System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +942
       System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1162
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +72
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +6601145
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +103
       System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +2102
       System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +116
       System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +1079
       System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +6605639
       System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +233
       System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +278
       System.Data.SqlClient.SqlConnection.Open() +239
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +292
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +420
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +277
       System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +3326331
       System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +176
       System.Web.UI.WebControls.ListControl.PerformSelect() +51
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +146
       System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +36
       System.Web.UI.Control.PreRenderRecursiveInternal() +113
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4297

This is my connection string, I've replaced the login credentials with asterisks.

<add name="BakeryConnection" providerName="System.Data.SqlClient"  connectionString="Data Source= 192.168.2.10\BAKERYDB,52468;Initial Catalog=Bakery;Integrated Security=False;User ID=*******;Password=******;MultipleActiveResultSets=True" />




Viewing all articles
Browse latest Browse all 1814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>