Corriger les échecs de connexion IronPdfEngine Docker sur macOS ARM
Lorsque vous connectez une application .NET à IronPdfEngine via Docker sur un appareil macOS ARM (Apple Silicon), l'application génère :
Unhandled exception. System.IO.FileNotFoundException: Error loading native library.
Not found in any of the possible locations
IronPdfConnectionType.Docker utilise une implémentation gRPC plus ancienne qui ne prend pas en charge l'architecture ARM. Sur macOS ARM (Apple Silicon), le client .NET ne peut pas charger le binaire gRPC natif requis, même lorsque l'image Docker est forcée de fonctionner en tant que --platform linux/amd64. Les plates-formes Windows et Linux x64 ne sont pas affectées.
Solution
Remplacez IronPdfConnectionType.Docker par IronPdfConnectionType.RemoteServer dans la configuration de connexion. RemoteServer utilise une implémentation gRPC plus récente qui est compatible avec ARM :
using IronPdf;
var config = new IronPdfConnectionConfiguration
{
ConnectionType = IronPdfConnectionType.RemoteServer,
Host = "http://127.0.0.1",
Port = 33350
};
IronPdf.Installation.ConnectToIronPdfHost(config);
IronPdf.License.LicenseKey = Environment.GetEnvironmentVariable("IRONPDF_LICENSE_KEY");
var renderer = new ChromePdfRenderer();
var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Hello from IronPdfEngine</h1>");
pdf.SaveAs("output.pdf");
using IronPdf;
var config = new IronPdfConnectionConfiguration
{
ConnectionType = IronPdfConnectionType.RemoteServer,
Host = "http://127.0.0.1",
Port = 33350
};
IronPdf.Installation.ConnectToIronPdfHost(config);
IronPdf.License.LicenseKey = Environment.GetEnvironmentVariable("IRONPDF_LICENSE_KEY");
var renderer = new ChromePdfRenderer();
var pdf = await renderer.RenderHtmlAsPdfAsync("<h1>Hello from IronPdfEngine</h1>");
pdf.SaveAs("output.pdf");
Imports IronPdf
Dim config As New IronPdfConnectionConfiguration With {
.ConnectionType = IronPdfConnectionType.RemoteServer,
.Host = "http://127.0.0.1",
.Port = 33350
}
IronPdf.Installation.ConnectToIronPdfHost(config)
IronPdf.License.LicenseKey = Environment.GetEnvironmentVariable("IRONPDF_LICENSE_KEY")
Dim renderer As New ChromePdfRenderer()
Dim pdf = Await renderer.RenderHtmlAsPdfAsync("<h1>Hello from IronPdfEngine</h1>")
pdf.SaveAs("output.pdf")
Exigences :
- Le conteneur Docker IronPdfEngine doit être en cours d'exécution et accessible à l'hôte et au port spécifiés avant d'appeler
ConnectToIronPdfHost. - Utilisez
http://, pashttps://; utiliserhttps://sans certificat SSL valide provoque des erreurs de corruption de trame dans le canal gRPC.
Voir aussi : dépannage des erreurs d'initialisation Vulkan/ANGLE dans Docker et correction des erreurs de connexion gRPC dans les conteneurs Azure.

