microsoft / BITS-Manager

The BITS Manager is a sample WPF C#/.NET utility to examine and control your BITS uploads and downloads
MIT License
77 stars 23 forks source link

The background access settings of the job's owner app prevent the job from transferring at this time #15

Open szanto90balazs opened 2 years ago

szanto90balazs commented 2 years ago

First and foremost, thanks for this managed sample, it was a great help to kick-start my BITS journey.

My app based on BITS-Manager and BITS-Manager itself worked great, but when I packaged my app with MSIX, things started behaving strangely. Every background copy job started from the packaged app transitions into the BG_JOB_STATE_TRANSIENT_ERROR state immediately and stays that way until the app is closed or becomes inactive/minimized. I was able to reproduce this issue with the BITS-Manager app in a packaged environment.

Using bitsadmin /list /allusers /verbose, I got this:

GUID: {A8C6001C-182D-424B-86DC-6C8E131E185B} DISPLAY: 'Download an update'
TYPE: DOWNLOAD STATE: TRANSIENT_ERROR OWNER: ....
PRIORITY: NORMAL FILES: 0 / 1 BYTES: 0 / UNKNOWN
CREATION TIME: 9/2/2022 11:33:08 AM MODIFICATION TIME: 9/2/2022 11:33:58 AM
COMPLETION TIME: UNKNOWN ACL FLAGS:
NOTIFY INTERFACE: UNREGISTERED NOTIFICATION FLAGS: 3
RETRY DELAY: 600 NO PROGRESS TIMEOUT: 1209600 ERROR COUNT: 0
PROXY USAGE: PRECONFIG PROXY LIST: NULL PROXY BYPASS LIST: NULL
ERROR FILE:    ...
ERROR CODE:    0x8020006e - The background access settings of the job's owner app prevent the job from transferring at this time.
ERROR CONTEXT: 0x00000002 - The error occurred in the Background Intelligent Transfer Service (BITS) queue manager.
DESCRIPTION:
JOB FILES:
        0 / UNKNOWN WORKING ...
NOTIFICATION COMMAND LINE: none
owner MIC integrity level: MEDIUM
owner elevated ?           false

Peercaching flags
         Enable download from peers      :false
         Enable serving to peers         :false

CUSTOM HEADERS: NULL

I tried to set the job's priority, but it didn't help. I also had a hunch that I might need to enable some capability in the MSIX manifest, but I haven't found anything. I also tried to use the BackgroundDownloader from my WPF app, but it looks like UWP only.

Is it a known behavior? Anything I can do to make it transfer bites while the packaged app is running? Thanks in advance 👍