Compartilhar via


SSLBinding.Create Method1

Cria uma associação de protocolo SSL (Secure Sockets Layer).

Sintaxe

oWebAdmin.Get("SSLBinding").Create(  
   IPAddress,  
   Port,  
   CertificateHash,  
   StoreName  
);  
oWebAdmin.Get("SSLBinding").Create  
   IPAddress,  
   Port,  
   CertificateHash,  
   StoreName  
  

Parâmetros

Nome Descrição
CertificateHash Um valor string que especifica o hash de certificado para a associação de protocolo SSL.
IPAddress Um valor string que especifica o endereço IP para a associação de protocolo SSL.
Port Um valor uint32 que especifica o número da porta para a associação protocolo SSL.
StoreName Um string valor que especifica o nome do repositório de certificados para a associação de protocolo SSL.

Valor de retorno

Esse método não retorna um valor.

Comentários

O script a seguir mostra os diferentes formatos que você pode usar para o IPAddress parâmetro:

' This is the standard format for a specific IP address.  
oWebAdmin.Get("SSLBinding").Create "172.30.190.122", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"  
  
' Each of the following formats is an acceptable way to create a secure binding   
' to port 443 on all IP addresses.  
oWebAdmin.Get("SSLBinding").Create "*", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"  
oWebAdmin.Get("SSLBinding").Create "0.0.0.0", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"  
oWebAdmin.Get("SSLBinding").Create "", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"  

Exemplo

O exemplo a seguir cria uma associação segura e a adiciona a um site.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Create the secure binding.  
oWebAdmin.Get("SSLBinding").Create "*", 443, "fbbca460988a482227ec71122177045e47f9f2ff", "MyStoreName"  
  
' Create a new binding element.  
Set oBinding = oWebAdmin.Get("BindingElement").SpawnInstance_  
oBinding.BindingInformation = "*:443:"  
oBinding.Protocol = "https"  
  
' Get the default Web site.  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
  
' Increase the size of the array in the site's Bindings property.  
arrBindings = oSite.Bindings  
ReDim Preserve arrBindings(UBound(arrBindings) + 1)  
  
' Add the new binding to the array.   
Set arrBindings(UBound(arrBindings)) = oBinding  
  
' Assign the array to the Site.Bindings property.  
oSite.Bindings = arrBindings   
Set oPath = oSite.Put_  
  

Requisitos

Tipo Descrição
Cliente – IIS 7.0 no Windows Vista
– IIS 7.5 no Windows 7
– IIS 8.0 no Windows 8
– IIS 10.0 no Windows 10
Servidor – IIS 7.0 no Windows Server 2008
– IIS 7.5 no Windows Server 2008 R2
– IIS 8.0 no Windows Server 2012
– IIS 8.5 no Windows Server 2012 R2
– IIS 10.0 no Windows Server 2016
Product – IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
Arquivo MOF WebAdministration.mof

Confira também

Classe BindingElement
Classe SSLBinding
Classe Site