LocalServiceSecuritySettings Klasa

Definicja

Zapewnia właściwości zabezpieczeń usługi lokalnej, które można ustawić.

public ref class LocalServiceSecuritySettings sealed
public sealed class LocalServiceSecuritySettings
type LocalServiceSecuritySettings = class
Public NotInheritable Class LocalServiceSecuritySettings
Dziedziczenie
LocalServiceSecuritySettings

Przykłady

W tym przykładzie pokazano, jak zmienić DetectReplays ustawienie za LocalServiceSecuritySettings pomocą klasy.

    // Create an instance of the binding to use.
    WSHttpBinding b = new WSHttpBinding();

    // Get the binding element collection.
    BindingElementCollection bec = b.CreateBindingElements();

    // Find the SymmetricSecurityBindingElement in the colllection.
    // Important: Cast to the SymmetricSecurityBindingElement when using the Find
    // method.
    SymmetricSecurityBindingElement sbe = (SymmetricSecurityBindingElement)
bec.Find<SecurityBindingElement>();

    // Get the LocalServiceSettings from the binding element.
    LocalServiceSecuritySettings lss = sbe.LocalServiceSettings;

    // Print out values.
    Console.WriteLine("DetectReplays: {0} days", lss.DetectReplays);
    Console.WriteLine("ReplayWindow: {0} minutes", lss.ReplayWindow.Minutes);
    Console.WriteLine("MaxClockSkew: {0} minutes", lss.MaxClockSkew.Minutes);

    Console.ReadLine();
    Console.WriteLine("Press Enter to Continue");
    // Change the MaxClockSkew to 3 minutes.
    lss.MaxClockSkew = new TimeSpan(0, 0, 3, 0);

    // Print the new value.
    Console.WriteLine("New MaxClockSkew: {0} minutes", lss.MaxClockSkew.Minutes);
    Console.WriteLine("Press Enter to End");
    Console.ReadLine();

    // Create a URI for the service.
    Uri httpUri = new Uri("http://localhost/calculator");

    // Create a ServiceHost. The binding has the changed MaxClockSkew.
    ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);
    sh.AddServiceEndpoint(typeof(ICalculator), b, "");
    // sh.Open();
    // Console.WriteLine("Listening");
    // Console.ReadLine();
    // sh.Close();
' Create an instance of the binding to use.
Dim b As New WSHttpBinding()

' Get the binding element collection.
Dim bec As BindingElementCollection = b.CreateBindingElements()

' Find the SymmetricSecurityBindingElement in the colllection.
' Important: Cast to the SymmetricSecurityBindingElement when using the Find
' method.
Dim sbe As SymmetricSecurityBindingElement = CType(bec.Find(Of SecurityBindingElement)(), SymmetricSecurityBindingElement)

' Get the LocalServiceSettings from the binding element.
Dim lss As LocalServiceSecuritySettings = sbe.LocalServiceSettings

' Print out values.
Console.WriteLine("DetectReplays: {0} days", lss.DetectReplays)
Console.WriteLine("ReplayWindow: {0} minutes", lss.ReplayWindow.Minutes)
Console.WriteLine("MaxClockSkew: {0} minutes", lss.MaxClockSkew.Minutes)

Console.ReadLine()
Console.WriteLine("Press Enter to Continue")
' Change the MaxClockSkew to 3 minutes.
lss.MaxClockSkew = New TimeSpan(0, 0, 3, 0)

' Print the new value.
Console.WriteLine("New MaxClockSkew: {0} minutes", lss.MaxClockSkew.Minutes)
Console.WriteLine("Press Enter to End")
Console.ReadLine()

' Create a URI for the service.
Dim httpUri As New Uri("http://localhost/calculator")

' Create a ServiceHost. The binding has the changed MaxClockSkew.
Dim sh As New ServiceHost(GetType(Calculator), httpUri)
sh.AddServiceEndpoint(GetType(ICalculator), b, "")
' sh.Open();
' Console.WriteLine("Listening");
' Console.ReadLine();
' sh.Close();

Uwagi

Ta klasa zawiera lokalne ustawienia zabezpieczeń używane przez SecurityBindingElement program do tworzenia kanału zabezpieczeń. Te ustawienia są lokalne dla usługi i nie są reprezentowane w zasadach zabezpieczeń usługi.

Konstruktory

LocalServiceSecuritySettings()

Inicjuje nowe wystąpienie klasy LocalServiceSecuritySettings.

Właściwości

DetectReplays

Pobiera lub ustawia wartość wskazującą, czy wykrywanie odtwarzania jest włączone w usłudze.

InactivityTimeout

Pobiera lub ustawia czas oczekiwania przed zamknięciem kanału z powodu braku aktywności.

IssuedCookieLifetime

Pobiera lub ustawia okres istnienia dla SecurityContextSecurityToken klienta, który ma problemy z usługą.

MaxCachedCookies

Pobiera lub ustawia maksymalną liczbę SecurityContextSecurityTokens, którą usługa umożliwia buforowanie jednocześnie.

MaxClockSkew

Pobiera lub ustawia maksymalną dozwoloną różnicę czasu między zegarami systemowymi obu stron, które komunikują się.

MaxPendingSessions

Pobiera lub ustawia maksymalną liczbę współbieżnych sesji zabezpieczeń ustanowionych z serwerem, dla którego wydał token sesji, ale dla których nie są wysyłane żadne komunikaty aplikacji.

MaxStatefulNegotiations

Pobiera lub ustawia maksymalną liczbę równoczesnych negocjacji zabezpieczeń z klientami, w których może uczestniczyć usługa.

NegotiationTimeout

Pobiera lub ustawia maksymalny czas trwania fazy negocjacji zabezpieczeń między klientem a usługą.

NonceCache

Pobiera lub ustawia pamięć podręczną ustawień zabezpieczeń usługi lokalnej.

ReconnectTransportOnFailure

Pobiera lub ustawia wartość wskazującą, czy sesje zabezpieczeń próbują ponownie nawiązać połączenie po awariach transportu.

ReplayCacheSize

Pobiera lub ustawia rozmiar pamięci podręcznej innej niż używana do wykrywania odtwarzania.

ReplayWindow

Pobiera lub ustawia maksymalny czas, w którym usługa może zaakceptować komunikat.

SessionKeyRenewalInterval

Pobiera lub ustawia okres istnienia klucza używanego w sesji zabezpieczeń. Po wygaśnięciu tego interwału klucz zostanie automatycznie odnowiony.

SessionKeyRolloverInterval

Pobiera lub ustawia interwał czasu po odnowieniu klucza, dla którego poprzedni klucz sesji jest prawidłowy dla komunikatów przychodzących podczas odnawiania klucza.

TimestampValidityDuration

Pobiera lub ustawia maksymalny czas trwania komunikatów, które są prawidłowe podczas wysyłania przez usługę. Jeśli klient otrzyma komunikat usługi po tym czasie, odrzuci komunikat.

Metody

Clone()

Tworzy nowe wystąpienie tej klasy z bieżącego wystąpienia.

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy