我有一個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