# ClientTlsHostingExtensions Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.hosting.clienttlshostingextensions/)

## UseTls(IClientBuilder, Action&lt;TlsOptions&gt;) {#usetls-this-orleans-hosting-iclientbuilder-system-action-orleans-connections-tra-79233d35}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.hosting.clienttlshostingextensions/methods/usetls-this-orleans-hosting-iclientbuilder-system-action-orleans-connections-tra-79233d35/)

[Source](https://github.com/dotnet/orleans/blob/fbe240c34e9a1389ca5ab2d52f292ed8749ea530/src/Orleans.Core/Hosting/ClientTlsHostingExtensions.IClientBuilder.cs#L101-L106)

```csharp
public static IClientBuilder UseTls(this IClientBuilder builder, Action<TlsOptions> configureOptions)
```

Configures TLS.

### Parameters

- `builder` (`IClientBuilder`): The builder to configure.
- `configureOptions` (`Action<TlsOptions>`): An Action to configure the [TlsOptions](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.connections.transport.security.tlsoptions/).

### Returns

The builder.

## UseTls(IClientBuilder, StoreName, string, bool, StoreLocation, Action&lt;TlsOptions&gt;) {#usetls-this-orleans-hosting-iclientbuilder-system-security-cryptography-x509cert-7b61f49f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.hosting.clienttlshostingextensions/methods/usetls-this-orleans-hosting-iclientbuilder-system-security-cryptography-x509cert-7b61f49f/)

[Source](https://github.com/dotnet/orleans/blob/fbe240c34e9a1389ca5ab2d52f292ed8749ea530/src/Orleans.Core/Hosting/ClientTlsHostingExtensions.IClientBuilder.cs#L34-L38)

```csharp
public static IClientBuilder UseTls(this IClientBuilder builder, StoreName storeName, string subject, bool allowInvalid, StoreLocation location, Action<TlsOptions> configureOptions)
```

Configures TLS.

### Parameters

- `builder` (`IClientBuilder`): The builder to configure.
- `storeName` (`StoreName`): The certificate store to load the certificate from.
- `subject` (`string`): The subject name for the certificate to load.
- `allowInvalid` (`bool`): Indicates if invalid certificates should be considered, such as self-signed certificates.
- `location` (`StoreLocation`): The store location to load the certificate from.
- `configureOptions` (`Action<TlsOptions>`): An Action to configure the [TlsOptions](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.connections.transport.security.tlsoptions/).

### Returns

The builder.

## UseTls(IClientBuilder, X509Certificate2) {#usetls-this-orleans-hosting-iclientbuilder-system-security-cryptography-x509cert-5d67f3f6}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.hosting.clienttlshostingextensions/methods/usetls-this-orleans-hosting-iclientbuilder-system-security-cryptography-x509cert-5d67f3f6/)

[Source](https://github.com/dotnet/orleans/blob/fbe240c34e9a1389ca5ab2d52f292ed8749ea530/src/Orleans.Core/Hosting/ClientTlsHostingExtensions.IClientBuilder.cs#L78-L88)

```csharp
public static IClientBuilder UseTls(this IClientBuilder builder, X509Certificate2 certificate)
```

Configures TLS.

### Parameters

- `builder` (`IClientBuilder`): The builder to configure.
- `certificate` (`X509Certificate2`): The server certificate.

### Returns

The builder.

## UseTls(IClientBuilder, X509Certificate2, Action&lt;TlsOptions&gt;) {#usetls-this-orleans-hosting-iclientbuilder-system-security-cryptography-x509cert-54f896c9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.hosting.clienttlshostingextensions/methods/usetls-this-orleans-hosting-iclientbuilder-system-security-cryptography-x509cert-54f896c9/)

[Source](https://github.com/dotnet/orleans/blob/fbe240c34e9a1389ca5ab2d52f292ed8749ea530/src/Orleans.Core/Hosting/ClientTlsHostingExtensions.IClientBuilder.cs#L53-L65)

```csharp
public static IClientBuilder UseTls(this IClientBuilder builder, X509Certificate2 certificate, Action<TlsOptions> configureOptions)
```

Configures TLS.

### Parameters

- `builder` (`IClientBuilder`): The builder to configure.
- `certificate` (`X509Certificate2`): The server certificate.
- `configureOptions` (`Action<TlsOptions>`): An Action to configure the [TlsOptions](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.connections.transport.security.tlsoptions/).

### Returns

The builder.
