'HTTP 1.1 400 Bad request in AzureAnchorScript

   IEnumerator ShareAzureAnchorIdToNetworkCoroutine()
   {
       string filename = "SharedAzureAnchorID." + publicSharingPin;
       string path = Application.persistentDataPath;

#if WINDOWS_UWP
       StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
       path = storageFolder.Path + "/";           
#endif

       string filePath = Path.Combine(path, filename);
       File.WriteAllText(filePath, currentAzureAnchorID);

       Debug.Log($"Current Azure anchor ID '{currentAzureAnchorID}' successfully saved to path '{filePath}'");
       Byte[] binaryData = File.ReadAllBytes(filePath);

       WWWForm form = new WWWForm();
       form.AddBinaryData("the_file", binaryData, Path.GetFileName(filePath), "text/plain");
       form.AddField("replace_file", 1);

       UnityWebRequest www = UnityWebRequest.Post("http://167.99.111.15:8090/uploadFile.php", form);
       yield return www.SendWebRequest();

       if (www.isHttpError || www.isNetworkError)
       {
           Debug.Log(www.error);
       }
       else
       {
           Debug.Log($"Current Azure anchor ID '{currentAzureAnchorID}' shared successfully");
       }
   }

I'm doing the hololens2 tutorials shared by microsoft https://docs.microsoft.com/en-us/learn/modules/azure-spatial-anchors-tutorials/5-exercise-save-retrieve-share-azure-spatial-anchors It Worked prettey well last week

but when I tried it again today the ShareAzureAnchorIdToNetworkCoroutine function keeps showing me the HTTP 1.1 400 Bad request Error And I cannot find the reason why



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source