Developer forum

Forum » Swift » image handler returns 500 internal server error

image handler returns 500 internal server error

Peter Leleulya
Peter Leleulya
Reply

Hi guys,

We have a possible client for a Swift application, so I tried to create a demo site to get familiair with Swift.

I used the zips as provided in the installation manual and followed it step by step.

Now my application runs, but all image handler calls return a 500 internal server error.
It does not generate any errors in the logging and custom errors set to 'on' doesnt help me either.

In the CMS under the files section all images are shown as broken links too.

When I check the path in the CMS it is correct.

returns an error:
https://swift-demo.local.innovadis.io/Admin/Public/GetImage.ashx?image=%2fFiles%2fImages%2f65A4487.jpg&Width=640&Height=480&Crop=0&Format=jpg&Compression=75
(I tried all kind of parameter options)

returns an image:
https://swift-demo.local.innovadis.io/Files/Images/65A4487.jpg

Does anybody have an idea why this doesn't work out-of-the-box and how I can find out what the f-ing problem is?


Replies

 
Nicolai Pedersen
Reply

What does your windows  event viewer say?

And in Dynamicweb Settings->System->Event viewer says if you look for exceptions?

Usually it can be related to permissions of your app pool user. The image handler can use a temp folder when generating an image. So you can try to set the user of the app pool to netork service instead of app pool identity.

BR Nicolai

 
Peter Leleulya
Peter Leleulya
Reply
This post has been marked as an answer

Thnx Nicolai,

There is no logging whatsoever in either the windows event logger or the dynamicweb event logger when the 500 raises.

Changing the appool to network service doesn't do anything either ...

The directory Application\Files\cache.net\images does have a number of dirctories (all with a single char name) but are all empty.
Looks like it can't write the handled file?
As a test I added Everyone with full control to the /Files directory, that didn't help either.

Without knowing what is wrong due to no logging at all its quit difficult to fix the problem ...

Votes for this answer: 1
 
Nicolai Pedersen
Reply

It sounds really strange that the windows event viewer does not have information...

If you access the getimage url directly you should also see the exception. If not, web.config can be changed to show the full exception.

 
Peter Leleulya
Peter Leleulya
Reply

I have found the problem ...
The ImageGlue-7 DLLs were missing somehow ...
I added them manually to the root of my application with Copy to output directory property settings 'copy if newer' ...
Now can I see the images and images appear in the Application\Files\cache.net\images directory.

 
Nicolai Pedersen
Reply

Ok cool - thank you for the update.

Were something missing from the nuget package?

 
Peter Leleulya
Peter Leleulya
Reply

Not sure, I did setup from scratch using nuget ...

 
Nicolaj Christensen
Reply

Hi I am also getting 500 erros and does not seem to be due to missing DLL's

For instance this endpoint gives me a 500 error: /Admin/Public/GetImage.ashx?image=%2fFiles%2fImages%2fScreenshot+2023-01-10+091159.png&width=960&format=webp

The directory Application\Files\cache.net\images does have a number of dirctories (all with a single char name) but are all empty.

What I did try:

  • Set user of the app pool to network service
  • Check logging, there is no logging whatsoever in either the windows event logger or the dynamicweb event logger
  •  I added Everyone with full control to the /Files directory.
  • Uploading a file through DW interface as opposed to copy into the images directory

The problem was not reprocucible on another pc using the same codebase, so perhaps I need to configure my IIS. Can you provide steps I can follow in doing so?

This is on 9.14.6
and using Swift v1.14.0


 

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

So what is the exception coming from this 500?

 
Peter Leleulya
Peter Leleulya
Reply

@Nicolaj

When I get a 500 fot image handler it often is unclear why.
What helps for me is to go to the web.config and change the httpErrors errorMode value from Detailed to Custom.
For me it was often a missing imageglue dll

BR Peter

 
Nicolaj Christensen
Reply

Hi,
Httperrors errormode is already set to "Custom"
The error I am getting is this:

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

 

Dynamicweb.Imaging.Providers.ImageGlueProviders and ImageGlue

are both correctly referenced

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Nicolaj

You need to do something like this to see the full exception:

<system.web>
    <customErrors mode="Off"/>
</system.web>
<system.webServer>
    <httpErrors errorMode="Detailed" />
</system.webServer>

 

I am pretty sure it is a missing or wrong assembly - alternatively missing permissions to temp folder.

Event viewer of your server will also show the detailed error.

BR Nicolai

 
Nicolaj Christensen
Reply

Hi, problem solved, thank you

What i did:
<system.webServer>
    <httpErrors errorMode="Detailed" />
</system.webServer>

changing errorMode from Custom to Detailed gave this error:
 

System.DllNotFoundException: Unable to load DLL 'ImageGlue7-64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I then manually downloaded and added the file from https://doc.dynamicweb.com/downloads/archive
to the bin folder
 
Peter Leleulya
Peter Leleulya
Reply

Nicolaj Christensen

Ooowww ... I see I had it turned around ... from custom to detailed I meant.
So it was a missing imageglue dll adter all ... as I suggested.

@np this often happens. perhaps there is something wrong with the relations? nuget should handle this for you i guess.

 

You must be logged in to post in the forum