question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

First Call from .Net core 2 Web API works, next one hangs

See original GitHub issue

I’m using this on Windows 10 with a .Net core 2 web api.

The first call works fine, but subsequent calls hang. Any ideas?

private byte[] GeneratePDFFromHtml(string html)
        {
            var converter = new SynchronizedConverter(new PdfTools());

            var doc = new HtmlToPdfDocument()
            {
                GlobalSettings =
                {
                    ColorMode = ColorMode.Color,
                    Orientation = Orientation.Landscape,
                    PaperSize = PaperKind.A4Plus
                },
                Objects =
                {
                    new ObjectSettings()
                    {
                        PagesCount = true,
                        HtmlContent = html,
                        WebSettings =
                        {
                            DefaultEncoding = "utf-8"
                        },
                        HeaderSettings =
                        {
                            FontSize = 9,
                            Right = "Page [page] of [toPage]",
                            Line = true,
                            Spacing = 2.812
                        }
                    }
                }
            };

            var bytes = converter.Convert(doc);

            return bytes;
        }

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
pritampashtev2commented, Oct 23, 2019

this solution didn’t worked for me. I have declared singleton but still it stops at line var bytes = converter.Convert(doc); Please suggest.

2reactions
rdvojmoccommented, Jan 15, 2018

You must declare SynchronizedConverter as singleton. Example with DI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - .NET Web Api application hangs when calling other ...
The problem: when there are 3 or more clients calling the first service in parallel the calls to second service hangs. Here is...
Read more >
NET Core 2.2 Web API Shuts down immediately after running
After a few times of this the code just stops running. I hit the IIS Express start button and it looks like it's...
Read more >
ASP.NET Core Best Practices
ASP.NET Core apps perform best when architected to run code in parallel. Do not call Task.Run and immediately await it. ASP.NET Core already ......
Read more >
Diagnosing an ASP.NET Core hard crash
The immediate crash was due to an exception being thrown in an async void method. Relevant threading aspects: I start the ASP.NET Core...
Read more >
Configure the ASP.NET Core application to start ...
The ASP.NET Core application is configured to start automatically after the server restarts or if the process stops or crashes. Therefore, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found