我有一个Web应用程序,需要更改才能使用Windows Azure网站。两个文本文件被上传和解析,然后第三个文件被逐行写入解析的数据。我发现我无法将文件直接上传到Azure网站并需要使用Blob存储。这非常简单。我无法找到的是如何将文本文件逐行写入Blob或者可能会有更好的解决方案?我需要重新创建此代码与Azure的Web站点的工作:将文本文件逐行写入蔚蓝网站
using (var writer = new StreamWriter(filePath, false))
{
foreach (Product product in pm.GetAll())
{
fp = pm.MakeFinal(product);
curLine.Append(fp.InventoryNumber + "\t");
curLine.Append(fp.SellerCost + "\t");
curLine.Append(fp.RetailPrice + "\t");
curLine.Append(fp.StartingBid + "\t");
curLine.Append(fp.BINPrice + "\t");
curLine.Append(fp.CAPrice + "\t");
curLine.Append(fp.Weight + "\t");
curLine.Append(fp.Length + "\t");
curLine.Append(fp.Width + "\t");
curLine.Append(fp.Height + "\t");
curLine.Append(fp.Brand + "\t");
curLine.Append(fp.Manufacturer + "\t");
curLine.Append(fp.MPN + "\t");
curLine.Append(fp.Quantity);
writer.WriteLine(curLine.ToString());
}
}
是否有可能使用一个StreamWriter由行文本文件中的行写入到Azure的斑点。如果没有,那么这将是一个很好的替代方法吗?
编辑------------------------------
这不回答我提出的问题,但我不再需要使用Azure blob存储。添加以下到我的web.config和这两个文件上传罚款,正在创建的第三个文件还罚款:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2000000000" />
</requestFiltering>
</security>
是什么让你这么说:*我发现我不能直接上传文件到Azure网站*? –
@AmitApple我有两个文件需要上传,一个是1.75mb,另一个是大约45mb。 1.75 mb文件上传正常,但由于某种原因,当我通过ftp验证时,45mb文件未显示在上传目录中。 – David
这就是说azure blob不能超过4mb,否则需要拆分成块。 http://dvanderboom.wordpress.com/2009/02/21/windows-azure-blobs-and-blocks/ – David