问题出在URL的拼接上,导致了重复的部分。正确的URL应该是以一个"http://"或"https://"开头。
解决方法:
string baseUrl = "https://localhost:5001"; // 或者 "http://localhost:5000";
string endpoint = "/api/example"; // 使用具体的API端点
string url = baseUrl + endpoint; // 拼接URL
// 或者使用字符串替换修复URL
string malformedUrl = "https://localhost:5001http://localhost:5000/api/example";
string fixedUrl = malformedUrl.Replace("https://localhost:5001http://localhost:5000", "https://localhost:5001/api/example");
// 使用修复后的URL发送请求
// ...
请根据您的具体代码和情况选择适合的解决方法。