문제

I'm trying to implement http handler for handling file upload by wp background transfers. I've tried this:

            var request = new BackgroundTransferRequest(@"http://computerName/test.ashx")
            {
                Method = "POST",
                TransferPreferences = TransferPreferences.None,
                UploadLocation = new Uri(@"shared/transfers/testfile.txt", UriKind.RelativeOrAbsolute)
            };

In this case my phone always sends Range:0- . ContentLength equals actual source file size. And request stream contains all data... I did not know how to make it sending data partially. And, I can not find any actual info about how uploading works, what headers it uses and so on. There is no any specification for server!

도움이 되었습니까?

해결책

Sadly, BackgroundTransferRequests do not support range for upload or download. If you don't need to allow transfers when your app is not running, I would suggest writing your own transfer code. Then you can support RANGE and you can control the number of concurrent transfers(and you can get around the 2 transfer limit for the phone) and you don't have to deal with the various file size/network type limitations.

Below is the documentation explaining this from the following link: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202955%28v=vs.105%29.aspx#BKMK_BackgroundTransferPolicies

The Headers property of the BackgroundTransferRequest object is used to set the HTTP headers for a transfer request. The following headers are reserved for use by the system and cannot be used by calling applications. Adding one of the following headers to the Headers collection will cause a NotSupportedException to be thrown when the Add(BackgroundTransferRequest) method is used to queue the transfer request: • If-Modified-Since

• If-None-Match

• If-Range

• Range

• Unless-Modified-Since

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top