【发布时间】:2018-07-10 12:43:39
【问题描述】:
是否可以使用作为集成测试的一部分生成的TestServer 来测试SignalR (https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests view=aspnetcore-2.1)?
我的所有重试都未能与TestServer 实例握手失败并出现异常:System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it
运行在Debug/Console/IIS 完美运行
服务器代码
public void Configure(...)
{
...
app.UseSignalR(router => router.MapHub<MockHub>("/ws"));
...
}
测试代码
...
var server = factory.Server;
var connection = new HubConnectionBuilder()
.WithUrl(server.BaseAddress)
.Build();
await connection.StartAsync();
【问题讨论】:
标签: asp.net-core signalr integration-testing