BasicHttpBinding BasicHttpBinding BasicHttpBinding BasicHttpBinding Constructors

Definition

Überlädt

BasicHttpBinding() BasicHttpBinding() BasicHttpBinding()

Initialisiert eine neue Instanz der BasicHttpBinding-Klasse. Initializes a new instance of the BasicHttpBinding class.

BasicHttpBinding(BasicHttpSecurityMode) BasicHttpBinding(BasicHttpSecurityMode) BasicHttpBinding(BasicHttpSecurityMode) BasicHttpBinding(BasicHttpSecurityMode)

Initialisiert eine neue Instanz der BasicHttpBinding-Klasse mit einem von der Bindung verwendeten Sicherheitstyp. Initializes a new instance of the BasicHttpBinding class with a specified type of security used by the binding.

BasicHttpBinding(String) BasicHttpBinding(String) BasicHttpBinding(String) BasicHttpBinding(String)

Initialisiert eine neue Instanz der BasicHttpBinding-Klasse mit einer durch ihren Konfigurationsnamen angegebenen Bindung. Initializes a new instance of the BasicHttpBinding class with a binding specified by its configuration name.

BasicHttpBinding() BasicHttpBinding() BasicHttpBinding()

Initialisiert eine neue Instanz der BasicHttpBinding-Klasse. Initializes a new instance of the BasicHttpBinding class.

public:
 BasicHttpBinding();
public BasicHttpBinding ();
Public Sub New ()

Beispiele

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();

Dim binding As BasicHttpBinding = New BasicHttpBinding()
binding.Name = "binding1"
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
binding.Security.Mode = BasicHttpSecurityMode.None

Dim baseAddress As Uri = New Uri("http://localhost:8000/servicemodelsamples/service")
Dim address As Uri = New Uri("http://localhost:8000/servicemodelsamples/service/calc")

' Create a ServiceHost for the CalculatorService type and provide the base address.
Using serviceHost As ServiceHost = New ServiceHost(GetType(CalculatorService), baseAddress)

    serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, address)

    ' Open the ServiceHost 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 ServiceHost to shutdown the service.
    serviceHost.Close()
End Using

Hinweise

Der Standardwert des verwendeten BasicHttpSecurityMode ist None, wodurch angegeben wird, dass die SOAP-Nachricht nicht gesichert und der Client nicht authentifiziert ist.The default value of BasicHttpSecurityMode used is None, which specifies that the SOAP message is not secured and the client is not authenticated.

BasicHttpBinding(BasicHttpSecurityMode) BasicHttpBinding(BasicHttpSecurityMode) BasicHttpBinding(BasicHttpSecurityMode) BasicHttpBinding(BasicHttpSecurityMode)

Initialisiert eine neue Instanz der BasicHttpBinding-Klasse mit einem von der Bindung verwendeten Sicherheitstyp. Initializes a new instance of the BasicHttpBinding class with a specified type of security used by the binding.

public:
 BasicHttpBinding(System::ServiceModel::BasicHttpSecurityMode securityMode);
public BasicHttpBinding (System.ServiceModel.BasicHttpSecurityMode securityMode);
new System.ServiceModel.BasicHttpBinding : System.ServiceModel.BasicHttpSecurityMode -> System.ServiceModel.BasicHttpBinding
Public Sub New (securityMode As BasicHttpSecurityMode)

Parameter

securityMode
BasicHttpSecurityMode BasicHttpSecurityMode BasicHttpSecurityMode BasicHttpSecurityMode

Der Wert von BasicHttpSecurityMode, der den Sicherheitstyp angibt, der für die SOAP-Nachricht und den Client verwendet wird. The value of BasicHttpSecurityMode that specifies the type of security that is used with the SOAP message and for the client.

Beispiele

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

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();

Dim binding As BasicHttpBinding = New BasicHttpBinding(BasicHttpSecurityMode.Message)
binding.Name = "binding1"
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
binding.Security.Mode = BasicHttpSecurityMode.None

Dim baseAddress As Uri = New Uri("http://localhost:8000/servicemodelsamples/service")
Dim address As Uri = New Uri("http://localhost:8000/servicemodelsamples/service/calc")

' Create a ServiceHost for the CalculatorService type and provide the base address.
Using serviceHost As ServiceHost = New ServiceHost(GetType(CalculatorService), baseAddress)

    serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, address)

    ' Open the ServiceHost 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 ServiceHost to shutdown the service.
    serviceHost.Close()
End Using

Hinweise

Der Standardwert des verwendeten BasicHttpSecurityMode ist None, wodurch angegeben wird, dass die SOAP-Nachricht nicht gesichert und der Client nicht authentifiziert ist.The default value of BasicHttpSecurityMode used is None, which specifies that the SOAP message is not secured and the client is not authenticated.

BasicHttpBinding(String) BasicHttpBinding(String) BasicHttpBinding(String) BasicHttpBinding(String)

Initialisiert eine neue Instanz der BasicHttpBinding-Klasse mit einer durch ihren Konfigurationsnamen angegebenen Bindung. Initializes a new instance of the BasicHttpBinding class with a binding specified by its configuration name.

public:
 BasicHttpBinding(System::String ^ configurationName);
public BasicHttpBinding (string configurationName);
new System.ServiceModel.BasicHttpBinding : string -> System.ServiceModel.BasicHttpBinding
Public Sub New (configurationName As String)

Parameter

configurationName
String String String String

Der Bindungskonfigurationsname für das BasicHttpBindingElement. The binding configuration name for the BasicHttpBindingElement.

Ausnahmen

Die Bindung mit dem Konfigurationsnamen configurationName wurde nicht gefunden. The binding with the configuration name configurationName was not found.

Beispiele

Dieses Beispiel initialisiert eine neue BasicHttpBinding-Klasse mit einer Bindung, die vom BasicBinding-Konfigurationsnamen angegeben wird.This example initializes a new BasicHttpBinding class with a binding specified by the configuration name BasicBinding. In der Konfigurationsdatei des Diensts muss ein Bindungsabschnitt erstellt werden.You must create a bindings section in the service's configuration file.

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

BasicHttpSecurity security = binding.Security;
BasicHttpMessageSecurity msgSecurity = security.Message;

SecurityAlgorithmSuite sas = msgSecurity.AlgorithmSuite;
BasicHttpMessageCredentialType credType = msgSecurity.ClientCredentialType;

Console.WriteLine("The algorithm suite used is {0}", sas.ToString());
Console.WriteLine("The client credential type used is {0}", credType.ToString());
Dim binding As BasicHttpBinding = New BasicHttpBinding()
binding.Name = "binding1"
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
binding.Security.Mode = BasicHttpSecurityMode.Message

Dim security As BasicHttpSecurity = binding.Security
Dim msgSecurity As BasicHttpMessageSecurity = security.Message

Dim sas As SecurityAlgorithmSuite = msgSecurity.AlgorithmSuite
Dim credType As BasicHttpMessageCredentialType = msgSecurity.ClientCredentialType

Console.WriteLine("The algorithm suite used is {0}", sas.ToString())
Console.WriteLine("The client credential type used is {0}", credType.ToString())

Dann wird der Name der Bindungskonfiguration im Aufruf des BasicHttpBinding-Konstruktors angegeben.Then the name of the binding configuration is specified in the call to the BasicHttpBinding constructor.

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.
using (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();
}
Dim binding As BasicHttpBinding = New BasicHttpBinding("BasicBinding")
binding.Name = "binding1"
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
binding.Security.Mode = BasicHttpSecurityMode.None

Dim baseAddress As Uri = New Uri("http://localhost:8000/servicemodelsamples/service")
Dim address As Uri = New Uri("http://localhost:8000/servicemodelsamples/service/calc")

' Create a ServiceHost for the CalculatorService type and provide the base address.
Using serviceHost As ServiceHost = New ServiceHost(GetType(CalculatorService), baseAddress)

    serviceHost.AddServiceEndpoint(GetType(ICalculator), binding, address)

    ' Open the ServiceHost 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 ServiceHost to shutdown the service.
    serviceHost.Close()
End Using

Gilt für: