1

In my Apps, I have to get some file in a LOCAL web Server from REST uri like http://localhost:8080/getfile/myfile_ID" and then copy them on the localStorage of the App so I proceed like this :

StorageFolder fileFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync("MyFiles");
StorageFile file =await fileFolder.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);

var download = new BackgroundDownloader().CreateDownload(source, file);
await download.StartAsync();

or like this :

StorageFile file = await StorageFile.CreateStreamedFileFromUriAsync(filename, source, RandomAccessStreamReference.CreateFromUri(source));

This is working fine on any device that are located on a network, devices which got an IP, but when the device is not on any network (unpluged RJ45 or not connected to any Wifi) the code stuck at those lines without any error. I can see in debug that the program just wait the async method to finish, but it never happened. If, during the debug, I plug the RJ45 again or connect to a Wifi the async method now end and work fine.

Is this a normal behavior ? I understand that, in order to get a file from an uri the device has to be networked but what about a local uri ?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.