IChannelCredentials Interface
An interface that allows the setting of certain security features on a service proxy.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
The IChannelCredentials type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | SetClientCertificateFromFile | Retrieves a certificate from a file and adds it to the client credentials. |
![]() | SetClientCertificateFromStore | Retrieves a certificate from a certificate store and adds it to the client credentials. |
![]() | SetClientCertificateFromStoreByName | Retrieves a certificate from a certificate store by name and adds it to the client credentials. |
![]() | SetDefaultServiceCertificateFromFile | Retrieves a certificate from a file and adds it to the service credentials as the default certificate. |
![]() | SetDefaultServiceCertificateFromStore | Retrieves a certificate from a certificate store and adds it to the service credentials as the default certificate. |
![]() | SetDefaultServiceCertificateFromStoreByName | Retrieves a certificate from a certificate store by name and adds it to the service credentials as the default certificate |
![]() | SetIssuedToken | Sets parameters for the issued token. |
![]() | SetServiceCertificateAuthentication | Sets the service certificate authentication parameters. |
![]() | SetUserNameCredential | Sets the user name credentials. |
![]() | SetWindowsCredential | Sets the Windows credentials. |
Unmanaged clients use the "service" moniker to access services. These clients are subject to the security model rather than the COM security model. The IChannelCredentials interface is provided to specify channel credentials. This is required because the COM moniker cannot access the managed security object model.
It is not legal to call methods on the IChannelCredentials interface after the channel is created. This is because does not support changing security settings on an already opened channel. When the service moniker client obtains a proxy, the channel is not yet created. Thus, the client must call IChannelCredentials methods prior to invoking the service method. If the client calls an IChannelCredentials method after the service method is invoked, the exception RPC_E_TOO_LATE is thrown.
monString = "service:mexAddress=http://localhost:8000/ServiceModelSamples/Service?wsdl"
monString = monString + ", address=http://localhost:8000/ServiceModelSamples/Service"
monString = monString + ", binding=BasicHttpBinding_ICalculator, bindingNamespace=http://Microsoft.ServiceModel.Samples"
monString = monString + ", contract=ICalculator, contractNamespace=http://Microsoft.ServiceModel.Samples"
Set monikerProxy = GetObject(monString)
'Set the Service Certificate.
monikerProxy.ChannelCredentials.SetServiceCertificateAuthentication "CurrentUser", "NoCheck", "PeerOrChainTrust"
monikerProxy.ChannelCredentials.SetDefaultServiceCertificateFromStore "CurrentUser", "TrustedPeople", "FindBySubjectName", "localhost"
'Set the Client Certificate.
monikerProxy.ChannelCredentials.SetClientCertificateFromStoreByName "CN=client.com", "CurrentUser", "My"
MsgBox monikerProxy.Add(3, 4)
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
