BasicHttpBinding Constructor ()

BasicHttpBinding.BasicHttpBinding() Constructor

Initializes a new instance of the BasicHttpBinding class.

Namespace: System.ServiceModel
Assembly: System.ServiceModel (in system.servicemodel.dll)

public BasicHttpBinding ()
public BasicHttpBinding ()
public function BasicHttpBinding ()
Not applicable.

The default value of BasicHttpSecurityMode used is None, which specifies that the SOAP message is not secured and the client is not authenticated.

BasicHttpBinding binding = new BasicHttpBinding();
binding.Name = "binding1";
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
binding.Security.Mode = BasicHttpSecurityMode.None;

Uri baseAddress = new Uri("http://localhost:8000/servicemodelsamples/service");
Uri address = new Uri("http://localhost:8000/servicemodelsamples/service/calc");

// Create a ServiceHost for the CalculatorService type and provide the base address.
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, address);

// Open the ServiceHostBase to create listeners and start listening for messages.
serviceHost.Open();

// The service can now be accessed.
Console.WriteLine("The service is ready.");
Console.WriteLine("Press <ENTER> to terminate service.");
Console.WriteLine();
Console.ReadLine();
        
// Close the ServiceHostBase to shutdown the service.
serviceHost.Close();


Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2016 Microsoft