[英]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.我正在开发一个 aspnet webapp,它目前部署在最新的 IIS 上并且工作正常。 Now My client asked me to move same application over azure App Service.
现在,我的客户要求我在 azure 应用服务上移动相同的应用程序。
I deploy it there and Http Listener which is included in application has stopped working.我将它部署在那里,应用程序中包含的 Http 侦听器已停止工作。 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错误发生在 listener.Start() 上我在邮递员上收到错误的网关错误
502 - Web server received an invalid response while acting as a gateway or proxy server. 502 - Web 服务器在充当网关或代理服务器时收到无效响应。
After Azure Remote Debugging I have found Exception 'Access denied' on在 Azure 远程调试之后,我发现异常“拒绝访问”
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
What is the listening on url
? listening on url
的listening on url
是什么?
If it listen localhost port.如果它监听本地主机端口。 In Azure App Services, it just support
80
and 443
.在 Azure 应用服务中,它只支持
80
和443
。 If other server URL,it should be works fine.如果是其他服务器 URL,它应该可以正常工作。
You also can refer to the comment in this post.您也可以参考这篇文章中的评论。 I think the usage of
HttpListener
is correct, it should be useful to you.我觉得
HttpListener
的用法是对的,应该对你有用。
Reference post:参考帖子:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.