Skip to content

Commit 07dee6e

Browse files
committed
Added TLS and cleanup messy code
1 parent c371924 commit 07dee6e

File tree

1 file changed

+34
-7
lines changed
  • articles/cognitive-services/Speech-Service/includes/quickstarts/from-blob/csharp

1 file changed

+34
-7
lines changed

articles/cognitive-services/Speech-Service/includes/quickstarts/from-blob/csharp/dotnet.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,51 @@ The first step is to make sure that you have your project open in Visual Studio.
2525
## Add a reference to Newtonsoft.Json
2626

2727
1. In the Solution Explorer, right-click the **helloworld** project, and then select **Manage NuGet Packages** to show the NuGet Package Manager.
28-
2928
1. In the upper-right corner, find the **Package Source** drop-down box, and make sure that **`nuget.org`** is selected.
30-
3129
1. In the upper-left corner, select **Browse**.
32-
3330
1. In the search box, type *newtonsoft.json* and select **Enter**.
34-
3531
1. From the search results, select the [**Newtonsoft.Json**](https://www.nuget.org/packages/Newtonsoft.Json) package, and then select **Install** to install the latest stable version.
36-
3732
1. Accept all agreements and licenses to start the installation.
38-
3933
After the package is installed, a confirmation appears in the **Package Manager Console** window.
4034

4135
## Start with some boilerplate code
4236

4337
Let's add some code that works as a skeleton for our project.
4438

45-
[!code-csharp[](~/samples-cognitive-services-speech-sdk/quickstart/csharp/dotnet/from-blob/program.cs?range=6-43,138,277)]
39+
```csharp
40+
class Program
41+
{
42+
// Replace with your subscription key
43+
const string SubscriptionKey = "YourSubscriptionKey";
44+
45+
// Update with your service region
46+
const string Region = "YourServiceRegion";
47+
const int Port = 443;
48+
49+
// Recordings and locale
50+
const string Locale = "en-US";
51+
const string RecordingsBlobUri = "YourFileUrl";
52+
53+
// Name and description
54+
const string Name = "Simple transcription";
55+
const string Description = "Simple transcription description";
56+
57+
const string SpeechToTextBasePath = "api/speechtotext/v2.0/";
58+
59+
static async Task Main()
60+
{
61+
// For non-Windows 10 users.
62+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
63+
64+
await TranscribeAsync();
65+
}
66+
67+
static async Task TranscribeAsync()
68+
{
69+
Console.WriteLine("Starting transcriptions client...");
70+
}
71+
}
72+
```
4673

4774
[!INCLUDE [placeholder-replacements](../placeholder-replacement.md)]
4875

0 commit comments

Comments
 (0)