Document AI connected container keep throwing 404

Shailesh Kumar (NAV Backoffice) 25 Reputation points
2024-02-28T14:38:45.9666667+00:00

I am trying to extract document information using below SDK method, which keep throwing me 404 exception, i have tried different SDK versions, but they all throwing same exception.

When I am calling the same endpoint ("http://172.16.18.154:5000/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-08-31") using postman or using HTTPClient it works fine and returns 202 response code

Source Code

var credential = new AzureKeyCredential(_APIKey);

            var client = new FormRecognizerClient(new Uri("http://172.16.18.154:5000/formrecognizer/documentModels/prebuilt-idDocument:analyze?api-version=2022-08-31";), credential);
            RecognizeIdentityDocumentsOperation operation = client.StartRecognizeIdentityDocumentsFromUri(new Uri("https://www.navconsulting.net/images/awards/digital-banker-award.jpg"));
            Response<RecognizedFormCollection> operationResponse = await operation.WaitForCompletionAsync();

Response

{"Status":404,"ErrorCode":null,"ClassName":"Azure.RequestFailedException","Message":"Service request failed.\r\nStatus: 404 (Not Found)\r\n\r\nHeaders:\r\nDate: Wed, 28 Feb 2024 14:31:06 GMT\r\nServer: Kestrel\r\nContent-Length: 0\r\n","Data":{},"InnerException":null,"HelpURL":null,"StackTraceString":" at Azure.AI.FormRecognizer.FormRecognizerRestClient.AnalyzeIdDocumentAsync(Nullable1 includeTextDetails, IEnumerable1 pages, SourcePath fileStream, CancellationToken cancellationToken)\r\n at Azure.AI.FormRecognizer.FormRecognizerClient.StartRecognizeIdentityDocumentsFromUri(Uri identityDocumentUri, RecognizeIdentityDocumentsOptions recognizeIdentityDocumentsOptions, CancellationToken cancellationToken)\r\n at NAVRTA.API.Activity.Controllers.OCRController.AnalyzeId(Stream streamDocument) in D:\GitDev\NAVRTA\NAVRTA API\NAVRTA API\NAVRTA.WebApi.Activity\Controllers\OCRController.cs:line 119","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2146233088,"Source":"Azure.AI.FormRecognizer","WatsonBuckets":null}

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
2,112 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 18,676 Reputation points Moderator
    2024-03-01T01:39:04.8866667+00:00

    Hello @Shailesh Kumar (NAV Backoffice) , I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Document AI connected container keep throwing 404 Not Found

    Solution: Make sure to enter the right API key and endpoint URL from the Azure Document Intelligence resource.

    Regards,
    Vasavi

    Thank you again for your time and patience throughout this issue. let me know.

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    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.