Access WCF in Azure Using Mapped Domain Name
I have a WCF service in Azure. I can reference its IP address and successfully hit it with a browser or with WcfTestclient.exe. I've gone into GoDaddy and mapped svc.mydomain.com to my IP/port and now I can't hit with a browser, but not with WcfTestClient.exe. The error is "Error: Cannot obtain Metadata from http://svc.mydomain.com/Service1.svc?wsdl... Metadata contains a reference that cannot be resolved: 'http://svc.mydomain.com/Service1.svc?wsdl'. The remote server returned 开发者_StackOverflow中文版an unexpected response: (408) Request. The remote server returned an error: (408) Request Timeout.HTTP GET Error URI: http://svc.mydomain.com/Service1.svc?wsdl The HTML document does not contain Web service discovery information." When I hit it with the browser it comes back with the stock html showing that it found the service, but it refers to it by its IP, so I wonder if it's a config file change that I need to make. Is it best practice to nickname my service with a CNAME (i.e. svc.mydomain.com) and thus reference my services with like: http://svc.mydomain.com/MyService.svc?
You shouldn't rely on the IP address for a Windows Azure service. The IP addresses can and almost certainly will change (for instance, if you deploy from within Visual Studio, it tends to result in a different IP address being allocated).
You service already has a DNS name: deployment name.cloudapp.net
The Windows Azure Management Portal will show you the DNS name.
If you want to address the service using a different DNS name, use a CNAME to create a DNS alias.
精彩评论