This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.35k
stars
4.66k
forks
source link
[QUERY] C# Form Recognizer returning 404 Not Found #46201
Goal: use custom extraction model in C# .NET console app:
var config = GetConfigurationRoot("");
var docIntelligenceEndPoint = config["AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT"] ?? throw new NullReferenceException("AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT");
var docIntelligenceApiKey = config["AZURE_DOCUMENT_INTELLIGENCE_KEY"] ?? throw new NullReferenceException("AZURE_DOCUMENT_INTELLIGENCE_KEY");
string modelId = "REDACTED";
string endpoint = docIntelligenceEndPoint;
string apiKey = docIntelligenceApiKey;
var inputPath = @"sample.pdf";
var client = new DocumentAnalysisClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
if (!File.Exists(inputPath))
{
throw new InvalidOperationException("Missing input file");
}
using (FileStream stream = new FileStream(inputPath, FileMode.Open))
{
var result2 = await client.AnalyzeDocumentAsync(WaitUntil.Completed, modelId, stream);
Console.WriteLine($"Model ID used: {result2.Value.ModelId}");
}
Response:
Azure.RequestFailedException: 'Resource not found.
Status: 404 (Not Found)
ErrorCode: NotFound
Content:
{"error":{"code":"NotFound","message":"Resource not found.","innererror":{"code":"ModelNotFound","message":"The requested model was not found."}}}
However my model ID matched with what is displayed in ADI Studio.
Environment
.NET SDK:
Version: 8.0.400
Commit: 36fe6dda56
Workload version: 8.0.400-manifests.57f7c351
MSBuild version: 17.11.3+0c8610977
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-arm64
Base Path: C:\Program Files\dotnet\sdk\8.0.400\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
[aspire]
Installation Source: SDK 8.0.400, VS 17.11.35219.272
Manifest Version: 8.2.0/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.0\WorkloadManifest.json
Install Type: FileBased
Host:
Version: 8.0.8
Architecture: arm64
Commit: 08338fcaa5
.NET SDKs installed:
6.0.425 [C:\Program Files\dotnet\sdk]
8.0.400 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x64 [C:\Program Files\dotnet\x64]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation]
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Library name and version
Azure.AI.FormRecognizer 4.1.0
Query/Question
Goal: use custom extraction model in C# .NET console app:
Response:
However my model ID matched with what is displayed in ADI Studio.
Environment