No server response in Postman and Receive Failure in Fiddler #176

Closed
opened 2025-12-29 14:24:27 +01:00 by adam · 8 comments
Owner

Originally created by @codeplayer14 on GitHub (Jun 3, 2019).

I'm using the following code

       FluentMockServer fms = FluentMockServer.Start();
            fms.Given(Request
                    .Create()
                    .WithPath("/api/evaluator/start")
                    .UsingPost())
                .RespondWith(
                    Response.Create()
                        .WithStatusCode(202));

On hitting this with Postman or Fiddler I get no response. The server is started as mentioned below. I also face the same issue when I start it with Admin interface and try to access one of the admin routes.
From the Immediate Window, this is the status of the fms variable

    IsStarted: true
    LogEntries: Count = 0
    Mappings: {WireMock.IMapping[1]}
    Ports: Count = 1
    Scenarios: Count = 0
    Urls: {string[1]}
Originally created by @codeplayer14 on GitHub (Jun 3, 2019). I'm using the following code ``` c# FluentMockServer fms = FluentMockServer.Start(); fms.Given(Request .Create() .WithPath("/api/evaluator/start") .UsingPost()) .RespondWith( Response.Create() .WithStatusCode(202)); ``` On hitting this with Postman or Fiddler I get no response. The server is started as mentioned below. I also face the same issue when I start it with Admin interface and try to access one of the admin routes. From the Immediate Window, this is the status of the fms variable ```{WireMock.Server.FluentMockServer} IsStarted: true LogEntries: Count = 0 Mappings: {WireMock.IMapping[1]} Ports: Count = 1 Scenarios: Count = 0 Urls: {string[1]} ```
adam added the invalid label 2025-12-29 14:24:27 +01:00
adam closed this issue 2025-12-29 14:24:27 +01:00
Author
Owner

@StefH commented on GitHub (Jun 3, 2019):

After your start code, can you try to add this code?

System.Console.WriteLine("Press any key to stop the server");
System.Console.ReadKey();
fms.Stop();
@StefH commented on GitHub (Jun 3, 2019): After your start code, can you try to add this code? ``` c# System.Console.WriteLine("Press any key to stop the server"); System.Console.ReadKey(); fms.Stop(); ```
Author
Owner

@codeplayer14 commented on GitHub (Jun 3, 2019):

I tried. Same result. I was using a while(true) loop before to block the thread from exiting. Replaced it with your code. But the result is still the same.

@codeplayer14 commented on GitHub (Jun 3, 2019): I tried. Same result. I was using a while(true) loop before to block the thread from exiting. Replaced it with your code. But the result is still the same.
Author
Owner

@StefH commented on GitHub (Jun 3, 2019):

Note that when you start the server like this, a random port is used.
If you want to fix the port, use:

FluentMockServer fms = FluentMockServer.Start("http://localhost:9999");

or

FluentMockServer fms = FluentMockServer.Start(9999);
@StefH commented on GitHub (Jun 3, 2019): Note that when you start the server like this, a random port is used. If you want to fix the port, use: ``` c# FluentMockServer fms = FluentMockServer.Start("http://localhost:9999"); ``` or ``` c# FluentMockServer fms = FluentMockServer.Start(9999); ```
Author
Owner

@codeplayer14 commented on GitHub (Jun 3, 2019):

Yeah. But that's not the issue I'm facing. I've been getting the port from fms.Ports and using it in the request. However, I don't get a response.

@codeplayer14 commented on GitHub (Jun 3, 2019): Yeah. But that's not the issue I'm facing. I've been getting the port from fms.Ports and using it in the request. However, I don't get a response.
Author
Owner

@StefH commented on GitHub (Jun 3, 2019):

You are sending a POST request ?

(Can you also export the Postman request so that I can re-play this on my machine?)

@StefH commented on GitHub (Jun 3, 2019): You are sending a POST request ? (Can you also export the Postman request so that I can re-play this on my machine?)
Author
Owner

@codeplayer14 commented on GitHub (Jun 3, 2019):

Yes I'm using a POST request. Attaching the Postman request.

Wiremock.net Test.postman_collection.zip

@codeplayer14 commented on GitHub (Jun 3, 2019): Yes I'm using a POST request. Attaching the Postman request. [Wiremock.net Test.postman_collection.zip](https://github.com/WireMock-Net/WireMock.Net/files/3246465/Wiremock.net.Test.postman_collection.zip)
Author
Owner

@StefH commented on GitHub (Jun 3, 2019):

I'm using this code (tested in Linqpad):

FluentMockServer fms = FluentMockServer.Start(9999);
fms.Given(
    Request.Create().WithPath("/api/evaluator/start").UsingPost())
    .RespondWith(Response.Create().WithBody("hello").WithStatusCode(202)
);
				
Thread.Sleep(1000*1000);
fms.Stop();

image

And Postman works fine:
image

@StefH commented on GitHub (Jun 3, 2019): I'm using this code (tested in Linqpad): ``` c# FluentMockServer fms = FluentMockServer.Start(9999); fms.Given( Request.Create().WithPath("/api/evaluator/start").UsingPost()) .RespondWith(Response.Create().WithBody("hello").WithStatusCode(202) ); Thread.Sleep(1000*1000); fms.Stop(); ``` ![image](https://user-images.githubusercontent.com/249938/58787227-a85c3480-85e9-11e9-90eb-76403a4fde83.png) And Postman works fine: ![image](https://user-images.githubusercontent.com/249938/58787258-bc079b00-85e9-11e9-860b-ad744638356c.png)
Author
Owner

@codeplayer14 commented on GitHub (Jun 3, 2019):

Okay. Thanks. Turns out I was missing one of the dependencies! :/

@codeplayer14 commented on GitHub (Jun 3, 2019): Okay. Thanks. Turns out I was missing one of the dependencies! :/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#176