0

I have asp.net web app with following code which works in local system (Mac OS) but didn't work in Azure Web App (Linux) after deployment.

I checked the api key and api endpoint with logging and they are correct.

I'm using Azure.AI.DocumentIntelligence" Version="1.0.0-beta.3"

 async Task<AnalyzeDocumentResult> AnalyzeDocumentAsync(string filePath)
 {
 var config = ((IConfigurationRoot)_config).GetRequiredSection("DocumentIntelligence").Get<DocumentIntelligenceConfig>();
 var credential = new AzureKeyCredential(config?.ApiKey ?? string.Empty);
 var options = new DocumentIntelligenceClientOptions(DocumentIntelligenceClientOptions.ServiceVersion.V2024_07_31_Preview);
 var client = new DocumentIntelligenceClient(new Uri(config?.EndPoint ?? string.Empty), credential, options);
 var file = new AnalyzeDocumentContent()
 {
 Base64Source = BinaryData.FromBytes(await File.ReadAllBytesAsync(filePath))
 };
 var operation = await client.AnalyzeDocumentAsync(WaitUntil.Completed, "prebuilt-layout", file.Content, outputContentFormat: ContentFormat.Markdown);
 if (!operation.HasValue)
 {
 _logger.LogError($"File doesn't have data: trackingCode: {trackingCode}");
 return new AnalyzeDocumentResult(false, file.FilePath, null);
 }
 if (!operation.HasCompleted)
 {
 _logger.LogError($"File doesn't completed: trackingCode: {trackingCode}");
 return new AnalyzeDocumentResult(false, file.FilePath, null);
 }
 await File.WriteAllTextAsync(file.FilePath.Replace(".pdf", ".md"), operation.Value.Content);
 return new AnalyzeDocumentResult(true, file.FilePath, operation.Value.Content);
 }

I receive the following error:

AnalyzeFileAsync -> Resource not found
Status: 404 (Not Found)
ErrorCode: 404
Content:
{"error":{"code":"404","message":"Resource not found"}}
Headers:
Date: 2024年10月01日 20:43:28 GMT
Content-Length: 55
Content-Type: application/json

It's really weird, why it should works locally but not after publish! What is the difference?

asked Oct 1, 2024 at 21:26

2 Answers 2

1

Yes, the problem you encoutred is due to deploying Doc Intelligence in unsupported Azure region.

It's specified in the Azure AI Document Intelligence documentation that the 2024年07月31日-preview version is currently available only in the following Azure regions:

  • East US
  • West US2
  • West Europe
  • North Central US
answered Oct 31, 2024 at 14:01
Sign up to request clarification or add additional context in comments.

Comments

0

I'm not sure if this is directly related to this repository, but the issue I encountered was with the Germany West Central region. After redeploying Doc Intelligence in West Europe, everything is working fine now!

I couldn't find any documentation explaining the differences or specific issues between regions. If anyone else is facing a similar problem, consider redeploying to a different region, as it might resolve the issue.

answered Oct 2, 2024 at 8:19

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.