I'm trying to convert my page to PDF using HiQPDF. The code works fine when I run it on my local machine (through localhost), but when I push it to the server, I receive this error:
HTML from URL layout error
Here's some example code:
HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
htmlToPdfConverter.ConvertUrlToFile("https://website.com/12345", filePath);
filePath is the path where the PDF should be created. Path is correct and the folders are all created. When I go to https://website.com/12345 as my site, I can view the page fine. Even in incognito. If I simply replace website.com with localhost it works fine locally.
The error suggests there's a problem with the code of the page.. right? What could the issue be?
Are you using this in an Azure web app? If so, it's not supported. If you're using Azure it would need to be deployed to a web role running in a cloud service.
You can use the HiQPdf library in Windows Azure Cloud Services and Virtual Machines but not in Web Sites because the Web Sites run in a restricted sandbox. Using Visual Studio you can easily transform an existing ASP.NET 4.0 or MVC application into a Web Role by adding a cloud service project to the solution containing your project. For this, open your solution, right click on the ASP.NET project and select the 'Add Windows Azure Cloud Service Project' option from menu. Right click on the added cloud service project and select the 'Package' option to produce a package and a configuration file you can deploy as an Azure Cloud Service.
http://www.hiqpdf.com/FAQs.aspx
Related
I am trying to publish an ASP.NET Web Application (.Net Framework) to a subdomain on my webhotel. The problem is that when the site has uploaded and I visit the page, the site is not displayed, only the code in the index.cshtml file is shown in the browser. The site consists of Razor Pages.
I have checked the root directory for the subdomain at my webhotel and noticed that there are no .dll files which I was expecting there would be. What might the problem be and how can I solve this?
I have been informed by the support from the Webhotel Host that it is not possible to publish a Web Application to an ordinary FTP server. Instead I have found that Google Cloud Platform or equivalent, is needed to host a Web Application. The directory needs to be specifically prepared for a Web Application.
I want to publish my single page app to Azure. I have created the App Service, App Service Plan and downloaded the publish profile settings on my local. Now I can use FTP to publish it to Azure. But I am wondering if there is a way I can configure this in the my Visual Studio similar to what we do when publishing a .Net application (MVC or Web API) as shown below in the snapshot.
My single page application is not part of the solution. This is how the structure of my projects look like.
It has one .Net Core Web API project and one Single Page App created in Vue.js. I can publish the Web API project from the Visual Studio but not the SPA. Any help with this please?
Per my knowledge, it is impossible to publish it in Visual Studio similar to what we do when publishing a .Net application. There is no Publish... option for us to choose.
As a workaround, we can upload our SPA project to Azure web app via KuDu.
More information about KuDu, we can refer to: Using KUDU with Microsoft Azure Web Apps
We just need to drag the SPA project into KUDU under wwwroot folder as below:
I am using HiQPdf DLL to convert my HTML into PDF. It works on all server but when i deployed this to Azure ,it throws an error. Below is the error:-
"HiQPdf.HtmlToImage HTML layout error"
Thanks for your help in Advance.
Please check the HiQPdf HTML to PDF Converter for .NET FAQ regarding the Azure deployments. Below I copied the information from that page.
Basically you can use the HiQPdf library in Windows Azure Cloud Services and Virtual Machines but not in Web Sites because the Web Sites run in a restricted sandbox. Using Visual Studio you can easily transform an existing ASP.NET 4.0 or MVC application into a Web Role by adding a cloud service project to the solution containing your project. For this, open your solution, right click on the ASP.NET project and select the 'Add Windows Azure Cloud Service Project' option from menu. Right click on the added cloud service project and select the 'Package' option to produce a package and a configuration file you can deploy as an Azure Cloud Service.
I have published the created ASP.NET WEb API in the FILE SYstem. And in the IIS I have created a website and linked the published application in the physical path. After creating the website I tried to encrypt the connection string using aspnet_regiis. Everything works fine in the current server.
So If want to create the website on different server. How will I be doing it. I tried to move the published folder local in to the server and tried creating the website referencing that as the physical path but when I browse through the website it returns some irrelevant data.
Is there any procedure for doing this.
Using my old computer. I used to publish web sites to windows azure (that was before the latest azure design) via Visual Studio 2013:
Right-click the project
Select Publish
Select Profile
Enter credentials
Validate connection
Publish
Now (with the latest azure design, and I am now using VS2015), with my new computer. I downloaded the profile I used to have then imported it then published it.
But then I got this error message
Then I tried to debug the error:
I used the connection string from my old published profile then pasted it in my webconfig. Upon running the application, it does not break the application instead it showed the error above.
Basically, I want to use the old profile I used to publish on windows azure. Same domain name and same database (I also want to keep the data)
What options do I have?
PS. I'm still new to windows azure. All I know is publishing website via Visual Studio
EDIT: I don't have any error locally
For the issue at hand, You can enable Diagnostics Logs and Check them to see why your site is crashing. You can even do remote debugging by attaching to the website running on the cloud.
To get the diagnostics logs follow the below steps.
Go to portal.azure.com.
Browse to your web app
Open the Settings Blade and Click on the Diagnostics Logs Settings.
Set the Diagnostics Settings as below.
After this go to the Tools by Clicking on Tools Command on the Web App Blade.
Click on Streaming Logs to see logs coming in at real time.
If you need to see the logs dumps, You can download the Publishing Profile and access the file share directly using any FTP Client like Filezilla using the FTP UserId and Pwd from the .publish file when you open it with notepad.
The other way to debug you app is to attach your visual studio directly to the Web App running on the cloud, This is very simple and powerful way to debug the issue interactively, As your error is a null ref the exception will break directly on VS and you should be able to see the cause quickly.
Great Blogs on Attaching to VS for a Web App Here.
There are multiple ways to publish your site to Azure Web App.
Using Continuous Deployment feature to deploy your bits based on your repo updates. Great Blog to learn how to setup Continuous Deployment on Azure App Service.
Publishing directly from Visual Studio which you are already familiar.Publishing Profile which you can download from the Web App Blade can be used in Web Matrix and other tools to deploy your site directly into a web app.
Downloading the Publishing Profile and directly placing the files in to the wwwroot of your website using FTP.
Glad to see developers starting into our product, hope this information helps you get started !.