Welcome Guest Search | Active Topics | Sign In | Register

EO.Pdf not working after deployed in to azure app service Options
KumoJosh
Posted: Monday, December 17, 2018 6:04:17 AM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31

Hi Team,

We are facing an issue with EO.Pdf after deployed in to the azure app service (i.e) time out exception, as per our observations we got some info related to this from queries already raised by some one in EO portal.As per your comments instead of Azure app service better to put the code int to Azure Worker Role , but currently it is not possible for our project.Please let us know if there is any other solution.??

Please find the below link and sample code which we are using.
https://www.essentialobjects.com/forum/postst8015_Error-creating-PDF-document-in-Azure-Website.aspx

Code:
MemoryStream pdfStream = new MemoryStream();
{

HtmlToPdf.ConvertHtml(contentDecodeString, pdfStream, op);

byte[] pdfFileBytes = pdfStream.ToArray();
MemoryStream outPutStream = new MemoryStream(pdfFileBytes);
response.Content = new PushStreamContent((responseStream, httpContent, tc) =>
{
outPutStream.CopyTo(responseStream);
responseStream.Close();
}, "application/octet-stream");
HttpStatusCode successStatus = HttpStatusCode.Created;
response.StatusCode = successStatus;
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
response.Content.Headers.ContentDisposition.FileName = "sample.pdf";
response.Content.Headers.ContentLength = new MemoryStream(pdfFileBytes).Length;
return response;
}

please provide solution asap and also we ready to discuss over video call if required.
Regards,
Gowtham.
eo_support
Posted: Monday, December 17, 2018 11:18:28 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

The real issue is not whether you use App Service or not. The real issue is whether you use a dedicated VM or a shared VM. If your application runs in a shared VM, then Microsoft would restrict what your application can do so that your application does not accidentally do something that can negatively impact your "roommates" on the same VM. Because EO.Pdf needs to run a native browser engine to render the HTML page, it needs to make numerous system level calls that are not allowed by Microsoft in a shared environment. Obviously if Microsoft does not give you the permission to do something, there is no way around it from our side.

Thanks!
KumoJosh
Posted: Monday, December 17, 2018 1:20:18 PM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Hi Support ,
Thanks for your reply . Currently we have deployed EO PDF in to a app service running under dedicated premium VM . not in to a shared VM . please recheck and suggest us on this .
KumoJosh
Posted: Monday, December 17, 2018 1:20:49 PM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Hi Support ,
Thanks for your reply . Currently we have deployed EO PDF in to a app service running under dedicated premium VM . not in to a shared VM . please recheck and suggest us on this .

Thanks
Kumo Team
eo_support
Posted: Monday, December 17, 2018 3:34:31 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Can you try to use remote desktop to connect to the computer directly, then run our installer on the computer and run the sample application locally and see if it works for you?
KumoJosh
Posted: Monday, December 17, 2018 9:02:24 PM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Hi Support ,
Thanks for your reply . There is no option to connect azure app service via RDP . So your suggestion will not work for us . please recheck and suggest us.

Thanks
Kumo Team
KumoJosh
Posted: Tuesday, December 18, 2018 2:30:31 AM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Hi Support,
Any update on this?

Thanks,
Kumo Team.
KumoJosh
Posted: Tuesday, December 18, 2018 5:18:48 AM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Hi Support,
Any update on this ,we have very urgent need, could you please suggest us.

Thanks,
Kumo Team.
eo_support
Posted: Tuesday, December 18, 2018 11:55:23 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

Sorry about the late replying. We were trying to test this on our end.

During our test it did work --- our test steps are as follow:

1. Create a new blank MVC Test app based on .NET Framework 4.6;
2. Follow steps here to add MVCToPDF to it:

https://www.essentialobjects.com/doc/pdf/web/mvc.aspx

During our test, we simply added [EO.Pdf.Mvc.RenderAsPDF] attribute to the "About" method in HomeController;

3. Deply the site to Azure, then click "About" and it successfully generated a PDF file for download;

Please try the above step and see if it works for you. If that still does not work for you, add the following code to your Application_Start handler before you call EO.Pdf.Mvc.MVCToPDF.RegisterFilter (per instructions in step 2):

Code: C#
EO.Base.Runtime.EnableEOWP = true;


Please let us know if this works for you.

Thanks
KumoJosh
Posted: Wednesday, December 19, 2018 10:30:30 AM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Support Team , Thanks for you reply . whatever the code you have shared will work for MVC based application. But our project architecture completely based of System.Web.Http.ApiController and deployed in azure website . please kindly help in this asap. please make a note that this issue is very very urgent to us. if you required we are ready for a video call setup to discuss on this.

Thanks,
Kumo Team
eo_support
Posted: Wednesday, December 19, 2018 10:48:03 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

There should be no real difference between Web API app and a regular MVC app from the HTML to PDF point of view because they use the same pipeline. In fact in the same MVC test app we tried the following code and it also works fine:

Code: C#
PdfDocument doc = new PdfDocument();
HtmlToPdf.ConvertHtml("test", doc);


The reason we also tested MVCToPDF attribute is because it will produce the result as download thus is easier to verify. This code while it produce no visible result if it succeeds, it should produce an exception if it fails.

You can run this test first and see whether it works for you. We understand this test code does very minimum and it will not achieve the same task you wanted to achieve in your application, but the above code will test whether the core browser engine is working correctly in your environment.

Thanks!
KumoJosh
Posted: Saturday, December 22, 2018 9:24:41 AM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Team,

We created a sample api application using above code and hosted in Azure site. Here are the issues still we are facing.

1. First request (this line of execution HtmlToPdf.ConvertHtml) is taking more time to respond.
2. Application is completely not responding (from this line of code HtmlToPdf.ConvertHtml) when site runs on on 64 bit. Does it support 64 bit? Do you have any specific dll available to make the application run on 64 bit?

Kindly help in this asap. please make a note that this issue is very very urgent to us. if you required we are ready for a video call setup to discuss on this.


Thanks,
Kumo Team
KumoJosh
Posted: Wednesday, December 26, 2018 10:12:53 AM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Team,

We are waiting for your response, please check above post and suggest us on this asap.

Thanks
Kumo Team
eo_support
Posted: Friday, December 28, 2018 5:48:06 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
Hi,

The first request takes longer is normal because it needs to initialize the browser engine.

Our product runs on both 32 bit mode and 64 mode. So there is no separate DLLs for 64 bit mode.

Thanks
KumoJosh
Posted: Friday, December 28, 2018 8:42:30 AM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Thanks for the update.

But EOPDF dll is not responding while running on azure app service with below few lines when we make it as 64 bit.

When we update to 32 bit then the same code is working fine and again updated back to 64 bit then its not responding.

PdfDocument doc = new PdfDocument();
HtmlToPdf.ConvertHtml("test", doc);

eo_support
Posted: Friday, December 28, 2018 10:16:34 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
I am not sure what else to tell you. We tested both 32 bit and 64 bit and it worked fine for us. How do you know your application not responding is because of this two lines?
Newbie
Posted: Friday, December 28, 2018 10:23:13 AM
Rank: Newbie
Groups: Member

Joined: 12/16/2018
Posts: 4
I also tried in my local machine and its worked well in both 32 and 64 bit but when we deploy it in Azure app service, its not responding in 64 bit.

Do you have any success story with azure app service running on 64 bit or can you try once on Azure app service.

We kept below two lines of code only in the API call which worked well in 32 bit but not 64 bit. We debug the code while running on azure app service and have seen its hanging in the line HtmlToPdf.ConvertHtml("test", doc); of code.

PdfDocument doc = new PdfDocument();
HtmlToPdf.ConvertHtml("test", doc);
eo_support
Posted: Friday, December 28, 2018 10:25:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
We did test the 64 bit on Azure app service. Not locally.
KumoJosh
Posted: Friday, December 28, 2018 10:39:46 AM
Rank: Advanced Member
Groups: Member

Joined: 12/14/2018
Posts: 31
Good to hear.

Can you please share the sample code used and the settings placed in App service, so this will help us to compare the difference in our app service settings.

Can we have a quick call, please suggest your availability and contact details.

Thanks,
Kumo Team
eo_support
Posted: Friday, December 28, 2018 11:48:30 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,258
There is nothing special about the sample. We just created the blank MVC sample app using VS 2017's built-in template and then we add the following two lines of code:

1. Add EO.Base.Runtime.EnableEOWP = true; inside Global.asax.cs in function Application_Start;
2. Add HtmlToPdf.ConvertHtml("", new PdfDocument()) inside HomeController.cs in function About;

We then deploy it to Azure App Service and click About, it will take a while and then the about page will show.

We do not provide technical support over the phone ---- it's notoriously inefficient to troubleshoot technical issues over the phone, especially for our product where very often we need to exchange a wide variety of technical data with the customer such as code, error code, screen shot, stack traces, etc. If you wish to contact us directly without using the forum, you can find our contact email address here:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.