2016-11-11 56 views
0

我試圖用HiQPDF將我的頁面轉換爲PDF。代碼工作正常,當我在我的本地機器上運行(通過本地主機),但是當我把它推到服務器,我收到此錯誤:來自URL佈局錯誤的HTML

HTML from URL layout error

下面是一些示例代碼:

HtmlToPdf htmlToPdfConverter = new HtmlToPdf(); 
htmlToPdfConverter.ConvertUrlToFile("https://website.com/12345", filePath); 

filePath是應該創建PDF的路徑。路徑是正確的,並且所有文件夾都被創建。當我作爲我的網站前往https://website.com/12345時,我可以查看該頁面。即使在隱身。如果我簡單地用localhost替換website.com,它在本地工作正常。

錯誤提示存在頁面代碼的問題..對嗎?這個問題會是什麼?

回答

0

您是否在Azure Web應用程序中使用此項功能?如果是這樣,它不被支持。如果您使用的是Azure,則需要將其部署到在雲服務中運行的Web角色。

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

+0

嗯這是奇怪的。儘管如此,我仍然給它提供了網站的完整路徑。我沒有使用localhost或類似的東西。我給它全長。 HiQPdf的支持能夠生成它。 – MortenMoulder