ServiceCredentials.Clone Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Crea una copia de la instancia actual.
public:
System::ServiceModel::Description::ServiceCredentials ^ Clone();
public System.ServiceModel.Description.ServiceCredentials Clone ();
member this.Clone : unit -> System.ServiceModel.Description.ServiceCredentials
Public Function Clone () As ServiceCredentials
Devoluciones
Instancia de ServiceCredentials.
Ejemplos
El siguiente código muestra cómo llamar a este método.
// Create a service host.
Uri httpUri = new Uri("http://localhost/Calculator");
ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);
// Create a binding that uses a WindowsServiceCredential .
WSHttpBinding b = new WSHttpBinding(SecurityMode.Message);
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
// Add an endpoint.
sh.AddServiceEndpoint(typeof(ICalculator), b, "WindowsCalculator");
// Clone these credentials.
ServiceCredentials cloneCredential =
sh.Credentials.Clone();
' Create a service host.
Dim httpUri As New Uri("http://localhost/Calculator")
Dim sh As New ServiceHost(GetType(Calculator), httpUri)
' Create a binding that uses a WindowsServiceCredential .
Dim b As New WSHttpBinding(SecurityMode.Message)
b.Security.Message.ClientCredentialType = MessageCredentialType.Windows
' Add an endpoint.
sh.AddServiceEndpoint(GetType(ICalculator), b, "WindowsCalculator")
' Clone these credentials.
Dim cloneCredential As ServiceCredentials = sh.Credentials.Clone()