Share via


FileWebRequest.Timeout Özellik

Tanım

İstek zaman aşımına uyana kadar olan süreyi alır veya ayarlar.

public:
 virtual property int Timeout { int get(); void set(int value); };
public override int Timeout { get; set; }
member this.Timeout : int with get, set
Public Overrides Property Timeout As Integer

Özellik Değeri

İstek zaman aşımına uğradıysa milisaniye cinsinden süre veya isteğin zaman aşımına uğradı olmadığını belirten değer Infinite .

Özel durumlar

Belirtilen değer sıfırdan küçük veya sıfıra eşit ve değeri değildir Infinite.

Örnekler

Aşağıdaki kod örneği özelliğini ayarlar Timeout . sınıfındaki tam örne FileWebRequest bakın.

// Create a Uri object.
Uri^ myUrl = gcnew Uri( String::Format( "file://{0}", fileName ) );

// Create a FileWebRequest object.
myFileWebRequest = dynamic_cast<FileWebRequest^>(WebRequest::CreateDefault( myUrl ));

// Set the timeout to the value selected by the user.
myFileWebRequest->Timeout = timeout;
// Create a Uri object.
Uri myUrl = new Uri ("file://" + fileName);

// Create a FileWebRequest object.
myFileWebRequest = (FileWebRequest)WebRequest.CreateDefault (myUrl);

// Set the time-out to the value selected by the user.
myFileWebRequest.Timeout = timeout;
' Create a Uri object.to access the file requested by the user. 
Dim myUrl As New Uri("file://" + fileName)

' Create a FileWebRequest object.for the requeste file.
myFileWebRequest = CType(WebRequest.CreateDefault(myUrl), FileWebRequest)

' Set the time-out to the value selected by the user.
myFileWebRequest.Timeout = timeout

Açıklamalar

Etki Alanı Adı Sistemi (DNS) sorgusu döndürülmesi veya zaman aşımına uğrarken 15 saniye kadar sürebilir. İsteğiniz çözüm gerektiren bir ana bilgisayar adı içeriyorsa ve 15 saniyeden kısa bir değere ayarlarsanız Timeout , isteğinizde zaman aşımını belirtmek için bir WebException oluşturma işlemi 15 saniye veya daha uzun sürebilir.

Şunlara uygulanır