filestream

Synchronization requirements for FileStream.(Begin/End)(Read/Write)

Is the following pattern of multi-threaded calls acceptable to a .Net FileStream? Several threads calling a method like this: ulong offset = whatever; // different for each thread byte[] buffer = new byte[8192]; object state = someState; // unique for each call, hence also for each thread lock(theFile) { theFile.Seek(whatever, See...

Deserializing a FileStream on Client using WCF

I'm very new to WCF, so I apologize in advance if I misstate something. This is using .NET 4.0 RC1. Using WCF, I am trying to deserialize a response from the server. The base response has a Stream as its only MessageBodyMember. public abstract class StreamedResponse { [MessageBodyMember] public Stream Stream { get; set; } publ...

How to Lock a file and avoid readings while it's writing

My web application returns a file from the filesystem. These files are dynamic, so I have no way to know the names o how many of them will there be. When this file doesn't exist, the application creates it from the database. I want to avoid that two different threads recreate the same file at the same time, or that a thread try to return...

Alter Table Filestream runs even if IF statement is false

I am writing a script to update a database to add Filestream capability. The script needs to be able to be run multiple times without erroring. This is what I currently have IF ((select count(*) from sys.columns a inner join sys.objects b on a.object_id = b.object_id inner join sys.default_constraints c on c.parent_obje...

How come the Name property is <Unknown> on a FileStream which uses handle constructors?

Say you get a file handle from some outside DLL and instantiate a FileStream with it. It works just fine for reading and writing. Then you want the path and name of that handle and try to access the Name property of your FileStream object, and it returns 'unknown'. This is true for the constructors which takes file handles: public Fil...

XmlSerializer.Serialize doesn't save a file and doesn't throw an exception.

Hi guys. I am having problem with saving of my object. Take a look at this code: public void SerializeToXML(String FileName) { XmlSerializer fSerializer = new XmlSerializer(typeof(Configuration)); using (Stream fStream = new FileStream(FileName, FileMode.Create, FileAccess.Write, FileShare.None)) { fSerializer.Seria...

Need help manipulating WAV (RIFF) Files at a byte level

I'm writing an an application in C# that will record audio files (*.wav) and automatically tag and name them. Wave files are RIFF files (like AVI) which can contain meta data chunks in addition to the waveform data chunks. So now I'm trying to figure out how to read and write the RIFF meta data to and from recorded wave files. I'm using...

how to read the txt file from the database(line by line)

i have stored the txt file to sql server database . i need to read the txt file line by line to get the content in it. my code : DataTable dtDeleteFolderFile = new DataTable(); dtDeleteFolderFile = objutility.GetData("GetTxtFileonFileName", new object[] { ddlSelectFile.SelectedItem.Text }).Tables[0]; foreach (DataRow dr in dtDeleteFol...

FileStream to save file then immediately unlock in .NET ?

I have this code that saves a pdf file. FileStream fs = new FileStream(SaveLocation, FileMode.Create); fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); fs.Flush(); fs.Close(); It works fine. However sometimes it does not release the lock right away and that causes file locking exceptions with functions run after this on...

Is Streaming Video possible with Sql Filestream?

We have stored all media in Sql Filestream, but now we'll need Video and Audio streaming... Will this be possible with Sql Filestream or will I have to take all of the Video and Audio out of the database? Which technology would you use to enable Video/Audio Streaming? WebORB FluorineFX Wowza (way better I think than the first two) IIS...

how do i insert html file that have hebrew text and read it back in sql server 2008 using the filestream option ?

hello all, i am new to the filestream option in sql server 2008, but i have already understand how to open this option and how to create a table that allow you to save files. let say my table contains: id,name, filecontent i tried to insert an html file (that has hebrew chars/text in it) to this table. i'm writing in asp.net (c#), usi...

updateBinaryStream on ResultSet with FileStream

If I try to update a FileStream column I get following error: com.microsoft.sqlserver.jdbc.SQLServerException: The result set is not updatable. Code: System.out.print("Now, let's update the filestream data."); FileInputStream iStream = new FileInputStream("c:\\testFile.mp3"); rs.updateBinaryStream(2, iStream, -1); rs.updateRow(); iStr...

Restful WCF Data Service to up- and download large files?

Hi, I'm thinking about to write a restful service which is able to upload and stream large video files (GB) (in future it might not only be videos and could also be large documents. I researched so far and what really makes sense to me could be to use off: WCF Data Services and Implement IDataServiceStreamProvider and on the back-end ...

PushbackReader without EOF?!

Hello SOers, I'm currently using PushbackReader and while waiting for where it 'supposed' to be an EOF, I get the character 65535 and I'm wondering if that's normal. Where is my EOF?! Thank you. ...

Filestream in Sql Server 2008 Express

i tried to get it to work but i never seem to have to luck, i go a code snippet for a blog and still no dice. This is the code. EXEC sp_configure filestream_access_level, 1 GO RECONFIGURE GO CREATE DATABASE NorthPole ON PRIMARY ( NAME = NorthPoleDB, FILENAME = 'C:\Temp\NP\NorthPoleDB.mdf' ), FILEGROUP NorthPoleFS CONTAINS FILESTREA...

OutOfMemoryException when I read FileStream 500 MB

Hi all, I'm using Filestream for read big file (> 500 MB) and I get the OutOfMemoryException. Any solutions about it. My Code is: using (var fs3 = new FileStream(filePath2, FileMode.Open, FileAccess.Read)) { byte[] b2 = ReadFully(fs3, 1024); } public static byte[] ReadFully(Stre...

Any succesful document management sytem (application using documents intensively) using sql server filestream?

Did anyone create a Document Management System using SQL SERVER's Filestream? By this I mean: if an application makes intensive use of documents is filestream a good option, or in those cases it would be better to go for another solution? I understand this depends on many factors, but in general my guess is that if "<5%" than server lo...

How to insert exisitng documents stored on NFTS in sql server filestream's storage

I am doing investigation on filestream (asking on stackoverflow while reading whitepapers and google searching), in my current screnario documents are managed in this way: 1) I have a DB table where I keep the document id and the doc path (like \fileserver\DocumentRepository\file000000001.pdf) 2) I have a document folder (\fileserver\D...

Which file types are worth compressing (zipping) for remote storage? For which of them the compressed size/original size ratio is << 1?

I am storing documents in sql server in varbinary(max) fileds, I use filestream optionally when a user has: (DB_Size + Docs_Size) ~> 0.8 * ExpressEdition_Max_DB_Size I am currently zipping all the files, anyway this is done because the Document Read/Write work was developed 10 years ago where Storage was more expensive than now. Many...

Curl Wrapper Class does not return any data even though it worked previously?

We changed servers and installed all necessary software and just cannot seem to pin point what is going on. A simple CURL request does not return anything. Command Line CURL commands work just fine. We are using a wrapper for CURL utilizing streams. Do PHP streams require any out of the ordinary configuration? We are using the latest Lam...