问题
I am using paypal NVP api in an ecommerce website. It was working fine before but now it is throwing "System.Net.WebException: The remote name could not be resolved: 'api-3t.sandbox.paypal.com'"
Exception. I also tried api.sandbox.paypal.com but no luck. Any ideas?
Thanks
Update : Same codes works if my client runs it from his system.
回答1:
This is a DNS problem, or at least, that's what the exception points to. The machine that is running your code, and failing, is not able to resolve the hostname 'api-3t.sandbox.paypal.com' to an IP address.
Potential problems, in order of likelyhood:
- Your machine does not have a DNS server configured properly.
- Your machine is using a DNS server that filters queries.
- This is common in corporate environments; filtering is done to try to stop malware from working.
- Your machine does have a DNS server configured, however, that server may refuse to perform recursive querys
- This is typical of 'authoritative-only' DNS servers.
- Your code is somehow misusing the local DNS query API.
- Paypal's DNS servers are broken.
You could fire up a command prompt on that machine and see if normal DNS resolution works:
c:\>nslookup api-3t.sandbox.paypal.com
Server: google-public-dns-a.google.com.
Address: 8.8.8.8
Non-authoritative answer:
Name: api-3t.sandbox.paypal.com
Address: 173.0.82.83
If you want to try to bypass your institution's DNS server for testing, you can reconfigure your computer to use Google's public DNS server, 8.8.8.8.
来源:https://stackoverflow.com/questions/23522306/the-remote-name-could-not-be-resolved-api-3t-sandbox-paypal-com