Http error in background task Windows 10 mobile (UWP)

Cabuxa.Mapache

I have a background task which executes a http request, but only works a small number of times. The error returned is: "The server name or address could not be resolved". The url is correct and works fine if I execute it from main app.

The code is a simple http request with a "HttpClient":

public async void Run(IBackgroundTaskInstance taskInstance)
{
    _deferral = taskInstance.GetDeferral();

    try
    {
        using (var client = new HttpClient()) 
        {
            var c = await client.GetStringAsync("http://www.google.com");
        }

    }
    catch (Exception e)
    {

    }
    finally
    {
        _deferral.Complete();
    }
}

As I've said, the same url Works sometimes and sometimes not, and yes, I'm checking internet connection before each request. Any ideas please?

EDITED: Here is my phone info: enter image description here

And here is the repo with a test app demonstrating the issue: https://github.com/CabuxaMapache/BackgroundTask.Test

EDITED 2: I've tested the app in a Lumia 640 with the same results, over 100 executions and only 10 of them OK. Here is the L640 info: enter image description here

Thanks in advance

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to Read SMS from background task in Windows Mobile 10

From Dev

Error during UWP app launch in Windows 10 mobile

From Dev

Windows 10 Mobile App background task or service auto start when phone restarts

From Dev

ContentDialog Width Fitting on Windows 10 Mobile (UWP)

From Dev

Keyboard Behavior on ContentDialog with Windows 10 Mobile (UWP)

From Dev

Windows 10 mobile UWP - slow back button

From Dev

Windows 10 UWP targeting windows 10 mobile only

From Dev

Windows 10 - bring background task into foreground

From Dev

UWP Background Task is not executing

From Dev

Unregister uwp background task

From Dev

UWP Background Task - ExecutionTimeExceeded

From Dev

Azure - Mobile Services - run background task every 10 seconds

From Dev

how to deploy qt app to UWP or Windows 10 mobile

From Dev

Cordova/UWP Windows Mobile 10 Access Violation on HTML select element

From Dev

How to develop windows 10 uwp on real device (mobile)?

From Dev

System.Threading.Thread replacement in UWP / Windows 10 mobile

From Dev

Windows 10 UWP app: StreamSocket via mobile broadband

From Dev

Windows 10 mobile (UWP) Flyout with calendar picker locking on screen

From Dev

Windows 10 UWP app async/await usage on long running task

From Dev

Windows 10 Mobile Error: DEP6200

From Dev

Error reading a image in Windows 10 Mobile

From Dev

How to check foreground/background status in Windows 10 UWP javascript

From Dev

File system error :windows 10 task manager

From Dev

Run Background Task at specific time - Windows 10 App

From Dev

Windows Store Background Task

From Dev

PostAsync throwing IRandomAccessStream error when targeting windows 10 UWP

From Dev

UWP Deployment Error after deploying to store - Windows 10

From Dev

Windows 10 UWP Application - Error whilst creating package

From Dev

Windows 10 UWP Application - Error whilst creating package

Related Related

  1. 1

    How to Read SMS from background task in Windows Mobile 10

  2. 2

    Error during UWP app launch in Windows 10 mobile

  3. 3

    Windows 10 Mobile App background task or service auto start when phone restarts

  4. 4

    ContentDialog Width Fitting on Windows 10 Mobile (UWP)

  5. 5

    Keyboard Behavior on ContentDialog with Windows 10 Mobile (UWP)

  6. 6

    Windows 10 mobile UWP - slow back button

  7. 7

    Windows 10 UWP targeting windows 10 mobile only

  8. 8

    Windows 10 - bring background task into foreground

  9. 9

    UWP Background Task is not executing

  10. 10

    Unregister uwp background task

  11. 11

    UWP Background Task - ExecutionTimeExceeded

  12. 12

    Azure - Mobile Services - run background task every 10 seconds

  13. 13

    how to deploy qt app to UWP or Windows 10 mobile

  14. 14

    Cordova/UWP Windows Mobile 10 Access Violation on HTML select element

  15. 15

    How to develop windows 10 uwp on real device (mobile)?

  16. 16

    System.Threading.Thread replacement in UWP / Windows 10 mobile

  17. 17

    Windows 10 UWP app: StreamSocket via mobile broadband

  18. 18

    Windows 10 mobile (UWP) Flyout with calendar picker locking on screen

  19. 19

    Windows 10 UWP app async/await usage on long running task

  20. 20

    Windows 10 Mobile Error: DEP6200

  21. 21

    Error reading a image in Windows 10 Mobile

  22. 22

    How to check foreground/background status in Windows 10 UWP javascript

  23. 23

    File system error :windows 10 task manager

  24. 24

    Run Background Task at specific time - Windows 10 App

  25. 25

    Windows Store Background Task

  26. 26

    PostAsync throwing IRandomAccessStream error when targeting windows 10 UWP

  27. 27

    UWP Deployment Error after deploying to store - Windows 10

  28. 28

    Windows 10 UWP Application - Error whilst creating package

  29. 29

    Windows 10 UWP Application - Error whilst creating package

HotTag

Archive