WebScriptServiceHost.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / WebScriptServiceHost.cs / 1 / WebScriptServiceHost.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------

namespace System.ServiceModel 
{
    using System.IO; 
    using System.Collections.Generic; 
    using System.ServiceModel.Description;
    using System.Diagnostics.CodeAnalysis; 
    using System.Configuration;
    using System.ServiceModel.Web;
    using System.Net;
    using System.ServiceModel.Channels; 

    class WebScriptServiceHost : ServiceHost 
    { 
        public WebScriptServiceHost(Type serviceType, params Uri[] baseAddresses)
            : 
            base(serviceType, baseAddresses)
        {
        }
 
        protected override void OnOpening()
        { 
            base.OnOpening(); 

            WebServiceHost.AddAutomaticWebHttpBindingEndpoints(this, this.ImplementedContracts, 
                SR2.GetString(SR2.JsonWebScriptServiceHostOneServiceContract, this.ImplementedContracts.Count));
            foreach (ServiceEndpoint endpoint in this.Description.Endpoints)
            {
                if (endpoint.Binding != null && endpoint.Binding.CreateBindingElements().Find() != null) 
                {
                    if (endpoint.Behaviors.Find() == null) 
                    { 
                        endpoint.Behaviors.Add(new WebScriptEnablingBehavior());
                    } 
                }
            }
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK