This is a migrated thread and some comments may be shown as answers.

IIS Worker Process blocking file

2 Answers 197 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Zachary French
Top achievements
Rank 1
Zachary French asked on 20 Aug 2010, 11:44 PM

I am using a RadAsyncUpload control on a page that allows the user to send emails with attachments.

I have in place the work around found here

http://www.telerik.com/community/forums/aspnet-ajax/async-upload/known-issues-and-breaking-changes.aspx

My radscriptmanager is in the master page, here's my radasyncupload declaration

<tel:RadAsyncUpload
ID="fileUpload"
runat="server"
ReadOnlyFileInputs="true"
OnClientValidationFailed="onUploadFailed"
OnClientFileUploadFailed="onUploadFailed"
OnClientFileSelected="onFileSelected"
OnClientFileUploaded="onFileUploaded"
HttpHandlerUrl="~/Handlers/RadAsyncUploadWorkAround.ashx" />

In the code behind,

I have this in my onInit

fileUpload.FileUploaded += new FileUploadedEventHandler(uploaded);
fileUpload.TemporaryFolder = systemDocumentPathRoot;
//fileUpload.TargetFolder = systemDocumentPathFull;
fileUpload.Localization.Select = GetResourceString("Browse");

and for my uploaded method

List<string> fileNames = new List<string>();
  public void uploaded(object sender, FileUploadedEventArgs args){

 string fileName = @"DocumentFolder" + args.File.FileName;
args.File.SaveAs(fileName);
fileNames.Add(fileName);

}

on my SendButton event

System.Net.Mail.MailMessage message = new MailMessage("Zach.French@blackline.com", "Zach.French@Blackline.com", "test", "this is a test");
foreach(string fileName in fileNames)
      message.Attachments.Add(new Attachment(fileName));
SmtpClient smtpClient = new SmtpClient();

smtpClient.Send(message);

for a small files it works fine

but when I tried a file at about 2MB or more it fails.

the file is uploaded to the correct temporary location.

When I click the send button and do the full postback, uploaded is called and the file is saved to the correct location

When the send button event is called,  an exception is thrown on smtpClient.send(message).

the quick watch of the exception was print screened and is attached as exception.jpg

When I go to the file via the file explorer, and try to delete it I get an error message saying the file is in use (see fileinuse.jpg)

I believe the radasyncupload is still accessing the file or blocking it but I'm not sure.

Any help would be appreciated.

 

2 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 25 Aug 2010, 04:27 PM
Hi Zachary French,

I've tried to reproduce the problem, however, no avail. RadAsyncUpload uses the .NET File.Move method in order to move the uploaded file from the temporary to the target folder. In general we don't open any streams to the uploaded file this why I think that the problem might be somewhere else. Anyway, just to be sure, could you please give it a try with the latest internal build? We have tweaked the RadAsyncUpload temporary files handling and this might reflect the error that you experience. More information on how to obtain the latest internal can be found here.

Sincerely yours,
Genady Sergeev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Zachary French
Top achievements
Rank 1
answered on 31 Aug 2010, 12:01 AM

It was a .net 3.5 to .net 4.0 issue for smtp client

http://connect.microsoft.com/VisualStudio/feedback/details/544562/cannot-send-e-mails-with-large-attachments-system-net-mail-smtpclient-system-net-mail-mailmessage

thanks for looking into it though

Tags
AsyncUpload
Asked by
Zachary French
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Zachary French
Top achievements
Rank 1
Share this question
or