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

System.IO.FileNotFoundException: Could not find file

9 Answers 1027 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Karthiekyan
Top achievements
Rank 1
Karthiekyan asked on 18 Jun 2014, 01:46 PM
Hi,

We are getting below exception from Telerik file upload control AsyncUpload but this issue coming very rarly. Can you anybody help what is rootcause of this issue and how to fix this issue. Hoping you may also faced this kind of issue in your apps. FYI,  TemporaryFileExpiration valuse set as default value only.


System.IO.FileNotFoundException: Could not find file 'C:\inetpub\wwwroot\wss\VirtualDirectories\80\TempUploadedFiles\5taz52la.zdo'.
File name: 'C:\inetpub\wwwroot\wss\VirtualDirectories\80\TempUploadedFiles\5taz52la.zdo'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Telerik.Web.UI.AsyncUploadedFile.get_InputStream().

Control has benn set as ber below:

<telerik:RadAsyncUpload runat="server" ID="radasycFileUpload"
DisablePlugins="true" Width="540" UseApplicationPoolImpersonation="true"
Localization-Select="Browse" TemporaryFolder="~/TempUploadedFiles" />

  

Thanks
Karthikeyan K

9 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 23 Jun 2014, 10:44 AM
Hi Karthikeyan,

Do you have any code, which saves the file on a button click? Please make sure that your application has permissions to write files in the temporary folder.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Karthiekyan
Top achievements
Rank 1
answered on 23 Jun 2014, 04:02 PM
Hi Hristo,
Thanks for your reply.

First this issue coming very rarely.

We are not set any permission for Temp Folder since App Pool Impersonation has been set as per below and temp folder “TempUploadedFiles” manually created in “C:\inetpub\wwwroot\wss\VirtualDirectories\80\TempUploadedFiles”.

<telerik:RadAsyncUpload runat="server" ID="radasycFileUpload"
        DisablePlugins="true" Width="540" UseApplicationPoolImpersonation="true"
        Localization-Select="Browse" TemporaryFolder="~/TempUploadedFiles" />

FYI.. i also attached sample code to upload document.
0
Hristo Valyavicharski
Telerik team
answered on 26 Jun 2014, 03:09 PM
Karthiekyan,

It is possible to get this exception if your application pool is restarted and the AsyncUpload cannot transfer the uploaded file from the Temp to Target folder. Other possible reason could be if the temporary folder is cleared for some reason.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Karthiekyan
Top achievements
Rank 1
answered on 27 Jun 2014, 03:52 PM
There is no App Pool reset during that time and it was in PROD. we also confirmed from event log. it seems the file not available in Temp folder. is there ayway we can see the log for RadAsyncUpload during AsyncUpload event (when it is upload to Temp folder).
0
Hristo Valyavicharski
Telerik team
answered on 02 Jul 2014, 03:26 PM
Karthiekyan,

What are the exact steps to reproduce this behavior? RadAsyncUpload does not have log, you may try to create your own by subscribing for some of the client events of the control.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
John Truong
Top achievements
Rank 1
answered on 02 Jul 2014, 04:54 PM
We're having the same issue as well. Is there something wrong with the latest version?
0
Hristo Valyavicharski
Telerik team
answered on 04 Jul 2014, 10:45 AM
Hi John,

We are not aware of this problem. Please specify what version do you have? What is your browser and how do you reproduce issue?

Thanks

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Karthiekyan
Top achievements
Rank 1
answered on 10 Jul 2014, 05:45 PM
Telerik.Web.UI Version is 2013.2.611.35.

Browser IE 8.

We not able to reproduce this issue. As said earlier this rarely coming and we confirmed that there is no App pool recycle during this time.

It would be better if you give some solution for this issue
 
0
Hristo Valyavicharski
Telerik team
answered on 11 Jul 2014, 12:32 PM
Hi guys,

We cannot identify the reported problem. This stop us to make addition research. That's why I'm asking for sample project or any pattern we can follow to get the same error as you.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Bandaru
Top achievements
Rank 1
commented on 04 Jul 2023, 12:35 PM

Did we find any solution for this?

 

Rumen
Telerik team
commented on 04 Jul 2023, 02:09 PM

Hi Bandaru,

If you get this error in a load balancing environment configure the App_Data folder to be on a shared virtual directory as described in this documentation article: http://docs.sitefinity.com/administration-configure-the-project-s-app_data-folder-to-be-on-a-shared-file-location. This way Sitefinity will access the files under the App_Data folder from one and the same place.

Another approach to avoid the use of temp files and therefore the error is to remove the TargetFolder property from the RadAsyncUpload markup and save the file(s) manually:

Bandaru
Top achievements
Rank 1
commented on 04 Jul 2023, 04:05 PM

I don't have TargetFolder property and load balancer.
My application is in Azure Pass. Do I need to give any permissions to the managed identity or any other solution?

 

Rumen
Telerik team
commented on 05 Jul 2023, 06:31 AM

If you are encountering a System.IO.FileNotFoundException error when using RadAsyncUpload in your Azure application, it could be due to a missing file or a file access issue. However, since you mentioned that you don't have a TargetFolder property and load balancer, it's important to clarify a few points.

If you are using RadAsyncUpload, make sure you have configured it correctly, including specifying the appropriate TargetFolder where the uploaded files should be saved. This TargetFolder should exist and have the necessary write permissions for the application. For more information see here and here.

If you are running your application on Azure using a load balancer, you may encounter issues with file access since multiple instances of your application can be running simultaneously. In such cases, it's recommended to use a shared storage solution, such as Azure Blob Storage or Azure Files, to store the uploaded files. This allows all instances of your application to access the same storage location. Make sure you have properly configured the necessary access permissions for the storage account and that your application is using the appropriate credentials to access the storage.

If you are using Azure Managed Identity for your application, you may need to grant the necessary permissions to the managed identity to access the file storage. Managed Identity allows your application to authenticate and access Azure resources securely. To grant the required permissions, you can assign the appropriate role (e.g., Storage Blob Data Contributor) to the managed identity on the storage account or the corresponding resource group.

 

Bandaru
Top achievements
Rank 1
commented on 05 Jul 2023, 06:59 AM | edited

Thanks for the suggestions..! I am using RadAsyncUpload.
As I mentioned, I am not using load balancer and this is working fine in my local, I can see that target folder in Web app.
We are currently migrating our app from on premise to Azure cloud (No Load Balancer).
I just don't want to use that blob storage or file server which azure provides. 
Can't we use the folder which is in webapp App_data/RadUploadTemp?. I am attaching the error here.

 
Rumen
Telerik team
commented on 05 Jul 2023, 09:06 AM

Thank you for the screenshot of the error! 

There is something that doesn't save or deletes the temp file prior to the saving. Can you check whether after you select a file and upload it the c:\home\site\wwwroot\App_Data\RadUploadTemp folder gets updated and the filename.pdf.tmp appears in it?

Otherwise, you can implement and use a custom handler and send and save the file to the desired location on the Azure server.

You can also review the following forum threads:

Bandaru
Top achievements
Rank 1
commented on 05 Jul 2023, 12:46 PM | edited

It's failing before even clicking on save button.

It's just showing the error when I am selecting the file.
Do I need to provide any access .. If yes .How?.
Note: This is not IIS , this is Azure webapp

 

Rumen
Telerik team
commented on 06 Jul 2023, 11:57 AM

Let me clarify how the AsyncUpload works: when the client selects a file in the Open (File Select) dialog, that file is immediately sent in pieces to the handler, whether it's a custom handler or ours, and the handler assembles it in the temp folder. Then, once the entire file is uploaded, the handler returns an encrypted path to the temp file, and this encrypted path is used when you perform a postback, allowing the control to retrieve the temp file and potentially move it to the target folder.

That is why I wrote that there is something on your Azure server that prevents the tmp file from saving or deletes it prior to the saving. Can you check whether after you select a file and upload it the c:\home\site\wwwroot\App_Data\RadUploadTemp folder gets updated and the filename.pdf.tmp appears in it?

If you are unable to find out the reason for the tmp deletion behavior, my advice to implement a custom handler is still valid because when using a custom handler you can upload the file(s) without using a temporary folder. You can find an example of a custom handler at 

https://demos.telerik.com/aspnet-ajax/asyncupload/examples/imageuploader/defaultcs.aspx 

https://docs.telerik.com/devtools/aspnet-ajax/controls/asyncupload/how-to/how-to-extend-the-radasyncupload-handler 

I am attaching a small blank web application that shows how using a custom handler can prevent files from being written to the disk. Ultimately, it does save the file to the disk for demonstration purposes, but this is done in the user code, not in the Telerik.Web.UI assembly.

Tags
AsyncUpload
Asked by
Karthiekyan
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Karthiekyan
Top achievements
Rank 1
John Truong
Top achievements
Rank 1
Share this question
or