简体   繁体   English

无法访问Azure虚拟机上的自托管WCF服务

[英]Unable to access a self-hosted WCF service on azure virtual machine

I have self-hosted a WCF service on base adress new Uri("http://" + Environment.MachineName + ":1235/myService") on an Azure Virtual Machine. 我已经在Azure虚拟机上的new Uri("http://" + Environment.MachineName + ":1235/myService")地址new Uri("http://" + Environment.MachineName + ":1235/myService")上自托管了WCF服务。 I have printed this address and I get it as http://TRIALVM:1235/IRChatbotService . 我已经打印了该地址,并将其作为http://TRIALVM:1235/IRChatbotService The DNS name of my virtual machine is trialvm.cloudapp.net . 我的虚拟机的DNS名称是trialvm.cloudapp.net

As I have hosted this service on port 1235, I have added the inbound rule with following properties: 由于我在端口1235上托管了此服务,因此添加了具有以下属性的入站规则:

在此处输入图片说明

Still the created service is not accessible from outside VM. 仍然无法从外部VM访问创建的服务。 I am able to get service page when I go to the service URL http://TRIALVM:1235/IRChatbotService on the same virtual machine, but not from my local computer. 当我转到同一虚拟机上的服务URL http://TRIALVM:1235/IRChatbotService时,但无法从本地计算机上获得服务页面。

Have you opened the endpoint on the Azure portal. 您是否已在Azure门户上打开端点。 By default the machine is firewalled from Azure as well...not just your VM. 默认情况下,计算机也从Azure进行防火墙保护,而不仅仅是从您的VM中进行防火墙保护。

https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-set-up-endpoints/ https://azure.microsoft.com/zh-CN/documentation/articles/virtual-machines-set-up-endpoints/

If you're using http://TRIALVM:1235/IRChatbotService to access the web service from outside the VM it won't work. 如果您使用http:// TRIALVM:1235 / IRChatbotService从VM外部访问Web服务,它将无法正常工作。 TRAILVM is the hostname which is resolvable within the cloud service but from the outside world you need the domain name of the cloud service/load balancer, in this case both the VM and the cloud service are called trialvm but they can be different as you can have many vms in a cloud service. TRAILVM是可在云服务中解析的主机名,但从外部世界来看,您需要云服务/负载平衡器的域名,在这种情况下,VM和云服务都称为trialvm,但它们可以不同云服务中有许多虚拟机。 In this case the domain name looks to be trialvm.cloudapp.net. 在这种情况下,域名看起来是trialvm.cloudapp.net。

Hth, Gareth Hth Gareth

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM