Host the API Server on Azure



The CData API Server gives you the tools you need to securely connect to live data from cloud applications, mobile devices, and business intelligence tools. The API Server is a lightweight Web application that produces OData feeds for 110+ relational, non-relational, cloud, and on-premises data sources. The API Server can be hosted on any Windows .NET server such as IIS or Azure.

This article will show you how to deploy the API Server to Azure, how to add other CData Connectors, and persist your configuration to an Azure SQL database.

Deploy API Server as an Azure Web App

  1. In the Azure management console, create a new Web-app resource by clicking 'Create a resource' -> Web -> Web App. In the next menu, choose a name/URL for the Web App and define other Web App settings (though the default should be sufficient).
  2. Deploy the API Server by copying the files to the web-app. Azure provides several ways to upload files. We recommend using the FTPS host provided with the Web App.

    In 'Deployment credentials' create a password for the FTP login and connect from your FTP client application.

    • Username: Use the Deployment / FTP User value.
    • Password: Use the password you defined in your deployment credentials. If you have not already created a new password, you can do so by clicking Deployment Credentials in the App Development setting of the settings blade for your app.
    • Host: Use the FTPS Host Name value.
  3. Copy the files from the www folder in the installation directory (typically C:\Program Files\CData\CData API Server\) to the /site/wwwroot/ directory for the Web App.

Add Other Connection Options with CData ADO.NET Providers

On Azure, connecting to the CData data sources which are not included in the API Server requires more configuration. To enable the API Server to connect to any data source using a CData ADO.NET Provider:

  1. Install the CData ADO.NET Provider for your data source. In this walkthrough, we'll use NetSuite as the example.
  2. Using the FTP login information for the Web App, copy the .NET framework 4.0 DLL (System.Data.CData.NetSuite.dll) from the installation directory (typically C:\Program Files\CData\CData ADO.NET Provider for NetSuite\lib\4.0\) to the /site/wwwroot/bin/ remote directory of the API Server.
  3. Edit the Web.config file of the remote Web App and add the following line within the <dbProviderFactory> section:

    <add name="CData ADO.NET Provider for NetSuite 2018" invariant="System.Data.CData.NetSuite" description="CData ADO.NET Provider for NetSuite 2018" type="System.Data.CData.NetSuite.NetSuiteProviderFactory, System.Data.CData.NetSuite" />
  4. Save the change and restart the Azure Web App. The Netsuite connector should be listed as a new connection option in the API Server.

Connecting to Data From API Server

See the "Getting Started" chapter in the API Server help (click DOCS on the API Server page) for a guide to setting the required connection properties and allowing access to tables.

Persist Configuration to an Azure SQL Database

You can persist schemas, users, settings, and logs to an Azure SQL database. Add entries for AppDb, AppUsers, and AppLogs like the following to the configuration node in your Web.config:

<configuration>
  <connectionStrings>
    <add name="AppDb" connectionString="Server=tcp:abcdef123.database.windows.net,1433;Database=mydb;User ID=MyUser@abcdef123;Password=MyPassword;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SQLClient" />
    <add name="AppUsers" connectionString="Server=tcp:abcdef123.database.windows.net,1433;Database=mydb;User ID=MyUser@abcdef123;Password=MyPassword;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SQLClient" />
    <add name="AppLogs" connectionString="Server=tcp:abcdef123.database.windows.net,1433;Database=mydb;User ID=MyUser@abcdef123;Password=MyPassword;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SQLClient" />
  </connectionStrings>

You can get the connection string by clicking Show Connection Strings from the dashboard for your database. Use the ADO.NET connection string.

Troubleshooting

If you get an error during deployment, details about the error may not be visible due to ASP.NET security policy. The first troubleshooting step is often to add the following property to your Web.config and redeploy:

<system.web>
  <customErrors mode="Off" />
  ...
</system.web>

You can then access the full stack trace, containing the error message.

  • Server Error in '/' Application: To resolve this error, comment out the following property in your Web.config and then redeploy:

    <compilation tempDirectory=''/>