1

I am trying to create a Listener (that listens multiple routes). But I don't manage to find the right solution. My problem is : I am running locally Ngrok (on my 8000 port), and an API is sending JSON (with REST request) to my ngrok address. How can I correctly listen the routes called by the API in CSharp ?

2
  • Nope ! Do you have an example ? Commented Sep 21, 2015 at 22:25
  • Sorry, I deleted my comment and posted it as an answer. The topic is a bit large to provide an example in a Stackoverflow answer, but if you look at the "getting started" tutorials, you should get the idea pretty quickly. Commented Sep 21, 2015 at 22:28

2 Answers 2

1

Have you considered ASP.NET Web API? Looks like it's exactly what you need.

Sign up to request clarification or add additional context in comments.

9 Comments

That's too complex for what I want I think. I am searching for something like "http.HandleFunc()" in Go.
@AnthonyD'amato, too complex for what? Your requirements aren't very clear. What do you want to do with the API requests? Send a response, or just intercept them?
Yes.. Sorry. I just want to intercept them, read them and send a HTTP 200 as response.
For example : The API sends a POST request at 8376de2f.ngrok.io/actions/light/start (an http tunnel generated by Ngrok) sending a json, and I want to intercept this request.
@AnthonyD'amato, you can use an HttpListener
|
0

I have found the solution. My route was : http://localhost:8000/foo/bar To correct the problem, I have changed the route in : http://+:8000/foo/bar

Hope this will help.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.