Documentation Center

Setting up image transformation in a legacy in-process .NET Web application

To set up image transformation in a .NET Web application that uses the API (in-process) Role,

Procedure

  1. Access your installation media and navigate to the folder Content Delivery\roles\.
  2. Navigate to the folder cid\proxy\dotnet\bin\.
  3. Copy the contents of this folder to the bin\ folder of your .NET Web application.
  4. In the root folder of your .NET Web application, open Web.config for editing.
  5. Within the system.webServer section, within the modules section, add the following add element:
    <add name="ContextualImageProxyModule" type="Sdl.Web.Context.Image.Proxy.ContextualImageProxyModule" />
  6. In the appSettings section, ensure the presence of the following add elements if you have authentication set up:
    <add key="oauth-client-id" value="USERNAME" />
    <add key="oauth-client-secret" value="PASSWORD" />
    <add key="oauth-enabled" value="true" />

    where USERNAME and PASSWORD are the credentials for accessing the Contextual Image Delivery microservice.

  7. In the same section, ensure the presence of the following add elements:
    <add key="discovery-service-uri" value="http://DSHOST:DSPORT/discovery.svc/" />
    <add key="cid-service-proxy-pattern" value="PATTERN" />
    where:
    • DSHOST identifies the host server on which the Discovery Service is running
    • DSPORT identifies the port on which the Discovery Service is running (8082 by default)
    • PATTERN specifies a particular URL on which to filter, for example, /cid*. If Contextual Image Delivery should match everything, you can omit the last add element.
  8. If you installed the Contextual Image Delivery microservice properly, the Contextual Image Delivery Capability is registered and can therefore be found through the Discovery Service. If, for some reason, you failed to do so, you can make the service directly discoverable by adding the following add element (not a recommended approach):
    <add key="cid-service-uri" value="http://CIDHOST:CIDPORT/cid" />
    where:
    • CIDHOST identifies the host server on which the Contextual Image Delivery microservice is running
    • CIDPORT identifies the port on which the Contextual Image Delivery microservice is running (8088 by default)
  9. Save and close Web.config.
  10. Restart the Web application.