-
Notifications
You must be signed in to change notification settings - Fork 752
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Running aspire publish --debug with builder.AddAzureAppServiceEnvironment() throws the above exception.
The ApiService must run locally with an https endpoint for many reasons.
The ApiService requires launchSettings.json to be defined, or one will be generated by default.
There doesn't appear a way to override the endpoint definitions when publishing aspire to circumvent this error.
It appears that the launchSettings.json are consulted.
Expected Behavior
I have read Azure App Service constraints where it says:
Single endpoint: App Service supports only a single target port. Resources with multiple external endpoints with different target ports are not supported. The default target port is 8000, which can be overridden using the
WithHttpEndpointextension method.
This is fine, so I expect a way to override and to define this single endpoint.
Steps To Reproduce
Directory.Packages.props:
<PackageVersion Include="Aspire.Hosting.Azure.AppService" Version="13.0.2-preview.1.25603.5" />
Aspire.AppHost/AppHost.cs:
builder.AddAzureAppServiceEnvironment("appServiceEnvironment");
...
var apiService = builder.AddProject<Projects.ApiService>("apiService")
.WithHttpHealthCheck("/health")
.WithExternalHttpEndpoints()
.PublishAsAzureAppServiceWebsite((_, _) => { });
ApiService/Properties/launchSettings.json:
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:44444",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Exceptions (if any)
Unhandled exception. System.AggregateException: One or more errors occurred. (The endpoint https is not allocated for the resource apiService.)
---> System.InvalidOperationException: The endpoint https is not allocated for the resource apiService.
at Aspire.Hosting.ApplicationModel.EndpointReference.get_AllocatedEndpoint() in //src/Aspire.Hosting/ApplicationModel/EndpointReference.cs:line 134
at Aspire.Hosting.ApplicationModel.EndpointReference.get_Url() in //src/Aspire.Hosting/ApplicationModel/EndpointReference.cs:line 128
at Program.<>c__DisplayClass0_0.<
at Aspire.Hosting.ApplicationModel.EnvironmentCallbackAnnotation.<>c__DisplayClass3_0.<.ctor>b__0(EnvironmentCallbackContext c) in //src/Aspire.Hosting/ApplicationModel/EnvironmentCallbackAnnotation.cs:line 59
at Aspire.Hosting.Azure.AzureResourcePreparer.GetAzureReferences(IResource resource, CancellationToken cancellationToken) in //src/Aspire.Hosting.Azure/AzureResourcePreparer.cs:line 366
at Aspire.Hosting.Azure.AzureResourcePreparer.BuildRoleAssignmentAnnotations(DistributedApplicationModel appModel, List
1 azureResources, CancellationToken cancellationToken) in /_/src/Aspire.Hosting.Azure/AzureResourcePreparer.cs:line 141 at Aspire.Hosting.Azure.AzureResourcePreparer.OnBeforeStartAsync(BeforeStartEvent event, CancellationToken cancellationToken) in /_/src/Aspire.Hosting.Azure/AzureResourcePreparer.cs:line 38 at Aspire.Hosting.Eventing.DistributedApplicationEventing.<>c__DisplayClass4_01.<b__0>d.MoveNext() in //src/Aspire.Hosting/Eventing/DistributedApplicationEventing.cs:line 82--- End of stack trace from previous location ---
at Aspire.Hosting.Eventing.DistributedApplicationEventing.PublishAsync[T](T event, EventDispatchBehavior dispatchBehavior, CancellationToken cancellationToken) in //src/Aspire.Hosting/Eventing/DistributedApplicationEventing.cs:line 69
at Aspire.Hosting.DistributedApplication.ExecuteBeforeStartHooksAsync(CancellationToken cancellationToken) in //src/Aspire.Hosting/DistributedApplication.cs:line 490
at Aspire.Hosting.DistributedApplication.RunAsync(CancellationToken cancellationToken) in //src/Aspire.Hosting/DistributedApplication.cs:line 440
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Aspire.Hosting.DistributedApplication.Run() in /_/src/Aspire.Hosting/DistributedApplication.cs:line 471
at Program.$(String[] args) in C:\Source\Project\Aspire.AppHost\AppHost.cs:line 117
.NET Version info
.NET SDK:
Version: 10.0.101
Commit: fad253f51b
Workload version: 10.0.100-manifests.9f71effe
MSBuild version: 18.0.6+fad253f51
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.101\
.NET workloads installed:
[maui-windows]
Installation Source: VS 18.1.11304.174
Manifest Version: 10.0.1/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.1\WorkloadManifest.json
Install Type: Msi
[maccatalyst]
Installation Source: VS 18.1.11304.174
Manifest Version: 26.1.10502/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maccatalyst\26.1.10502\WorkloadManifest.json
Install Type: Msi
[android]
Installation Source: VS 18.1.11304.174
Manifest Version: 36.1.2/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.android\36.1.2\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: VS 18.1.11304.174
Manifest Version: 26.1.10502/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.ios\26.1.10502\WorkloadManifest.json
Install Type: Msi
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.1
Architecture: x64
Commit: fad253f51b
.NET SDKs installed:
10.0.100 [C:\Program Files\dotnet\sdk]
10.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
DOTNET_CLI_UI_LANGUAGE [en-US]
DOTNET_GCHeapCount [2]
DOTNET_GCNoAffinitize [1]
DOTNET_MULTILEVEL_LOOKUP [0]
DOTNET_TC_CallCountThreshold [1000]
DOTNET_ThreadPool_UnfairSemaphoreSpinLimit [0]
DOTNET_gcConcurrent [0]
Detected COMPlus_* environment variable(s). Consider transitioning to DOTNET_* equivalent.
global.json file:
Not found
Anything else?
<PackageVersion Include="Aspire.Azure.Security.KeyVault" Version="13.0.2" />
<PackageVersion Include="Aspire.Hosting.Azure.ApplicationInsights" Version="13.0.2" />
<PackageVersion Include="Aspire.Hosting.Azure.AppService" Version="13.0.2-preview.1.25603.5" />
<PackageVersion Include="Aspire.Hosting.Azure.KeyVault" Version="13.0.2" />
<PackageVersion Include="Aspire.Hosting.Azure.Sql" Version="13.0.2" />
<PackageVersion Include="Aspire.Hosting.Azure.Storage" Version="13.0.2" />
<PackageVersion Include="Aspire.Hosting.JavaScript" Version="13.0.2" />
<PackageVersion Include="Aspire.Hosting.Testing" Version="13.0.2" />