# REST web services -Deploying and common issues

**URL:** <https://community.linx.software/community/t/rest-web-services-deploying-and-common-issues/465>\
**Category:** Support\
**Created:** [October 16, 2020, 12:15pm UTC](https://community.linx.software/community/t/rest-web-services-deploying-and-common-issues/465 "2020-10-16T12:15:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronan](https://community.linx.software/community/user_avatar/community.linx.software/ronan/32/433_2.png) [@ronan](https://community.linx.software/community/u/ronan)\
**Post date:** [October 16, 2020, 12:15pm UTC](https://community.linx.software/community/t/rest-web-services-deploying-and-common-issues/465/1 "2020-10-16T12:15:23Z")

</div>

# Deploying

## How to deploy?

**Let`s use sample from [RESTHost - Sample Solution - CRUD and File operations](https://community.linx.software/community/t/resthost-sample-solution-crud-and-file-operations/467)**

To **deploy** and **start** a [RESTHost svc](https://linx.software/docs/reference/plugins/rest/content/resthost/):

1. In the **Linx Application Designer** , click the **Deploy** button in top menu.

2. In the pop-up, configure your **Linx Application Server’s** `Server URL`, `User` and `Password` fields.

3. Click **Deploy & Open Server**

4. Once the **Solution** has been uploaded and started, you will automatically be navigated to the **Linx Application Server** front end.

5. Log into the **Linx Application Server** dashboard.

6. Navigate into the **Solution**  **services** and find the **RESTHost**  **service** that you created and turn it **ON**.

7. The [RESTHost svc](https://linx.software/docs/reference/plugins/rest/content/resthost/) is now activated.

Once this is done the service will monitor for incoming requests and send responses. Incoming requests as well as the subsequent results of the operations are logged and can be viewed on the services dashboard.

* * *

**Linx Designer and Server view:**

 ![RESTHost - Deploy and Start Service](https://community.linx.software/uploads/default/original/1X/1392110626585321963d3ae7a15c5db428490843.gif)

* * *

## Common Deployment Issues

### Accessing ‘localhost’ externally

A common issue is that the `Base URI` prefix is set to “localhost” i.e. `http://localhost:8022/service` when debugging [RESTHost svc](https://linx.software/docs/reference/plugins/rest/content/resthost/) in the **Linx Designer**.

When deploying to the **Linx Application Server** , in order to use the local host of the server as the `Base URI`, use the `+` character like below:

```auto
https://+:8022/service/

```

This wildcard character (`+`) will ‘grab’ the current local hostname to generate the `Base URI`.

* * *

### Start Solution failed

If you see the upload dialog like below, this means that there is a fatal error in the application and the application cannot compile (invalid references, incomplete expressions etc).

```http
Error on server: StartSolution failed ...

```

![deploy_upload_error](https://community.linx.software/uploads/default/original/1X/ca6e1e9927ec7c70685fc5be13c2635feba31c37.png)

This means that the **Solution** cannot compile due to there being a design error in terms of logic. To view the issue, click on the **more** option and address the specific error.

* * *

### Base URI Conflict

```http
The prefix 'http://+:8080/service/' is already registered.

```

```http
Cannot start rest service on base URI https://+:8022/service because this base URI is already in use.

```

The issue described above is due to there being more than a single [RESTHost svc](https://linx.software/docs/reference/plugins/rest/content/resthost/) that is configured on the same `Base URI`.

The `Base URI` can only be used to host a single [RESTHost svc](https://linx.software/docs/reference/plugins/rest/content/resthost/), if you have multiple [RESTHost svc](https://linx.software/docs/reference/plugins/rest/content/resthost/) in your solution, ensure that they are using unique Base URIs. If an active service shares the same `Base URI` as a newly deployed **Solution** , the existing service will take preference.

### Invalid Object Reference

The below error describes an invalid reference within the **Solution** , this means that at runtime the reference does not contain any value and thus cannot be used.

```http
Exeception at SetValue:
Object reference not set to an instance of an object

```

Normally, in the **Designer** , if you have invalid references you will be  
shown them:

 ![image76](https://community.linx.software/uploads/default/original/1X/5bc1772d96c6b0416c9fa441b1a3ec4adffabf5a.png)

However, certain properties may have valid references in the **Designer** , but at runtime  
the values contained in these references are `NULL`.

Typically, this occurs in **operations** when individual child fields are set  
before the whole parent object is initiated.

For example:

 ![Capture1](https://community.linx.software/community/uploads/default/original/2X/1/196fc4ba3d62be36b71ecb5c530566377ea2ad8f.png)

There is an issue at the [SetValue FNC](https://linx.software/docs/reference/plugins/linx/content/setvalue/) in the OperationEvents\_BeforeOperation EVT:

 ![Capture2](https://community.linx.software/community/uploads/default/original/2X/9/9a92fc3f2b809bd5f6551692f22e5559be5bc7fa.png)

Technically, this is a valid reference (that is why there are no error validations visible in the **Designer** ), however at runtime an error is thrown because the parent `$.Result` object has not been initiated. In this case you would set the `Target` of the [SetValue FNC](https://linx.software/docs/reference/plugins/linx/content/setvalue/) as the whole `$.Result` object and then set the individual field values:

 ![Capture3](https://community.linx.software/community/uploads/default/original/2X/a/a9d212f4745a5aa9e2d444c1cff57253154cea00.png)

* * *

### Server Runtime Errors

If an unhandled error occurs during runtime on the **Server** such as an error with a request, it will appear on the service dashboard in red:

 ![image80](https://community.linx.software/uploads/default/original/1X/690f1971efe12fcc340c3f1e29e108b11e9319dc.png)

You are able to view a detailed stack trace of the error by navigating to the **Log** option on the left panel.

 ![image81](https://community.linx.software/uploads/default/original/1X/c1b342f820e9dfea7ed37c2349b3496f0f93fd4f.png)

### Internal Server Error – No Log Entry

If you are receiving `500 (InternalServerError)` responses when making a request to a Linx web service and there is nothing in the **Server Log** , this indicates that there is an issue with the authentication setup of the [RESTHost svc](https://linx.software/docs/reference/plugins/rest/content/resthost/) with regards to the Bearer Authentication scheme attached to an operation.

If you configure the [RESTHost svc](https://linx.software/docs/reference/plugins/rest/content/resthost/) `Return server errors` as `True`, then when you make the request again, the error will be included in the response.

```http
Response received
...
Response Code: 500 (InternalServerError)
Response Body:
("ClassName":"System.ArgumentException","Message":"IDX10703: Cannot create symmetric security key. Key length is zero."}
...

```

If the response is similar to the above, please ensure that you have configured the `Auth config` correctly by referencing the signing key used in the generation of the JWT Tokens.

> 📗[**Learn more**](https://community.linx.software/t/resthost-guide-securing-your-api/462/#auth-bearer) about implementing Bearer authentication.

---

<div class="post-metadata">

**Author:** ![ronan](https://community.linx.software/community/user_avatar/community.linx.software/ronan/32/433_2.png) [@ronan](https://community.linx.software/community/u/ronan)\
**Post date:** [October 28, 2020, 3:27pm UTC](https://community.linx.software/community/t/rest-web-services-deploying-and-common-issues/465/2 "2020-10-28T15:27:48Z")

</div>

Listed on October 28, 2020, 3:27pm UTC


