Skip to content

Commit e5b570d

Browse files
Final edits before PR.
1 parent 6580bf9 commit e5b570d

File tree

3 files changed

+32
-33
lines changed

3 files changed

+32
-33
lines changed

articles/service-bus-relay/service-bus-dotnet-hybrid-app-using-service-bus-relay.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,16 @@ ms.workload: tbd
1313
ms.tgt_pltfrm: na
1414
ms.devlang: dotnet
1515
ms.topic: conceptual
16-
ms.date: 11/01/2018
16+
ms.date: 09/12/2019
1717
ms.author: spelluru
1818

1919
---
2020
# Expose an on-premises WCF service to a web application in the cloud by using Azure Relay
2121

2222
This article shows how to build a hybrid cloud application with Microsoft Azure and Visual Studio. You create an application that uses multiple Azure resources up and running in the cloud.
2323

24-
* How to create or adapt an existing web service for consumption by a
25-
web solution.
26-
* How to use the Azure Windows Communication Foundation (WCF) Relay service to share data between
27-
an Azure application and a web service hosted elsewhere.
24+
* How to create or adapt an existing web service for consumption by a web solution.
25+
* How to use the Azure Windows Communication Foundation (WCF) Relay service to share data between an Azure application and a web service hosted elsewhere.
2826

2927
You take the following steps in this tutorial:
3028

@@ -93,7 +91,7 @@ First, you build a simulated on-premises product catalog system. This project i
9391
![Configure your new project][11]
9492

9593
1. In **Solution Explorer**, right-click the **ProductsServer** project, then select **Manage NuGet Packages**.
96-
1. Select **Browse**, then search for and choose *WindowsAzure.ServiceBus*. Select **Install**, and accept the terms of use.
94+
1. Select **Browse**, then search for and choose **WindowsAzure.ServiceBus**. Select **Install**, and accept the terms of use.
9795

9896
![Select NuGet package][13]
9997

@@ -193,7 +191,7 @@ First, you build a simulated on-premises product catalog system. This project i
193191
}
194192
```
195193

196-
1. In **Solution Explorer**, double-click **App.config** to open *App.config* in the Visual Studio editor. At the bottom of the `<system.ServiceModel>` element, but still within `<system.ServiceModel>`, add the following XML code. Be sure to replace `yourServiceNamespace` with the name of your namespace, and `yourKey` with the SAS key you retrieved earlier from the portal:
194+
1. In **Solution Explorer**, double-click **App.config** to open the file in the Visual Studio editor. At the bottom of the `<system.ServiceModel>` element, but still within `<system.ServiceModel>`, add the following XML code. Be sure to replace `yourServiceNamespace` with the name of your namespace, and `yourKey` with the SAS key you retrieved earlier from the portal:
197195

198196
```xml
199197
<system.serviceModel>
@@ -217,7 +215,8 @@ First, you build a simulated on-premises product catalog system. This project i
217215
</system.serviceModel>
218216
```
219217

220-
The error caused by `transportClientEndpointBehavior` is just a warning and isn't a blocking issue for this example.
218+
> [!NOTE]
219+
> The error caused by `transportClientEndpointBehavior` is just a warning and isn't a blocking issue for this example.
221220

222221
1. Still in *App.config*, in the `<appSettings>` element, replace the connection string value with the connection string you previously obtained from the portal.
223222

@@ -273,7 +272,7 @@ In this section, you build a simple ASP.NET application that displays data retri
273272
}
274273
```
275274

276-
1. In **Solution Explorer**, expand **Controllers**, then double-click **HomeController.cs** to open *HomeController.cs* in Visual Studio.
275+
1. In **Solution Explorer**, expand **Controllers**, then double-click **HomeController.cs** to open the file in Visual Studio.
277276
1. In *HomeController.cs*, replace the existing namespace definition with the following code:
278277

279278
```csharp
@@ -296,13 +295,13 @@ In this section, you build a simple ASP.NET application that displays data retri
296295
}
297296
```
298297

299-
1. In **Solution Explorer**, expand **Views** > **Shared**, then double-click **_Layout.cshtml** to open *_Layout.cshtml* in the Visual Studio editor.
298+
1. In **Solution Explorer**, expand **Views** > **Shared**, then double-click **_Layout.cshtml** to open the file in the Visual Studio editor.
300299
1. Change all occurrences of `My ASP.NET Application` to *Northwind Traders Products*.
301-
1. Remove the **Home**, **About**, and **Contact** links. In the following example, delete the highlighted code.
300+
1. Remove the `Home`, `About`, and `Contact` links. In the following example, delete the highlighted code.
302301

303302
![Delete the generated list items][41]
304303

305-
1. In **Solution Explorer**, expand **Views** > **Home**, then double-click **Index.cshtml** to open *Index.cshtml* in the Visual Studio editor. Replace the entire contents of the file with the following code:
304+
1. In **Solution Explorer**, expand **Views** > **Home**, then double-click **Index.cshtml** to open the file in the Visual Studio editor. Replace the entire contents of the file with the following code:
306305

307306
```html
308307
@model IEnumerable<ProductsWeb.Models.Product>
@@ -355,7 +354,7 @@ Your application should appear, running in a browser.
355354

356355
The next step is to hook up the on-premises products server with the ASP.NET application.
357356

358-
1. If it isn't already open, in Visual Studio reopen the **ProductsPortal** project you created in the [Create an ASP.NET application](#create-an-aspnet-application) section.
357+
1. If it isn't already open, in Visual Studio, open the **ProductsPortal** project you created in the [Create an ASP.NET application](#create-an-aspnet-application) section.
359358
1. Similar to the step in the [Create an On-Premises Server](#create-an-on-premises-server) section, add the NuGet package to the project references. In **Solution Explorer**, right-click the **ProductsPortal** project, then select **Manage NuGet Packages**.
360359
1. Search for *WindowsAzure.ServiceBus* and select the **WindowsAzure.ServiceBus** item. Then complete the installation and close this dialog box.
361360
1. In **Solution Explorer**, right-click the **ProductsPortal** project, then select **Add** > **Existing Item**.
@@ -460,7 +459,7 @@ Before running the application in the cloud, you must ensure that **ProductsPort
460459

461460
## Run the application
462461

463-
Press **F5** to build and run the application. The on-premises server (the **ProductsServer** console application) should start first, then the **ProductsPortal** application should start in a browser window, as shown here:
462+
Press **F5** to build and run the application. The on-premises server, which is the **ProductsServer** console application, should start first, then the **ProductsPortal** application should start in a browser window, as shown here:
464463

465464
![Run the web app on Azure][1]
466465

articles/service-bus-relay/service-bus-relay-rest-tutorial.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.devlang: na
1313
ms.topic: article
1414
ms.tgt_pltfrm: na
1515
ms.workload: na
16-
ms.date: 11/06/2018
16+
ms.date: 09/12/2019
1717
ms.author: spelluru
1818

1919
---
@@ -23,7 +23,7 @@ This tutorial describes how to build an Azure Relay host application that expose
2323

2424
The tutorial uses the Windows Communication Foundation (WCF) REST programming model to construct a REST service on Azure Relay. For more information, see [WCF REST Programming Model](/dotnet/framework/wcf/feature-details/wcf-web-http-programming-model) and [Designing and Implementing Services](/dotnet/framework/wcf/designing-and-implementing-services).
2525

26-
You take the following steps in this tutorial:
26+
You do the following tasks in this tutorial:
2727

2828
> [!div class="checklist"]
2929
>
@@ -49,7 +49,7 @@ To begin using the relay features in Azure, you must first create a service name
4949

5050
When you create a WCF REST-style service, you must define the contract. The contract specifies what operations the host supports. A service operation can be thought of as a web service method. Contracts are created by defining a C++, C#, or Visual Basic interface. Each method in the interface corresponds to a specific service operation. The [ServiceContractAttribute](/dotnet/api/system.servicemodel.servicecontractattribute) attribute must be applied to each interface, and the [OperationContractAttribute](/dotnet/api/system.servicemodel.operationcontractattribute) attribute must be applied to each operation. If a method in an interface that has the [ServiceContractAttribute](/dotnet/api/system.servicemodel.servicecontractattribute) doesn't have the [OperationContractAttribute](/dotnet/api/system.servicemodel.operationcontractattribute), that method isn't exposed. The code used for these tasks is shown in the example following the procedure.
5151

52-
The primary difference between a WCF contract and a REST-style contract is the addition of a property to the [OperationContractAttribute](/dotnet/api/system.servicemodel.operationcontractattribute): [WebGetAttribute](/dotnet/api/system.servicemodel.web.webgetattribute). This property enables you to map a method in your interface to a method on the other side of the interface. This example uses the [WebGetAttribute](/dotnet/api/system.servicemodel.web.webgetattribute) attribute to link a method to HTTP GET. This approach enables Service Bus to accurately retrieve and interpret commands sent to the interface.
52+
The primary difference between a WCF contract and a REST-style contract is the addition of a property to the [OperationContractAttribute](/dotnet/api/system.servicemodel.operationcontractattribute): [WebGetAttribute](/dotnet/api/system.servicemodel.web.webgetattribute). This property enables you to map a method in your interface to a method on the other side of the interface. This example uses the [WebGetAttribute](/dotnet/api/system.servicemodel.web.webgetattribute) attribute to link a method to `HTTP GET`. This approach enables Service Bus to accurately retrieve and interpret commands sent to the interface.
5353

5454
### To create a contract with an interface
5555

@@ -65,8 +65,8 @@ The primary difference between a WCF contract and a REST-style contract is the a
6565

6666
This step adds references to Service Bus and *System.ServiceModel.dll*. This package automatically adds references to the Service Bus libraries and the WCF `System.ServiceModel`.
6767

68-
1. Explicitly add a reference to `System.ServiceModel.Web.dll` to the project. In **Solution Explorer**, right-click **References** under the project folder. and select **Add Reference**.
69-
1. In **Add Reference**, select **Framework** on the left side and enter *System.ServiceModel.Web* in **Search**. Select the **System.ServiceModel.Web** check box, then click **OK**.
68+
1. Explicitly add a reference to `System.ServiceModel.Web.dll` to the project. In **Solution Explorer**, right-click **References** under the project folder, and select **Add Reference**.
69+
1. In **Add Reference**, select **Framework** and enter *System.ServiceModel.Web* in **Search**. Select the **System.ServiceModel.Web** check box, then click **OK**.
7070

7171
Next, make the following code changes to the project:
7272

@@ -169,7 +169,7 @@ namespace Microsoft.ServiceBus.Samples
169169

170170
## Implement the REST-based WCF service contract
171171

172-
To create a REST-style WCF Relay service, first create the contract, which is defined by using an interface. The next step is to implement the interface. This procedure involves creating a class named `ImageService` that implements the user-defined `IImageContract` interface. After you implement the contract, you then configure the interface using an *App.config* file. The configuration file contains necessary information for the application. This information includes the name of the service, the name of the contract, and the type of protocol that is used to communicate with the relay service. The code used for these tasks is provided in the example following the procedure.
172+
To create a REST-style WCF Relay service, first create the contract, which is defined by using an interface. The next step is to implement the interface. This procedure involves creating a class named `ImageService` that implements the user-defined `IImageContract` interface. After you implement the contract, you then configure the interface by using an *App.config* file. The configuration file contains necessary information for the application. This information includes the name of the service, the name of the contract, and the type of protocol that is used to communicate with the relay service. The code used for these tasks is provided in the example following the procedure.
173173

174174
As with the previous steps, there's little difference between implementing a REST-style contract and a WCF Relay contract.
175175

@@ -202,7 +202,7 @@ As with the previous steps, there's little difference between implementing a RES
202202

203203
The rest of this tutorial assumes that the name of the image is *image.jpg*. If you have a different file, you must rename the image, or change your code to compensate.
204204

205-
1. To make sure that the running service can find the image file, in **Solution Explorer** right-click the image file, then choose **Properties**. In the **Properties** pane, set **Copy to Output Directory** to **Copy if newer**.
205+
1. To make sure that the running service can find the image file, in **Solution Explorer** right-click the image file, then choose **Properties**. In **Properties**, set **Copy to Output Directory** to **Copy if newer**.
206206

207207
1. Use the procedure in [#to-create-a-contract-with-an-interface](#to-create-a-contract-with-an-interface) to add a reference to the *System.Drawing.dll* assembly to the project.
208208

@@ -252,7 +252,7 @@ As with the previous steps, there's little difference between implementing a RES
252252

253253
### To define the configuration for running the web service on Service Bus
254254

255-
1. In **Solution Explorer**, double-click **App.config** to open *App.config* in the Visual Studio editor.
255+
1. In **Solution Explorer**, double-click **App.config** to open the file in the Visual Studio editor.
256256

257257
The *App.config* file includes the service name, endpoint, and binding. The endpoint is the location Azure Relay exposes for clients and hosts to communicate with each other. The binding is the type of protocol that is used to communicate. The main difference here is that the configured service endpoint refers to a [WebHttpRelayBinding](/dotnet/api/microsoft.servicebus.webhttprelaybinding) binding.
258258

@@ -506,11 +506,11 @@ This section describes how to run a web service using a console application with
506506

507507
Still in `Main()`, create the web service host, using the URI address created earlier in this section.
508508

509-
```csharp
510-
WebServiceHost host = new WebServiceHost(typeof(ImageService), address);
511-
```
509+
```csharp
510+
WebServiceHost host = new WebServiceHost(typeof(ImageService), address);
511+
```
512512

513-
The service host is the WCF object that instantiates the host application. This example passes it the type of host you want to create (an `ImageService`), and also the address at which you want to expose the host application.
513+
The service host is the WCF object that instantiates the host application. This example passes it the type of host you want to create, which is an `ImageService`, and also the address at which you want to expose the host application.
514514

515515
### To run the web service host
516516

@@ -540,7 +540,7 @@ Still in `Main()`, create the web service host, using the URI address created ea
540540

541541
### Example of the service contract and implementation
542542

543-
The following example includes the service contract and implementation from previous steps in the tutorial and hosts the service in a console application. Compile the following code into an executable named ImageListener.exe.
543+
The following example includes the service contract and implementation from previous steps in the tutorial and hosts the service in a console application. Compile the following code into an executable named *ImageListener.exe*.
544544

545545
```csharp
546546
using System;

articles/service-bus-relay/service-bus-relay-tutorial.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ms.devlang: na
1313
ms.topic: article
1414
ms.tgt_pltfrm: na
1515
ms.workload: na
16-
ms.date: 11/01/2018
16+
ms.date: 09/12/2019
1717
ms.author: spelluru
1818

1919
---
@@ -185,7 +185,7 @@ Creating an Azure relay requires that you first create the contract, which is de
185185

186186
The configuration file is similar to a WCF configuration file. It includes the service name, endpoint, and binding. The endpoint is the location Azure Relay exposes for clients and hosts to communicate with each other. The binding is the type of protocol that is used to communicate. The main difference is that this configured service endpoint refers to a [NetTcpRelayBinding](/dotnet/api/microsoft.servicebus.nettcprelaybinding) binding, which isn't part of the .NET Framework. [NetTcpRelayBinding](/dotnet/api/microsoft.servicebus.nettcprelaybinding) is one of the bindings defined by the service.
187187

188-
1. In **Solution Explorer**, double-click **App.config** to open the *App.config* file in the Visual Studio editor.
188+
1. In **Solution Explorer**, double-click **App.config** to open the file in the Visual Studio editor.
189189
1. In the `<appSettings>` element, replace the placeholders with the name of your service namespace, and the SAS key that you copied in an earlier step.
190190
1. Within the `<system.serviceModel>` tags, add a `<services>` element. You can define multiple relay applications in a single configuration file. However, this tutorial defines only one.
191191

@@ -334,11 +334,11 @@ For this tutorial, the URI is `sb://putServiceNamespaceHere.windows.net/EchoServ
334334
}
335335
```
336336

337-
As stated in the previously, you could have declared multiple services and endpoints in the configuration file. If you had, this code would traverse the configuration file and search for every endpoint to which it should apply your credentials. However, for this tutorial, the configuration file has only one endpoint.
337+
As stated previously, you could have declared multiple services and endpoints in the configuration file. If you had, this code would traverse the configuration file and search for every endpoint to which it should apply your credentials. However, for this tutorial, the configuration file has only one endpoint.
338338

339339
### Open the service host
340340

341-
1. Still in `Main()`, add the following lin to open the service.
341+
1. Still in `Main()`, add the following line to open the service.
342342

343343
```csharp
344344
host.Open();
@@ -513,7 +513,7 @@ namespace Microsoft.ServiceBus.Samples
513513

514514
In this step, you create an *App.config* file for a basic client application that accesses the service created previously in this tutorial. This *App.config* file defines the contract, binding, and name of the endpoint. The code used for these tasks is provided in the example following the procedure.
515515

516-
1. In **Solution Explorer**, in the **EchoClient** project, double-click **App.config** to open *App.config* in the Visual Studio editor.
516+
1. In **Solution Explorer**, in the **EchoClient** project, double-click **App.config** to open the file in the Visual Studio editor.
517517
2. In the `<appSettings>` element, replace the placeholders with the name of your service namespace, and the SAS key that you copied in an earlier step.
518518
3. Within the `system.serviceModel` element, add a `<client>` element.
519519

@@ -756,7 +756,7 @@ namespace Microsoft.ServiceBus.Samples
756756

757757
`Press [Enter] to exit`
758758

759-
1. In the **EchoClient** console window, enter the same information that you entered previously for the service application. Follow the previous steps to enter the same service namespace and SAS key values for the client application.
759+
1. In the **EchoClient** console window, enter the same information that you entered previously for the service application. Enter the same service namespace and SAS key values for the client application.
760760
1. After entering these values, the client opens a channel to the service and prompts you to enter some text as seen in the following console output example.
761761

762762
`Enter text to echo (or [Enter] to exit):`

0 commit comments

Comments
 (0)