Running test project with command `dotnet test` leads to exception: Configuration is missing the 'HostEndpoint' information.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
At my client we have a couple of Azure Functions projects that we're migrating from .NET 6 to .NET 8, thereby making the switch from the in-process worker model to the isolated worker model during the upgrading process. We're also moving our integration testing suite for every functionapp from a custom-built componenttest framework to Aspire.
Most of the upgrade went smoothly, there is however one nagging issue. We can't get the new aspire-based integration tests running in our pipeline.
We have a step in our pipeline that runs the test project
```
- task: DotNetCoreCLI@2
displayName: 'Execute Unit tests'
inputs:
command: 'test'
projects: 'src/${{parameters.solutionName}}'
arguments: '--collect "Code Coverage" --configuration Debug --blame-hang-timeout 10000'
```
The unit tests run fine but the tests that use Aspire's `DistributedApplicationTestingBuilder` all fail without error. Always.
The following log entry can be found
```
fail: Client.Project.AppHost.Resources.afm-dmsgw-functions[0]
8: 2025-10-13T14:32:10.7890000Z Unhandled exception. System.InvalidOperationException: Configuration is missing the 'HostEndpoint' information. Please ensure an entry with the key 'Functions:Worker:HostEndpoint' is present in your configuration.
```
### Expected Behavior
When running the test project with command `dotnet test`, I expect the AppHost to spin up succesfully and run the tests.
We can run the tests from Visual Studio test explorer or Jetbrains Rider without issue. It's just the `dotnet test` command that's giving headaches.
### Steps To Reproduce
1. Create new empty Azure Functions project in Visual Studio 2022 - select _Enlist in .NET Aspire Orchestration_ on creation in Visual Studio
2. Install dependencies to AppHost project
- Azure functions integration ``
- Azure blobstorage integration ``
3. Have a basic HTTP-trigger based function app like this:
```csharp
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;
namespace ReproFunctionApp;
public class Function1
{
private readonly ILogger _logger;
public Function1(ILogger logger)
{
_logger = logger;
}
[Function("Function1")]
public IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req)
{
_logger.LogInformation("C# HTTP trigger function processed a request.");
return new OkObjectResult("Welcome to Azure Functions!");
}
}
```
With .csproj looking as follows:
```xml
net8.0
v4
Exe
enable
enable
```
4. Add Functionapp to your AppHost project
```csharp
var builder = DistributedApplication.CreateBuilder(args);
var storage = builder.AddAzureStorage("storage").RunAsEmulator();
builder.AddAzureFunctionsProject("reprofunctionapp")
.WithHostStorage(storage);
builder.Build().Run();
```
5. Add xUnit Test project, add dependencies and add reference to AppHost project
```xml
net8.0
enable
enable
false
true
```
6. Add test in Test project
```csharp
namespace ReproFunctionApp.Tests
{
public class UnitTest1
{
[Fact]
public async void Test1()
{
var builder = await DistributedApplicationTestingBuilder.CreateAsync();
builder.Services.ConfigureHttpClientDefaults(clientBuilder =>
{
clientBuilder.AddStandardResilienceHandler();
});
await using var app = await builder.BuildAsync();
await app.StartAsync();
// Act
var httpClient = app.CreateHttpClient("reprofunctionapp");
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
await app.ResourceNotifications.WaitForResourceHealthyAsync(
"reprofunctionapp",
cts.Token);
var response = await httpClient.GetAsync("/");
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}
}
```
7. Verify if test works through VS test explorer.
8. Finally, run test by running command `dotnet test .\ReproFunctionApp.Tests\ --logger "console;verbosity=detailed" --configuration Debug`
9. Test should fail. Log should display various error messages. See chapter Exceptions:
### Exceptions (if any)
```
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
1: 2025-10-13T15:38:25.3650000Z Unhandled exception. System.InvalidOperationException: Configuration is missing the 'HostEndpoint' information. Please ensure an entry with the key 'Functions:Worker:HostEndpoint' is present in your configuration.
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
2: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.GrpcServiceCollectionExtensions.GetFunctionsHostGrpcUri(IConfiguration configuration) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcServiceCollectionExtensions.cs:line 83
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
3: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.GrpcServiceCollectionExtensions.GrpcWorkerStartupOptionsSetup.Configure(GrpcWorkerStartupOptions options) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcServiceCollectionExtensions.cs:line 98
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
4: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
5: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
6: 2025-10-13T15:38:25.3940000Z at Microsoft.Azure.Functions.Worker.Grpc.GrpcWorkerClientFactory..ctor(GrpcHostChannel outputChannel, IOptions`1 startupOptions) in D:\a\_work\1\s\src\DotNetWorker.Grpc\GrpcWorkerClientFactory.cs:line 29
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
7: 2025-10-13T15:38:25.3940000Z at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
8: 2025-10-13T15:38:25.3940000Z at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
9: 2025-10-13T15:38:25.3940000Z at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
10: 2025-10-13T15:38:25.3940000Z at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
11: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
12: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
13: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
14: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
15: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
16: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
17: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
18: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
19: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
20: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
21: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
22: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
23: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
24: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
25: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
26: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
27: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
28: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
29: 2025-10-13T15:38:25.3940000Z at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
30: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
31: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
32: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
33: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
34: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
35: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
36: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
37: 2025-10-13T15:38:25.3940000Z at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
fail: ReproFunctionApp.AppHost.Resources.reprofunctionapp[0]
38: 2025-10-13T15:38:25.3940000Z at Program.$(String[] args) in C:\Users\beek\Sandbox\repro\ReproFunctionApp\ReproFunctionApp\Program.cs:line 14
warn: Polly[3]
Execution attempt. Source: '-standard//Standard-Retry', Operation Key: '', Result: 'No connection could be made because the target machine actively refused it. (localhost:7293)', Handled: 'True', Attempt: '0', Execution Time: 4152,7629ms
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:7293)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
warn: Polly[0]
Resilience event occurred. EventName: 'OnRetry', Source: '-standard//Standard-Retry', Operation Key: '', Result: 'No connection could be made because the target machine actively refused it. (localhost:7293)'
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:7293)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
info: System.Net.Http.HttpClient.Default.ClientHandler[100]
Sending HTTP request GET http://localhost:7293/
info: ReproFunctionApp.AppHost.Resources.storage[0]
2: 2025-10-13T15:38:29.6426574Z Azurite Blob service is starting at http://0.0.0.0:10000
info: ReproFunctionApp.AppHost.Resources.storage[0]
3: 2025-10-13T15:38:29.6791264Z Azurite Blob service is successfully listening at http://0.0.0.0:10000
info: ReproFunctionApp.AppHost.Resources.storage[0]
4: 2025-10-13T15:38:29.6792596Z Azurite Queue service is starting at http://0.0.0.0:10001
info: ReproFunctionApp.AppHost.Resources.storage[0]
5: 2025-10-13T15:38:29.6943463Z Azurite Queue service is successfully listening at http://0.0.0.0:10001
info: ReproFunctionApp.AppHost.Resources.storage[0]
6: 2025-10-13T15:38:29.6956386Z Azurite Table service is starting at http://0.0.0.0:10002
info: ReproFunctionApp.AppHost.Resources.storage[0]
7: 2025-10-13T15:38:29.7024892Z Azurite Table service is successfully listening at http://0.0.0.0:10002
warn: Polly[3]
Execution attempt. Source: '-standard//Standard-Retry', Operation Key: '', Result: 'No connection could be made because the target machine actively refused it. (localhost:7293)', Handled: 'True', Attempt: '1', Execution Time: 4106,529ms
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:7293)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
warn: Polly[0]
Resilience event occurred. EventName: 'OnRetry', Source: '-standard//Standard-Retry', Operation Key: '', Result: 'No connection could be made because the target machine actively refused it. (localhost:7293)'
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:7293)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
info: ReproFunctionApp.AppHost.Resources.storage[0]
8: 2025-10-13T15:38:33.4322922Z 172.20.0.1 - - [13/Oct/2025:15:38:33 +0000] "GET /devstoreaccount1/?comp=list&maxresults=1 HTTP/1.1" 200 -
info: System.Net.Http.HttpClient.Default.ClientHandler[100]
Sending HTTP request GET http://localhost:7293/
warn: Polly[3]
Execution attempt. Source: '-standard//Standard-Retry', Operation Key: '', Result: 'No connection could be made because the target machine actively refused it. (localhost:7293)', Handled: 'True', Attempt: '2', Execution Time: 4101,7704ms
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:7293)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
warn: Polly[0]
Resilience event occurred. EventName: 'OnRetry', Source: '-standard//Standard-Retry', Operation Key: '', Result: 'No connection could be made because the target machine actively refused it. (localhost:7293)'
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:7293)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
info: System.Net.Http.HttpClient.Default.ClientHandler[100]
Sending HTTP request GET http://localhost:7293/
fail: Polly[3]
Execution attempt. Source: '-standard//Standard-Retry', Operation Key: '', Result: 'No connection could be made because the target machine actively refused it. (localhost:7293)', Handled: 'True', Attempt: '3', Execution Time: 4086,8574ms
System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it. (localhost:7293)
---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
[xUnit.net 00:00:36.16] ReproFunctionApp.Tests.UnitTest1.Test1 [FAIL]
[xUnit.net 00:00:36.16] System.Net.Http.HttpRequestException : No connection could be made because the target machine actively refused it. (localhost:7293)
[xUnit.net 00:00:36.16] ---- System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it.
[xUnit.net 00:00:36.16] Stack Trace:
[xUnit.net 00:00:36.16] at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
[xUnit.net 00:00:36.16] at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
[xUnit.net 00:00:36.16] --- End of stack trace from previous location ---
[xUnit.net 00:00:36.16] at Polly.Outcome`1.ThrowIfException()
[xUnit.net 00:00:36.16] at Microsoft.Extensions.Http.Resilience.ResilienceHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
[xUnit.net 00:00:36.16] C:\Users\beek\Sandbox\repro\ReproFunctionApp\ReproFunctionApp.Tests\UnitTest1.cs(27,0): at ReproFunctionApp.Tests.UnitTest1.Test1()
[xUnit.net 00:00:36.16] C:\Users\beek\Sandbox\repro\ReproFunctionApp\ReproFunctionApp.Tests\UnitTest1.cs(30,0): at ReproFunctionApp.Tests.UnitTest1.Test1()
[xUnit.net 00:00:36.16] at System.Threading.Tasks.Task.<>c.b__128_0(Object state)
[xUnit.net 00:00:36.16] ----- Inner Stack Trace -----
[xUnit.net 00:00:36.16] at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
[xUnit.net 00:00:36.16] at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
[xUnit.net 00:00:36.17] at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
[xUnit.net 00:00:36.17] at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
[xUnit.net 00:00:36.18] Finished: ReproFunctionApp.Tests
Failed ReproFunctionApp.Tests.UnitTest1.Test1 [35 s]
Error Message:
System.Net.Http.HttpRequestException : No connection could be made because the target machine actively refused it. (localhost:7293)
---- System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it.
Stack Trace:
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(QueueItem queueItem)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.<>c.<b__3_0>d.MoveNext()
--- End of stack trace from previous location ---
at Polly.Outcome`1.ThrowIfException()
at Microsoft.Extensions.Http.Resilience.ResilienceHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at ReproFunctionApp.Tests.UnitTest1.Test1() in C:\Users\beek\Sandbox\repro\ReproFunctionApp\ReproFunctionApp.Tests\UnitTest1.cs:line 27
at ReproFunctionApp.Tests.UnitTest1.Test1() in C:\Users\beek\Sandbox\repro\ReproFunctionApp\ReproFunctionApp.Tests\UnitTest1.cs:line 30
at System.Threading.Tasks.Task.<>c.b__128_0(Object state)
----- Inner Stack Trace -----
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|285_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
Test Run Failed.
Total tests: 1
Failed: 1
Total time: 37,6204 Seconds
```
### .NET Version info
```
dotnet --info
.NET SDK:
Version: 8.0.414
Commit: 62977d44a9
Workload version: 8.0.400-manifests.ff114e0a
MSBuild version: 17.11.41+18f1ecf82
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.414\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
[wasm-tools-net6]
Installation Source: VS 17.10.34928.147
Manifest Version: 8.0.20/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.net6\8.0.20\WorkloadManifest.json
Install Type: FileBased
[wasm-tools-net7]
Installation Source: VS 17.10.34928.147
Manifest Version: 8.0.20/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.net7\8.0.20\WorkloadManifest.json
Install Type: FileBased
[aspire]
Installation Source: VS 17.10.34928.147
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: FileBased
Host:
Version: 8.0.20
Architecture: x64
Commit: 574100b692
.NET SDKs installed:
6.0.428 [C:\Program Files\dotnet\sdk]
8.0.300 [C:\Program Files\dotnet\sdk]
8.0.414 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.20 [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:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
```
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.