Welcome Guest Search | Active Topics | Sign In | Register

Visual Studio debugging and BaseUrl Options
Aaron
Posted: Wednesday, December 13, 2017 3:35:57 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
If we attempt to generate a pdf from running within Visual Studio (using IIS EXpress), then it is not loading the CSS or Images. I suspect this is down to the BaseUrl.

It is being set to the website address of: http://localhost:52012/

Our html is coming out fine. I can see in the IIS Express logs, that when we hit the endpoint to just produce the html, then it is doing a GET on the CSS and Images just fine (status 200), but when I change the endpoint to then render the same Html as a pdf, then there is nothing in the IIS EXpress logs to show that it is even making a request to http://localhost:52012/ to get the CSS or images.

It works fine when released to a server. This is only an issue for us when running via Visual Studio.
eo_support
Posted: Wednesday, December 13, 2017 8:33:13 AM
Rank: Administration
Groups: Administration

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

I can't think of anything that can cause that. Can you try to isolate the problem into a test project and send the test project to us? See here for more details:

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

Once we have that we will be happy to investigate further.

Thanks!
Aaron
Posted: Thursday, December 21, 2017 6:07:45 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
Hi,

I am sorry but I don't have time to create a test project to send to you, but you can test this very simply.

We have some HTML with our logo image.

When running in Visual Studio, I can get it to both fail and to work. Note. The HtmlToPdf.Options.BaseUrl i set to "http://localhost:52012/"

Test 1 - FAILS

<div id="logo">
<img src="/content/kids/logo.png">
</div>

Test 2 - FAILS

<div id="logo">
<img src="http://localhost:52012/content/kids/logo.png">
</div>

Test 3 - SUCCESS

<div id="logo">
<img src="https://<our dev url>/content/kids/logo.png">
</div>


It seems to have a problem with "localhost"? Do you do something special / different with localhost??
eo_support
Posted: Thursday, December 21, 2017 8:44:19 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Have you tried to type in the "http://localhost:52012/content/kids/logo.png" Url directly in the browser and are you able to get the image?
Aaron
Posted: Thursday, December 21, 2017 8:47:05 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
yes of course. The HTML renders it fine, and you can see the image fine by directly putting the url in the browser. It is only Essential Objects (with local host) that seems to be an issue.
eo_support
Posted: Thursday, December 21, 2017 9:15:58 AM
Rank: Administration
Groups: Administration

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

I am not sure what to tell you. We tested it here and it works fine. So there must be something that we are missing here. That is why we need you to isolate the problem into a test project so that we will be able to reproduce the problem. Once we have the test project, we will be happy to investigate further.

Thanks!
Aaron
Posted: Thursday, December 21, 2017 9:28:35 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
Did you test using Visual Studio with IIS Express with localhost url?

Is there any logging that we can turn on to see the raw url it is using to get the image? As our IIS logs show that it is not hitting IIS Express. i.e. your pdf generation is not using the url.

With your tests, can you reply with the IIS Express log file showing that it hits IIS Express to load the image (or CSS etc).
eo_support
Posted: Thursday, December 21, 2017 9:32:45 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
We did test with IISExpress by modifying our own PdfWeb_CS project in the EO.Total.Sample solution to include an image with localhost Url and the image appears fine in the result PDF. You need to send us a test project in order for us to investigate further on this matter.
Aaron
Posted: Thursday, December 21, 2017 9:35:40 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
Are there any logging switches that we can turn on?
eo_support
Posted: Thursday, December 21, 2017 9:55:41 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
You do need to follow our instructions. Otherwise there is no point for us to continue working with you. This issue will not move forward until you send us a test project demonstrating the problem.

Hope this makes our position clear enough to you.
Aaron
Posted: Friday, December 22, 2017 6:11:02 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
have sent an email to your support email with a test project that replicates the issue. I have received a security email that looks like it is from our exchange security to say that it has stripped code from the zip file. Our support teams are looking to see if they can send it unaltered.
Aaron
Posted: Friday, December 22, 2017 6:17:05 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
our support team have now allowed the email through with the attachment unaltered. Have a great Christmas.
eo_support
Posted: Friday, December 22, 2017 10:03:03 AM
Rank: Administration
Groups: Administration

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

Thanks for the test project. We received the project and ran it here according to your instructions and everything seems to work fine. Specifically, both the logo image and the pageOne pageTwo background image are rendered correctly in the PDF file.

Our guess is that this maybe caused by some kind of network/security configuration on your computer that disallows rundll32.exe (this is Windows the process that we use to run the browser engine) from accessing local resources. There are a few things you can try:

1. Try the same test on a different machine;

2. Try to use the following code and see what you get:

Code: C#
HtmlToPdf.ConvertUrl("http://localhost:52012/content/kids/logo.png");


If it works correctly, it should give you the image in the result PDF file. If it does not, you should either receive an exception or a PDF file that contains an error message, which may provide you additional information about exactly what's causing the problem.

Thanks!
Aaron
Posted: Thursday, January 4, 2018 6:33:23 AM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
Thanks. I have done the above and it returns the following in the pdf output.

The Page Failed to Load
Error code:‐138
To customize this message, please handle the WebView's LoadFailed event and then Set
e.ErrorMessage in your event handler based on e.ErrorCode, or call
e.UseDefaultMessage if you just wish to display the error message without this help
message.
eo_support
Posted: Thursday, January 4, 2018 1:49:25 PM
Rank: Administration
Groups: Administration

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

Error code -138 is Chromium's NETWORK_ACCESS_DENIED, which corresponds to Windows socket error WSAEACCES and it usually indicates that you have a Windows firewall setting/rule somewhere that explicitly blocks such connection (from localhost to localhost:52012 for process rundll32.exe). Once you resolve that this should work.

Thanks!
Aaron
Posted: Wednesday, March 21, 2018 12:32:29 PM
Rank: Advanced Member
Groups: Member

Joined: 12/13/2017
Posts: 29
It has been some time, but we are now a bit stuck with resolving the problem. We have found that it is McAfee that is blocking rundll32 as per company policy. The team that manages McAfee has tried to put in a rule to allow this on the loop back address. Unfortunately, either EO or WebKit that EO uses is using an IPV6 loopback address of 0000:000:0000:0000:0000:000:0000:0001 as opposed to 127.0.0.1. Our version of McAfee can only be configured to a allow an IPV4 loop back address. i.e. it sees this IPV6 loop back address as an external address and blocks it.

Q. Is there a way that we can make it use 127.0.0.1 as its loop back address?
eo_support
Posted: Wednesday, March 21, 2018 8:45:16 PM
Rank: Administration
Groups: Administration

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

Unfortunately there is no way to disable that. Chromium automatically uses IPV6 whenever possible. There used to have a way to disable it but Chromium has explicitly removed the support for this more than 2 years ago:

https://codereview.chromium.org/1149303005

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.