Export (0) Print
Expand All

IChannelCredentials Interface

An interface that allows the setting of certain security features on a service proxy.

Namespace:  System.ServiceModel.ComIntegration
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIDispatch)]
[GuidAttribute("181b448c-c17c-4b17-ac6d-06699b93198f")]
public interface IChannelCredentials

The IChannelCredentials type exposes the following members.

  NameDescription
Public methodSetClientCertificateFromFileRetrieves a certificate from a file and adds it to the client credentials.
Public methodSetClientCertificateFromStoreRetrieves a certificate from a certificate store and adds it to the client credentials.
Public methodSetClientCertificateFromStoreByNameRetrieves a certificate from a certificate store by name and adds it to the client credentials.
Public methodSetDefaultServiceCertificateFromFileRetrieves a certificate from a file and adds it to the service credentials as the default certificate.
Public methodSetDefaultServiceCertificateFromStoreRetrieves a certificate from a certificate store and adds it to the service credentials as the default certificate.
Public methodSetDefaultServiceCertificateFromStoreByNameRetrieves a certificate from a certificate store by name and adds it to the service credentials as the default certificate
Public methodSetIssuedTokenSets parameters for the issued token.
Public methodSetServiceCertificateAuthenticationSets the service certificate authentication parameters.
Public methodSetUserNameCredentialSets the user name credentials.
Public methodSetWindowsCredentialSets the Windows credentials.
Top

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)

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 3.5 SP1

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.

Community Additions

ADD
Show:
© 2014 Microsoft