SORU
22 Aralık 2011, PERŞEMBE


Zaman aşımı süresi doldu. Zaman aşımı süresi işlem tamamlanmadan önce geçen veya sunucu yanıt vermiyor. Deyim sonlandırıldı

lütfen aşağıdaki hata görürsünüz :

Server Error in '/' Application.
Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)  404
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()  412
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)  1363
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)  6387741
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)  6389442
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)  538
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)  689
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery()  327
   NovinMedia.Data.DbObject.RunProcedure(String storedProcName, IDataParameter[] parameters, Int32& rowsAffected)  209
   DataLayer.OnlineUsers.Update_SessionEnd_And_Online(Object Session_End, Boolean Online)  440
   NiceFileExplorer.Global.Application_Start(Object sender, EventArgs e)  163

[HttpException (0x80004005): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)  4052053
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)  191
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)  352
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)  407
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)  375

[HttpException (0x80004005): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
The statement has been terminated.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context)  11686928
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)  141
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)  4863749

ben gerçekten bu hata hakkında karıştı
web sitem (20000~60000 günlük) çok sayıda kullanıcı var(mobil dosyaları için bir yükleme bölgesi) ve benim sunucu (windows server 2008-R2) için uzaktan erişim var.
bazı zamanlar server is unavailable error var ama n. bağlantı zaman aşımı şu ana kadar hata görmedim.
neden bu hata accours ve bunu nasıl düzeltebilirim?

CEVAP: SONRA DÜZENLE
Genel olarak benim Application_Start.asax gibi aşağıda :

protected void Application_Start(object sender, EventArgs e)
{
    Application["OnlineUsers"] = 0;

    OnlineUsers.Update_SessionEnd_And_Online(
        DateTime.Now,
        false);

    AddTask("DoStuff", 10);
}

Bu saklı yordam karınca :

ALTER Procedure [dbo].[sp_OnlineUsers_Update_SessionEnd_And_Online]
    @Session_End datetime,
    @Online bit
As
Begin
    Update OnlineUsers
    SET
        [Session_End] = @Session_End,
        [Online] = @Online

End

onlineusers almak için iki yöntem var.
1-kullanma Uygulaması [""] OnlineUsers = 0;
2-başka bir Veritabanı kullanarak.

yani, yöntem #2 Ben Application_Start Hiç OnlineUsers sıfırlamak gerekir.
ve bu tablodaki 482,751 kaydı vardır.

CEVAP
22 Aralık 2011, PERŞEMBE


Daha uzun sürecek bir sorgu var gibi görünüyor. Senin yığın izleme ve kod tam olarak ne olduğunu belirlemek gerekir.

Zaman aşımı bu tür üç neden; olabilir

  1. Bir kilitlenme var
  2. Veritabanı istatistiklerini ve/veya sorgu planı önbelleğe yanlıştır
  3. Bu sorgu çok karmaşık ve ayarlı olması gerekir

Bir kilitlenme düzeltmek için zor olabilir, ama kolay bir durum olup olmadığını belirlemek için. Sql Server Management Studio ile veritabanına bağlanmak. Sağ sunucu üzerindeki sol bölmede düğüm ve seçinEtkinlik İzleyicisi. Çalışan süreçleri bir göz atın. Normalde çoğu boş ya da yayınlanmaya başlayacak. Bu sorun oluştuğunda süreç devlet tarafından herhangi bir bloke işlemi tanımlayabilirsiniz. Sağ tıklatın süreci ve seçinayrıntılarson sorgu işlemi tarafından yürütülen gösterecek.

İkinci sorun, veritabanı alt-en iyi sorgu planı kullanmak için neden olur. İstatistikler temizleyerek çözülebilir:

exec sp_updatestats

Eğer bu işe yaramaz ise hiç de deneyebilirsiniz

dbcc freeproccache

Saklı yordamlara ve sorguları tüm ilk çalıştırıldığında çekirdekler gibi geçici olarak büyük bir performans isabet etmiş olur çünkü sunucu ağır yük altında olduğunda, bunu kullanmayın. State beri ancak, sorun ortaya çıkarbazenve izleme uygulama başlatılıyor gösterir yığını, sadece zaman zaman kaçak bir sorgu çalışan sensin bence. Önceki SQL Server bir sorgu planı yeniden zorlayarak daha iyi olabilir. Bunun nasıl yapılacağı hakkında ayrıntılar için this answer bkz.

Zaten üçüncü konuda dokunmadım, ama kolayca sorgu el ile sorgu, örnek Sql Server Management Studio kullanarak yürüterek ayar gerekli olup olmadığını belirleyebilirsiniz. Eğer sorgu çok uzun, hatta istatistiklerini sıfırlamadan sonra sürüyorsa, muhtemelen ayarlamak için ihtiyacınız olacak. Bu konuda yardım için, yeni bir soru tam sorgu göndermek gerekir.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • khloe brooks

    khloe brooks

    25 Temmuz 2011
  • Makeup Lover

    Makeup Lover

    12 HAZİRAN 2011
  • TheDailyTechDose

    TheDailyTech

    15 EKİM 2012