HttpListener Issue - works on my machine but not on another server

I have hosted a web service on an Https port on my local machine, when the service gets a request from the client it sends back an "ACK" signal. Please see below my code in c# :
static void Main(string[] args)
{      try{
            System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
            listener.AuthenticationSchemes = AuthenticationSchemes.Anonymous;
      }catch (HttpListenerException exception)
      while (listener.IsListening) //For ProcessRequestwithContext()
            var context = listener.GetContext();
private static void ProcessRequestwithContext(HttpListenerContext context)
      Console.WriteLine("Request received through ProcessRequestwithContext");
      var body = new StreamReader(context.Request.InputStream).ReadToEnd();
      byte[] b = Encoding.UTF8.GetBytes("ACK");
      context.Response.StatusCode = 200;
      context.Response.KeepAlive = false;
      context.Response.ContentLength64 = b.Length;
      var output = context.Response.OutputStream;
      output.Write(b, 0, b.Length);

My problem is that the above code works perfectly on my local machine but when I try to listen on an https port of another machine as follows, I don't get an "ACK" back :

Please tell me what I'm missing ? I'm unable to debug this issue. My intention is to setup a simple web service that can listen continuously to Post requests from the client and service them accordingly.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
I am curious about this approach, versus something like Web API, which can still be a simple web service...
oldstone00Author Commented:

My goal is to accept Http POST requests from a client and process them in c#. I have exposed a url endpoint to a client who will send me Post requests. My aim is to catch and decode the JSON data in those POST requests using c#.

I'm not sure if what I'm doing is the best way so please suggest what my options are ?

Thanks in advance!
Bob LearnedCommented:
Personally, I prefer the options that come with a dedicated web service, such as WebAPI, but that's me.

Building ASP.Net Web API RESTful Service – Part 5

I like that idea better than using a while loop to wait for requests:

while (listener.IsListening) 
            var context = listener.GetContext();

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.