在Azure Centos VM中设置HttpListener [英] Setup HttpListener in Azure Centos VM

查看:69
本文介绍了在Azure Centos VM中设置HttpListener的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在Azure CentOS 7.5 VM中安装了C#Web服务器,遇到的问题是让HttpListener侦听VM的公共IP.根据stackoverflow帖子和通配符"*"的备注部分,我设法将Web服务器设置为 收听所有IP(我无法插入链接,因为我从来没有验证我的帐户)

在本地CentOS VM上,我可以侦听VM的静态IP,但是在Azure CentOS VM上,我不能侦听VM的公共IP.我遇到的错误消息如下.

Hi all,

I have a C# Webserver setup in an Azure CentOS 7.5 VM and the issue I faced was getting my HttpListener to listen to the public ip of my VM. According to a stackoverflow post and the remarks section on wildcard "*", I managed to get my webserver to listen to all ip (I can't insert links because I never got to verify my account)

On a local CentOS VM, I am able to listen to the VM's static ip, but on Azure CentOS VM I can't listen to the VM's public ip. The error message that I encountered is as follows.

An exception was encountered which triggered this message
  Method     : AcceptConnections
  Type       : System.Net.HttpListenerException
  Data       : System.Collections.ListDictionaryInternal
  Inner      :
  Message    : Cannot assign requested address
  Source     : System.Net.HttpListener
  StackTrace :    at System.Net.HttpEndPointManager.GetEPListener(String host, Int32 port, HttpListener listener, Boolean secure)
   at System.Net.HttpEndPointManager.AddPrefixInternal(String p, HttpListener listener)
   at System.Net.HttpEndPointManager.AddListener(HttpListener listener)
   at System.Net.HttpListener.Start()
   at WatsonWebserver.Server.AcceptConnections(CancellationToken token)
  Stack      : StackToString <= LogException <= AcceptConnections <= Run <= ExecuteWithThreadLocal <= Dispatch
  Line       : 0
  File       :
  ToString   : System.Net.HttpListenerException (0x80004005): Cannot assign requested address
   at System.Net.HttpEndPointManager.GetEPListener(String host, Int32 port, HttpListener listener, Boolean secure)
   at System.Net.HttpEndPointManager.AddPrefixInternal(String p, HttpListener listener)
   at System.Net.HttpEndPointManager.AddListener(HttpListener listener)
   at System.Net.HttpListener.Start()
   at WatsonWebserver.Server.AcceptConnections(CancellationToken token)




我是否需要在VM或Azure中做任何事情以允许Web服务器仅侦听VM的公共IP?问题可能是由于我的VM在Azure中没有与其公用IP相对应的以太网设置吗?




Is there anything that I need to do in my VM or in Azure to allow my webserver to listen only to my VM's public ip? Could the issue be due to my VM in Azure does not have a ethernet setting that corresponds to its public ip? 

推荐答案

Are您在Azure VM公用IP上侦听特定端口吗?如果是这样,您可能还需要在虚拟机上打开关联的网络安全组

Are you listening to a specific port on your Azure VMs public IP? If so, you will likely need to also open the associated Network Security Group on the VM

https://docs.microsoft.com/en-us/azure/virtual -network/security-overview


这篇关于在Azure Centos VM中设置HttpListener的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆