macOS ARMでのIronPdfEngine Docker接続の失敗を修正
macOS ARMデバイス(Apple Silicon)でDockerを介してIronPdfEngineに.NETアプリケーションを接続する際に、アプリケーションが次を投げます:
Unhandled exception. System.IO.FileNotFoundException: Error loading native library.
Not found in any of the possible locations
IronPdfConnectionType.Docker は、ARMアーキテクチャをサポートしない古いgRPC実装を使用しています。 macOS ARM (Apple Silicon)では、.NETクライアントが必要なネイティブgRPCバイナリをロードできません。たとえDockerイメージが--platform linux/amd64として実行されるよう強制されてもです。 WindowsおよびLinux x64プラットフォームは影響を受けません。
解決策
接続設定でIronPdfConnectionType.RemoteServerに置き換えます。 RemoteServer は、ARM互換の新しいgRPC実装を使用しています:
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")
要件:
ConnectToIronPdfHostを呼び出す前に、指定されたホストとポートでIronPdfEngine Dockerコンテナが実行され、到達可能である必要があります。http://を使用し、https://は使用しないでください; 有効なSSL証明書なしでhttps://を使用すると、gRPCチャネルでフレーム破損エラーが発生します。
参照: DockerでのVulkan/ANGLE初期化エラーのトラブルシューティング および AzureコンテナでのgRPC接続エラーの修正。

