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

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

本文介绍了无法访问Azure虚拟机上的自托管WCF服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Azure虚拟机的基本地址new Uri("http://" + Environment.MachineName + ":1235/myService")上自托管了WCF服务.我已经打印了该地址,并以http://TRIALVM:1235/IRChatbotService的形式获取.我的虚拟机的DNS名称为trialvm.cloudapp.net.

I have self-hosted a WCF service on base adress new Uri("http://" + Environment.MachineName + ":1235/myService") on an Azure Virtual Machine. I have printed this address and I get it as http://TRIALVM:1235/IRChatbotService. The DNS name of my virtual machine is trialvm.cloudapp.net.

由于我已在端口1235上托管了此服务,因此我添加了具有以下属性的入站规则:

As I have hosted this service on port 1235, I have added the inbound rule with following properties:

仍然无法从外部VM访问创建的服务.当我转到同一虚拟机上的服务URL http://TRIALVM:1235/IRChatbotService,但不能从本地计算机访问服务页面时,我可以获得服务页面.

Still the created service is not accessible from outside 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.

推荐答案

如果您使用的是 http://TRIALVM:1235/IRChatbotService 可以从无法使用的VM外部访问Web服务. TRAILVM是可在云服务中解析的主机名,但从外部世界来看,您需要云服务/负载平衡器的域名,在这种情况下,VM和云服务都称为trialvm,但是它们可以不同云服务中有许多虚拟机.在这种情况下,域名看起来是trialvm.cloudapp.net.

If you're using http://TRIALVM:1235/IRChatbotService to access the web service from outside the VM it won't work. 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. In this case the domain name looks to be trialvm.cloudapp.net.

Hth,加雷斯(Gareth)

Hth,Gareth

这篇关于无法访问Azure虚拟机上的自托管WCF服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 07:47