SPHttpThrottleSettings.AddThrottleClassifier - Méthode
Ajoute un classifieur de demande HTTP à la collection de ThrottleClassifiers de l'objet SPHttpThrottleSettings .
Espace de noms : Microsoft.SharePoint.Utilities
Assembly : Microsoft.SharePoint (dans Microsoft.SharePoint.dll)
Syntaxe
'Déclaration
Public Sub AddThrottleClassifier ( _
classifier As SPRequestThrottleClassifier _
)
'Utilisation
Dim instance As SPHttpThrottleSettings
Dim classifier As SPRequestThrottleClassifier
instance.AddThrottleClassifier(classifier)
public void AddThrottleClassifier(
SPRequestThrottleClassifier classifier
)
Paramètres
classifier
Type : Microsoft.SharePoint.Utilities.SPRequestThrottleClassifierLe classifieur est ajouté.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | classifier est une référence Null (Rien dans Visual Basic). |
ArgumentException | classifier est déjà dans la collection. |
Exemples
L'exemple de code suivant illustre la méthode en cours d'utilisation. Pour obtenir l'exemple complet, consultez How to: Create and Register or Deregister a Request Classifier.
// Get a reference to the throttle settings
Uri webApplicationUri = new Uri("Http://localhost/");
SPWebApplication webApplication = SPWebApplication.Lookup(webApplicationUri);
SPHttpThrottleSettings throttleSettings = SPHttpThrottleSettings.GetHttpThrottleSettings(webApplication);
// Create the classifier object
SPHttpFileExtensionThrottleClassifier docxClassifier = new SPHttpFileExtensionThrottleClassifier(".docx",SPRequestThrottleLevel.FirstStage);
// Add it to the collection of classifiers
throttleSettings.AddThrottleClassifier(docxClassifier);
' Get a reference to the throttle settings
Dim webApplicationUri As New Uri("Http://localhost/")
Dim webApplication As SPWebApplication = SPWebApplication.Lookup(webApplicationUri)
Dim throttleSettings As SPHttpThrottleSettings = SPHttpThrottleSettings.GetHttpThrottleSettings(webApplication)
' Create the classifier object
Dim docxClassifier As New SPHttpFileExtensionThrottleClassifier(".docx",SPRequestThrottleLevel.FirstStage)
' Add it to the collection of classifiers
throttleSettings.AddThrottleClassifier(docxClassifier)