return AddServiceEndpointCore (cd, binding, ea, listenUri);
}
-#if NET_4_0
public virtual void AddServiceEndpoint (ServiceEndpoint endpoint)
{
if (endpoint == null)
Description.Endpoints.Add (endpoint);
}
-#endif
Type PopulateType (string typeName)
{
ServiceElement service = GetServiceElement ();
if (service != null)
- ApplyServiceElement (service);
-#if NET_4_0
+ LoadConfigurationSection (service);
// simplified configuration
AddServiceBehaviors (String.Empty, false);
-#endif
// TODO: consider commonBehaviors here
// ensure ServiceAuthorizationBehavior
void AddServiceBehaviors (string configurationName, bool throwIfNotFound)
{
-#if NET_4_0
if (configurationName == null)
return;
-#else
- if (String.IsNullOrEmpty (configurationName))
- return;
-#endif
ServiceBehaviorElement behavior = ConfigUtil.BehaviorsSection.ServiceBehaviors [configurationName];
if (behavior == null) {
if (throwIfNotFound)
foreach (ServiceEndpointElement endpoint in service.Endpoints) {
ServiceEndpoint se;
-#if NET_4_0
var binding = String.IsNullOrEmpty (endpoint.Binding) ? null : ConfigUtil.CreateBinding (endpoint.Binding, endpoint.BindingConfiguration);
if (!String.IsNullOrEmpty (endpoint.Kind)) {
binding = ConfigUtil.GetBindingByProtocolMapping (endpoint.Address);
se = AddServiceEndpoint (endpoint.Contract, binding, endpoint.Address);
}
-#else
- var binding = ConfigUtil.CreateBinding (endpoint.Binding, endpoint.BindingConfiguration);
- se = AddServiceEndpoint (endpoint.Contract, binding, endpoint.Address);
-#endif
// endpoint behaviors
EndpointBehaviorElement epbehavior = ConfigUtil.BehaviorsSection.EndpointBehaviors [endpoint.BehaviorConfiguration];
foreach (ServiceEndpoint endPoint in Description.Endpoints)
endPoint.Validate ();
-#if NET_4_0
// In 4.0, it seems that if there is no configured ServiceEndpoint, infer them from the service type.
if (Description.Endpoints.Count == 0) {
foreach (Type iface in Description.ServiceType.GetInterfaces ())
AddServiceEndpoint (iface.FullName, binding, baddr);
}
}
-#endif
if (Description.Endpoints.FirstOrDefault (e => e.Contract != mex_contract && !e.IsSystemEndpoint) == null)
throw new InvalidOperationException ("The ServiceHost must have at least one application endpoint (that does not include metadata exchange endpoint) defined by either configuration, behaviors or call to AddServiceEndpoint methods.");
}
- [MonoTODO]
- protected void LoadConfigurationSection (ServiceElement element)
+ protected void LoadConfigurationSection (ServiceElement serviceSection)
{
- ServicesSection services = ConfigUtil.ServicesSection;
+ ApplyServiceElement (serviceSection);
}
- [MonoTODO]
protected override sealed void OnAbort ()
{
+ OnCloseOrAbort (TimeSpan.Zero);
}
Action<TimeSpan> close_delegate;
}
protected override void OnClose (TimeSpan timeout)
+ {
+ OnCloseOrAbort (timeout);
+ }
+
+ void OnCloseOrAbort (TimeSpan timeout)
{
DateTime start = DateTime.Now;
ReleasePerformanceCounters ();