function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MikeARMikeAR 

Compressed Result Of Bulk API Query Not Valid For .NET Client

I am currently looking for working .NET samples which use the Bulk API Query, as I am having issues as follows:
1. After creating a job on the SFDC Server, with a single batch with the aim of performing a bulk api query...
2. I request the batch query results and send the following header which asks for the results to be GZipped: Accept-Encoding: gzip
3. I download the response onto Windows Server 2003 using the following (simplified) code: wc.DownloadFile(requestUrl, filename); //(where wc is my .NET web client, requestUrl is the location of the query result on the SFDC Server and filename is the local file into which the GZipped results should be saved).
4. The results file is saved to my local file system successfully , but does not seem to be a valid zip file.

Anny attempt to open / decompress the file (using windows explorer) results in error "The Compressed (zipped) Folder 'my file name' is invalid".

I have also tried downloading the results as a stream and decompressing in memory, but the result is always same, and suggests that the compressed result is not valid.
I am wondering whether there is some type of encoding mismatch as the result is saved to the Windows Server file system.

Any help in the form of working samples would be greatly appreciated.
ShashankShashank (Salesforce Developers) 
This could be a windows related issue too. What happens when you use any one these fixing tools? https://www.raymond.cc/blog/repair-damaged-or-corrupted-zip-archive/