2014-03-03 24 views
1

我創建了以下兩個教程我的自定義CSV媒體類型格式:asp.net WEB API,BufferedMediaTypeFormatter - > WriteToStream數據丟失?

http://www.asp.net/web-api/overview/formats-and-model-binding/media-formatters

http://www.tugberkugurlu.com/archive/creating-custom-csvmediatypeformatter-in-asp-net-web-api-for-comma-separated-values-csv-format

它做工精細,如果沒有一個問題:

我沒有得到孔關於csv文件的數據。

enter image description here

,並在我的CSV我得到172線:

enter image description here

什麼導致這個問題呢?

回答

1

給大家使用StreamWriter當誰找到「數據丟失」的問題:這是修復我已經找到:

myStreamWriter.AutoFlush = true;