Closed gregoks closed 5 years ago
If possible, please provide the mappings you use.
Thats the thing, I dont see that it's related to a mapping that I have added. is it possible? I'll try to increase the log level to see if I can add more information.
Or provide a demo project ?
@StefH just to update, I have tried to make my logs to be "Debug". still havent really figured out the issue, but I saw this error one time:
and I would like to ask if you could create pre-release version with the following change in the WireMockMiddleware class:
In many cases I see the following error without any exception stack trace:
"HttpStatusCode set to 500"
because you error message without the exception in this line:
_options.Logger.Error("HttpStatusCode set to 500");
The error is very general, could add the exception itself to the error? Or even if you could add the problematic mapping to the log message, that would be even better!
Thanks,
Greg
Just to clarify, Im using wiremock as an mocking infra in a company I work for. Currently I have around 20 mocks set up on different ports and automation nightlies are running at the same time, adding miltiple mappings and sometimes the errors that Ive mentioned happen so without the logging, its hard to understand which mapping causes the error.
Can you install WireMock.Net.1.0.27-ci-11567.nupkg
?
This version contains more logging. https://github.com/WireMock-Net/WireMock.Net/pull/309/commits/e423a995f4835fe261e8869ce04c95ea58969eee
You mean this line?
yes exactly. It would be great if you could add the exception to the error message or perhaps even the mapping that caused it..
Can you install and try WireMock.Net.1.0.27-ci-11567.nupkg from MyGet?
Can you install
WireMock.Net.1.0.27-ci-11567.nupkg
?This version contains more logging. e423a99
sure, ill try and let you know.
I have tried WireMock.Net.1.0.27-ci-11567 and the logs that you have added help! I saw the reason for the error, it was a mapping that led to service that took really long time to respond.
Good to hear.
Also check if https://github.com/WireMock-Net/WireMock.Net/issues/308 is still happening, or maybe this is also fixed.
Closing
Hi,
Many times I see the following error when I use wiremock:
"HttpStatusCode set to 500 System.InvalidOperationException: Writing to the response body is invalid for responses with status code 204. at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ThrowWritingToResponseBodyNotSupported() at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.WriteAsync(ReadOnlyMemory`1 data, CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpResponseStream.WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) at WireMock.Owin.Mappers.OwinResponseMapper.MapAsync(ResponseMessage responseMessage, HttpResponse response) at WireMock.Owin.WireMockMiddleware.InvokeInternal(HttpContext ctx) at WireMock.Owin.GlobalExceptionMiddleware.InvokeInternal(HttpContext ctx)"
it comes from the following class:
WireMock.Owin.GlobalExceptionMiddleware+d__7.MoveNext
I thought that perhaps I'm trying to add mapping with response content for http status 204 but I havent found anything like that.
Do you have any idea about this sort of error?
Thanks,
Greg