ServicePointManager.DefaultConnectionLimit Properti

Definisi

Mendapatkan atau mengatur jumlah maksimum koneksi bersamaan yang ServicePoint diizinkan oleh objek.

public:
 static property int DefaultConnectionLimit { int get(); void set(int value); };
public static int DefaultConnectionLimit { get; set; }
static member DefaultConnectionLimit : int with get, set
Public Shared Property DefaultConnectionLimit As Integer

Nilai Properti

Jumlah maksimum koneksi bersamaan yang diizinkan oleh ServicePoint objek. Batas koneksi default adalah 10 untuk ASP.NET aplikasi yang dihosting dan 2 untuk semua yang lain. Ketika aplikasi berjalan sebagai host ASP.NET, tidak mungkin untuk mengubah nilai properti ini melalui file konfigurasi jika properti autoConfig diatur ke true. Namun, Anda dapat mengubah nilai secara terprogram ketika properti autoConfig adalah true. Atur nilai pilihan Anda sekali, saat AppDomain dimuat.

Pengecualian

DefaultConnectionLimit kurang dari atau sama dengan 0.

Contoh

Contoh kode berikut mengatur properti ini.

ServicePointManager::UseNagleAlgorithm = true;
ServicePointManager::Expect100Continue = true;
ServicePointManager::CheckCertificateRevocationList = true;
ServicePointManager::DefaultConnectionLimit = ServicePointManager::DefaultPersistentConnectionLimit;
ServicePointManager.UseNagleAlgorithm = true;
ServicePointManager.Expect100Continue = true;
ServicePointManager.CheckCertificateRevocationList = true;
ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit;
ServicePointManager.UseNagleAlgorithm = True
ServicePointManager.Expect100Continue = True
ServicePointManager.CheckCertificateRevocationList = True
ServicePointManager.DefaultConnectionLimit = _
    ServicePointManager.DefaultPersistentConnectionLimit

Keterangan

Properti DefaultConnectionLimit mengatur jumlah maksimum default koneksi bersamaan yang ServicePointManager ditetapkan objek ke ConnectionLimit properti saat membuat ServicePoint objek.

Mengubah DefaultConnectionLimit properti tidak berpengaruh pada objek yang ada ServicePoint ; hanya ServicePoint memengaruhi objek yang diinisialisasi setelah perubahan. Jika nilai properti ini belum diatur baik secara langsung atau melalui konfigurasi, nilai default ke konstanta DefaultPersistentConnectionLimit.

Catatan

Setiap perubahan pada DefaultConnectionLimit properti memengaruhi koneksi HTTP 1.0 dan HTTP 1.1. Tidak dimungkinkan untuk mengubah batas koneksi secara terpisah untuk protokol HTTP 1.0 dan HTTP 1.1.

Berlaku untuk

Lihat juga