我一直在尝试通过以下 C# 代码模拟以下 cURL 命令:
curl.exe –v –u user:pwd –XPOST –T "file1.txt" –H "Content-Type:text/plain" "http://example.com/xx/xx/xx/insert"
string url = "http://example.com/xx/xx/xx/insert";
string fileName = @"file1.txt";
var client = new WebClient();
client.Credentials = new NetworkCredential("user", "pwd");
client.Headers.Add("Content-Type", "text/plain");
byte[] responseBinary = client.UploadFile(url, "POST", fileName);
string response = Encoding.UTF8.GetString(responseBinary);
它给了我一个“内部服务器错误 500”。我认为我要上传到的服务器是 PHP 服务器。我应该如何进行调试?