Welcome Guest Search | Active Topics | Sign In | Register

EO.WebEngine with HtmlToPdf.ConvertUrl Options
JujairV
Posted: Thursday, October 27, 2022 10:47:25 AM
Rank: Newbie
Groups: Member

Joined: 2/10/2017
Posts: 5
I have an ASP.Net VB application running on Windows Server 2019.
I have a function which converts HTML reports to PDF using HtmlToPdf.ConvertUrl (last 2022 release).
I works fine, but sometimes (I don't know why/when : temporary system overload, concurrent tasks, whatever...), the generated PDF contains an ASP error (returned by IIS), cause the ASP.Net crashes, probably because of missing parameters. I pass URL GET parameters to my ASP.Net page (my Session variables serialized in fact).
When I call my page with the same URL parameters in another tab of my browser, the page displays fine !
So the error occurs in HtmlToPdf.ConvertUrl, but not every time !!!
In the Windows Event Viewer, I regularly see this message :
Quote:
Could not load file or assembly 'EO.WebEngine' or one of its dependencies. The process cannot access the file because this file is in use by another process. (Exception from HRESULT: 0x80070020)

Could this be related ?
Any idea of what can be wrong if not ?
Many thanks.
eo_support
Posted: Friday, October 28, 2022 12:53:04 PM
Rank: Administration
Groups: Administration

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

When you get an ASP error returned by IIS, what error do you get? Can try use a try catch block to catch and log the detailed error message like this:

Code: C#
try
{
    HtmlToPdf.ConvertUrl(....);
}
catch (Exception e)
{
    Log(e.ToString());
}


You can then let us know the detail about the exception that you logged. We can then go from there.

Additionally, when you get the EO.WebEngine error in your Event Viewer, do you have additional information such as stack trace in your event viewer?

Thanks!
JujairV
Posted: Saturday, October 29, 2022 2:32:38 AM
Rank: Newbie
Groups: Member

Joined: 2/10/2017
Posts: 5
Hi,
Thanks for your answer :)

eo_support wrote:
When you get an ASP error returned by IIS, what error do you get? Can try use a try catch block to catch and log the detailed error message like this:

Code: C#
try
{
    HtmlToPdf.ConvertUrl(....);
}
catch (Exception e)
{
    Log(e.ToString());
}


You can then let us know the detail about the exception that you logged. We can then go from there.


I already have a try/catch there, and it tells me that the conversion is done successfully (I have a PDF file created).
However, in fact, I think this error does not appear during this step (ConvertUrl)
See my next post with Event Viewer details...
JujairV
Posted: Saturday, October 29, 2022 2:39:36 AM
Rank: Newbie
Groups: Member

Joined: 2/10/2017
Posts: 5
eo_support wrote:
Additionally, when you get the EO.WebEngine error in your Event Viewer, do you have additional information such as stack trace in your event viewer?


Here is my full stack trace :

Code: XML
Avertissement	27/10/2022 10:05:09	ASP.NET 4.0.30319.0	1310	Web Event	"Event code: 3008 
Event message: A configuration error has occurred. 
Event time: 27/10/2022 10:05:09 
Event time (UTC): 27/10/2022 08:05:09 
Event ID: c3046bd85fd14ab08cf6e0d9427bb870 
Event sequence: 2 
Event occurrence: 1 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/2/ROOT-55-133113315094605261 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: C:\inetpub\wwwroot\***\ 
    Machine name: NS2****90 
 
Process information: 
    Process ID: 1784 
    Process name: w3wp.exe 
    Account name: MyServer\MyUser 
 
Exception information: 
    Exception type: ConfigurationErrorsException 
    Exception message: Impossible de charger le fichier ou l'assembly 'EO.WebEngine' ou une de ses dépendances. Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus. (Exception de HRESULT : 0x80070020)
   à System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
   à System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
   à System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
   à System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
   à System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
   à System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
   à System.Web.Compilation.BuildManager.ExecutePreAppStart()
   à System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Impossible de charger le fichier ou l'assembly 'EO.WebEngine' ou une de ses dépendances. Le processus ne peut pas accéder au fichier car ce fichier est utilisé par un autre processus. (Exception de HRESULT : 0x80070020)
   à System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   à System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   à System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   à System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   à System.Reflection.Assembly.Load(String assemblyString)
   à System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)

Request information: 
    Request URL: http://my.domain.fr/index.aspx?ReturnUrl=/ 
    Request path: /index.aspx 
    User host address: 92.182.23.209 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: MyServer\MyUser 
 
Thread information: 
    Thread ID: 65 
    Thread account name: MyServer\MyUser 
    Is impersonating: False 
    Stack trace:    à System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
   à System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
   à System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
   à System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
   à System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
   à System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
   à System.Web.Compilation.BuildManager.ExecutePreAppStart()
   à System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

The Request URL (http://my.domain.fr/index.aspx?ReturnUrl=/ ) is NOT the URL I call in HtmlToPdf.ConvertUrl() !

Perhaps that's an IIS/ASP.Net related behaviour (a kind of DLL checking before parsing pages ??) ?
Because in index.aspx, I don't call any EO.PDF functions :-/

Thank you for you precious help
eo_support
Posted: Monday, October 31, 2022 1:08:10 PM
Rank: Administration
Groups: Administration

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

This appears to be some third party application locking the file. Both IIS and our code would read from this file but the read is not exclusive so the file is never locked for read, thus even when IIS or our code is reading this file, other process can still read this file. The error you are receiving indicates that there is another process that is holding on a lock on this file at the moment thus IIS is unable to read it. So you must find out who locked that file and stop that application from doing so. The most common "suspect" of such applications are AntiVirus application that scans the file. So that might be something you want to look into first.

Thanks!
JujairV
Posted: Monday, October 31, 2022 1:25:00 PM
Rank: Newbie
Groups: Member

Joined: 2/10/2017
Posts: 5
Hi,

Thank you for this answer.
I understand the principle, I will follow this lead to check if something else can lock this DLL.

However, that's still strange, my server is a freshly installed Windows Server 2019 with only SQL Server...

By the way, the error I had sometimes in my PDF was due to URL parameters not correctly taken into account (but it was working on the previous server, whereas, it shouldn't had...).

So I managed to solve my issue, finally not really related to EO.PDF (but I suspected the component to sometimes read Session variables, in some particular conditions (?), whereas it can not do this, right ?)
eo_support
Posted: Monday, October 31, 2022 1:31:08 PM
Rank: Administration
Groups: Administration

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

ConvertUrl does not read your session variables. Session variable is a concept/feature of your web server (in your case IIS + ASP.NET). The only way ConvertUrl interacts with your web server is to send the Url to your server and your server sends back a response. In another word, your web server is a black box to ConvertUrl. It does not get into any details such as session variables inside your web server.

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.