Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

System.InvalidOperationException on ImageServiceClient

$
0
0

I use EPiServer.ImageLibrary ImageServiceClient RenderImage method to render a cropped image. This was the code before upgrade to EPiServer CMS 11.5 and this was working fine.

var imageService = new ImageServiceClient("ImageServiceClientEndPoint");

After the upgrade, this code shows a compile error;

'ImageServiceClient.ImageServiceClient(string)' is obsolete: 'Use constructor that takes options instead, read options from container' 

Accordingly, I changed the code as follows;

ImageServiceOptions options = new ImageServiceOptions();
options.ClientEndpoint = "ImageServiceClientEndPoint";
var imageService = new ImageServiceClient(options);

Then I was able to compile successfully. But now this throws this exception;

System.InvalidOperationException: 'Could not find endpoint element with name 'ImageServiceClientEndPoint' and contract 'EPiServer.ImageLibrary.IImageService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.'

What have I done wrong here? 


Viewing all articles
Browse latest Browse all 9076

Trending Articles