Page 1 of 1

FormsMap.XMapUrl exceptions assigning the xMapServer URL

Posted: Fri Oct 01, 2021 1:46 pm
by pssdiogo
Hello Ptv Team

While debugging, the "Output Window" shows 2 exceptions when the property FormsMap.XMapUrl is assigned to the xMapServer URL. This is an internally handled exception that is only displayed in the output window, after which the form is loaded and the map shown correctly.

Environment Info:
I'm using the Ptv XServer.Net Version 1.7.8.0 and your C# sample code "FormsMapCS":
https://github.com/ptv-logistics/xserve ... FormsMapCS

1 Exception using your xMapServer URL:
formsMap1.XMapUrl = "https://xmap-eu-n-test.cloud.ptvgroup.com/xmap/ws/XMap";

Exception thrown: 'System.ObjectDisposedException' in System.dll
at System.Net.Sockets.NetworkStream.get_InternalSocket()
Cannot access a disposed object.


2 Exceptions using our xMapServer http url:
formsMap1.XMapUrl = "http://192.168.101.29:50010/xmap/ws/XMap";

Exception thrown: 'System.ObjectDisposedException' in System.dll
Exception thrown: 'System.Net.WebException' in System.dll
at System.Net.HttpWebRequest.GetResponse()
The remote server returned an error: (404) Not Found.


How can we remove both exception?

Thank you in advance for your support.
Kind regards
Pedro Diogo

Re: FormsMap.XMapUrl exceptions assigning the xMapServer URL

Posted: Fri Oct 01, 2021 1:55 pm
by Bernd Welter
Hello Pedro,

I forwarded this to Oli... Please stay tuned!

Bernd

Re: FormsMap.XMapUrl exceptions assigning the xMapServer URL

Posted: Fri Oct 01, 2021 4:10 pm
by Oliver Heilig
Hello Pedro,

do i understand you right, your program is running, but you see exceptions in the console? I have debugged the the samples with "All Exceptions", and i think they come from the "intelligent" Uri-detection. This guesses the correct uri scheme and xserver version. I think this causes the 404s, but the "acess to disposed" object looks like a bug in the control.

I can take a look at it, but i generally advice to initialize the control explicity for productive environments, without the "smart detection". The sample CustomInit shows this practice. This will generally lead to faster startup times, and will also not raise internal exceptions.

Take a look at "CustomInit" here https://github.com/ptv-logistics/xserver.net-samples

Oli

Re: FormsMap.XMapUrl exceptions assigning the xMapServer URL

Posted: Tue Oct 05, 2021 8:26 am
by pssdiogo
Hello Oliver

Thank you for your quick reply.
Perfect, it works exactly as you described it.
I have no more exceptions and it seems to be faster. Thank you.

However, I still have the same question regarding the xServer2 url.
The "CustomInit" sample it's only valid for xServer1, right?

I would like to start the migration of our maps to the xServer2.
Could you suggest me a sample code that I can follow to do it?
Thank you once again.

Best regards,
Pedro Diogo

Re: FormsMap.XMapUrl exceptions assigning the xMapServer URL

Posted: Thu Jun 09, 2022 3:38 pm
by pssdiogo
Hello Oliver

Can you please help me with the initialization of the XMap2 using Feature Layers?

As explained below, I have followed two projects, the first focusing on feature layers and the second avoiding "smart" Uri detection in the FormsMap.XMapUrl property. But in both approaches, the initialization of the map Uri causes me problems.

1) I followed the FeatureLayer code-sample:
Xmap2LayerFactoryTest #xserver-2

Issue:
It works very well, but it crashes if the FormsMap control is initialized more than 3 times during the same application execution. It crashes when the URL is assigned in the FormsMap.XMapUrl property.
Xmap2LayerFactoryTestImg
Xmap2LayerFactoryTestImg
I have created a sample project to illustrate the problem.
Xmap2LayerFactoryTest.zip
Xmap2LayerFactoryTest
(3.04 MiB) Downloaded 598 times

2) To avoid FormsMaps "intelligent" Uri-detection, I then explicitly initialized the control following the "XSTwo" code-sample as described in the topic: https://xserver.ptvgroup.com/forum/view ... map2#p1350

Issue:
It works well and I can then open the map several times, but the problem is that then the FormsMap.Xmap2LayerFactory is not initialized.

Thank you in advance for your support.
Kind regards
Pedro Diogo

Re: FormsMap.XMapUrl exceptions assigning the xMapServer URL

Posted: Fri Jun 10, 2022 8:53 am
by Oliver Heilig
Hello Pedro,

this looks like the number of (ephermal) connections isn't enough. Adding a

ServicePointManager.DefaultConnectionLimit = 64;

at your application startup for example increases the default limit and fixes the timeout. I would generally recommend to specify the limit, the control itself doesn't make any changes there.

Oli

Re: FormsMap.XMapUrl exceptions assigning the xMapServer URL

Posted: Fri Jun 10, 2022 10:10 am
by pssdiogo
Hello Oliver

Oh yes, you are absolutely right. It works perfectly now.
Thank you for your quick response.

Best regards,
Pedro Diogo