如何在Azure中托管TCP侦听器? [英] How can I host a TCP Listener in Azure?

查看:98
本文介绍了如何在Azure中托管TCP侦听器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在Azure中构建一个应用程序,该应用程序将充当TCP侦听器,在指定的端口上接收TCP消息流,然后将信息添加到数据库中.传入的TCP通信将使用证书进行保护.

I am looking to build an application in Azure which will act as TCP listener, receive TCP message streams on a specified port, and then add the information to a database. The incoming TCP communication will be secured with a certificate.

我正在考虑以下选项:

云服务工作者角色

这肯定看起来像工作.但是,这意味着我必须使用Cloud Service,并且错过了App Service提供的功能和简单性.云服务文档还专门介绍了如何打开所需的TCP端口.

This definitely looks like it will work. However that means I have to use a Cloud Service, and I miss out on the features and simplicity offered by the App Service. The Cloud Service documentation also specifically describes how to open the required TCP ports.

应用服务

在Logic App(首选)中,但这似乎并不本地支持TCP侦听器,因此我希望构建一个自定义API App.或者,我可以创建一个Web Job.

In a Logic App (preferred), however this doesn't seem to natively support a TCP listener, so I would look to build a custom API App. Alternatively I could create a Web Job.

但是我不确定这种方法是否行得通,并且我有以下问题:

However I'm not sure this approach will work, and I have the following questions:

  • 我可以在App Service上公开任意TCP端口吗?
    • 尽管Cloud Service文档专门描述了如何执行此操作,但我找不到与App Service类似的东西.因此,要么不需要配置,要么就无法在App Service中进行TCP通信.
    • Can I expose arbitrary TCP ports on the App Service?
      • Whilst the Cloud Service documentation specifically describes how to do this, I can't find anything similar for the App Service. So, either the configuration is not required or TCP communication is just not possible within the App Service.

      我可以在Azure应用服务中托管TCP侦听器吗?

      Can I host a TCP Listener in an Azure App Service?

      推荐答案

      云服务工作者角色

      Cloud Service Worker Role

      这看起来确实可行.但是,这意味着我必须使用Cloud Service,并且错过了App Service提供的功能和简单性. Cloud Service文档还专门描述了如何打开所需的TCP端口.

      This definitely looks like it will work. However that means I have to use a Cloud Service, and I miss out on the features and simplicity offered by the App Service. The Cloud Service documentation also specifically describes how to open the required TCP ports.

      绝对可以.

      https://msdn.microsoft.com/en-us/library/azure/gg557553.aspx

      ServiceDefinition.csdef 中:

      <Endpoints>
        <InputEndpoint name="RawTCP" protocol="tcp" port="54321" localPort="54321" />
      </Endpoints> 
      

      应用服务

      在Logic App(首选)中,但这似乎并不本机支持TCP>监听器,因此我希望构建一个自定义API App.或者,我可以创建一个Web Job. ...

      In a Logic App (preferred), however this doesn't seem to natively support a TCP >listener, so I would look to build a custom API App. Alternatively I could create a Web Job. ...

      我可以在App Service上公开任意TCP端口吗? ...

      Can I expose arbitrary TCP ports on the App Service? ...

      我可以在Azure应用服务中托管TCP侦听器吗?

      Can I host a TCP Listener in an Azure App Service?

      否和否.只有80/TCP和443/TCP公开公开,并且唯一有效的协议是HTTP. 您无法使用App Service进行自定义侦听器.

      No and No. Only 80/TCP and 443/TCP are exposed publicly and the only protocol that works is HTTP. You can't do custom listeners with App Service.

      请参阅此处列出的沙箱限制: https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#network-endpoint-listening

      See the sandbox limitations listed here: https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox#network-endpoint-listening

      如果应用程序服务"页面上未提及此限制,请随时在Azure文档中提出拉取请求.

      Feel free to make a pull request in the Azure documentation if this limitation is not mentioned on the App Service page.

      服务结构将是一个很酷的第三(或第一?)选项: https://azure.microsoft.com/en-us/services/service-面料/

      Service Fabric would be a cool 3rd (or 1st?) option: https://azure.microsoft.com/en-us/services/service-fabric/

      这篇关于如何在Azure中托管TCP侦听器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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