LocalServiceSecuritySettings Class
Provides local service security properties that can be set.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
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.
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();
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.