2016-07-22 10 views
4

Da wir nach Azure umgezogen sind, sehen wir ein paar Probleme mit unserer DB.Intermittierende System.ComponentModel.Win32Exception: Der Netzwerkpfad wurde nicht gefunden

System.ComponentModel.Win32Exception: Der Netzwerkpfad

Mit diesem Aufruf Stapel nicht gefunden wurde:

System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> 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) ---> System.ComponentModel.Win32Exception: The network path was not found 
    --- End of inner exception stack trace --- 
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) 
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) 
    at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) 
    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) 
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) 
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) 
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) 
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) 
    at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) 
    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.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) 
    at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) 
    at System.Data.SqlClient.SqlConnection.Open() 
    at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) 
    at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) 
    at System.Data.Entity.Infrastructure.DbExecutionStrategy.<>c__DisplayClass1.<Execute>b__0() 
    at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation) 
    at System.Data.Entity.Core.EntityClient.EntityConnection.Open() 
    --- End of inner exception stack trace --- 
    at System.Data.Entity.Core.EntityClient.EntityConnection.Open() 
    at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions) 
    at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) 
    at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5() 
    at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation) 
    at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) 
    at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0() 
    at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() 
    at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) 
    at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate) 

Die recommandation ou Tier von S0 bis S1 zu erhöhen war, was wir tat, immer noch nicht geholfen.

Die zweite Frage ist:

System.ComponentModel.Win32Exception: Ein Verbindungsversuch ist fehlgeschlagen, da die verbundene Partei nicht richtig nach einer Zeitspanne reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da die verbundene Host ausgefallen reagieren

dritte ist:

System.Data.SqlClient.SqlException: Anmeldung für den Benutzer 'MyUserName'.

Wir haben versucht:

public class SqlAzureConfiguration : DbConfiguration 
    { 
     public SqlAzureConfiguration() { 
      SetExecutionStrategy("System.Data.SqlClient",() => new SqlAzureExecutionStrategy()); 
     } 
    } 

, die nicht helfen. Irgendwelche Ideen, was ist das Problem und wie man es angeht?

Edit 1: Unsere Website bleibt jetzt versagt. Ich habe einen Screenshot mit der Anzahl der DTUs gemacht. Wie Sie sehen können, haben wir 20 DTUs, und es scheitert auch bei einem sehr niedrigen Nutzungsgrad.

DTU usage

EDIT 2

Wir Sitzungen mehr als Grenze vermuten, wir diejenigen auf AppInsight verfolgt, immer noch nicht das Problem: Sessions numbers on AppInsight

+0

Welche Verbindungszeichenfolge verwenden Sie? (Entfernen Sie alle vertraulichen Informationen, um den Server zu schützen.) –

+0

@drediske onnectionString = "Server = tcp: ********. Database.windows.net, 1433; Datenquelle = *****. Database .windows.net; Initial Catalog = Produktion; Persistent Sicherheitsinfo = False; Benutzer-ID = *****; Kennwort = ****; Pooling = False; MultipleActiveResultSets = True; Encrypt = True; TrustServerCertificate = False; Verbindungstimeout = 30; – MBen

+0

Nicht sicher, ob relevant, aber das passiert, wenn wir einen Webhook erhalten. Und da wir einen Webhook für die gleiche Firma erhalten können, benutzen wir einige Locks. Könnte das das Problem sein? – MBen

Antwort

0

Wir haben die Timeout in der Connectionstring aus erhöht:

Verbindungstimeout = 30;

zu

Connection Timeout = 1800;

und das hat geholfen. Es war eine Woche und wir haben bisher keine Probleme gesehen.

0

Jeder, bei dem dieser Fehler auftritt, insbesondere bei Azure, versuchen Sie, in Ihrer Verbindungszeichenfolge in Ihrer Anwendung "tcp:" zum db-server-name hinzuzufügen. Dies zwingt den SQL-Client zur Kommunikation mit der Datenbank mit TCP. Ich gehe davon aus, dass die Verbindung standardmäßig UDP ist und es zu zeitweiligen Verbindungsproblemen kommen kann.Dies ist ein etwas anderes Szenario als das, was der OP als seine Verbindungszeichenfolge geschrieben hat tcp, es ist wichtig, dies dennoch zu versuchen

Verwandte Themen