[英]“The remote name could not be resolved” error when calling API from server
On my website I have some calls to an API.在我的网站上,我调用了一些 API。
In client side, with AJAX, it works perfectly but from server side (MVC and C#) I'm getting the following error:在客户端,使用 AJAX,它可以完美运行,但从服务器端(MVC 和 C#)我收到以下错误:
The remote name could not be resolved 'api.website.com'无法解析远程名称“api.website.com”
This is the code that calls the API:这是调用API的代码:
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.ContractResolver = new CamelCasePropertyNamesContractResolver();
var data = JsonConvert.SerializeObject(email);
WebClient client = new WebClient();
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
var resp = client.UploadString(@"http://api.website.com/functions/email", data);
Any help would be very much appreciated.任何帮助将不胜感激。
正如@neuhaus 所写,问题出在 DNS 设置上,一旦修复,它就可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.