Connection issue from application

  • We are having connection issue, while the application from IIS server connects to the SQL server 2014 server(on san box) using SQL authentication. It has no issues while connecting the application from my local machine to the SQL server (on san box).

    The SQL user has db_reader and db_write access to the database.

    Could you please help me fix this issue.

    Error received from the IIS server is:

    [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) +5352431

    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244

    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5363103

    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145

    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +891

    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307

    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +518

    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +278

    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38

    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +732

    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85

    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1057

    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78

    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +196

    System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +146

    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +16

    System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +94

    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +110

    System.Data.SqlClient.SqlConnection.Open() +96

    System.Data.Entity.SqlServer.<>c__DisplayClass2f.<UsingConnection>b__2d() +136

    System.Data.Entity.SqlServer.<>c__DisplayClass1.<Execute>b__0() +34

    System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +251

    System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation) +196

    System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection sqlConnection, Action`1 act) +345

    System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action`1 act) +411

    System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +350

    System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +132

    [ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.]

    System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +327

    System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +67

    [ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]

    System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +228

    System.Data.Entity.Infrastructure.<>c__DisplayClass1.<ResolveManifestToken>b__0(Tuple`3 k) +63

    System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72

    System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection) +260

    System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +89

    System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +79

    System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +143

    System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +171

    System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +594

    System.Data.Entity.Internal.InternalContext.Initialize() +31

    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +39

    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +138

    System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +38

    System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +99

    System.Linq.Queryable.Where(IQueryable`1 source, Expression`1 predicate) +63

    Microsoft.AspNet.Identity.EntityFramework.UserStore`1.FindByNameAsync(String userName) +1099

    Microsoft.AspNet.Identity.<FindByNameAsync>d__d.MoveNext() +231

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52

    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24

    Microsoft.AspNet.Identity.<ValidateUserName>d__0.MoveNext() +832

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52

    System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21

    Microsoft.AspNet.Identity.<ValidateAsync>d__4.MoveNext() +433

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52

    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24

    Microsoft.AspNet.Identity.<CreateAsync>d__0.MoveNext() +629

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52

    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24

    Microsoft.AspNet.Identity.<CreateAsync>d__10.MoveNext() +883

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52

    System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +24

    CC.UI.Recruiting.Controllers.<Register>d__8.MoveNext() in c:\Projects\Recruiting\Dev\CCRecruiting\CC.UI.Recruiting\Controllers\AccountController.cs:82

    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93

    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52

    System.Runtime.CompilerServices.TaskAwaiter.GetResult() +21

    lambda_method(Closure , Task ) +64

    System.Threading.Tasks.TaskHelpersExtensions.ThrowIfFaulted(Task task) +37

    System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +114

    System.Web.Mvc.Async.<>c__DisplayClass34.<BeginInvokeAsynchronousActionMethod>b__33(IAsyncResult asyncResult) +65

    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47

    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102

    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +49

    System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3c() +117

    System.Web.Mvc.Async.<>c__DisplayClass45.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3e() +323

    System.Web.Mvc.Async.<>c__DisplayClass30.<BeginInvokeActionMethodWithFilters>b__2f(IAsyncResult asyncResult) +44

    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +47

    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +136

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +102

    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50

    System.Web.Mvc.Async.<>c__DisplayClass28.<BeginInvokeAction>b__19() +72

    System.Web.Mvc.Async.<>c__DisplayClass1e.<BeginInvokeAction>b__1b(IAsyncResult asyncResult) +185

    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +42

    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +133

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +56

    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +40

    System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +34

    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70

    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40

    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +44

    System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +39

    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +62

    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40

    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +39

    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +39

    System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(IAsyncResult asyncResult, ProcessRequestState innerState) +39

    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +70

    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +139

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +59

    System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40

    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +40

    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38

    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514928

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446

    Please let me know if you have questions.

    Thanks

    Esha

  • Wow. Now that is a stack dump.

    Anyway, since you have other clients (your laptop) that can connect to the SQL Server, we can rule out just about everything on the SQL Server side. i find that the Windows Firewall is almost always to blame for these problems. If you have not already, I highly recommend logging dropped packets on the SQL Server, and on the IIS machine. This command (run as administrator) will set that up. The GUI is a little horrid.

    netsh advfirewall set allprofiles logging droppedconnections enable

    Once logging is enabled, check the logs on both machines to see if any traffic is being dropped for UDP port 1434 on the SQL Server side, or the TCP port which SQL Server is listening for. The IIS machine may be blocking responses from the SQL Server (very common on Failover Cluster instances). In that case, you can open the firewall on the IIS machine to allow traffic from the remote UDP port 1434, and you should be all set.

  • the error says it all, your connection string is wrong. Does your SQL server have an instance name or is it default? are you using a default port?

    MCSE SQL Server 2012\2014\2016

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply