Closed MarcoMartins86 closed 2 months ago
@MarcoMartins86 Did you try to make the test async? Like:
[Test]
public async Task Test()
{
var client = new HttpClient();
var result = await client.GetAsync(_server.Url);
Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK));
}
@StefH Fail with the same behavior.
System.Net.Http.HttpRequestException : An error occurred while sending the request.
----> System.Net.WebException : The underlying connection was closed: An unexpected error occurred on a receive.
----> System.IO.IOException : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
----> System.Net.Sockets.SocketException : An existing connection was forcibly closed by the remote host
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Adding a logger I can see that the server prints Server listening at http://localhost:57550
but then no request reachs the WireMockMiddleware.Invoke()
(reach when working). Feels like the server have a deadlock somewhere at the beginning of request pipeline, because, it reserved the port successfully since if I try to reuse the same port while the process is running it says it is already in use.
I will close this, I've added <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
and it started working for all versions. For me, that is good enough.
Thank you for your time and good work.
Describe the bug
I've made a clean project with only
The behavior I've got is similar to the one described on this other thread https://github.com/WireMock-Net/WireMock.Net/issues/470, there's no error and it seems to be on some kind of deadlock somewhere but I can't pinpoint it.
Expected behavior:
Should work with .Net Framework 4.6.1 and NUnit3
Test to reproduce
Other related info
With Wiremock version 1.5.46 it is working. Also, it is working with .Net Framework 4.6.2 for 1.5.47+ Workaround, stay on 1.5.46 for now.