IdeaBlade.EntityModel.Server Assembly > IdeaBlade.EntityModel.Server Namespace : ServiceHostEvents Class |
'Declaration
<DefaultExportAttribute(IsDefault=True, ContractName="", ContractType=IdeaBlade.EntityModel.Server.ServiceHostEvents)> Public Class ServiceHostEvents
'Usage
Dim instance As ServiceHostEvents
[DefaultExport(IsDefault=true, ContractName="", ContractType=IdeaBlade.EntityModel.Server.ServiceHostEvents)] public class ServiceHostEvents
using System; using System.ComponentModel.Composition; using System.ServiceModel.Channels; using System.ServiceModel.Description; using IdeaBlade.EntityModel.Server; public class MyServiceHostEvents : ServiceHostEvents { // Called after an endpoint is created. public override void OnEndpointCreated(ServiceEndpoint endpoint) { // Here we'll tweak the binding to add message security. // Bindings used in DevForce are by default the CustomBinding type. if (endpoint.Binding is CustomBinding) { var binding = endpoint.Binding as CustomBinding; var elements = binding.CreateBindingElements(); // This just inserts the equivalent of a <security authenticationMode="SspiNegotiated"> // element to the binding. var sec = new SymmetricSecurityBindingElement(); sec.ProtectionTokenParameters = new System.ServiceModel.Security.Tokens.SspiSecurityTokenParameters(); elements.Insert(1, sec); // Replace the binding on the endpoint. endpoint.Binding = new CustomBinding(elements); } // Let's change the default timeouts too. endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 2, 0); endpoint.Binding.SendTimeout = new TimeSpan(0, 2, 0); } // Called after the service has been configured but before it has opened. public override void OnServiceHostCreated(System.ServiceModel.ServiceHost host) { // Let's add a MEX endpoint and metadata behavior, using this utility function. IdeaBlade.EntityModel.RemoteServiceFns.AddMexEndpoint(host); } }
System.Object
IdeaBlade.EntityModel.Server.ServiceHostEvents
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2