Upload model failed after "Attemping to upload asset..." in Azure Object Anchors quick start.

2021-07-13T06:49:30.753+00:00

When I was following the tutorials in the guide below, I failed to upload my model.

https://learn.microsoft.com/en-us/azure/object-anchors/quickstarts/get-started-model-conversion#convert-a-3d-model

The error message is as follows:

"Attempting to upload asset...

AggregateException:
Retry failed after 6 tries. (A task was canceled.) (A task was canceled.) (A task was canceled.) (A task was canceled.) (A task was canceled.) (A task was canceled.)"

What is causing the error?

The following items have been checked:
AccountDomain, AccountID, and AccountKey are filled with correct values.
The size of the model is less than 150MB.

Azure Object Anchors
Azure Object Anchors
An Azure mixed reality service that automatically aligns and anchors three-dimensional content to objects in the physical world.
17 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Horatiu Roman 6 Reputation points
    2021-09-15T13:40:24.153+00:00

    Hi, I got the same error but then I tried something clever :)

    I created a new resource that was identical, but instead of North Europe I set the location to East US 2. Now the upload worked. Hope this helps you diagnose! @Ishida, Atsushi / 石田 篤志

    1 person found this answer helpful.
    0 comments No comments

  2. AshokPeddakotla-MSFT 35,096 Reputation points
    2021-08-04T07:11:02.173+00:00

    @Ishida, Atsushi / 石田 篤志 Below is an update from our team on your issue.

    Here are a few suggestions that we think would help further debug/understand the issue.

    1) Add this line of code:

    Console.WriteLine($"\t{assetUri}");  
    Right after the call to:  
    Uri assetUri = (await client.GetAssetUploadUriAsync()).Value.UploadUri;  
    

    Run the sample. The upload uri will print to screen. Copy it, and try to open it up on any browser. Share with us what the browser displays. If the company’s intranet is blocking is, it should fail, and the browser might be able to show us a better error message. If the intranet is not blocking it, the message will be different.

    2) Add this function to the code:

    private void PrintException(Exception e)  
    {  
        Console.Error.WriteLine($"\n{e.GetType().Name}:\n{e.Message}");  
        if (e.InnerException != null)  
        {  
            PrintException(e.InnerException);  
        }  
    }  
    

    Then, replace this line of code:

    Console.Error.WriteLine($"\n{e.GetType().Name}:\n{e.Message}");  
    With this line instead:  
    PrintException(e);  
    

    Run the sample again. This should give us much better error details on the failure while running the sample.

    3) Add this function to the code:

    private static async Task UploadBlobAsync(BlobClient blobClient, string fileToUploadPath)  
    {  
        FileInfo file = new FileInfo(fileToUploadPath);  
        long uploadFileSize = file.Length;  
    
        object lockObj = new object();  
        int consoleRow = Console.CursorTop;  
        Progress<long> progressHandler = new Progress<long>();  
        progressHandler.ProgressChanged += new EventHandler<long>(delegate (object sender, long bytesUploaded)  
        {  
            lock (lockObj)  
            {  
                Console.SetCursorPosition(0, consoleRow);  
                Console.Write($"\tProgress: {((float)bytesUploaded / uploadFileSize) * 100 : 00.00}%");  
            }  
        });  
    
        using (FileStream fs = File.OpenRead(fileToUploadPath))  
        {  
            await blobClient.UploadAsync(fs, progressHandler: progressHandler);  
        }  
    }  
    

    Then, replace this line of code:

    using (FileStream fs = File.OpenRead(configuration.InputAssetPath))  
    {  
        await uploadBlobClient.UploadAsync(fs);  
    }  
    

    With this line instead:

      await UploadBlobAsync(uploadBlobClient, configuration.InputAssetPath);  
    

    Run the sample again. This will print progress status while the upload is happening, allowing us to know if the upload is not working at all, or if it is partially allowing to upload a portion of the file.

    Also, we will work on our side to make these improvements to the sample code as well.


  3. Horatiu Roman 6 Reputation points
    2021-09-15T13:34:19.647+00:00

    Hi. I'm trying to upload a model as well and I'm getting a similar error, or maybe the same.

    I pasted the error first and then the code. I just wrapped it all in a try{} catch so I can output the error. The error seems to happen on first line. Note: I actually tried on my company wifi, on my usb tethering mobile 4g wifi, as well as without internet at all and I get the same error. So I suspect the Azure library gives a bad upload URL or something.... but I can't see that code because it's probably in a .dll somewhere.

    Any idea how to fix?

    Attempting to upload asset...
    Failed.... :(
    System.AggregateException: Retry failed after 4 tries. Retry settings can be adjusted in ClientOptions.Retry. (No such host is known.) (No such host is known.) (No such host is known.) (No such host is known.)
     ---> Azure.RequestFailedException: No such host is known.
     ---> System.Net.Http.HttpRequestException: No such host is known.
     ---> System.Net.Sockets.SocketException (11001): No such host is known.
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
       at Azure.Core.Pipeline.HttpClientTransport.ProcessAsync(HttpMessage message, Boolean async)
       --- End of inner exception stack trace ---
       at Azure.Core.Pipeline.HttpClientTransport.ProcessAsync(HttpMessage message, Boolean async)
       at Azure.Core.Pipeline.ResponseBodyPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.LoggingPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       --- End of inner exception stack trace ---
       at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.MixedReality.ObjectAnchors.Conversion.BlobUploadEndpointRestClient.GetAsync(Guid accountId, String xMrcCv, CancellationToken cancellationToken)
       at Azure.MixedReality.ObjectAnchors.Conversion.ObjectAnchorsConversionClient.GetAssetUploadUriAsync(CancellationToken cancellationToken)
       at ConversionQuickstart.Program.RunJob(String jobId) in C:\Unity\azure-object-anchors\quickstarts\conversion\ConversionQuickstart\Program.cs:line 85
     ---> (Inner Exception #1) Azure.RequestFailedException: No such host is known.
     ---> System.Net.Http.HttpRequestException: No such host is known.
     ---> System.Net.Sockets.SocketException (11001): No such host is known.
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
       at Azure.Core.Pipeline.HttpClientTransport.ProcessAsync(HttpMessage message, Boolean async)
       --- End of inner exception stack trace ---
       at Azure.Core.Pipeline.HttpClientTransport.ProcessAsync(HttpMessage message, Boolean async)
       at Azure.Core.Pipeline.ResponseBodyPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.LoggingPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)<---
    
     ---> (Inner Exception #2) Azure.RequestFailedException: No such host is known.
     ---> System.Net.Http.HttpRequestException: No such host is known.
     ---> System.Net.Sockets.SocketException (11001): No such host is known.
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
       at Azure.Core.Pipeline.HttpClientTransport.ProcessAsync(HttpMessage message, Boolean async)
       --- End of inner exception stack trace ---
       at Azure.Core.Pipeline.HttpClientTransport.ProcessAsync(HttpMessage message, Boolean async)
       at Azure.Core.Pipeline.ResponseBodyPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.LoggingPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)<---
    
     ---> (Inner Exception #3) Azure.RequestFailedException: No such host is known.
     ---> System.Net.Http.HttpRequestException: No such host is known.
     ---> System.Net.Sockets.SocketException (11001): No such host is known.
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
       at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
       at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
       at Azure.Core.Pipeline.HttpClientTransport.ProcessAsync(HttpMessage message, Boolean async)
       --- End of inner exception stack trace ---
       at Azure.Core.Pipeline.HttpClientTransport.ProcessAsync(HttpMessage message, Boolean async)
       at Azure.Core.Pipeline.ResponseBodyPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.LoggingPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.BearerTokenAuthenticationPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
       at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)<---
    
    Waiting for job completion...
    
    NullReferenceException:
    Object reference not set to an instance of an object.
    

    The code is as follows:

    Console.WriteLine("Attempting to upload asset...");
                        try
                        {
                            Uri assetUri = (await client.GetAssetUploadUriAsync()).Value.UploadUri;
    
                            Console.WriteLine($"\tUpload Uri: {assetUri}");
                            BlobClient uploadBlobClient = new BlobClient(assetUri);
                            await UploadBlobAsync(uploadBlobClient, configuration.InputAssetPath);
                            Console.WriteLine("\nAsset uploaded");
    
                            // Schedule our asset conversion job specifying:
                            // - The uri to our uploaded asset
                            // - Our asset file format
                            // - Gravity direction of 3D asset
                            // - The unit of measurement of the 3D asset
                            Console.WriteLine("Attempting to create asset conversion job...");
                            AssetConversionOptions assetOptions = new AssetConversionOptions(
                                assetUri,
                                AssetFileType.FromFilePath(configuration.InputAssetPath),
                                configuration.Gravity,
                                configuration.AssetDimensionUnit);
                            conversionOperation = await client.StartAssetConversionAsync(assetOptions);
    
                            jobId = conversionOperation.Id;
                            Console.WriteLine($"Successfully created asset conversion job. Job ID: {jobId}");
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("Failed.... :(");
                            Console.WriteLine(e);
                        }
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.