We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error 500

Thread ID:

Created:

Updated:

Platform:

Replies:

149032 Nov 12,2019 12:06 PM UTC Nov 13,2019 12:12 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: PDFViewer
JudicaelG
Asked On November 12, 2019 12:06 PM UTC

Hello,

I use, Syncfusion.EJ.PdfViewer version 17.3460.0.19 and .Net version 4.6.1. 
I followed the documention to display a pdf on pdfviewer. In local the pdf is well displayed but on my server I obtain a error 500 for api/pdfviewer/Load, I don't understand why I have this error. 


In my page I have :

<ej:PdfViewer Height="700" id="PdfViewer" runat="server" ServiceUrl="../api/PdfViewer" PdfService="Local" SignatureAdd="signatureAdded">
 </ej:PdfViewer>

In my PdfViewerController :

    public class PdfViewerController : ApiController
    {
        //Post action for processing the PDF documents.
        public object Load(Dictionary<string, string> jsonResult)
        {
            PdfViewerHelper helper = new PdfViewerHelper();
            //load the multiple document from client side 
            if (jsonResult.ContainsKey("newFileName"))
            {
                var name = jsonResult["newFileName"];
                var pdfName = name.ToString() + ".pdf";
                helper.Load(HttpContext.Current.Server.MapPath("~/Data/" + pdfName));
            }
            else
            {
                if (jsonResult.ContainsKey("isInitialLoading"))
                {
                    if (jsonResult.ContainsKey("file"))
                    {
                        string name = HttpContext.Current.Server.MapPath("~/Data/" + jsonResult["file"].ToString().Substring(jsonResult["file"].ToString().IndexOf("/") + 1));
                        helper.Load(name);
                    }
                    else
                    {
                        helper.Load(HttpContext.Current.Server.MapPath("~/Data/EULA_OTPOne_EN.pdf"));
                    }
                }
            }
            return JsonConvert.SerializeObject(helper.ProcessPdf(jsonResult));
        }

        //Post action for processing the PDF documents when uploading to the ejPdfviewer widget.
        public object FileUpload(Dictionary<string, string> jsonResult)
        {
            PdfViewerHelper helper = new PdfViewerHelper();
            if (jsonResult.ContainsKey("uploadedFile"))
            {
                var fileUrl = jsonResult["uploadedFile"];
                byte[] byteArray = Convert.FromBase64String(fileUrl);
                MemoryStream stream = new MemoryStream(byteArray);
                helper.Load(stream);
            }
            return JsonConvert.SerializeObject(helper.ProcessPdf(jsonResult));
        }

        //Post action for downloading the PDF documents from the ejPdfviewer widget.
        public object Download(Dictionary<string, string> jsonResult)
        {
            PdfViewerHelper helper = new PdfViewerHelper();
            return helper.GetDocumentData(jsonResult);
        }

        //Post action for unloading and disposing the PDF document resources in server side from the ejPdfviewer widget.
        public void Unload()
        {
            PdfViewerHelper helper = new PdfViewerHelper();
            helper.UnLoad();
        }
    }

In my global :
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            RouteTable.Routes.MapHttpRoute(name: "StripeWebhooks", routeTemplate: "api/{controller}/");
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("mylicencekey");

            GlobalConfiguration.Configuration.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{action}/{id}",
            defaults: new { id = RouteParameter.Optional });
        }



Akshaya Arivoli [Syncfusion]
Replied On November 13, 2019 12:12 PM UTC

Hi JudicaelG, 

Thank you for contacting Syncfusion support. 

Based on the provided details we suspect that the Web API controller is not mapped properly in the production environment, so kindly ensure whether it is mapped properly. Map the controller absolutely in the production environment by using the VirtualPathUtility.ToAbsolute(). Please find the below UG link for more details, 


Please try this and revert us with more details or the sample in which you are facing the issue . These details will be helpful for is to investigate more on your issue and assist you better. 

Regards, 
Akshaya 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon