Sometimes the same image is not displayed in a picturebox. Image.FromStream

0
0

Hi!
Sometimes the image is not displayed in a picturebox, it’s the same image (when i go to image url from inspector doesn’t show anything), I have to reopen the page a couple of times to show it. Tested in firefox and IE.

The image is loaded like
……
var ms = new MemoryStream(BytesMainLogoMini);
return Image.FromStream(ms);
……

See attached image

Thanks in advance!

Attachment
  • You must to post comments
0
0

In this case, load balancer doesn’t exists in server/website
Client/browser is in [subnetwork/lan/private ip].
Public ip addresses (of client) are exposed only by internet provider (has a load balancer)
Client/browser requests goes for dinamic public ISP address.
Issue not happens if I use for example a VPN windows app in client.

For example client/browser internal private ip is 192.168.0.55, when open a wisej app, maybe wisejapp in server would see a 189.216.40.55 remote client or some another time would see 189.216.40.100 remote client

See attached image

What is the keyword and posible values for sticky sessions? Is in default.json?

Thanks in advance!

Attachment
  • Luca (ITG)
    Sticky session is a load balancer setting, it cannot be controlled by the web application since the redirection occurs before the app is reached. What load balancer are you using?
  • Luca (ITG)
    The image came in late, I see that you have only 1 wisej app server and the load balancer front end may come in with different IPs. In this case try to add “validateClient”:false in Default.json.
  • Ser Gar
    I don’t know since is something of ISP internet provider specific. The issue is in client/browser and ISP architecture network, not the server.
  • Ser Gar
    Great I’ll try it. Now I see that could be due to “fingerprint client”, (and different IP addresses used of the same client)
  • Ser Gar
    it would be great if some way to optionally exclude only client ip validation from validatClient to preserve that fingerprint feature partially.
  • You must to post comments
0
0

The component.wx request needs the instance of the component, which means that it needs the session indicated by the sid argument. When using a load balancer you need to set it to using “sticky sessions”. When using WebSocket it’s irrelevant since the WebSocket is already a “sticky” connection. But the http requests (images or data loads) may get rerouted, so you need t he sticky session mode.

Load balances do that in several ways: they can use a cookie or use the IP, or a combination of IP and UserAgent or other info to identify a request source.

https://wisej.com/docs/html/LoadBalancing.htm

The docs don’t mention this requirement, will add.

  • You must to post comments
0
0

It seems that this is related only when I am in a place in a network where the internet provider has a kind of load balancer. I see that the requests sometimes go for one ip and sometimes for another. In these cases the images are sometimes shown or not. Does the image response [ /component.wx?sid = … ] have any validation about the client ip?
I tried disabling enablewebsocket in default.json but no success.
Any advice to avoid that, or some way to configure something?
Thanks in advance!

  • You must to post comments
0
0

Please send a small sample code. Using Image.FromStream can be tricky since the stream is kept open and the image may not be loaded at once so, depending on timing, you may have an incomplete image. It’s usually better to create a new image and dispose the stream.

using (var ms = new MemoryStream…) {

return new Bitmap(Image.FromStream(ms));

}

The stream should be kept open only the case of animated gif images.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.