Web Core connecting to XData issue

I am experimenting with XData server running on Azure hosted machine. This is connected to a MSSQL database also in Azure.
I have this running and have exposed some data which I can GET from a simple Web Client running default on localhost:8000.
I want to host my WebApp on Azure and sftp the required files to site/wwwroot everything runs fine UNTIL I try to connect the WebApp to the XData service where it fails to connect with this:

ERROR
XDataConnectionError: Error connecting to XData server | fMessage::XDataConnectionError: Error connecting to XData server FJSError::Error: XDataConnectionError: Error connecting to XData server fHelpContext::0
at https://imlweb.azurewebsites.net/webProject.js [79489:13]

Hi Steven
Make sure that you added CORS middleware to your XDataServer's middleware list. If not this may be a reason. Right mouse click XDataServer, select manage middleware list and add middleware, select CORS. If this is the case of your problem have a look at this url for docs.
https://doc.tmssoftware.com/biz/sparkle/guide/middleware.html#cors-middleware

1 Like

There is also a chapter in the manual with more details about how to check for error details: Web Applications with TMS Web Core | TMS XData documentation

The CORS side I had addressed after reading the documentation and Holger Flicks "TMS Web Core" and "Hands-On with Delphi".
I have kept my experiments as close to the guide as possible.

Ok - so I have found my error.
If I make the request using HTTP it works, if I use HTTPS I get the error, looks like I need to brush up on my web skills around mixed content:

Yes, that's how browsers work, If the page is accessed via HTTPS, then all the requests it mades (including to XData server) must also be done using HTTPS.

For the life of me I CANNOT get HTTPS to work for me. I have secured my azure XData client, assigned custom domain name and added SSL.
However, I just can't get the SSL bindings to work on the VM that hosts the XDataServer. I am aware that this is probably outside the scope of TMS support but I have so many apps that are still using a direct connection to SQL server and I have struggled with this for a couple of years I am hoping another customer has the resolution, I know I am close.....
If I leave everything as HTTP it works so I know my connections work.
Last piece is adding the SSL to the public IP on the Azure VM, this has no DNS entry, I can then amend the app components to look at https.
HOPEFULLY someone has cracked this.

As far as I know, you can't generate SSL certificates for IP numbers. They must be generated for a specific domain.

I have now used a domain name for the IP address and obtained a GoDaddy SSL which I have installed on the VM. When I try to add the SSL certificate through the Config Tool I get the following error:

Unfortunately it looks like a problem with your certificate. References:

Having looked at all of this I finally managed to get the setup to work by deleting all certificate entries and rekeying my GoDaddy certificate with a CSR generated through the certlm MMC snap-in. For future reference, both mine and any other users, here are the basic steps to generate and install a working SSL certificate on an Azure VM with public IP:

  1. Assign a domain name to the public IP

  2. In MMC navigate to Certificates - Local Computer\Personal\Certificates

  3. Right click select AllTasks/Advanced Operations/Create Custom request > Next

  4. Select Custom Request\Proceed without enrollment policy > Next

  5. Select (No Template) CNG key and PKS#10 > Next

  6. Select Details/Properties

  7. Add a friendly name (I used domain name) and description

  8. Select Subject Tab and add Subject Name/Common Name value=domain.com > Add>

  9. Select Private Key Tab/Key Options/ Key Size=2048 and tick Make Private Key exportable

  10. >OK >Next Give the file a name and Save > Finish

  11. Open the generated CSR file in Notepad and use this to generate your SSL in GoDaddy. The only entry I put in the certificate was the domain name I had assigned to the Public IP address.

  12. Download the ZIP file and copy the 3 files to the machine to be secured

  13. Install the 2 *.crt files in Local Computer/Personal

  14. Make sure https://+:port/root has been added to HTTPConfig and on the SSL tab select the newly installed certificate on ip 0.0.0.0

  15. Test

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.