问题
I am running into a problem with my background task on Windows Mobile 10 (build 10.0.14393.82). In my background task, HTTP client is sometimes throwing an Exception with the error (note it seems to happen when the phone is locked):
The server name or address could not be resolved
The phone shouldn't have an issue resolving the address, since it resolves it fine when running in the foreground.
Has anyone else seen this issue, or have any ideas?
回答1:
check the IsNetworkRequested property when registering your background task: https://docs.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.Background.BackgroundTaskBuilder#properties_
回答2:
Do you check (or does your background task scheduler check) if there is an active Internet connection before you make your DNS probe request? It looks like the device is turning wireless off during sleep mode.
来源:https://stackoverflow.com/questions/39300532/windows-mobile-10-background-task-dns-fails