Skip to content

Commit 3b308aa

Browse files
CopilotReubenBond
andcommitted
Address PR feedback: Remove VB examples, use IsDevelopment, add mTLS, update title
Co-authored-by: ReubenBond <203839+ReubenBond@users.noreply.github.com>
1 parent afc2a98 commit 3b308aa

File tree

7 files changed

+17
-261
lines changed

7 files changed

+17
-261
lines changed

docs/orleans/host/snippets/transport-layer-security/csharp/ClientExample/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ class ClientDevelopmentExample
3030
public static async Task ConfigureDevelopmentTls()
3131
{
3232
// <ClientDevelopmentTlsConfiguration>
33-
var isDevelopment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development";
34-
35-
using IHost host = Host.CreateDefaultBuilder()
36-
.UseOrleansClient(builder =>
33+
var hostBuilder = Host.CreateDefaultBuilder();
34+
35+
using IHost host = hostBuilder
36+
.UseOrleansClient((context, builder) =>
3737
{
38+
var isDevelopment = context.HostingEnvironment.IsDevelopment();
39+
3840
builder
3941
.UseLocalhostClustering()
4042
.UseTls(StoreName.My, "localhost", allowInvalid: isDevelopment, StoreLocation.CurrentUser, options =>

docs/orleans/host/snippets/transport-layer-security/csharp/SiloExample/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ class DevelopmentExample
3232
public static async Task ConfigureDevelopmentTls()
3333
{
3434
// <DevelopmentTlsConfiguration>
35-
var isDevelopment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development";
36-
37-
using IHost host = Host.CreateDefaultBuilder()
38-
.UseOrleans(builder =>
35+
var hostBuilder = Host.CreateDefaultBuilder();
36+
37+
using IHost host = hostBuilder
38+
.UseOrleans((context, builder) =>
3939
{
40+
var isDevelopment = context.HostingEnvironment.IsDevelopment();
41+
4042
builder
4143
.UseLocalhostClustering()
4244
.UseTls(StoreName.My, "localhost", allowInvalid: isDevelopment, StoreLocation.CurrentUser, options =>

docs/orleans/host/snippets/transport-layer-security/vb/ClientExample/ClientExample.vbproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/orleans/host/snippets/transport-layer-security/vb/ClientExample/Program.vb

Lines changed: 0 additions & 85 deletions
This file was deleted.

docs/orleans/host/snippets/transport-layer-security/vb/SiloExample/Program.vb

Lines changed: 0 additions & 128 deletions
This file was deleted.

docs/orleans/host/snippets/transport-layer-security/vb/SiloExample/SiloExample.vbproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/orleans/host/transport-layer-security.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: Transport Layer Security (TLS)
3-
description: Learn how to configure Transport Layer Security (TLS) in .NET Orleans to secure network communication between hosts.
2+
title: Orleans Transport Layer Security (TLS)
3+
description: Learn how to configure Transport Layer Security (TLS) and mutual TLS (mTLS) in .NET Orleans to secure network communication between hosts.
44
ms.date: 10/28/2025
55
ms.topic: how-to
66
ai-usage: ai-assisted
77
---
88

9-
# Transport Layer Security (TLS)
9+
# Orleans Transport Layer Security (TLS)
1010

11-
Transport Layer Security (TLS) is a cryptographic protocol that secures network communication between Orleans silos and clients. Configure TLS to implement mutual authentication and encrypt data in transit, protecting your Orleans deployment from unauthorized access and eavesdropping.
11+
Transport Layer Security (TLS) is a cryptographic protocol that secures network communication between Orleans silos and clients. Configure TLS to implement mutual authentication (mTLS) and encrypt data in transit, protecting your Orleans deployment from unauthorized access and eavesdropping.
1212

1313
## Prerequisites
1414

@@ -28,7 +28,6 @@ To enable TLS on an Orleans silo, use the <xref:Orleans.Hosting.OrleansConnectio
2828
The following example shows how to configure TLS using a certificate from the Windows certificate store:
2929

3030
:::code language="csharp" source="./snippets/transport-layer-security/csharp/SiloExample/Program.cs" id="BasicTlsConfiguration":::
31-
:::code language="vb" source="./snippets/transport-layer-security/vb/SiloExample/Program.vb" id="BasicTlsConfiguration":::
3231

3332
In the preceding code:
3433

@@ -43,11 +42,10 @@ In the preceding code:
4342
For development and testing, you might need to use self-signed certificates. The following example shows how to configure TLS with relaxed validation for development:
4443

4544
:::code language="csharp" source="./snippets/transport-layer-security/csharp/SiloExample/Program.cs" id="DevelopmentTlsConfiguration":::
46-
:::code language="vb" source="./snippets/transport-layer-security/vb/SiloExample/Program.vb" id="DevelopmentTlsConfiguration":::
4745

4846
In the preceding code:
4947

50-
- The `isDevelopment` flag determines whether to use relaxed certificate validation.
48+
- The `context.HostingEnvironment.IsDevelopment()` method checks if the application is running in a development environment.
5149
- The <xref:Orleans.Connections.Security.TlsOptions.AllowAnyRemoteCertificate%2A> method disables certificate validation in development.
5250

5351
> [!WARNING]
@@ -58,7 +56,6 @@ In the preceding code:
5856
If you have a certificate file instead of using the certificate store, configure TLS as shown in the following example:
5957

6058
:::code language="csharp" source="./snippets/transport-layer-security/csharp/SiloExample/Program.cs" id="CertificateTlsConfiguration":::
61-
:::code language="vb" source="./snippets/transport-layer-security/vb/SiloExample/Program.vb" id="CertificateTlsConfiguration":::
6259

6360
In the preceding code:
6461

@@ -70,7 +67,6 @@ In the preceding code:
7067
For production deployments, you might need more control over certificate validation and protocol selection. The following example demonstrates advanced TLS configuration:
7168

7269
:::code language="csharp" source="./snippets/transport-layer-security/csharp/SiloExample/Program.cs" id="AdvancedTlsConfiguration":::
73-
:::code language="vb" source="./snippets/transport-layer-security/vb/SiloExample/Program.vb" id="AdvancedTlsConfiguration":::
7470

7571
In the preceding code:
7672

@@ -87,7 +83,6 @@ Orleans clients require similar TLS configuration to securely connect to TLS-ena
8783
The following example shows how to configure TLS on an Orleans client:
8884

8985
:::code language="csharp" source="./snippets/transport-layer-security/csharp/ClientExample/Program.cs" id="BasicClientTlsConfiguration":::
90-
:::code language="vb" source="./snippets/transport-layer-security/vb/ClientExample/Program.vb" id="BasicClientTlsConfiguration":::
9186

9287
In the preceding code:
9388

@@ -100,14 +95,12 @@ In the preceding code:
10095
For development environments, configure the client with relaxed validation as shown in the following example:
10196

10297
:::code language="csharp" source="./snippets/transport-layer-security/csharp/ClientExample/Program.cs" id="ClientDevelopmentTlsConfiguration":::
103-
:::code language="vb" source="./snippets/transport-layer-security/vb/ClientExample/Program.vb" id="ClientDevelopmentTlsConfiguration":::
10498

10599
### Certificate file client configuration
106100

107101
Configure a client using a certificate file as shown in the following example:
108102

109103
:::code language="csharp" source="./snippets/transport-layer-security/csharp/ClientExample/Program.cs" id="ClientCertificateTlsConfiguration":::
110-
:::code language="vb" source="./snippets/transport-layer-security/vb/ClientExample/Program.vb" id="ClientCertificateTlsConfiguration":::
111104

112105
## Best practices
113106

0 commit comments

Comments
 (0)