gpt4 book ai didi

c# - azure vm windows服务器上的自托管wcf服务

转载 作者:行者123 更新时间:2023-11-30 18:27:03 25 4
gpt4 key购买 nike

我有带有 udp 绑定(bind)的 wcf 服务(WCF 4.5 中的新增功能),并且我正在尝试将其托管在 Azure 上的 Windows Server 2012 上。

我在 Azure 上为我需要的端口(39901;它适用于 HTTP:80,我可以看到 IIS 网站)进行了端点映射,并且我允许防火墙中此端口的所有流量。但我仍然无法在网络浏览器中获取 wsdl。

这是控制台应用程序的 app.config:

<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="12" maxConcurrentInstances="56" maxConcurrentSessions="12" />
<useRequestHeadersForMetadataAddress></useRequestHeadersForMetadataAddress>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="ServerService.UdpServiceAlpha">
<endpoint address="soap.udp://localhost:8091" binding="udpBinding" contract="ServerService.IUdpServiceAlpha" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:39901/SelfServerHost/" />
</baseAddresses>
</host>
</service>
</services>
<protocolMapping>
<add binding="udpBinding" scheme="soap.udp" />
</protocolMapping>
<bindings>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
</configuration>

对于本地主机,一切工作正常...我是这方面的新手( azure ,Windows 服务器部署),我在 stackoverflow 或其他任何地方尝试了很多想法。但还是不行。

有什么想法吗?

编辑1:

<services>
<service name="ServerService.UdpServiceAlpha" behaviorConfiguration="UdpServiceAlpha.Behavior">

<endpoint address="/" binding="udpBinding" contract="ServerService.IUdpServiceAlpha"/>
<endpoint address="/" binding="webHttpBinding" contract="ServerService.IUdpServiceAlpha"/>
<host>
<baseAddresses>
<add baseAddress="http://xxx.cloudapp.net:39901/SelfServerHost/" />
<add baseAddress="soap.udp://xxx.cloudapp.net:39901/SelfServerHost/" />
</baseAddresses>
</host>
</service>
</services>

最佳答案

尝试将 Azure VM 端点公共(public)端口从 39901 更改为 443!

大量系统管理员和 ISP 阻止所有传出端口,只允许少数端口(传出端口白名单)。端口 80 和 443 通常不会被阻止,因为它通常是 HTTP 流量。

仅更改 VM 端点的公共(public)端口。保留私有(private)端口不变 - 39901。

关于c# - azure vm windows服务器上的自托管wcf服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27501683/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com