@@ -18,7 +18,7 @@ ms.author: pafarley
18
18
19
19
In this quickstart, you will use the Azure Face REST API with C# to detect human faces in an image.
20
20
21
- If you don't have an Azure subscription, create a [ free account] ( https://azure.microsoft.com/free/?WT.mc_id=A261C142F ) before you begin.
21
+ If you don't have an Azure subscription, create a [ free account] ( https://azure.microsoft.com/free/?WT.mc_id=A261C142F ) before you begin.
22
22
23
23
## Prerequisites
24
24
@@ -27,7 +27,7 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
27
27
28
28
## Create the Visual Studio project
29
29
30
- 1 . In Visual Studio, create a new ** Console app (.NET Framework)** project and name it ** FaceDetection** .
30
+ 1 . In Visual Studio, create a new ** Console app (.NET Framework)** project and name it ** FaceDetection** .
31
31
1 . If there are other projects in your solution, select this one as the single startup project.
32
32
33
33
## Add face detection code
@@ -41,6 +41,7 @@ Add the following `using` statements to the top of your *Program.cs* file.
41
41
``` csharp
42
42
using System ;
43
43
using System .IO ;
44
+ using System .Net ;
44
45
using System .Net .Http ;
45
46
using System .Net .Http .Headers ;
46
47
using System .Text ;
@@ -60,7 +61,7 @@ namespace DetectFace
60
61
61
62
// Replace <Subscription Key> with your valid subscription key.
62
63
const string subscriptionKey = " <Subscription Key>" ;
63
-
64
+
64
65
// replace <myresourcename> with the string found in your endpoint URL
65
66
const string uriBase =
66
67
" https://<myresourcename>.cognitive.microsoft.com/face/v1.0/detect" ;
@@ -74,6 +75,10 @@ Add the following code to the **Main** method of the **Program** class. This cod
74
75
static void Main(string[] args)
75
76
{
76
77
78
+ // Explicitly set TLS 1.2.
79
+ ServicePointManager.SecurityProtocol = ServicePointManager .SecurityProtocol |
80
+ SecurityProtocolType .Tls12 ;
81
+
77
82
// Get the path and filename to process from the user.
78
83
Console.WriteLine ("Detect faces :");
79
84
Console.Write (
0 commit comments