【发布时间】:2019-08-02 23:39:43
【问题描述】:
我有招摇网址http://somehost/swagger/index.html 结束方法如图所示:
正如有人对我说的那样,http://somehost/api/Referral/GetReferralByNumber 是 API 地址,我可以通过 HTTP 请求引用它。
static void Main(string[] args)
{
try
{
System.Net.WebClient client = new System.Net.WebClient();
string result = client.DownloadString("http://somehost/api/Referral/GetReferralByNumber");
}
catch (System.Net.WebException ex)
{
Console.WriteLine(ex);
}
Console.ReadKey();
}
这是测试 API 的代码,但是
System.Net.WebException:远程服务器返回错误:(404) 未找到异常
有什么帮助吗?
【问题讨论】:
标签: c# api web-services swagger