# Troubleshooting

## Verify the API is responding

Navigate to `https://<server>/OrbitAPI` in a browser. If the API is responding, you should see a page similar to this:

## Login troubleshooting

To troubleshoot login problems manually:

1. Expand the **Sessions** section and choose **Simple Login**.
2. Enter login credentials in the **Parameters** section. You can use either the FastStats username or the email address.

> [!NOTE]
>
> You can safely ignore the following error if it appears:
>
> Text Only
>
> ```text
> {"schemaValidationMessages":[{"level":"error","message":"Can't read from file [http://psinttest/OrbitAPI/swagger/ui/index.html/../../../swagger/v2/swagger.json"}]}
> ```

## Errors relating to client access

**Error**: 401 Unauthorised

**Solution**: This can happen when the API responds with a 401 error despite correct login details. Check that the security settings in `appsettings.json` match those in your Web Service configuration.

**Error**: 403 Access Denied

**Solution**: The default page file must be `index.html` within IIS. If it's not set correctly, users will receive a 403 access denied message.

## Errors relating to directory access

These errors occur when the user running the AspNetCore application pool can't execute `dotnet.exe` or can't access the directory.

**Error**:

Text Only

```text
Application MACHINE/WEBROOT/APPHOST/ORBITAPI with physical root D:\www\inetpub\...\OrbitAPI\ failed to start process with commandline '"dotnet" .\Apteco.Orbit.API.dll', ErrorCode = '0x80070002: 0.
```

**Solution**: Add `C:\Program Files\dotnet\` to the PATH environment variable for the executing user, or edit `web.config` in the OrbitAPI directory to use the full path:

Change:

XML

```xml
<aspNetCore processPath="dotnet" arguments=".\Apteco.Orbit.API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
```

To:

XML

```xml
<aspNetCore processPath="C:\program files\dotnet\dotnet\dotnet.exe" arguments=".\Apteco.Orbit.API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
```

## Errors relating to ASP.NET Core version

This error occurs when someone installs an incorrect version of ASP.NET Core, for example the 'Current' channel instead of Long-Term Support (LTS).

**Error**:

Text Only

```text
Application '...' with physical root C:...\my-app-folder\ failed to start process with commandline '"dotnet" .\MyApp.dll', ErrorCode = '0x80004005: 80008083.
```

Make sure you have installed the correct LTS version. See [ASP.NET Core 10 requirement](<https://help.apteco.com/en/admin/requirements/asp-net-requirement/index.md>).

## Errors when using Internet Explorer with an intranet deployment

**Error**: The Orbit login page renders incorrectly in Internet Explorer.

**Solution**: Open the **Compatibility View Settings** in Internet Explorer.

Clear the checkbox for **Display intranet sites in Compatibility View**.

## API settings

You manage the API settings in `appsettings.json` in the `/OrbitAPI` virtual directory.

> [!NOTE]
>
> You may need to reset IIS after making changes to `appsettings.json`.

| Setting | Notes |
| --- | --- |
| JwtIssuerOptions | JSON Web Token Issuer Options: used as part of the login process. You might not need it, and you could set it to default and override it in certain circumstances. |
| CorsOptions | Cross Origin Resource Sharing Options: lets the Orbit UI communicate with the Orbit API when they're not the same website. Also useful when you use IP addresses and domain names interchangeably. |
| Systems \> Emails | The Email service settings indicate the method by which the API sends emails. The EmailNotificationService describes the details of the emails it sends. |
| Systems \> SessionService | The session service password details must match the FastStats Web Service password restrictions. Values for `HashMethod` are: `BasicCipher`, `SHA1`, `SHA256`, `SHA384`, `SHA512`, `MD5` |
| Systems \> User service | Orbit lets you share to any email address in a list of domains. You define the domains in `RestrictedEmailDomains`. Example: `"AllowUnrestrictedEmailDomains": "false"`, `"RestrictedEmailDomains": "apteco.com example.com"` |

## WebDAV conflicts

WebDAV is an IIS extension that can interfere with Orbit's correct operation, specifically causing Audience Export to fail silently.

**Affected systems**: Customers running Orbit on a server that also has GoldVision may be using WebDAV.

**Diagnosis**: Use browser developer tools to check for blocked HTTP verbs such as `Delete` or `Put`, or blocked methods such as `Download`. The following error indicates a WebDAV conflict:

JSON

```json
{"code":10002,"id":null,"message":"ErrorGettingFileContents","parameters":[{"key":"details","value":"The remote server returned an error: (405) Method Not Allowed.\n"}]}
```

**Solution**: In the Orbit Updater Configurator, tick **Disable WebDAV** on the Advanced tab.

> [!WARNING]
>
> Only select **Disable WebDAV** if you're certain the IIS instance has WebDAV installed. Disabling it when WebDAV isn't installed will cause errors in IIS and may cause IIS to serve no sites.

After changing this setting, restart the FastStats Orbit Updater Service. The service will then adjust the OrbitAPI `web.config` on its next update cycle.

### Technical notes

Default OrbitAPI `web.config` with WebDAV placeholders:

XML

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--
    Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
  -->
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      <!--StartWebDav--><!--EndWebDav-->
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Apteco.Orbit.API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
      <environmentVariables />
    </aspNetCore>
    <rewrite>
      <rules>
        <rule name="UseUnencodedUrl" stopProcessing="true">
          <match url="(.*)" />
          <action url="{UNENCODED_URL}" type="Rewrite" appendQueryString="false" />
        </rule>
      </rules>
    </rewrite>
    <security>
      <requestFiltering allowDoubleEscaping="true" />
    </security>
    <!--StartWebDavModule--><!--EndWebDavModule-->
  </system.webServer>
</configuration>
```

When the Orbit Updater Service applies the **Disable WebDAV** setting, it modifies the OrbitAPI `web.config` to:

XML

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--
    Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
  -->
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      <!--StartWebDav--><remove name="WebDAV" /><!--EndWebDav-->
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\Apteco.Orbit.API.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
      <environmentVariables />
    </aspNetCore>
    <rewrite>
      <rules>
        <rule name="UseUnencodedUrl" stopProcessing="true">
          <match url="(.*)" />
          <action url="{UNENCODED_URL}" type="Rewrite" appendQueryString="false" />
        </rule>
      </rules>
    </rewrite>
    <security>
      <requestFiltering allowDoubleEscaping="true" />
    </security>
    <!--StartWebDavModule--><modules><remove name="WebDAVModule" /></modules><!--EndWebDavModule-->
  </system.webServer>
</configuration>
```
