Page 1 of 1

Internal Server Error - client Javascript LoadFromUri or LoadFromFile

Posted: Tue Dec 20, 2016 3:51 am
by AlissonRS
I managed to implement DocuVieware in my C# mvc with razor project with a trial license, by copying examples that come with GdPicture installation, and I'm using the javascript client library to load pictures from uri:

Code: Select all

           
// C# + razor code sample  
      
@{
    GdPicture12.WEB.DocuVieware docuVieware = new GdPicture12.WEB.DocuVieware
    {
        ID = "DocuViewareIndexes",
        StickySessionsEnabled = MvcApplication.STICKY_SESSION,
        Timeout = MvcApplication.SESSION_TIMEOUT,
        CacheFolder = MvcApplication.GetCacheDirectory(),
        Height = new System.Web.UI.WebControls.Unit("568px"),
        Width = new System.Web.UI.WebControls.Unit("100%"),
        SinglePageView = false,
        ForceScrollBars = false,
        AllowedExportFormats = "*",
        MaxUploadSize = 52428800,
        CollapsedSnapIn = true,
        EnableMouseModeButtons = false,
        EnableFormFieldsEdition = true
    };
    docuVieware.RenderControl(Output);
}

// javascript code sample - get url from html, console that url, and load using docuvieware api
$('[id^=carousel-selector-]').click(function () {
    var url = $(this).data('url');
    $(this).addClass('active');
    $(this).siblings().removeClass('active');
    console.log(url);
    var response = DocuViewareAPI.LoadFromUri('DocuViewareIndexes', url, OnLoadDocumentSuccess, OnLoadDocumentFailure);
    console.log(response);
});

var OnLoadDocumentSuccess = function() {
    console.log('Carregou');
}

var OnLoadDocumentFailure = function (data) {
    console.log('Não Carregou');
}
It worked perfectly localhost with visual studio.

However, when I publish to my server, I'm getting this error (this is the console from chrome):

However, if I do this same POST request using fiddler (a software which helps debugging APIs, which also captures any requests done by your computer), I get a 200 OK status. In the printscreen below, the first request was made by the browser (using DocuVieware API), which returned a 500 http status code (Internal Server Error). The second was done by fiddler client, using POST as expected, which returned 200:

This same error occurs when loading from any other external link (from google, for example), or even when trying to load from file.

When I try to load from file, this is what happens to the component:

The component stays with this "loading" bar forever.

Please, I have searched a lot about what reasons it could be. I even enable cors, but I've never thought this was the error in the first place, otherwise fiddler would cause error anyway, and the error would occur only when loading from URIs from my server (not from file, for example).

Is this error due to trial license, or because I'm using the server IP instead of a domain? What is the cause of this and how to solve it?

Thanks!!!!
Alisson

Re: Internal Server Error - client Javascript LoadFromUri or LoadFromFile

Posted: Tue Dec 20, 2016 4:25 am
by AlissonRS
Fiddler was returning 200 because I was not sending the request body. If I do the request using the same body, I get 500. The request body is something like this:

Code: Select all

{"transferID":1482200245209,"sessionID":"3rdx5gwi053unz2ldi0f1twa_DocuViewareIndexes_documentsindex","progressRequest":false,"URI":"http://200.205.141.34/documents/download/12.png","fileName":"","clientConfiguration":{"viewerWidth":952,"viewerHeight":520,"scrollBarWidth":17,"hasWebPSupport":true,"hasTiffSupport":false}}
If I just remove the sessionID from this request...

Code: Select all

{"transferID":1482200243535,"sessionID":"","progressRequest":false,"URI":"http://200.205.141.34/documents/download/13.png","fileName":"","clientConfiguration":{"viewerWidth":952,"viewerHeight":520,"scrollBarWidth":17,"hasWebPSupport":true,"hasTiffSupport":false}}
...it returns 200. So I guess to problem is with this session ID (even though localhost I also have sessionID filled and it works). The problem occurs in other browsers as well. I don't know if this helps at all, but I just wanted to share.

Re: Internal Server Error - client Javascript LoadFromUri or LoadFromFile

Posted: Tue Dec 20, 2016 4:57 am
by AlissonRS
After thinking about the sessionID thing, I decided to set
StickySessionsEnabled
to false to do some test, even though I'm not using web farms.

It happens that now I'm able to load from file, and from external random URIs. Still when I try to load from my own server uri, the component at least start trying to download, and fiddler shows me 200 status for that requests.

However, the component shows me an error saying that it was not possible to load from uri because the connection was closed unexpectedly, even though the image is publicly available:

http://200.205.141.34/documents/download/13.png

The issue is not with acessing the image with IP instead of domain, because the component could load another image using IP, like the url below from google logo:

http://216.58.209.131/images/branding/g ... 2x92dp.png

Maybe this helps you guys understanding the issue. The best scenario would be to use sticky sessions enabled for best performance (since I'm using a single server).

Re: Internal Server Error - client Javascript LoadFromUri or LoadFromFile

Posted: Mon Dec 26, 2016 8:41 am
by Loïc
Hello Alisson,

Unfortunately we are not able to understand an replicate your problem.
Could you open a ticket on our helpdesk by providing a standalone application that demonstrates and reproduces it?

Link: https://www.gdpicture.com/support/getting-support-from-our-team

With best regards,

Loïc Carrère

Re: Internal Server Error - client Javascript LoadFromUri or LoadFromFile

Posted: Fri Jan 13, 2017 6:12 am
by AlissonRS
As you could see in the printscreens I provided, your DocuViewareAPI returns a 500 error when I try to load an image stored in the same server.

A sample url for an image in our server is: http://200.205.141.34/documents/download/10.jpg

If you open your online demo in http://www.docuvieware-demo.com/standal ... _demo.aspx and use the own component's button to load from an URI and put this image URL above which is stored in my server, it loads nicely.

If I open the same component in my webapp and try to load any image in web, it loads as well.

This means two things: the image in my server could be loaded (by your online demo app), and my webapp with the component could load a remote random image from web.

The problem is when I mix both, trying to use this component in my webapp to load that image url above from my own server. Then I get these 500 internal server errors.

This problem comes from your DocuViewareAPI, which I can't debug, so I can't debug. On the other hand, I'm afraid if I provide you with a sample app, you won't be able to reproduce either, because the problem is something about the environment (my guess), because they work individually (the image can be loaded, the component can load), I just can't use one to load the other.

When I run this same webapp in my local machine from visual studio, everything works, the problem is when it runs in my server.

Is there another way to load images without having to reload my page in mvc? That's why I was using your javascript lib, to load with ajax.

It looks when the component start loading the image, it makes a lot of requests to this:

http://mydomain/dvapi2/docuviewareapi/loadfromuri/1/

This is the call which returns 500, making your component not to load the image.

Is this to show the percentage progress? If yes, how can I disable it to see if it works?

Re: Internal Server Error - client Javascript LoadFromUri or LoadFromFile

Posted: Thu Feb 16, 2017 4:45 pm
by Cedric
Is there another way to load images without having to reload my page in mvc?
You could implement a simple custom action that will do the document loading server side using the .NET API instead.