-1

I'm currently writing some POC's where I need to consume a web service from my Mac. I write the web service on my PC and now I need the Mac to be able to consume it for debugging purposes. When working from my home office I have no problems resolving the PC machine name but whenever I get back to the office the browsers (Safari & Chrome) cannot see the PC. The only thing I know is different at work is we're accessing internet via a proxy. Other than that it's a pretty vanilla network setup over DHCP, just like with my home office.

Situation: Mac is set up to file share and can see the PC over SMB Mac can ping the PC successfully when I add ".local" to the PC machine name Mac cannot see the PC from the address line of any browser. PC is set up to run Bonjour print service PC is running the web service over IIS Express PC is set up to support the needed URLs through ...

netsh http add urlacl url=http://*:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://localhost:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://%COMPUTERNAME%:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://%COMPUTERNAME%.local:%HTTP_PORT%/ user=everyone

(%HTTP_PORT% = 60011, default for IIS Express) The above configuration (Bonjour + urlacl) was found at this blog

I wrote a small web method -- HelloWorld -- that just returns "Hello World" for testing purposes and made sure it works locally. Trying to consume it from the Mac via the browsers address field as "http://myPC.local:60011/MyWebService.asmx/HelloWorld" gives me this error (Safari):

Network Error (dns_unresolved_hostname) 

Your requested host "myPC.local" could not be resolved by DNS.

("myPC" is just a substitute for the actual machine name)

I'm currently out of ideas. Any suggestions would be greatly appreciated.

Cheers!

[EDIT 1] Not sure if it's a clue to anyone of you Mac gurus out there but: The browsers do react differently if I remove the ".local" in "myPC.local". When I leave it in both Safari and Chrome gives the same exact error message (see above) but when I leave it out Safari returns this message ...

You are not connected to the Internet

... while Chrome returns this ...

Oops! 
Google Chrome could not find myPC:60011

[EDIT 2] I've noticed another strange occurance: After having entered the above URL and being served the above error message, it seems to work if I navigate back and then forward again. But if I click 'Refresh' I get the same error message. I have tested this litte trick in Chrome (Safari won't let me navigate back/forward in this situation.

Not sure what to make of that, really! Anyone else willing to give it a shot?

Jonas Rembratt
  • 1,550
  • 3
  • 17
  • 39

2 Answers2

1

I have a simple hint; Only your machine knows that it is named like myPC. because it looks inside the hosts (and linked to /etc/hostname) file of your box. . Your other mac will not know that name, however.

Why don't you try to replace the 'myPC' with your current IP ? When in my wifi, I get ip addresses like 192.168.0.101, 192.168.0.102,...etc; and I use them for intra file transfers or whatever. other boxes won't know my box's names like 'I-AM-X', etc. You probably should have some ip address. (look ifconfig -a ohh.. ipconfig /all in windows..). You better use it in place of "myPC".

Siva Tumma
  • 1,695
  • 12
  • 23
  • Using the IP address works, of course, and I already do that but I would still prefer to be able to use the machine name as that's portable and the IP address isn't. Having to configure a client to use an IP address is rarely a good idea. Secondly, I would like to understand how the Mac does this. Why can it ping the PC if I add ".local" after it from the terminal while, at the same time, the browsers cannot (specifying "myPC.local:60011" as the host in the browser's address line doesn't work). – Jonas Rembratt Jan 21 '14 at 14:02
  • First of all, it looks like `myPC.local` is there as a single entry in your `/etc/hosts` file. Because that file is where host names and virtual names are picked up. (I name my domain as `comedaddy.com`). Okay, secondly, you should be able to differentiate between a `dhcp` and a `static` IP. with a `dhcp` configuration, You can not get what you are wishing to. Only if you get a `static` IP, (which takes at the least 4 days after you apply).., your box can be accessible with a `name` !! Someone correct me if I have wrongly understood. BTW, these settings are more attached to `OS` - ANY OS. – Siva Tumma Jan 21 '14 at 18:11
  • Not sure I understand correctly but, as I stated in my original question, the Mac successfully resolves the PC by its name when sitting in my home network, which is also a DHCP configuration. So I don't understand why DHCP would be a problem. The only difference is that the box gets its DNS address(es) from the DHCP service. It's still the DNS service's job to do name resolution and for some reason this either doesn't work or the browsers on the Mac is unsuccessful at employing my company's DNS servers for some reason. I'm far from a network guy but that's how I understand it to work. – Jonas Rembratt Jan 22 '14 at 09:16
0

I finally figured out out.

I wronly assumed the DNS servers at work would be able to correctly resolve just the machine name. If I add the fully qualified name ("myPC.") it works fine. Unlike the Mac, other PC's in the same network automatically falls back to employing WINS for name resolution when the AD fails. My home network is a simple workgroup (like the Mac's "local" namespace) so that's why the Mac can successfully employ my home router's DNS service.

It's still a problem of course since configuring the Mac to always make contact with a machine is a specified network makes it impossible to move outside that network (without having to reconfigure).

But, then again, I asked the question not only to crack the problem but to gain some knowledge so it's ok.

Thanks for giving it a shot sivatumma!

Jonas Rembratt
  • 1,550
  • 3
  • 17
  • 39