8

Bu hata beni çıldırtıyor ve ben bile üretemiyorum!Azure web sitesi Azure DB'ye erişemiyor

Web sitemi Windows Azure ve SQL Azure'a yayınladım ve harika çalıştı. Tüm ani çalışmıyor ve ben bu pis hata alıyorum:

İşte

hata olsun edilmektedir: istediğim

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)

:

İşte http://jsfiddle.net/shimmy/pcS7g/embedded/result

hata var SQL'e SSMS veya VS üzerinden erişebileceğimi ve tablolarımı görebileceğimi vurgulamak için

Bu sinir bozucu hataya neden olan hiçbir ipucum yok her dağıtımdan sonra tekrar ve tekrar olur. Hatta çalıştı

<connectionStrings> 
    <add name="Context" connectionString="Data Source=tcp:abcdefg.database.windows.net,1433;Initial Catalog=Database;User [email protected]:abcdefg;Password=my123password;" providerName="System.Data.SqlClient" /> 
    <add name="Storage" connectionString="DefaultEndpointsProtocol=https;AccountName=accountname;AccountKey=accountkey==" /> 
</connectionStrings> 

:

Yığın izleme: onlar sunucunun web.config göründükleri gibi

[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)] 
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5295167 
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +242 
    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5307115 
    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) +920 
    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) +434 
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +5309659 
    System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) +38 
    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +5311874 
    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +143 
    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +83 
    System.Data.SqlClient.SqlConnection.Open() +96 
    System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +76 

[HttpException (0x80004005): Unable to connect to SQL Server database.] 
    System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +131 
    System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +89 
    System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +27 
    System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +386 

Güncelleme İşte

bağlantı dizeleri bir kopyasıdır Bağlantı dizelerini tamamen sunucu web.config dosyasından kaldırın. Bu App_Data'un nereden geldiği hakkında hiçbir fikrim yok!

Benim DbContext şuna benzer:

public Context() 
    : base("name=Context") //I also tried "Context" alone 
{ 
} 
+0

Bu garip. Örnekleri doğrulayabilir ve doğru bağlantı dizelerini kullandığınızdan emin olmak için web.config dosyasına bakabilir misiniz? – Win

+0

Buna oldukça yeniyim, bir Azure sunucusunu nasıl çalıştırabilirsiniz? – Shimmy

+0

http://www.windowsazure.com/en-us/develop/net/common-tasks/remote-desktop/ – Win

cevap

6

sizin uygulama SQL Server Express yerel örneğinde projenizde ekli dosyası kullanarak bir veritabanı oluşturmayı mümkün bekliyor anlaşılmaktadır. Hata mesajında ​​kilit çizgidir:

The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory.

Muhtemelen Azure web bağlantı dizesini eşleşmesi için yapılandırma dosyasındaki bağlantı dizesini güncellemeniz gerekir. Web sitesini bir SQL Server ile kurduktan ve aynı gösterge panosundan ayarlandığında, bu bilgiler Azure panosunda elde edilebilir. Ben aynı sorunu vardı ve

http://blog.davidebbo.com/2012/09/managing-database-connections-in-azure.html

+0

Web.config.cloud adresinizi kontrol edin ve doğru bağlantı dizgisine sahip olduğunuzdan veya orada belirtilen dönüşüme sahip olduğunuzdan emin olun –

+0

Sunucu web.configuration üzerindeki bağlantı dizesini kontrol ettim ve orada App_Data ile bağlantıya değinilmedim ... – Shimmy

8

ben bu gerçekten eski bir yazı olduğunu biliyorum ama sadece aynı konuyu mücadele ... bende yok olsa':

Yapmaya yönelik iyi talimatları var Anladığım kadarıyla, şu anda giriş yapmış olsam (sitemde Azure konsolu değil), çıkış yapmam gerektiğini ve sonra tekrar açmam gerektiğini ve bu veritabanı hatasının kaybolduğunu keşfettim. Benim için hiçbir şey ifade etmiyor, ama konuşmamdan sonra benim için işe yarayan şey bu. Yerleştirdiğim birçok yerim var ve her şey harika çalışıyor (oturuma/giriş yapmaya gerek yok). Bazen bu moda geçer. Orada neler olduğundan emin değilim.

Web.config dosyanızdaki bağlantı dizeleriyle ilgisi yoktur - hepsi doğru şekilde dönüştürülür.

+0

teşekkürler @CPank, tarayıcıyı yeniden başlattığınız gibi, sadece – hawbsl

+1

tanımladığınız gibi sizlersiniz! Saçımı çekiyordum, sonra yazıyı okuduktan sonra sadece kurabiyelerimi temizledim ve problem gitti! Seni korusun efendim. – N1njaB0b

İlgili konular