考虑 .Net 服务中的以下代码
public async Task<Stream> GetBlob(string url) {
WebClient client = new WebClient();
Stream download = await client.OpenReadTaskAsync(url);
_operationContext.OperationCompleted += delegate
{
download.Close();
download.Dispose();
};
return download;
}
这行得通,我得到了二进制数据,但没有正确的内容类型(我得到应用程序/八位字节流,因为它应该是图像/jpeg)。如何传递/获得正确的 mimetype?