I'm trying to automate uploading my server to PlayFab as part of a C# program. I successfully call "GetAssetUploadUrlAsync" and get a URL. Then I use the following code to try and upload the zip file:
try { string url = GetURLTask.Result.Result.AssetUploadUrl; var wwwRequest = (HttpWebRequest)WebRequest.Create(url); wwwRequest.Method = "PUT"; wwwRequest.ContentType = "application/x-zip-compressed"; wwwRequest.Headers.Add("x-ms-blob-content-type: application/zip"); wwwRequest.Headers.Add("x-ms-blob-type: BlockBlob"); wwwRequest.ContentLength = contents.Length; wwwRequest.Timeout = 1000000; Stream dataStream = wwwRequest.GetRequestStream(); dataStream.Write(contents, 0, contents.Length); dataStream.Close(); HttpWebResponse wwwResponse = (HttpWebResponse)wwwRequest.GetResponse(); if (wwwResponse.StatusCode == HttpStatusCode.Created || wwwResponse.StatusCode == HttpStatusCode.OK) { Console.WriteLine("...HTTP PUT Successful"); } else { Console.WriteLine(string.Format("ERROR: [{0}] -- {1}", wwwResponse.StatusCode, wwwResponse.StatusDescription)); } } catch (Exception err) { System.Console.WriteLine(err.Message); if (err.InnerException != null) { System.Console.WriteLine(err.InnerException.Message); } }
If I upload a small zip file, this works fine. But if I actually upload our server which is a little over 1GB, I get:
The remote server returned an error: (413) The request body is too large and exceeds the maximum permissible limit..
I can upload this same zip file either using the web interface or the PowerShell interface. What do I need to do to upload this file in C#?