HostingEnvironmentSection.ShutdownTimeout 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
它會設定或設定一個以秒為單位的時間,以優雅地關閉應用程式。
public:
property TimeSpan ShutdownTimeout { TimeSpan get(); void set(TimeSpan value); };
[System.ComponentModel.TypeConverter(typeof(System.Configuration.TimeSpanSecondsConverter))]
[System.Configuration.ConfigurationProperty("shutdownTimeout", DefaultValue="00:00:30")]
[System.Configuration.TimeSpanValidator(MaxValueString="10675199.02:48:05.4775807", MinValueString="00:00:00")]
public TimeSpan ShutdownTimeout { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Configuration.TimeSpanSecondsConverter))>]
[<System.Configuration.ConfigurationProperty("shutdownTimeout", DefaultValue="00:00:30")>]
[<System.Configuration.TimeSpanValidator(MaxValueString="10675199.02:48:05.4775807", MinValueString="00:00:00")>]
member this.ShutdownTimeout : TimeSpan with get, set
Public Property ShutdownTimeout As TimeSpan
屬性值
A TimeSpan 是指定幾秒鐘內優雅關閉應用程式。 預設值為 30 秒。
- 屬性
範例
以下程式碼範例說明如何使用該 ShutdownTimeout 屬性。 此程式碼範例是本類別更大範例 HostingEnvironmentSection 的一部分。
// Display ShutdownTimeout property
Console.WriteLine("Shutdown Timeout: {0}", configSection.ShutdownTimeout);
' Display the ShutdownTimeout property
Console.WriteLine("Shutdown Timeout: {0}", configSection.ShutdownTimeout)
備註
該屬性的預設值 ShutdownTimeout 是 30 秒。 此設定可在機器或應用程式層級設定。 若此設定在其他配置層級定義,則忽略。 若應用程式連接除錯器,應用程式不會被關閉。