You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/service-bus-relay/service-bus-dotnet-hybrid-app-using-service-bus-relay.md
+13-14Lines changed: 13 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,18 +13,16 @@ ms.workload: tbd
13
13
ms.tgt_pltfrm: na
14
14
ms.devlang: dotnet
15
15
ms.topic: conceptual
16
-
ms.date: 11/01/2018
16
+
ms.date: 09/12/2019
17
17
ms.author: spelluru
18
18
19
19
---
20
20
# Expose an on-premises WCF service to a web application in the cloud by using Azure Relay
21
21
22
22
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.
23
23
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.
28
26
29
27
You take the following steps in this tutorial:
30
28
@@ -93,7 +91,7 @@ First, you build a simulated on-premises product catalog system. This project i
93
91
![Configure your new project][11]
94
92
95
93
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.
97
95
98
96
![Select NuGet package][13]
99
97
@@ -193,7 +191,7 @@ First, you build a simulated on-premises product catalog system. This project i
Copy file name to clipboardExpand all lines: articles/service-bus-relay/service-bus-relay-rest-tutorial.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.devlang: na
13
13
ms.topic: article
14
14
ms.tgt_pltfrm: na
15
15
ms.workload: na
16
-
ms.date: 11/06/2018
16
+
ms.date: 09/12/2019
17
17
ms.author: spelluru
18
18
19
19
---
@@ -23,7 +23,7 @@ This tutorial describes how to build an Azure Relay host application that expose
23
23
24
24
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).
25
25
26
-
You take the following steps in this tutorial:
26
+
You do the following tasks in this tutorial:
27
27
28
28
> [!div class="checklist"]
29
29
>
@@ -49,7 +49,7 @@ To begin using the relay features in Azure, you must first create a service name
49
49
50
50
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.
51
51
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.
53
53
54
54
### To create a contract with an interface
55
55
@@ -65,8 +65,8 @@ The primary difference between a WCF contract and a REST-style contract is the a
65
65
66
66
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`.
67
67
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**.
70
70
71
71
Next, make the following code changes to the project:
To create a REST-style WCF Relay service, first create the contract, which is defined by usinganinterface. Thenextstepistoimplementtheinterface. Thisprocedureinvolvescreatingaclassnamed `ImageService` thatimplementstheuser-defined `IImageContract` interface. Afteryouimplementthecontract, youthenconfiguretheinterfaceusingan *App.config* file. Theconfigurationfilecontainsnecessaryinformationfortheapplication. Thisinformationincludesthenameoftheservice, thenameofthecontract, andthetypeofprotocolthatisusedtocommunicatewiththerelayservice. Thecodeusedforthesetasksisprovidedintheexamplefollowingtheprocedure.
172
+
To create a REST-style WCF Relay service, first create the contract, which is defined by usinganinterface. Thenextstepistoimplementtheinterface. Thisprocedureinvolvescreatingaclassnamed `ImageService` thatimplementstheuser-defined `IImageContract` interface. Afteryouimplementthecontract, youthenconfiguretheinterfacebyusingan *App.config* file. Theconfigurationfilecontainsnecessaryinformationfortheapplication. Thisinformationincludesthenameoftheservice, thenameofthecontract, andthetypeofprotocolthatisusedtocommunicatewiththerelayservice. Thecodeusedforthesetasksisprovidedintheexamplefollowingtheprocedure.
1. Tomakesurethattherunningservicecanfindtheimagefile, in **SolutionExplorer** right-clicktheimagefile, thenchoose **Properties**. Inthe**Properties**pane, set **CopytoOutputDirectory** to **Copyifnewer**.
205
+
1. Tomakesurethattherunningservicecanfindtheimagefile, in **SolutionExplorer** right-clicktheimagefile, thenchoose **Properties**. In **Properties**, set **CopytoOutputDirectory** to **Copyifnewer**.
@@ -252,7 +252,7 @@ As with the previous steps, there's little difference between implementing a RES
252
252
253
253
### To definethe configuration for running the web service on Service Bus
254
254
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.
256
256
257
257
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.
258
258
@@ -506,11 +506,11 @@ This section describes how to run a web service using a console application with
506
506
507
507
Still in `Main()`, create the web service host, usingtheURIaddresscreatedearlierinthissection.
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.
514
514
515
515
### To run the web service host
516
516
@@ -540,7 +540,7 @@ Still in `Main()`, create the web service host, using the URI address created ea
540
540
541
541
### Example of the service contract and implementation
542
542
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*.
Copy file name to clipboardExpand all lines: articles/service-bus-relay/service-bus-relay-tutorial.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.devlang: na
13
13
ms.topic: article
14
14
ms.tgt_pltfrm: na
15
15
ms.workload: na
16
-
ms.date: 11/01/2018
16
+
ms.date: 09/12/2019
17
17
ms.author: spelluru
18
18
19
19
---
@@ -185,7 +185,7 @@ Creating an Azure relay requires that you first create the contract, which is de
185
185
186
186
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, whichisn'tpartofthe .NETFramework. [NetTcpRelayBinding](/dotnet/api/microsoft.servicebus.nettcprelaybinding) isoneofthebindingsdefinedbytheservice.
187
187
188
-
1. In **SolutionExplorer**, double-click **App.config** toopenthe*App.config* fileintheVisualStudioeditor.
188
+
1. In **SolutionExplorer**, double-click **App.config** toopenthefileintheVisualStudioeditor.
1. Withinthe `<system.serviceModel>` tags, adda `<services>` element. Youcandefinemultiplerelayapplicationsinasingleconfigurationfile. However, thistutorialdefinesonlyone.
191
191
@@ -334,11 +334,11 @@ For this tutorial, the URI is `sb://putServiceNamespaceHere.windows.net/EchoServ
334
334
}
335
335
```
336
336
337
-
Asstatedinthepreviously, youcouldhavedeclaredmultipleservicesandendpointsintheconfigurationfile. Ifyouhad, thiscodewouldtraversetheconfigurationfileandsearchfor every endpoint to which it should apply your credentials. However, for this tutorial, the configuration file has only one endpoint.
337
+
Asstatedpreviously, youcouldhavedeclaredmultipleservicesandendpointsintheconfigurationfile. Ifyouhad, thiscodewouldtraversetheconfigurationfileandsearchfor every endpoint to which it should apply your credentials. However, for this tutorial, the configuration file has only one endpoint.
338
338
339
339
### Open the service host
340
340
341
-
1. Still in `Main()`, addthefollowinglintoopentheservice.
341
+
1. Still in `Main()`, addthefollowinglinetoopentheservice.
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.
515
515
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.
517
517
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.
518
518
3. Within the `system.serviceModel` element, add a `<client>` element.
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.
760
760
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.
0 commit comments