Skip to content

Commit 8de9cb7

Browse files
Add proxyless endpoint support (#2314)
1 parent 80f7ae5 commit 8de9cb7

File tree

20 files changed

+450
-17
lines changed

20 files changed

+450
-17
lines changed

Aspire.sln

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseMigration.Migration
269269
EndProject
270270
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseMigration.ApiModel", "playground\DatabaseMigration\DatabaseMigration.ApiModel\DatabaseMigration.ApiModel.csproj", "{C15F3F13-AB63-47CF-AAFE-D319F02E7B33}"
271271
EndProject
272+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ProxylessEndToEnd", "ProxylessEndToEnd", "{9C30FFD6-2262-45E7-B010-24B30E0433C2}"
273+
EndProject
274+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxylessEndToEnd.ApiService", "playground\ProxylessEndToEnd\ProxylessEndToEnd.ApiService\ProxylessEndToEnd.ApiService.csproj", "{51654CD7-2E05-4664-B2EB-95308A300609}"
275+
EndProject
276+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxylessEndToEnd.AppHost", "playground\ProxylessEndToEnd\ProxylessEndToEnd.AppHost\ProxylessEndToEnd.AppHost.csproj", "{0244203D-7491-4414-9C88-10BFED9C5B2D}"
277+
EndProject
272278
Global
273279
GlobalSection(SolutionConfigurationPlatforms) = preSolution
274280
Debug|Any CPU = Debug|Any CPU
@@ -707,6 +713,14 @@ Global
707713
{C15F3F13-AB63-47CF-AAFE-D319F02E7B33}.Debug|Any CPU.Build.0 = Debug|Any CPU
708714
{C15F3F13-AB63-47CF-AAFE-D319F02E7B33}.Release|Any CPU.ActiveCfg = Release|Any CPU
709715
{C15F3F13-AB63-47CF-AAFE-D319F02E7B33}.Release|Any CPU.Build.0 = Release|Any CPU
716+
{51654CD7-2E05-4664-B2EB-95308A300609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
717+
{51654CD7-2E05-4664-B2EB-95308A300609}.Debug|Any CPU.Build.0 = Debug|Any CPU
718+
{51654CD7-2E05-4664-B2EB-95308A300609}.Release|Any CPU.ActiveCfg = Release|Any CPU
719+
{51654CD7-2E05-4664-B2EB-95308A300609}.Release|Any CPU.Build.0 = Release|Any CPU
720+
{0244203D-7491-4414-9C88-10BFED9C5B2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
721+
{0244203D-7491-4414-9C88-10BFED9C5B2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
722+
{0244203D-7491-4414-9C88-10BFED9C5B2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
723+
{0244203D-7491-4414-9C88-10BFED9C5B2D}.Release|Any CPU.Build.0 = Release|Any CPU
710724
EndGlobalSection
711725
GlobalSection(SolutionProperties) = preSolution
712726
HideSolutionNode = FALSE
@@ -835,6 +849,9 @@ Global
835849
{E5C93F8B-D31B-4268-89EB-830EDC5524D0} = {8B1802BC-6CB0-4027-850C-2AED42A82C9E}
836850
{E7DB736B-C316-460E-A609-2200E58BF0C2} = {8B1802BC-6CB0-4027-850C-2AED42A82C9E}
837851
{C15F3F13-AB63-47CF-AAFE-D319F02E7B33} = {8B1802BC-6CB0-4027-850C-2AED42A82C9E}
852+
{9C30FFD6-2262-45E7-B010-24B30E0433C2} = {D173887B-AF42-4576-B9C1-96B9E9B3D9C0}
853+
{51654CD7-2E05-4664-B2EB-95308A300609} = {9C30FFD6-2262-45E7-B010-24B30E0433C2}
854+
{0244203D-7491-4414-9C88-10BFED9C5B2D} = {9C30FFD6-2262-45E7-B010-24B30E0433C2}
838855
EndGlobalSection
839856
GlobalSection(ExtensibilityGlobals) = postSolution
840857
SolutionGuid = {6DCEDFEC-988E-4CB3-B45B-191EB5086E0C}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using StackExchange.Redis;
5+
6+
var builder = WebApplication.CreateBuilder(args);
7+
8+
builder.AddServiceDefaults();
9+
10+
builder.AddKeyedRedis("redis");
11+
12+
var app = builder.Build();
13+
14+
app.MapGet("/", () =>
15+
{
16+
return Random.Shared.Next();
17+
});
18+
19+
app.MapGet("/redis", ([FromKeyedServices("redis")] IConnectionMultiplexer redis) =>
20+
{
21+
var db = redis.GetDatabase();
22+
db.StringAppend("key", "a");
23+
return (string?)db.StringGet("key");
24+
});
25+
26+
app.Run();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"http": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"launchBrowser": true,
8+
"applicationUrl": "http://localhost:12345",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development"
11+
}
12+
}
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\..\Playground.ServiceDefaults\Playground.ServiceDefaults.csproj" />
11+
<ProjectReference Include="..\..\..\src\Components\Aspire.StackExchange.Redis\Aspire.StackExchange.Redis.csproj" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Warning"
6+
}
7+
},
8+
"AllowedHosts": "*"
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project>
2+
3+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
4+
5+
<!-- NOTE: This line is only required because we are using P2P references, not NuGet. It will not exist in real apps. -->
6+
<Import Project="../../../src/Aspire.Hosting/build/Aspire.Hosting.props" />
7+
8+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
3+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
4+
5+
<!-- NOTE: These lines are only required because we are using P2P references, not NuGet. They will not exist in real apps. -->
6+
<Import Project="..\..\..\src\Aspire.Hosting\build\Aspire.Hosting.targets" />
7+
<Import Project="..\..\..\src\Aspire.Hosting.Sdk\SDK\Sdk.targets" />
8+
9+
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
var builder = DistributedApplication.CreateBuilder(args);
5+
6+
var redis = builder.AddRedis("redis", 9999).WithEndpoint("tcp", (endpoint) =>
7+
{
8+
endpoint.IsProxied = false;
9+
});
10+
11+
builder.AddProject<Projects.ProxylessEndToEnd_ApiService>("api")
12+
.WithEndpoint(12345, "http", isProxied: false)
13+
.WithReference(redis);
14+
15+
builder.AddProject<Projects.ProxylessEndToEnd_ApiService>("api2")
16+
.ExcludeLaunchProfile()
17+
.WithEndpoint(13456, "http")
18+
.WithReference(redis);
19+
20+
// This project is only added in playground projects to support development/debugging
21+
// of the dashboard. It is not required in end developer code. Comment out this code
22+
// to test end developer dashboard launch experience. Refer to Directory.Build.props
23+
// for the path to the dashboard binary (defaults to the Aspire.Dashboard bin output
24+
// in the artifacts dir).
25+
builder.AddProject<Projects.Aspire_Dashboard>(KnownResourceNames.AspireDashboard);
26+
27+
builder.Build().Run();
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"$schema": "http://json.schemastore.org/launchsettings.json",
3+
"profiles": {
4+
"http": {
5+
"commandName": "Project",
6+
"dotnetRunMessages": true,
7+
"launchBrowser": true,
8+
"applicationUrl": "http://localhost:15888",
9+
"environmentVariables": {
10+
"ASPNETCORE_ENVIRONMENT": "Development",
11+
"DOTNET_ENVIRONMENT": "Development",
12+
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16175",
13+
"DOTNET_ASPIRE_SHOW_DASHBOARD_RESOURCES": "true"
14+
}
15+
},
16+
"generate-manifest": {
17+
"commandName": "Project",
18+
"launchBrowser": true,
19+
"dotnetRunMessages": true,
20+
"commandLineArgs": "--publisher manifest --output-path aspire-manifest.json",
21+
"applicationUrl": "http://localhost:15888",
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development",
24+
"DOTNET_ENVIRONMENT": "Development",
25+
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16175"
26+
}
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)