Problem serving terrain files in IIS

I have success with my own generated height map and orthophoto to view in Cesium.

The development machine was using Apache as the web server.

To serve out the *.terrain files, this was added to .htaccess file.

<filesMatch “(.*).terrain$”>

ForceType application/octet-stream

Header set Content-Disposition attachment

Header set Content-Encoding: gzip

However for deployment, the client’s server requires using IIS as the web server. The error that appear are

An error occurred in “E”: Failed to obtain terrain tile X: 0 Y: 0 Level: 0.

An error occurred in “E”: Failed to obtain terrain tile X: 1 Y: 0 Level: 0.

I have tried the following:

  1. add “” to web.config file

  2. use " " to web.config as specified in cesium download.

  3. point directly to “http://myurl/elevation/0/0/0.terrain” and “http://myurl/elevation/0/1/0.terrain”. The 0.terrain file will automatically be downloaded to the disk.

I believe it an issue of web.config to specify what to do with the terrain files to be similiar to .htaccess.

Any pointers is appreciated.

Hi there,

Serving terrain requires a specific configuration for handling tile requests.

I would recommend creating a Cesium ion account and uploading, processing, and serving your data there.

Optionally, there is the STK Terrain Server or other solutions for serving terrain.



Change IIS configuration , adding “content-encoding” “gzip” in the header of subfolder (0-19) of terrain directory.
Not in parent directory, because file like “layer.json” are not zipped.

Web.config in the foleter terrain\0 terrain\1 etc… is

<?xml version="1.0" encoding="UTF-8"?>