WaqarAli
WaqarAli

Reputation: 163

Azure : C# HttpListener Access Denied Error in App Services

I am developing an aspnet webapp which is currently deployed on latest IIS and working fine. Now My client asked me to move same application over azure App Service.

I deploy it there and Http Listener which is included in application has stopped working. Same code is working on server machine.

HttpListener listener = new HttpListener(); listener.Prefixes.Add('https//customerurlnameazurewebsites.net/'); listener.Start();

Error is on listener.Start() I am recieving bad gateway error on postman

502 - Web server received an invalid response while acting as a gateway or proxy server.

After Azure Remote Debugging I have found Exception 'Access denied' on

listener.Start();

Same Exception was concurring on local machine and server machine I had solve that problem by following command.

netsh http add urlacl url=http://+:80/MyUri user=DOMAIN\user

Upvotes: 2

Views: 950

Answers (1)

Jason Pan
Jason Pan

Reputation: 21873

What is the listening on url ?

If it listen localhost port. In Azure App Services, it just support 80 and 443. If other server URL,it should be works fine.

You also can refer to the comment in this post. I think the usage of HttpListener is correct, it should be useful to you.

Reference post:

Django channels and azure

Strapi on Azure does not run

Upvotes: 1

Related Questions