Share via


HostingEnvironmentSection.ShutdownTimeout 属性

定义

获取或设置正常关闭应用程序的时间长度(以秒为单位)。

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

属性值

一个 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 秒。 可以在计算机或应用程序级别设置此设置。 如果在任何其他配置级别定义此设置,则忽略此设置。 如果将调试器附加到应用程序,则不会关闭该应用程序。

适用于