LocalServiceSecuritySettings Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides local service security properties that can be set.
public ref class LocalServiceSecuritySettings sealed
public sealed class LocalServiceSecuritySettings
type LocalServiceSecuritySettings = class
Public NotInheritable Class LocalServiceSecuritySettings
- Inheritance
-
LocalServiceSecuritySettings
This example shows how to use the LocalServiceSecuritySettings class to change the DetectReplays setting.
// 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();
This class contains the local security settings used by the SecurityBindingElement to build the security channel. These settings are local to the service and are not represented in the service's security policy.
Local |
Initializes a new instance of the LocalServiceSecuritySettings class. |
Detect |
Gets or sets a value that indicates whether replay detection is enabled on the service. |
Inactivity |
Gets or sets the duration to wait before the channel is closed due to inactivity. |
Issued |
Gets or sets the lifetime for the SecurityContextSecurityToken that the service issues for the client. |
Max |
Gets or sets the maximum number of SecurityContextSecurityTokens that the service allows to cache at once. |
Max |
Gets or sets the maximum allowable time difference between the system clocks of the two parties that are communicating. |
Max |
Gets or sets the maximum number of concurrent security sessions that are established with the server for which it has issued a session token but for which no application messages are sent. |
Max |
Gets or sets the maximum number of concurrent security negotiations with clients that the service can participate in. |
Negotiation |
Gets or sets the maximum duration of the security negotiation phase between client and service. |
Nonce |
Gets or sets the cache for the local service security settings. |
Reconnect |
Gets or sets a value that indicates whether security sessions attempt to reconnect after transport failures. |
Replay |
Gets or sets the size of the nonce cache used for replay detection. |
Replay |
Gets or sets the maximum amount of time within which the service can accept a message. |
Session |
Gets or sets the lifetime of a key used in a security session. When this interval expires the key is automatically renewed. |
Session |
Gets or sets the time interval after key renewal for which the previous session key is valid on incoming messages during a key renewal. |
Timestamp |
Gets or sets the maximum duration of time that messages are valid when sent by the service. If the client receives the service's message after this duration, it discards the message. |
Clone() |
Creates a new instance of this class from the current instance. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
Produkt | Versjoner |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET-tilbakemelding
.NET er et åpen kilde-prosjekt. Velg en kobling for å gi tilbakemelding: