macOS ARMでのIronPdfEngine Docker接続の失敗を修正

This article was translated from English: Does it need improvement?
Translated
View the article in English

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")
$vbLabelText   $csharpLabel

要件:

  • ConnectToIronPdfHost を呼び出す前に、指定されたホストとポートでIronPdfEngine Dockerコンテナが実行され、到達可能である必要があります。
  • http:// を使用し、https:// は使用しないでください; 有効なSSL証明書なしでhttps:// を使用すると、gRPCチャネルでフレーム破損エラーが発生します。

参照: DockerでのVulkan/ANGLE初期化エラーのトラブルシューティング および AzureコンテナでのgRPC接続エラーの修正

Curtis Chau
テクニカルライター

Curtis Chauは、カールトン大学でコンピュータサイエンスの学士号を取得し、Node.js、TypeScript、JavaScript、およびReactに精通したフロントエンド開発を専門としています。直感的で美しいユーザーインターフェースを作成することに情熱を持ち、Curtisは現代のフレームワークを用いた開発や、構造の良い視覚的に魅力的なマニュアルの作成を楽しんでいます。

開発以外にも、CurtisはIoT(Internet of Things)への強い関心を持ち、ハードウェアとソフトウェアの統合方法を模索しています。余暇には、ゲームをしたりDiscordボットを作成したりして、技術に対する愛情と創造性を組み合わせています。

準備はできましたか?
Nuget ダウンロード 20,088,359 | バージョン: 2026.7 リリースされたばかり
Still Scrolling Icon

まだスクロールしていますか?

すぐに証拠が欲しいですか? PM > Install-Package IronPdf
サンプルを実行するHTML が PDF に変換されるのを確認します。