I am getting below exception after deploying HTML to PDF functionality in Azure Web App(.net Framework 4.8).Same is working fine in local .
IronSoftware.Exceptions.IronSoftwareDeploymentException: Error while deploying IronPdf Chrome renderer: 'Unable to locate 'IronInterop' in C:\home\site\wwwroot\, C:\home\site\wwwroot\bin, C:\local\Temporary ASP.NET Files\root\26df21a6\54e3e732\assembly\dl3\9559295f\001eed5d_d423d901, C:\home\site\wwwroot, Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) to path 'C:\home\site\wwwroot\runtimes\win-x64\native', Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) to path 'C:\home\site\wwwroot\runtimes\win.10-x64\native', Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) to path 'C:\home\site\wwwroot\' nor in an embedded resource'. To learn more about making an engineering support request please visit: <a href=https://ironpdf.com/troubleshooting/engineering-request-pdf/>.
To learn how to solve this issue please read https://iron.helpscoutdocs.com/article/194-azure-functions-deployment2
[Issue Code IRONPDF-CHROME-DEPLOYMENT-ERROR-AMZN] ---> IronSoftware.Exceptions.IronSoftwareDeploymentException:
Unable to locate 'IronInterop' in C:\home\site\wwwroot\, C:\home\site\wwwroot\bin, C:\local\Temporary ASP.NET Files\root\26df21a6\54e3e732\assembly\dl3\9559295f\001eed5d_d423d901,
C:\home\site\wwwroot, Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf) to path 'C:\home\site\wwwroot\runtimes\win-x64\native',
Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf)
to path 'C:\home\site\wwwroot\runtimes\win.10-x64\native', Embedded resource (IronPdf, Version=2023.1.0.11416, Culture=neutral, PublicKeyToken=94e1c31412563c75: IronPdf)
to path 'C:\home\site\wwwroot\' nor in an embedded resourceat IronSoftware.Deployment.SmartDeploymentBase.ThrowRelevantException(List`1 exceptions)at
IronSoftware.Deployment.SmartDeploymentBase.Deploy(Boolean download)at IronSoftware.Deployment.DeploymentEngine.Deploy[T](String custom_dir, Boolean download)---
End of inner exception stack trace
I have already added dependent nuget IronPdf.Native.Chrome.Windows as suggested. Below is the code :
var renderer = new ChromePdfRenderer();
renderer.RenderingOptions.RenderDelay = Convert.ToInt32(SiteSettingsPage.Settings.PDFRenderDelay);
renderer.RenderingOptions.MarginTop = 12;
renderer.RenderingOptions.MarginBottom = 12;
renderer.RenderingOptions.MarginLeft = 0;
renderer.RenderingOptions.MarginRight = 0;
renderer.RenderingOptions.PaperOrientation =
IronPdf.Rendering.PdfPaperOrientation.Portrait;
renderer.RenderingOptions.PaperSize = IronPdf.Rendering.PdfPaperSize.A4;
var pdf = renderer.RenderUrlAsPdf(htmlFileUrl).BinaryData;
As per the above requirement I have reproduced from my end I tried your code it works fine in local but where as deployed in webapp it was showing error.
Thanks @jdweng for your suggestions in the comments. Below is the code which I tried to reproduce.
In the above code
SdkContext.AzureCredentialsFactory.FromFilemethod to read your Azure credentials from a file called "azureauth.properties" that should be located in the same directory as your program file.azure.WebApps.GetByIdmethod retrieves an instance of your web app using the resource group and web app names.FileStreamobject to read the contents of the PDF file, and then use thewebApp.Inner.WebApps.CreateOrUpdateSiteBlobSourcemethod to create or update a blob in the web app's root directory