2009-10-02 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Fri, 2 Oct 2009 08:09:40 +0000 (08:09 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Fri, 2 Oct 2009 08:09:40 +0000 (08:09 -0000)
* ServiceHostBase.cs : apply endpoint behavior section in config.
  Otherwise WebScriptEnablingBehavior won't be created.

svn path=/trunk/mcs/; revision=143252

mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs

index 0374dbed9763918299dc2d2bd6ef956de0a2eba3..809a698ec35c75faa739c9c5d3f9be3d6f0a0be2 100755 (executable)
@@ -1,3 +1,8 @@
+2009-10-02  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ServiceHostBase.cs : apply endpoint behavior section in config.
+         Otherwise WebScriptEnablingBehavior won't be created.
+
 2009-10-01  Atsushi Enomoto  <atsushi@ximian.com>
 
        * ServiceHostBase.cs : fill behaviors first, then add endpoints.
index c85802c3ab244597da83c5fe294fd198119ac1e5..3d21380b7bd2ec28cc8f100909c61d22af2a85de 100644 (file)
@@ -300,11 +300,9 @@ namespace System.ServiceModel
                                // TODO: use EvaluationContext of ServiceElement.
                                ServiceBehaviorElement behavior = ConfigUtil.BehaviorsSection.ServiceBehaviors [service.BehaviorConfiguration];
                                if (behavior != null) {
-                                       for (int i = 0; i < behavior.Count; i++) {
-                                               BehaviorExtensionElement bxel = behavior [i];
-                                               IServiceBehavior b = (IServiceBehavior) behavior [i].CreateBehavior ();
-                                               if (b != null)
-                                                       Description.Behaviors.Add (b);
+                                       foreach (var bxe in behavior) {
+                                               IServiceBehavior b = (IServiceBehavior) bxe.CreateBehavior ();
+                                               Description.Behaviors.Add (b);
                                        }
                                }
 
@@ -315,6 +313,13 @@ namespace System.ServiceModel
                                                endpoint.Contract,
                                                ConfigUtil.CreateBinding (endpoint.Binding, endpoint.BindingConfiguration),
                                                endpoint.Address.ToString ());
+                                       // endpoint behaviors
+                                       EndpointBehaviorElement epbehavior = ConfigUtil.BehaviorsSection.EndpointBehaviors [endpoint.BehaviorConfiguration];
+                                       if (epbehavior != null)
+                                               foreach (var bxe in epbehavior) {
+                                                       IEndpointBehavior b = (IEndpointBehavior) bxe.CreateBehavior ();
+                                                       se.Behaviors.Add (b);
+                                       }
                                }
                        }
                        // TODO: consider commonBehaviors here