C# 使用Webclient下载Torrent文件时出现问题

C# 使用Webclient下载Torrent文件时出现问题,c#,webclient,mime,bittorrent,C#,Webclient,Mime,Bittorrent,我试图建立一个应用程序,将下载种子文件。虽然它下载,但似乎无法正确保存文件 它似乎有一个丢失的标题或什么。如果打开该文件,则不会看到跟踪器的信息。该文件比我从浏览器下载的文件小约1KB到3KB 我想这一定是mime文件类型的问题,因为我在Google上用一些图片替换了torrent链接,它可以正常下载 private void submitButton_Click(object sender, EventArgs e) { string hashCodeString; hashCodeStrin

我试图建立一个应用程序,将下载种子文件。虽然它下载,但似乎无法正确保存文件

它似乎有一个丢失的标题或什么。如果打开该文件,则不会看到跟踪器的信息。该文件比我从浏览器下载的文件小约1KB到3KB

我想这一定是mime文件类型的问题,因为我在Google上用一些图片替换了torrent链接,它可以正常下载

private void submitButton_Click(object sender, EventArgs e)
{
string hashCodeString;
hashCodeString = hashTextBox.Text;
addressTextBox.Text = "http://www.torrage.com/torrent/" + hashCodeString +".torrent";
torrageLinkLabel.Text = addressTextBox.Text;
}

private void torrageLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
using (var client = new WebClient())
{
client.DownloadFile(torrageLinkLabel.Tex… @"C:\torrent\file.torrent");
}

不确定为什么缺少标题和跟踪器。

我也有这个问题。我想我已经把范围缩小到重定向到位于SSL后面的torrent缓存站点。如果您打开Fiddler并将其配置为解密SSL通信,然后执行WebClient.Download部分的代码,您应该获得所有头/跟踪器数据

但是一旦你关闭Fiddler,并且流量没有被解密,报头/跟踪器数据就不再下降


不知道如何解决这个问题。

找到了这个问题的答案。。。响应使用gzip压缩。您只需在web请求中添加以下行:

Add(HttpRequestHeader.AcceptEncoding,“gzip,deflate”);
request.AutomaticDecompression=DecompressionMethods.GZip | DecompressionMethods.Deflate

你确定你是从同一个URL下载的吗?有同样的问题,你解决过吗?很抱歉回复太晚,答案是我还没弄清楚。