According to the documentation of the SDK Csharp:
// Troque <SubscriptionKey> com sua chave de inscrição.
// Por exemplo, subscriptionKey = "0123456789abcdef0123456789ABCDEF"
private const string subscriptionKey = "<SubscriptionKey>";
// Troque ou verifique seu endPoint.
//
// Você deve usar a mesma região usada para obter sua chave de inscrição
// Por exemplo, se você obteve suas chave de inscrição do
// westus region, substitua "Westcentralus" por "Westus".
//
// NOTA: As chave de inscrição de avaliação gratuita são geradas no westcentralus
// por isso, se você estiver usando uma chave de inscrição de avaliação gratuita,
// não precisa mudar esta região.
private const string faceEndpoint =
"https://westcentralus.api.cognitive.microsoft.com";
private readonly IFaceClient faceClient = new FaceClient(
new ApiKeyServiceClientCredentials(subscriptionKey),
new System.Net.Http.DelegatingHandler[] { });
recalling that it is necessary to use imports:
using Microsoft.Azure.CognitiveServices.Vision.Face;
using Microsoft.Azure.CognitiveServices.Vision.Face.Models;
According to this other documentation you must be doing it this way:
Step 1: Authorize the API Call
Each call to the Face API requires a signup key. This key needs to be passed by a query string parameter or specified in the request header. To pass the signup key through the query string, see the request URL of Face-Detect as an example:
https://westus.api.cognitive.microsoft.com/face/v1.0/detect[?returnFaceId][&returnFaceLandmarks][&returnFaceAttributes]&subscription-key=<Subscription Key>
Alternatively, the signup key can also be specified in the header of the HTTP request: ocp-apim-Subscription-key: When using a client library, the signature key is passed by the constructor of the Faceserviceclient class. For example:
faceServiceClient = new FaceServiceClient("<Subscription Key>");
It would just do that and it would already work ok.
According to Microsoft documentation, Example: How to identify faces in images, to initialize the service just do
faceServiceClient = new FaceServiceClient("<Subscription Key>");
.– João Martins
There is no faceServiceClient class in version 2.0 only Faceclient
– Renan Pinheiro