.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Streaming file result sometimes corrupt

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :.NET Framework

I have a WCF service with basic authentication that can be used by clients to upload data. The clients are .NET 2 clients. The file size is about 1-10 Mb and the service receives them in a streaming way. The configuration settings are adjusted to support files up to 500 Mb and this is tested and works fine in our lab environment.

About 99% of the uploads are successful, however sometimes the uploaded file is corrupt. The log files on the service side show this error: 'An exception has been thrown when reading the stream'.
I added the full stacktrace at the bottom.

What could be causing this? If I look at the client code I noticed that the connection isn't closed or disposed, but this is the same for every client. Also a .NET 2 client cannot close the connection because that method is not available. Besides that I found an article on the WCF Security Guide with a sample client call and even there the client isn't closed (while that is done for .NET 3.5 clients)(http://wcfsecurity.codeplex.com/wikipage?title=Internet%20%E2%80%93%20WCF%20and%20ASMX%20Client%20to%20Remote%20WCF%20Using%20Transport%20Security%20(HTTP)). Is it n

View Complete Post

More Related Resource Links

passing result from CS file to batch file?

Hello,I am trying to run a CS file within a batch file but so far nothing happens.. echo on cd \ net use z: \\CONFIGMGRTEST\SMSPKGC$\TST00014 rem FFCS-MultiPlatform.bat file rem a selection is made to know which program has to be launched rem SETTING THE LOCATION OF THE C# COMPILER SET framework=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727 rem COMPILING THE CS FILE %framework%\csc Architecture-Processor.cs rem EXECUTING THE C# APPLICATION :32BIT C:\Source Files\Packages\FOREFRONT\x86\FFCS.bat goto END :64BIT C:\Source Files\Packages\FOREFRONT\x64\FFCS.bat goto END :END exit and the CS file is: using System; using System.Management; public class ManagementObject { public static void Main() { /// ManagementObject mo; mo = new ManagementObject("Win32_Processor.AddressWidth=''"); ushort i = (ushort)mo["Architecture"]; /// Test the Processor and populated the field to be tested in the batch file switch (i) { case 0: return "32 Bit"; break; case 9: return "64 Bit"; break; } } } How do I pass the 32 Bit and/or 64 Bit collected by the CS file to the batch file to be used to the if .... goto 32Bit or 64 BitsThanks,DomSystem Center Operations Manager 2007 / System C

WCF streaming upload file sends tiny chunks very slow

Hello WCF friends, please help!   I've a WCF Service on both servers IIS7/ISA/Win2008 and IIS6/Apache Reverse-Proxy/Win2003. And a client app that downloads and uploads files (approx. 10MB).   When downloading there are no problems. But if I upload a file on some client machines a have a strange problem. They have all DSL 5 or 6mbps bandwidth. On some client machines the upload finishes after a few seconds. And some client machines it sends tiny chunks with pauses (see screenshot) and takes much time (after a long time I terminate the process). Screenshot: http://i55.tinypic.com/2s79wu8.png   I tried hundred different configurations and search and read complete google with no success. I tried it on VirtualBox with Win7 as guest and host. With NAT I get this problem but with network bridge there is no problem!!! Our customer have this problem too, but I don't know what for network settings they have. WCF Service web.config: <configuration> <system.web> <httpRuntime maxRequestLength="2097151" executionTimeout="100" /> </system.web> <system.serviceModel> <services> <service behaviorConfiguration="MyFileServiceBehavior" name="MyWeb.Services.FileService"> <endpoint binding="basicHttpBinding" bindingConfiguration="HttpBinding_MTOM" bindingNa

The cabinet file 'STS.CAB' required for this installation is corrupt and cannot be used


I'm trying to install Microsoft SharePoint Server 2010 Enterpise and I'm getting that error almost right away after I enter the serial number.
I tried to burn DVD, copy files on the local disk, mount original ISO file as a disk.. Nothing did not work.
Please advise.

Thank you,

400 Bad Request when trying to send large file to service using basichttp streaming.


Hi All,


I am trying to send the large file (approx 1.5GB) to the WCF service for upload using basic http streaming.

I have increased all the timeouts and quotas in the server and client's config files to quite large values, but still I am getting Bad Request error on the client.


Also the Bad request message is returned always in 1 minute 30 seconds after sending the request to server.


What the most unusual thing is when I use Fiddler or Charles to debug communication, everything works fine. Is it something like fiddler is pinging the IIS or service and hence its not getting timeouted or like that?




Following are the details:

Server Config:


 <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

Closing the browser window before file streaming




I have the following requirement in one of the applications I am working.

In an aspx page, that gets opened in new window from a hyperlink that is clicked in the main application. The newly opened window contains a button and on clicking on that button, an Excel file gets streamed to the user for download. If the file is created successfully for streaming, the newly opened window where the button is there should be closed automatically, otherwise, the window should stay with errror message gets displayed.


Can any one suggest how can this be achieved in ASP.Net?


Thank you,


Custom File Stream Result error when the client connection is closed


I recently notice that on our MVC 2.0 web app that does images retrieval,  we have this error when the user close the browser before image file is done transmitting :

TypeName: System.Web.HttpException

TypeAssembly: System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

Message: The remote host closed the connection. The error code is 0x80070057.

Source: System.Web

TargetSite: Void RaiseCommunicationError(Int32, Boolean)

StackTrace:    at System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32 result, Boolean throwOnDisconnect)

   at System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()

   at System.Web.HttpResponse.Flush(Boolean finalFlush)

   at System.Web.HttpResponse.End()

   at CT.iMagio2.Apps.Web.Search.Controllers.ControllerActionResultInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)

   at System.Web.Mvc.ControllerActionInvoker

Multiple result set to a single text file




I have a stored proc which gives me 5 resultsets.

I want to store these  in a flat file.

all the result set columns are different.

How can i store all these results into a single file in SSIS.??


sample resultset columns::

date  name

date  name   id    value

date  name   id    percentage

date  name  id     totalvalue

date  name  duration




Encountering error when trying to perform any AS operation because of corrupt file



I tried to restore a database i had downloaded from the net, but i guess the file was corrupted or I hadn't done it the proper way. However, now, am not able to do anything with my other AS databases as well ( ie, not able to browse, write MDX etc ). I tried deleting the problematic database but still encountered the same error :

File system error: Error opening file; \\?\C:\Program Files\Microsoft SQL Server\MSSQL.2\OLAP\Data\Foodmart 2000.2.db\0.CryptKey.bin is not a disk file or file is not accessible.
Errors in the metadata manager. Processing for the database will be disabled because of an error occured hile loading the 'Foodmart 2000' database cryptography key. One possible reason for this error is that the service account has changed.

Kindly help!!

--Mark the thread as answered if one of the replies answers your question. Thank you

Problem streaming xaml file


So I am trying to stream the file "test.xaml" (on the root of my project) to a canvas. I have tried numerous methods and for some reason when I call it to stream the xaml document but it doesn't.

My Code:

System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("test.xaml");
StreamReader sr1 = new StreamReader(s); 
string xamlString = sr1.ReadToEnd(); 

canvas1 = XamlReader.Load(new System.IO.StreamReader(s).ReadToEnd().ToString()) as Canvas;


To debug, I made a textblock element called debug1 and I wanted to send my code stream as a string to the textblock (to see where my problem is).

Whats interesting is that after line 2 no code will be executed; I know this because the debug1 textblock isnt populated with any data (it remains with its default "textblock" text value). I do not get any errors back or anything.

I know how to put prewritten xaml on a canvas in a ton of ways. I just want to know why xaml file is not streaming at all (is the code right?) (is there something im forgetting?) (is there a better way of going about this?)

Quicknote: My xaml file is just a page xaml document, there's nothing special about it format wise. Also I have been searching a day now and I haven't found anyone with the same issue.

How to store the result of a query in a CSV file



I'd like to create a stored procedure that runs a query and stores the resulting data in a CSV file.

How may I achieve this ?


File corrupt issue with SQL Server Express 2008 Download

I have tried to download SQL Server Express 2008 with advanced services a several times from different locations across the MS web site.  I keep getting a File Corrupt error when extracting "owc11sp1.msp."  I have tried several different computers and following the steps directly.  I can not perform a web install on the machine that will host the SQL server, so that option is out.  Does anyone know where I can get a copy of this that actually works?

I tried downloading it from here:

File Splitter in .Net

I love to do utility programs in .Net. And this is one of them. As I was playing with JSplit (a free file splitter program), I wondered if I could do it in .Net. The framework supports file operations like reading files in bytes and creating them. It is indeed easy to do file operations in .Net Basics on File operations

Upload Multiple File using JQuery in asp.net

In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.

Creating Excel file from C#

I used below coding for create a excel sheet.I got from on web site.
In below coding there is no problem.Its create the excel file.If i run second time,its ask to overwrite the current excel file.If I said "Yes" then it ok ,but If I select cancel button,its generate the Error message.The exception is

Upload a File to a SharePoint Document Library - Part I

The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

SmtpClient and Locked File Attachments

Got a note a couple of days ago from a client using one of my generic routines that wraps SmtpClient. Apparently whenever a file has been attached to a message and emailed with SmtpClient the file remains locked after the message has been sent. Oddly this particular issue hasn't cropped up before for me although these routines are in use in a number of applications I've built.

How to call an .exe file in .net

Sometimes a developer has to call an EXE from another EXE. While calling EXE there can be a requirement to pass parameter.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend