Project

General

Profile

Pdf Viewer net service » History » Version 2

Wil van Antwerpen, 08/01/2023 03:28 PM

1 1 Wil van Antwerpen
# Pdf Viewer net service
2 1 Wil van Antwerpen
3 1 Wil van Antwerpen
This is in principle the .net code we are using:
4 1 Wil van Antwerpen
https://ej2.syncfusion.com/javascript/documentation/pdfviewer/how-to/create-pdfviewer-service/
5 1 Wil van Antwerpen
6 1 Wil van Antwerpen
It’s a bit tweaked to be more up to date in regards to the VS version and that page there doesn’t have the latest .cs code.
7 1 Wil van Antwerpen
8 1 Wil van Antwerpen
It’s early days, so not much functionality beyond displaying a pdf and clearing the viewer.
9 1 Wil van Antwerpen
10 1 Wil van Antwerpen
You can download the compiled version of the .net pdf service from the Files tab above (we will supply the .net source code later on as well)
11 1 Wil van Antwerpen
12 1 Wil van Antwerpen
The folder above is the .net webservice. It also has a bunch of pdf’s in the Data subfolder.
13 1 Wil van Antwerpen
Please note this zip contains .dll files and other binaries. So you will have to use “Unblock” in the zip file properties in order to be able to use it.
14 1 Wil van Antwerpen
15 1 Wil van Antwerpen
The way to setup this webservice is:
16 1 Wil van Antwerpen
•	Unzip it in a folder that IIS can use (so not under Program Files, but in a location easily accessible from your webapp)
17 1 Wil van Antwerpen
•	Keep the folder name sfWebPdfViewer
18 1 Wil van Antwerpen
•	Create an IIS app for that by pointing to it in IIS (New Application -> C:\whereever\the\folder\lives\sfWebPdfViewer )
19 1 Wil van Antwerpen
•	Give it the application name “sfWebPdfViewer” 
20 1 Wil van Antwerpen
•	Browse to that folder ( eg. http://localhost/sfWebPdfViewer )
21 1 Wil van Antwerpen
•	If all is well then you get to see the pdf viewer rendering a pdf. (I put a simple index.html demo in the same folder, so you can test the setup)
22 1 Wil van Antwerpen
•	If not, reply with the error you’re seeing.
23 1 Wil van Antwerpen
•	First thing to try is to rename/delete the x86 folder .. seems like the web service created that itself and I left it in the zip for now.
24 1 Wil van Antwerpen
 
25 1 Wil van Antwerpen
 
26 1 Wil van Antwerpen
Once that works… the next thing is to download the updated demo workspace and try it in the demo.
27 1 Wil van Antwerpen
28 2 Wil van Antwerpen
## Troubleshooting
29 2 Wil van Antwerpen
30 2 Wil van Antwerpen
### HTTP Error 500.19
31 2 Wil van Antwerpen
32 1 Wil van Antwerpen
If you get the following error:
33 1 Wil van Antwerpen
34 1 Wil van Antwerpen
HTTP Error 500.19 - Internal Server Error
35 1 Wil van Antwerpen
36 1 Wil van Antwerpen
The requested page cannot be accessed because the related configuration data for the page is invalid.
37 1 Wil van Antwerpen
38 1 Wil van Antwerpen
Error code: 0x80070021
39 1 Wil van Antwerpen
40 1 Wil van Antwerpen
Error data: The configuration cannot be used at this path. This happens when a section is locked at the parent level. Blah blah blah
41 1 Wil van Antwerpen
42 1 Wil van Antwerpen
Then you're seeing this error because .net support has not been added to your server yet.
43 1 Wil van Antwerpen
44 1 Wil van Antwerpen
Add Windows features:
45 1 Wil van Antwerpen
46 1 Wil van Antwerpen
-> IIS -> Application Development
47 1 Wil van Antwerpen
 *  .NET Extensibility 4.7
48 1 Wil van Antwerpen
 *  ASP.NET 4.7
49 1 Wil van Antwerpen
50 1 Wil van Antwerpen
This needs to be ASP.net 4.5 or higher.
51 1 Wil van Antwerpen
52 1 Wil van Antwerpen
Without any of that you can't run a .net website.
53 2 Wil van Antwerpen
54 2 Wil van Antwerpen
### Service isn't running
55 2 Wil van Antwerpen
56 2 Wil van Antwerpen
Note that in order to satisfy CORS that the .net webservice has to run under the same domain.
57 2 Wil van Antwerpen
So you can test your localhost web app by setting up a localhost service.
58 2 Wil van Antwerpen
But if your webapp is running on say example.com then the pdf webservice will also have to run under example.com.