diff --git a/docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md b/docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md index 84be77ef8358f..065cc2bfe62ea 100644 --- a/docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md +++ b/docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md @@ -24,7 +24,8 @@ With [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)], you can create The behaviors of the data service are defined by the members of the class, and by members of the class, which is accessed from the property of the class. The class is supplied to the `InitializeService` method that is implemented by the data service, as in the following implementation of a Northwind data service: - +[!code-csharp[Astoria Northwind Service#DataServiceConfigComplete](../../../../samples/snippets/csharp/VS_Snippets_Misc/Astoria Northwind Service/cs/northwind.svc.cs#dataserviceconfigcomplete)] +[!code-vb[Astoria Northwind Service#DataServiceConfigComplete](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/Astoria Northwind Service/vb/northwind.svc.vb#dataserviceconfigcomplete)] ## Data Service Configuration Settings The class enables you to specify the following data service behaviors: diff --git a/docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md b/docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md index c18383bb03497..76daf2fe72837 100644 --- a/docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md +++ b/docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md @@ -28,12 +28,14 @@ When you use the [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] cli > [!NOTE] > When a data service requires you to manually set the message header for every request, consider registering the handler for the event by overriding the `OnContextCreated` partial method in the entity container that represents the data service, which in this case is `NorthwindEntities`. - +[!code-csharp[Astoria Northwind Client#RegisterHeadersQuery](../../../../samples/snippets/csharp/VS_Snippets_Misc/Astoria Northwind Client/cs/source.cs#registerheadersquery)] +[!code-vb[Astoria Northwind Client#RegisterHeadersQuery](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/Astoria Northwind Client/vb/source.vb#registerheadersquery)] ## Example The following method handles the event and adds an Authentication header to the request. - +[!code-csharp[Astoria Northwind Client#OnSendingRequest](../../../../samples/snippets/csharp/VS_Snippets_Misc/Astoria Northwind Client/cs/source.cs#onsendingrequest)] +[!code-vb[Astoria Northwind Client#OnSendingRequest](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/Astoria Northwind Client/vb/source.vb#onsendingrequest)] ## See Also [Securing WCF Data Services](../../../../docs/framework/data/wcf/securing-wcf-data-services.md) diff --git a/docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md b/docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md index 954520e3365dd..b86a640b36ec6 100644 --- a/docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md +++ b/docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md @@ -41,7 +41,7 @@ The [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] client library e The following query, when it is executed, returns all `Customers` entities in the Northwind data service: - [!code-csharp[Astoria Northwind Client#GetAllCustomersSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#getallcustomersspecific)] + [!code-csharp[Astoria Northwind Client#GetAllCustomersSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#getallcustomersspecific)] [!code-vb[Astoria Northwind Client#GetAllCustomersSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#getallcustomersspecific)] For more information, see [How to: Execute Data Service Queries](../../../../docs/framework/data/wcf/how-to-execute-data-service-queries-wcf-data-services.md). @@ -51,7 +51,8 @@ The [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] client library e ## LINQ Queries Because the class implements the interface defined by LINQ, the [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)] client library is able to transform LINQ queries against entity set data into a URI that represents a query expression evaluated against a data service resource. The following example is a LINQ query that is equivalent to the previous that returns `Orders` that have a freight cost of more than $30 and orders the results by the freight cost: - + [!code-csharp[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#addqueryoptionslinqspecific)] + [!code-vb[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#addqueryoptionslinqspecific)] This LINQ query is translated into the following query URI that is executed against the Northwind-based [quickstart](../../../../docs/framework/data/wcf/quickstart-wcf-data-services.md) data service: @@ -67,7 +68,8 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight ## Adding Query Options Data service queries support all the query options that [!INCLUDE[ssAstoria](../../../../includes/ssastoria-md.md)]s provides. You call the method to append query options to a instance. returns a new instance that is equivalent to the original query but with the new query option set. The following query, when executed, returns `Orders` that are filtered by the `Freight` value and ordered by the `OrderID`, descending: - + [!code-csharp[Astoria Northwind Client#AddQueryOptionsSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#addqueryoptionsspecific)] + [!code-vb[Astoria Northwind Client#AddQueryOptionsSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#addqueryoptionsspecific)] You can use the `$orderby` query option to both order and filter a query based on a single property, as in the following example that filters and orders the returned `Orders` objects based on the value of the `Freight` property: @@ -85,7 +87,8 @@ http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight ## Client versus Server Execution The client executes a query in two parts. Whenever possible, expressions in a query are first evaluated on the client, and then a URI-based query is generated and sent to the data service for evaluation against data in the service. Consider the following LINQ query: - + [!code-csharp[Astoria Northwind Client#LinqQueryClientEvalSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/source.cs#linqqueryclientevalspecific)] + [!code-vb[Astoria Northwind Client#LinqQueryClientEvalSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/source.vb#linqqueryclientevalspecific)] In this example, the expression `(basePrice – (basePrice * discount))` is evaluated on the client. Because of this, the actual query URI `http://localhost:12345/northwind.svc/Products()?$filter=(UnitPrice gt 90.00M) and substringof('bike',ProductName)` that is sent to the data service contains the already calculated decimal value of `90` in the filter clause. The other parts of the filtering expression, including the substring expression, are evaluated by the data service. Expressions that are evaluated on the client follow common language runtime (CLR) semantics, while expressions sent to the data service rely on the data service implementation of the [!INCLUDE[ssODataShort](../../../../includes/ssodatashort-md.md)] Protocol. You should also be aware of scenarios where this separate evaluation may cause unexpected results, such as when both the client and service perform time-based evaluations in different time zones. diff --git a/docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md b/docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md index 71ea0e8853824..41ff97d53b8db 100644 --- a/docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md +++ b/docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md @@ -25,22 +25,24 @@ By default, the client library does not supply credentials when sending a reques ## Example The following example is from the code-behind page for an Extensible Application Markup Language (XAML) file that is the main page of the Windows Presentation Framework application. This example displays a `LoginWindow` instance to collect authentication credentials from the user, and then uses these credentials when making a request to the data service. - + [!code-csharp[Astoria Northwind Client#ClientCredentials](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml.cs#clientcredentials)] + [!code-vb[Astoria Northwind Client#ClientCredentials](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/clientcredentials.xaml.vb#clientcredentials)] ## Example The following XAML defines the main page of the WPF application. - + [!code-xml[Astoria Northwind Client#ClientCredentialsXaml](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml#clientcredentialsxaml)] ## Example The following example is from the code-behind page for the window that is used to collect the authentication credentials from the user before making a request to the data service. - + [!code-csharp[Astoria Northwind Client#ClientCredentialsLogin](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentialslogin.xaml.cs#clientcredentialslogin)] + [!code-vb[Astoria Northwind Client#ClientCredentialsLogin](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria northwind client/vb/clientcredentialslogin.xaml.vb#clientcredentialslogin)] ## Example The following XAML defines the login of the WPF application. - + [!code-xml[Astoria Northwind Client#ClientCredentialsLoginXaml](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentialslogin.xaml#clientcredentialsloginxaml)] ## .NET Framework Security The following security considerations apply to the example in this topic: diff --git a/docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md b/docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md index 5dc9eeccc32d0..4930568598d79 100644 --- a/docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md +++ b/docs/framework/wcf/creating-ws-i-basic-profile-1-1-interoperable-services.md @@ -41,8 +41,8 @@ To configure a [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] service endp ### Code [!code-csharp[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/cs/program.cs#0)] - [!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)] - [!code-xml[C_HowTo-WCFServiceAndASMXClient#1](../../../samples/snippets/common/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config#1)] + [!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)] + [!code-xml[C_HowTo-WCFServiceAndASMXClient#1](../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config#1)] ## See Also [Interoperability with ASP.NET Web Services](../../../docs/framework/wcf/feature-details/interop-with-aspnet-web-services.md) diff --git a/docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md b/docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md index 5e615ae4029f1..b939d2bb3daf9 100644 --- a/docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md +++ b/docs/framework/wcf/extending/how-to-import-custom-policy-assertions.md @@ -49,7 +49,7 @@ Policy assertions describe the capabilities and requirements of a service endpoi 1. Add the importer type to the `` element inside the [\](../../../../docs/framework/configure-apps/file-schema/wcf/policyimporters.md) element in the client configuration file. - + [!code-xml[CustomPolicySample#7](../../../../samples/snippets/csharp/VS_Snippets_CFX/custompolicysample/cs/client.exe.config#7)] 2. In the client application, use the or to resolve the metadata and the importer is invoked automatically. diff --git a/docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md b/docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md index 5250299c5ed4b..f1b28c1d0c458 100644 --- a/docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md +++ b/docs/framework/wcf/extending/how-to-inspect-and-modify-messages-on-the-service.md @@ -41,7 +41,7 @@ You can inspect or modify the incoming or outgoing messages across a [!INCLUDE[i [!code-csharp[Interceptors#8](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs#8)] [!code-vb[Interceptors#8](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/interceptors/vb/insertingbehaviors.vb#8)] - + [!code-xml[Interceptors#9](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/hostapplication.exe.config#9)] ## See Also diff --git a/docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md b/docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md index 93e717e6da79e..69fdaada24a0d 100644 --- a/docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md +++ b/docs/framework/wcf/extending/how-to-inspect-or-modify-parameters.md @@ -41,7 +41,7 @@ You can inspect or modify the incoming or outgoing messages for a single operati [!code-csharp[Interceptors#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/insertingbehaviors.cs#5)] [!code-vb[Interceptors#5](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/interceptors/vb/insertingbehaviors.vb#5)] - + [!code-xml[Interceptors#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/interceptors/cs/client.exe.config#3)] ## See Also [Configuring and Extending the Runtime with Behaviors](../../../../docs/framework/wcf/extending/configuring-and-extending-the-runtime-with-behaviors.md) \ No newline at end of file diff --git a/docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md b/docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md index 4cf193c04be53..3cc9b66d6b74e 100644 --- a/docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md +++ b/docs/framework/wcf/feature-details/config-wcf-service-with-aspnet-web-service.md @@ -47,7 +47,7 @@ To configure a [!INCLUDE[indigo1](../../../../includes/indigo1-md.md)] service e [!code-csharp[C_HowTo-WCFServiceAndASMXClient#0](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/cs/program.cs#0)] [!code-vb[C_HowTo-WCFServiceAndASMXClient#0](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/vb/program.vb#0)] - + [!code-xml[C_HowTo-WCFServiceAndASMXClient#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config#1)] ## See Also [How to: Create a Service Endpoint in Code](../../../../docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-code.md) diff --git a/docs/framework/wcf/feature-details/create-a-service-arbitrary-data-using-wcf.md b/docs/framework/wcf/feature-details/create-a-service-arbitrary-data-using-wcf.md index b11c7c7ee0aee..fd28c9fb36df3 100644 --- a/docs/framework/wcf/feature-details/create-a-service-arbitrary-data-using-wcf.md +++ b/docs/framework/wcf/feature-details/create-a-service-arbitrary-data-using-wcf.md @@ -22,7 +22,7 @@ Sometimes developers must have full control of how data is returned from a servi 1. Define the service contract. The operation that receives the arbitrary data must have a parameter of type . In addition, this parameter must be the only parameter passed in the body of the request. The operation described in this example also takes a filename parameter. This parameter is passed within the URL of the request. You can specify that a parameter is passed within the URL by specifying a in the . In this case the URI used to call this method ends in “UploadFile/Some-Filename”. The “{filename}” portion of the URI template specifies that the filename parameter for the operation is passed within the URI used to call the operation. - ``` + ```csharp [ServiceContract] public interface IReceiveData { @@ -33,7 +33,7 @@ Sometimes developers must have full control of how data is returned from a servi 2. Implement the service contract. The contract has only one method, `UploadFile` that receives a file of arbitrary data in a stream. The operation reads the stream counting the number of bytes read and then displays the filename and the number of bytes read. - ``` + ```csharp public class RawDataService : IReceiveData { public void UploadFile(string fileName, Stream fileContents) @@ -54,7 +54,7 @@ Sometimes developers must have full control of how data is returned from a servi 1. Create a console application to host the service. - ``` + ```csharp class Program { static void Main(string[] args) @@ -66,25 +66,25 @@ Sometimes developers must have full control of how data is returned from a servi 2. Create a variable to hold the base address for the service within the `Main` method. - ``` + ```csharp string baseAddress = "http://" + Environment.MachineName + ":8000/Service"; ``` 3. Create a instance for the service that specifies the service class and the base address. - ``` + ```csharp ServiceHost host = new ServiceHost(typeof(RawDataService), new Uri(baseAddress)); ``` 4. Add an endpoint that specifies the contract, , and . - ``` + ```csharp host.AddServiceEndpoint(typeof(IReceiveData), new WebHttpBinding(), "").Behaviors.Add(new WebHttpBehavior()); ``` 5. Open the service host. The service is now ready to receive requests. - ``` + ```csharp host.Open(); Console.WriteLine("Host opened"); ``` @@ -93,21 +93,21 @@ Sometimes developers must have full control of how data is returned from a servi 1. Create a with the URI used to call the service. In this code, the base address is combined with `“/UploadFile/Text”`. The `“UploadFile”` portion of the URI specifies the operation to call. The `“Test.txt”` portion of the URI specifies the filename parameter to pass to the `UploadFile` operation. Both of these items map to the applied to the operation contract. - ``` + ```csharp HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(baseAddress + "/UploadFile/Test.txt"); ``` 2. Set the property of the to `POST` and the property to `“text/plain”`. This tells the service that the code is sending data and that data is in plain text. - ``` + ```csharp req.Method = "POST"; req.ContentType = "text/plain"; ``` 3. Call to get the request stream, create the data to send, write that data to the request stream, and close the stream. - ``` + ```csharp Stream reqStream = req.GetRequestStream(); byte[] fileToSend = new byte[12345]; for (int i = 0; i < fileToSend.Length; i++) @@ -120,7 +120,7 @@ Sometimes developers must have full control of how data is returned from a servi 4. Get the response from the service by calling and display the response data to the console. - ``` + ```csharp HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); Console.WriteLine("Client: Receive Response HTTP/{0} {1} {2}", resp.ProtocolVersion, (int)resp.StatusCode, resp.StatusDescription); @@ -128,14 +128,14 @@ Sometimes developers must have full control of how data is returned from a servi 5. Close the service host. - ``` + ```csharp host.Close(); ``` ## Example The following is a complete listing of the code for this example. -``` +```csharp using System; using System.Collections.Generic; using System.Text; diff --git a/docs/framework/wcf/feature-details/discoverable-service-that-registers-with-the-discovery-proxy.md b/docs/framework/wcf/feature-details/discoverable-service-that-registers-with-the-discovery-proxy.md index a59c8bf3a3dc1..02815e16adbe6 100644 --- a/docs/framework/wcf/feature-details/discoverable-service-that-registers-with-the-discovery-proxy.md +++ b/docs/framework/wcf/feature-details/discoverable-service-that-registers-with-the-discovery-proxy.md @@ -32,14 +32,14 @@ This topic is the second of four topics that discusses how to implement a discov 4. Add the following using statements. - ``` + ```csharp using System; using System.ServiceModel; ``` 5. Within CalculatorService.cs, define the service contract. - ``` + ```csharp // Define a service contract. [ServiceContract(Namespace = "http://Microsoft.Samples.Discovery")] public interface ICalculatorService @@ -58,7 +58,7 @@ This topic is the second of four topics that discusses how to implement a discov 6. Also within CalculatorService.cs, implement the service contract. - ``` + ```csharp // Service class which implements the service contract. public class CalculatorService : ICalculatorService { @@ -103,7 +103,7 @@ This topic is the second of four topics that discusses how to implement a discov 2. Add the following using statements. - ``` + ```csharp using System; using System.ServiceModel; using System.ServiceModel.Description; @@ -113,7 +113,7 @@ This topic is the second of four topics that discusses how to implement a discov 3. Within the `Main()` method, add the following code: - ``` + ```csharp // Define the base address of the service Uri baseAddress = new Uri("net.tcp://localhost:9002/CalculatorService/" + Guid.NewGuid().ToString()); @@ -169,7 +169,7 @@ This topic is the second of four topics that discusses how to implement a discov ## Example This is the full listing of the code used in this topic. -``` +```csharp // CalculatorService.cs //---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. @@ -233,7 +233,7 @@ namespace Microsoft.Samples.Discovery ``` -``` +```csharp // Program.cs //---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. @@ -294,9 +294,7 @@ namespace Microsoft.Samples.Discovery } } ``` - - - + ## See Also [WCF Discovery](../../../../docs/framework/wcf/feature-details/wcf-discovery.md) [How to: Implement a Discovery Proxy](../../../../docs/framework/wcf/feature-details/how-to-implement-a-discovery-proxy.md) diff --git a/docs/framework/wcf/feature-details/how-to-access-wcf-services-with-one-way-and-request-reply-contracts.md b/docs/framework/wcf/feature-details/how-to-access-wcf-services-with-one-way-and-request-reply-contracts.md index 00e973539a5d2..d5d85526ed0ed 100644 --- a/docs/framework/wcf/feature-details/how-to-access-wcf-services-with-one-way-and-request-reply-contracts.md +++ b/docs/framework/wcf/feature-details/how-to-access-wcf-services-with-one-way-and-request-reply-contracts.md @@ -22,7 +22,7 @@ The following procedures describe how to access a [!INCLUDE[indigo1](../../../.. 1. Declare the service contract. The operations that are to be one-way must have `IsOneWay` set to `true` within the . The following code declares the `IOneWayCalculator` contract that has one-way operations for `Add`, `Subtract`, `Multiply`, and `Divide`. It also defines a request response operation called `SayHello`. - ``` + ```csharp [ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] public interface IOneWayCalculator { @@ -41,7 +41,7 @@ The following procedures describe how to access a [!INCLUDE[indigo1](../../../.. 2. Implement the service contract. The following code implements the `IOnewayCalculator` interface. - ``` + ```csharp [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.PerCall)] public class CalculatorService : IOneWayCalculator { @@ -79,7 +79,7 @@ The following procedures describe how to access a [!INCLUDE[indigo1](../../../.. 3. Host the service in a console application. The following code shows how to host the service. - ``` + ```csharp // Host the service within this EXE console application. public static void Main() { @@ -117,7 +117,7 @@ The following procedures describe how to access a [!INCLUDE[indigo1](../../../.. 1. Run the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../../../../docs/framework/wcf/servicemodel-metadata-utility-tool-svcutil-exe.md) using the metadata exchange endpoint address to create the client class for the service using the following command line: `Svcutil http://localhost:8000/Service` The [ServiceModel Metadata Utility Tool (Svcutil.exe)](../../../../docs/framework/wcf/servicemodel-metadata-utility-tool-svcutil-exe.md) generates a set of interfaces and classes, as shown in the following sample code. - ``` + ```csharp [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="IOneWayCalculator")] public interface IOneWayCalculator @@ -198,24 +198,22 @@ The following procedures describe how to access a [!INCLUDE[indigo1](../../../.. return base.Channel.SayHello(name); } } - ``` Notice in the `IOneWayCalculator` interface that the one-way service operations have the attribute set to `true` and the request-reply service operation has the attribute set to the default value, `false`. Also notice the `OneWayCalculatorClient` class. This is the class that you will use to call the service. 2. Create the client object. - ``` + ```csharp // Create a client WSHttpBinding binding = new WSHttpBinding(); EndpointAddress epAddress = new EndpointAddress("http://localhost:8000/servicemodelsamples/service"); OneWayCalculatorClient client = new OneWayCalculatorClient(binding, epAddress); - ``` 3. Call service operations. - ``` + ```csharp // Call the Add service operation. double value1 = 100.00D; double value2 = 15.99D; @@ -245,21 +243,19 @@ The following procedures describe how to access a [!INCLUDE[indigo1](../../../.. string response = client.SayHello(name); Console.WriteLine("SayHello([0])", name); Console.WriteLine("SayHello() returned: " + response); - ``` 4. Close the client to close connections and clean up resources. - ``` + ```csharp //Closing the client gracefully closes the connection and cleans up resources client.Close(); - ``` ## Example The following is a complete listing of the code used in this topic. -``` +```csharp // Service.cs using System; using System.Configuration; @@ -351,8 +347,10 @@ namespace Microsoft.ServiceModel.Samples } } } -} - +} +``` + +```csharp // client.cs using System; using System.ServiceModel; @@ -406,10 +404,7 @@ namespace Microsoft.ServiceModel.Samples } } } - ``` - - ## See Also [One-Way Services](../../../../docs/framework/wcf/feature-details/one-way-services.md) \ No newline at end of file diff --git a/docs/framework/wcf/feature-details/how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md b/docs/framework/wcf/feature-details/how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md index 2c4ab59f7be5a..718f732abf9ed 100644 --- a/docs/framework/wcf/feature-details/how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md +++ b/docs/framework/wcf/feature-details/how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md @@ -28,7 +28,7 @@ manager: "erikre" 1. Define a basic [!INCLUDE[indigo2](../../../../includes/indigo2-md.md)] service contract with an interface marked with the attribute. Mark each operation with the . Be sure to set the property. - ``` + ```csharp [ServiceContract(Namespace = "MyService")]] public interface ICalculator { @@ -43,7 +43,7 @@ manager: "erikre" 2. Implement the `ICalculator` service contract with a `CalculatorService`. - ``` + ```csharp public class CalculatorService : ICalculator { public double Add(double n1, double n2) @@ -56,7 +56,7 @@ manager: "erikre" 3. Define a namespace for the `ICalculator` and `CalculatorService` implementations by wrapping them in a namespace block. - ``` + ```csharp Namespace Microsoft.Ajax.Samples { //Include the code for ICalculator and Caculator here. @@ -83,7 +83,6 @@ manager: "erikre" 1. The endpoint is configured at an empty address relative to the .svc file, so the service is now available and can be invoked by sending requests to service.svc/\ - for example, service.svc/Add for the `Add` operation. You can use it by entering the service URL into the Scripts collection of the ASP.NET AJAX Script Manager control. For an example, see the [AJAX Service Without Configuration](../../../../docs/framework/wcf/samples/ajax-service-without-configuration.md). ## Example - The automatically-configured endpoint is created at an empty address relative to the base URL. A configuration file can also be added and used with this approach. If the configuration file contains endpoint definitions, these endpoints are added to the automatically-configured endpoint. diff --git a/docs/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl.md b/docs/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl.md index eed2960e38a8e..d442dc88705a9 100644 --- a/docs/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl.md +++ b/docs/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl.md @@ -70,7 +70,7 @@ This topic describes how to set up an IIS-hosted WCF service to use HTTP transpo 1. In the WCF service’s web.config configure the HTTP binding to use transport security as shown in the following XML. - ``` + ```xml @@ -79,13 +79,12 @@ This topic describes how to set up an IIS-hosted WCF service to use HTTP transpo - - + ``` 2. Specify your service and service endpoint as shown in the following XML. - ``` + ```xml - - + ``` ## Example The following is a complete example of a web.config file for a WCF service using HTTP transport security -``` +```xml @@ -150,10 +148,8 @@ This topic describes how to set up an IIS-hosted WCF service to use HTTP transpo - ``` - ## See Also [Hosting in Internet Information Services](../../../../docs/framework/wcf/feature-details/hosting-in-internet-information-services.md) diff --git a/docs/framework/wcf/feature-details/how-to-create-a-custom-reliable-session-binding-with-https.md b/docs/framework/wcf/feature-details/how-to-create-a-custom-reliable-session-binding-with-https.md index 74fb7c3bc3760..ccecd9ee84f0b 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-custom-reliable-session-binding-with-https.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-custom-reliable-session-binding-with-https.md @@ -34,7 +34,7 @@ This topic demonstrates the use of Secure Sockets Layer (SSL) transport security 3. Create a Web.config file to configure an endpoint for the `CalculatorService` with a custom binding named "reliableSessionOverHttps" that uses a reliable session and the HTTPS transport. - + [!code-xml[c_HowTo_CreateReliableSessionHTTPS#2111](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/web.config#2111)] 4. Create a Service.svc file that contains the line: @@ -62,7 +62,7 @@ This topic demonstrates the use of Secure Sockets Layer (SSL) transport security 4. Configure a custom binding named "reliableSessionOverHttps" to use the HTTPS transport and reliable sessions. - + [!code-xml[C_HowTo_CreateReliableSessionHTTPS#2211](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/app.config#2211)] 5. Create an instance of the `ClientCalculator` in an application and then call the service operations. @@ -71,7 +71,6 @@ This topic demonstrates the use of Secure Sockets Layer (SSL) transport security 6. Compile and run the client. ## Example - ## .NET Framework Security Because the certificate used in this sample is a test certificate created with Makecert.exe, a security alert appears when you try to access an HTTPS address, such as https://localhost/servicemodelsamples/service.svc, from your browser. diff --git a/docs/framework/wcf/feature-details/how-to-create-a-service-that-requires-sessions.md b/docs/framework/wcf/feature-details/how-to-create-a-service-that-requires-sessions.md index bc825c3237fc0..0243aa608b88e 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-service-that-requires-sessions.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-service-that-requires-sessions.md @@ -32,15 +32,15 @@ Sessions create a shared state between two or more endpoints that enables useful 3. Configure your service endpoint to use a binding that supports sessions. The following configuration example shows the use of the , which supports a WS`-`ReliableMessaging session. - + [!code-xml[SCA.Session#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/sca.session/cs/hostapplication.exe.config#2)] ## Example The following example code shows how to specify a contract-level session requirement and use a configuration file to support that requirement with the binding. [!code-csharp[SCA.Session#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/sca.session/cs/services.cs#1)] - [!code-vb[SCA.Session#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/sca.session/vb/services.vb#1)] - + [!code-vb[SCA.Session#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/sca.session/vb/services.vb#1)] + [!code-xml[SCA.Session#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/sca.session/cs/hostapplication.exe.config#2)] ## See Also diff --git a/docs/framework/wcf/feature-details/how-to-create-a-wsfederationhttpbinding.md b/docs/framework/wcf/feature-details/how-to-create-a-wsfederationhttpbinding.md index a28350af07238..2d621c1d40c6a 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-wsfederationhttpbinding.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-wsfederationhttpbinding.md @@ -104,8 +104,8 @@ In [!INCLUDE[indigo1](../../../../includes/indigo1-md.md)], the + [!code-csharp[c_FederationBinding#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_federationbinding/cs/source.cs#2)] + [!code-vb[c_FederationBinding#2](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_federationbinding/vb/source.vb#2)] ## See Also [Federation](../../../../docs/framework/wcf/feature-details/federation.md) diff --git a/docs/framework/wcf/feature-details/how-to-enable-streaming.md b/docs/framework/wcf/feature-details/how-to-enable-streaming.md index 67d9c8449603f..2aaac9b935949 100644 --- a/docs/framework/wcf/feature-details/how-to-enable-streaming.md +++ b/docs/framework/wcf/feature-details/how-to-enable-streaming.md @@ -51,7 +51,7 @@ manager: "erikre" 1. The following configuration snippet from the sample shows setting the `TransferMode` property to streaming on the `basicHttpBinding` and a custom HTTP binding. - + [!code-xml[c_HowTo_EnableStreaming#103](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_enablestreaming/common/app.config#103)] 2. The following code snippet shows setting the `TransferMode` property to streaming on the `basicHttpBinding` and a custom HTTP binding. diff --git a/docs/framework/wcf/feature-details/how-to-enable-the-net-tcp-port-sharing-service.md b/docs/framework/wcf/feature-details/how-to-enable-the-net-tcp-port-sharing-service.md index 048e3fecc272e..216cf71c808a3 100644 --- a/docs/framework/wcf/feature-details/how-to-enable-the-net-tcp-port-sharing-service.md +++ b/docs/framework/wcf/feature-details/how-to-enable-the-net-tcp-port-sharing-service.md @@ -38,7 +38,6 @@ manager: "erikre" 5. To return to the list of services, click the **OK**, and exit the MMC Console. ## Example - ## See Also [Net.TCP Port Sharing](../../../../docs/framework/wcf/feature-details/net-tcp-port-sharing.md) diff --git a/docs/framework/wcf/feature-details/how-to-exchange-messages-within-a-reliable-session.md b/docs/framework/wcf/feature-details/how-to-exchange-messages-within-a-reliable-session.md index 3643ecd368f4c..37e3761dcbdb8 100644 --- a/docs/framework/wcf/feature-details/how-to-exchange-messages-within-a-reliable-session.md +++ b/docs/framework/wcf/feature-details/how-to-exchange-messages-within-a-reliable-session.md @@ -34,7 +34,7 @@ This topic outlines the steps required to enable a reliable session using one of 3. Create a Web.config file to configure an endpoint for the `CalculatorService` that uses the with reliable session enabled and ordered delivery of messages required. - + [!code-xml[c_HowTo_UseReliableSession#2111](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/web.config#2111)] 4. Create a Service.svc file that contains the line: @@ -62,7 +62,7 @@ This topic outlines the steps required to enable a reliable session using one of 4. Svcutil.exe also generates the configuration for the client that uses the class. This file should be named the App.config file when using [!INCLUDE[vsprvs](../../../../includes/vsprvs-md.md)]. - + [!code-xml[C_HowTo_UseReliableSession#2211](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/app.config#2211)] 5. Create an instance of the `ClientCalculator` in an application and then call the service operations. @@ -71,7 +71,6 @@ This topic outlines the steps required to enable a reliable session using one of 6. Compile and run the client. ## Example - Several of the system-provided bindings support reliable sessions by default. These include: diff --git a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis.md b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis.md index 9db1f1fdaf063..7dd06987d7cdd 100644 --- a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis.md +++ b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis.md @@ -68,31 +68,7 @@ This topic outlines the basic steps required to create a [!INCLUDE[indigo1](../. 10. Create a file named "Web.config" in the application directory and add the following configuration code into the file. At runtime, the [!INCLUDE[indigo2](../../../../includes/indigo2-md.md)] infrastructure uses the information to construct an endpoint that client applications can communicate with. - ```xml - - - - - - - - - - - - - - - - - - - ``` + [!code-xml[c_HowTo_HostInIIS#100](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/common/web.config#100)] This example explicitly specifies endpoints in the configuration file. If you do not add any endpoints to the service, the runtime adds default endpoints for you. [!INCLUDE[crabout](../../../../includes/crabout-md.md)] default endpoints, bindings, and behaviors see [Simplified Configuration](../../../../docs/framework/wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../../docs/framework/wcf/samples/simplified-configuration-for-wcf-services.md). @@ -101,10 +77,9 @@ This topic outlines the basic steps required to create a [!INCLUDE[indigo1](../. ## Example The following is a complete listing of the code for the IIS hosted calculator service. - [!code-csharp[C_HowTo_HostInIIS#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/cs/source.cs#1)] - [!code-vb[C_HowTo_HostInIIS#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto_hostiniis/vb/source.vb#1)] - - + [!code-csharp[C_HowTo_HostInIIS#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/cs/source.cs#1)] + [!code-vb[C_HowTo_HostInIIS#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto_hostiniis/vb/source.vb#1)] + [!code-xml[c_HowTo_HostInIIS#100](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/common/web.config#100)] ## See Also [Hosting in Internet Information Services](../../../../docs/framework/wcf/feature-details/hosting-in-internet-information-services.md) diff --git a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was.md b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was.md index 6514a5e2babcc..937b0e8a12169 100644 --- a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was.md +++ b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was.md @@ -96,7 +96,7 @@ This topic outlines the basic steps required to create a Windows Process Activat 4. The configuration for the client that uses the is also generated by Svcutil.exe. This file should be named in the App.config file when using Visual Studio. - + [!code-xml[C_HowTo_HostInWAS#2211](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/common/app.config#2211)] 5. Create an instance of the `ClientCalculator` in an application and then call the service operations. diff --git a/docs/framework/wcf/feature-details/how-to-programmatically-add-discoverability-to-a-wcf-service-and-client.md b/docs/framework/wcf/feature-details/how-to-programmatically-add-discoverability-to-a-wcf-service-and-client.md index 7561310809b98..8ec9fff9595a3 100644 --- a/docs/framework/wcf/feature-details/how-to-programmatically-add-discoverability-to-a-wcf-service-and-client.md +++ b/docs/framework/wcf/feature-details/how-to-programmatically-add-discoverability-to-a-wcf-service-and-client.md @@ -26,13 +26,13 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 3. Open the Service.cs file and add the following `using` statement. - ``` + ```csharp using System.ServiceModel.Discovery; ``` 4. In the `Main()` method, inside the `using` statement, add a instance to the service host. - ``` + ```csharp public static void Main() { // Create a ServiceHost for the CalculatorService type. @@ -50,7 +50,7 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 5. Add a to the service host right after the code that adds the . - ``` + ```csharp // Add ServiceDiscoveryBehavior serviceHost.Description.Behaviors.Add(new ServiceDiscoveryBehavior()); @@ -72,7 +72,7 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 5. Add the following `using` statements. - ``` + ```csharp using System.ServiceModel; using System.ServiceModel.Discovery; using Microsoft.ServiceModel.Samples; @@ -81,7 +81,7 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 6. Add a static method called `FindCalculatorServiceAddress()` to the `Program` class. - ``` + ```csharp static EndpointAddress FindCalculatorServiceAddress() { } @@ -91,7 +91,7 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 7. Inside the `FindCalculatorServiceAddress` method, create a new instance, passing in a to the constructor. - ``` + ```csharp static EndpointAddress FindCalculatorServiceAddress() { // Create DiscoveryClient @@ -103,14 +103,14 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 8. On the next line, call the method and specify a instance that contains the service contract you want to search for. In this case, specify `ICalculator`. - ``` + ```csharp // Find ICalculatorService endpoints FindResponse findResponse = discoveryClient.Find(new FindCriteria(typeof(ICalculator))); ``` 9. After the call to , check to see if there is at least one matching service and return the of the first matching service. Otherwise return `null`. - ``` + ```csharp if (findResponse.Endpoints.Count > 0) { return findResponse.Endpoints[0].Address; @@ -123,7 +123,7 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 10. Add a static method named `InvokeCalculatorService` to the `Program` class. - ``` + ```csharp static void InvokeCalculatorService(EndpointAddress endpointAddress) { } @@ -133,21 +133,21 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 11. Inside the `InvokeCalculatorService` method, create an instance of the `CalculatorServiceClient` class. This class is defined by the [Self-Host](http://go.microsoft.com/fwlink/?LinkId=145523) sample. It was generated using Svcutil.exe. - ``` + ```csharp // Create a client CalculatorClient client = new CalculatorClient(); ``` 12. On the next line, set the endpoint address of the client to the endpoint address returned from `FindCalculatorServiceAddress()`. - ``` + ```csharp // Connect to the discovered service endpoint client.Endpoint.Address = endpointAddress; ``` 13. Immediately after the code for the previous step, call the methods exposed by the calculator service. - ``` + ```csharp Console.WriteLine("Invoking CalculatorService at {0}", endpointAddress); double value1 = 100.00D; @@ -176,7 +176,7 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 14. Add code to the `Main()` method in the `Program` class to call `FindCalculatorServiceAddress`. - ``` + ```csharp public static void Main() { EndpointAddress endpointAddress = FindCalculatorServiceAddress(); @@ -185,7 +185,7 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo 15. On the next line, call the `InvokeCalculatorService()` and pass in the endpoint address returned from `FindCalculatorServiceAddress()`. - ``` + ```csharp if (endpointAddress != null) { InvokeCalculatorService(endpointAddress); @@ -229,7 +229,7 @@ This topic explains how to make a [!INCLUDE[indigo1](../../../../includes/indigo ## Example The following is a listing of the code for this sample. Because this code is based on the [Self-Host](http://go.microsoft.com/fwlink/?LinkId=145523) sample, only those files that are changed are listed. [!INCLUDE[crabout](../../../../includes/crabout-md.md)] the Self-Host sample, see [Setup Instructions](http://go.microsoft.com/fwlink/?LinkId=145522). -``` +```csharp // Service.cs using System; @@ -266,7 +266,7 @@ namespace Microsoft.ServiceModel.Samples } ``` -``` +```csharp // Program.cs using System; using System.Collections.Generic; @@ -347,9 +347,7 @@ namespace DiscoveryClientApp } } ``` - - - + ## See Also [WCF Discovery Overview](../../../../docs/framework/wcf/feature-details/wcf-discovery-overview.md) [WCF Discovery Object Model](../../../../docs/framework/wcf/feature-details/wcf-discovery-object-model.md) \ No newline at end of file diff --git a/docs/framework/wcf/feature-details/how-to-retrieve-metadata-and-implement-a-compliant-service.md b/docs/framework/wcf/feature-details/how-to-retrieve-metadata-and-implement-a-compliant-service.md index 9d032c9830423..060bfb467cb20 100644 --- a/docs/framework/wcf/feature-details/how-to-retrieve-metadata-and-implement-a-compliant-service.md +++ b/docs/framework/wcf/feature-details/how-to-retrieve-metadata-and-implement-a-compliant-service.md @@ -57,15 +57,10 @@ Often, the same person does not design and implement services. In environments w - A conversion of the client-side configuration file to a service-side version. - [!code-csharp[ClientProxyCodeSample#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/proxycode.cs#1)] - - - - - [!code-csharp[ClientProxyCodeSample#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/hostapplication.cs#5)] - - - + [!code-csharp[ClientProxyCodeSample#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/proxycode.cs#1)] + [!code-xml[ClientProxyCodeSample#10](../../../../samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/client.exe.config#10)] + [!code-csharp[ClientProxyCodeSample#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/hostapplication.cs#5)] + [!code-xml[ClientProxyCodeSample#20](../../../../samples/snippets/csharp/VS_Snippets_CFX/clientproxycodesample/cs/hostapplication.exe.config#20)] ## See Also [ServiceModel Metadata Utility Tool (Svcutil.exe)](../../../../docs/framework/wcf/servicemodel-metadata-utility-tool-svcutil-exe.md) \ No newline at end of file diff --git a/docs/framework/wcf/feature-details/importing-schema-to-generate-classes.md b/docs/framework/wcf/feature-details/importing-schema-to-generate-classes.md index 54056957c37d5..d0d05cfd7d458 100644 --- a/docs/framework/wcf/feature-details/importing-schema-to-generate-classes.md +++ b/docs/framework/wcf/feature-details/importing-schema-to-generate-classes.md @@ -67,7 +67,7 @@ To generate classes from schemas that are usable with [!INCLUDE[indigo1](../../. For example, consider the following schema. - + [!code-xml[c_SchemaImportExport#10](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/common/source.config#10)] The following example uses the `Namespaces` property to map the "http://schemas.contoso.com/carSchema" namespace to "Contoso.Cars". @@ -97,18 +97,18 @@ To generate classes from schemas that are usable with [!INCLUDE[indigo1](../../. ### Import Options: Choosing Collection Types Two special patterns in XML represent collections of items: lists of items and associations between one item and another. The following is an example of a list of strings. - + [!code-xml[C_SchemaImportExport#11](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/common/source.config#11)] The following is an example of an association between a string and an integer (`city name` and `population`). - + [!code-xml[C_SchemaImportExport#12](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/common/source.config#12)] > [!NOTE] > Any association could also be considered a list. For example, you can view the preceding association as a list of complex `city` objects that happen to have two fields (a string field and an integer field). Both patterns have a representation in the XSD Schema. There is no way to differentiate between a list and an association, so such patterns are always treated as lists unless a special annotation specific to [!INCLUDE[indigo2](../../../../includes/indigo2-md.md)] is present in the schema. The annotation indicates that a given pattern represents an association. [!INCLUDE[crdefault](../../../../includes/crdefault-md.md)][Data Contract Schema Reference](../../../../docs/framework/wcf/feature-details/data-contract-schema-reference.md). Normally, a list is imported as a collection data contract that derives from a Generic List or as a [!INCLUDE[dnprdnshort](../../../../includes/dnprdnshort-md.md)] array, depending on whether or not the schema follows the standard naming pattern for collections. This is described in more detail in [Collection Types in Data Contracts](../../../../docs/framework/wcf/feature-details/collection-types-in-data-contracts.md). Associations are normally imported as either a or a collection data contract that derives from the dictionary object. For example, consider the following schema. - + [!code-xml[c_SchemaImportExport#13](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/common/source.config#13)] This would be imported as follows (fields are shown instead of properties for readability). diff --git a/docs/framework/wcf/feature-details/schema-import-and-export.md b/docs/framework/wcf/feature-details/schema-import-and-export.md index 47268ba0df216..c889bf9b50b29 100644 --- a/docs/framework/wcf/feature-details/schema-import-and-export.md +++ b/docs/framework/wcf/feature-details/schema-import-and-export.md @@ -51,8 +51,8 @@ manager: "erikre" The data contract model supports only a limited subset of the WC3 schema. Any schema that does not conform to this subset will cause an exception during the import process. For example, there is no way to specify that a data member of a data contract should be serialized as an XML attribute. Thus, schemas that require the use of XML attributes are not supported and will cause exceptions during import, because it is impossible to generate a data contract with the correct XML projection. For example, the following schema fragment cannot be imported using the default import settings. - - + + [!code-xml[c_SchemaImportExport#9](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_schemaimportexport/common/source.config#9)] [!INCLUDE[crdefault](../../../../includes/crdefault-md.md)] [Data Contract Schema Reference](../../../../docs/framework/wcf/feature-details/data-contract-schema-reference.md). If a schema does not conform to the data contract rules, use a different serialization engine. For example, the uses its own separate schema import mechanism. Also, there is a special import mode in which the range of supported schema is expanded. [!INCLUDE[crdefault](../../../../includes/crdefault-md.md)] the section about generating types in [Importing Schema to Generate Classes](../../../../docs/framework/wcf/feature-details/importing-schema-to-generate-classes.md). diff --git a/docs/framework/wcf/feature-details/serialization-and-deserialization.md b/docs/framework/wcf/feature-details/serialization-and-deserialization.md index 0573212753cd1..b4b5d9c2512c5 100644 --- a/docs/framework/wcf/feature-details/serialization-and-deserialization.md +++ b/docs/framework/wcf/feature-details/serialization-and-deserialization.md @@ -48,7 +48,7 @@ manager: "erikre" The following example shows a class, `LibraryPatron`, that includes a collection of a specific type, the `LibraryItem`. The second class defines the `LibraryItem` type. The third and four classes (`Book` and `Newspaper`) inherit from the `LibraryItem` class. - + [!code-csharp[c_StandaloneDataContractSerializer#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_standalonedatacontractserializer/cs/source.cs#3)] [!code-vb[c_StandaloneDataContractSerializer#3](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_standalonedatacontractserializer/vb/source.vb#3)] The following code constructs an instance of the serializer using the `knownTypes` parameter. diff --git a/docs/framework/wcf/feature-details/transport-security-overview.md b/docs/framework/wcf/feature-details/transport-security-overview.md index fe7f04e5091db..ba79f009ee264 100644 --- a/docs/framework/wcf/feature-details/transport-security-overview.md +++ b/docs/framework/wcf/feature-details/transport-security-overview.md @@ -30,8 +30,8 @@ Transport security mechanisms in [!INCLUDE[indigo1](../../../../includes/indigo1 ### Interoperation with IIS The class is primarily used to interoperate with existing Web services, and many of those services are hosted by Internet Information Services (IIS). Consequently, the transport security for this binding is designed for seamless interoperation with IIS sites. This is done by setting the security mode to and then setting the client credential type. The credential type values correspond to IIS directory security mechanisms. The following code shows the mode being set and the credential type set to Windows. You can use this configuration when both client and server are on the same Windows domain. - [!code-csharp[c_ProgrammingSecurity#10](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_programmingsecurity/cs/source.cs#10)] - + [!code-csharp[c_ProgrammingSecurity#10](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_programmingsecurity/cs/source.cs#10)] + [!code-vb[c_ProgrammingSecurity#10](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_programmingsecurity/vb/source.vb#10)] Or, in configuration: diff --git a/docs/framework/wcf/feature-details/using-servicethrottlingbehavior-to-control-wcf-service-performance.md b/docs/framework/wcf/feature-details/using-servicethrottlingbehavior-to-control-wcf-service-performance.md index e2b6c3d08f73d..eb1c2cde260e8 100644 --- a/docs/framework/wcf/feature-details/using-servicethrottlingbehavior-to-control-wcf-service-performance.md +++ b/docs/framework/wcf/feature-details/using-servicethrottlingbehavior-to-control-wcf-service-performance.md @@ -27,7 +27,7 @@ The class expos The following code example shows the use of the class from an application configuration file that sets the , , and properties to 1 as a trivial example. Real-world experience determines the optimal settings for any particular application. - + [!code-xml[ServiceThrottlingBehavior#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/servicethrottlingbehavior/cs/hostapplication.exe.config#3)] The exact run-time behavior depends upon the values of the and properties, which control how many messages can execute inside an operation at once and the lifetimes of the service relative to incoming channel sessions, respectively. diff --git a/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md b/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md index e5fdcb4ed7fc1..1630e930d56ad 100644 --- a/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md +++ b/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md @@ -48,7 +48,7 @@ In this example, a client console application is created to use a calculator ser 4. Svcutil.exe also generates the configuration for the client that uses the class. When using [!INCLUDE[vsprvs](../../../includes/vsprvs-md.md)], name this file App.config. Note that the address and binding information are not specified anywhere inside the implementation of the service. Also, code does not have to be written to retrieve that information from the configuration file. - + [!code-xml[C_HowTo_ConfigureClientBinding#100](../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/common/client.exe.config#100)] 5. Create an instance of the `ClientCalculator` in an application, and then call the service operations. diff --git a/docs/framework/wcf/specifying-an-endpoint-address.md b/docs/framework/wcf/specifying-an-endpoint-address.md index 1970597189ef7..004c0d3c1809a 100644 --- a/docs/framework/wcf/specifying-an-endpoint-address.md +++ b/docs/framework/wcf/specifying-an-endpoint-address.md @@ -47,13 +47,13 @@ All communication with a [!INCLUDE[indigo1](../../../includes/indigo1-md.md)] se ## Defining Endpoint Addresses in Configuration To define an endpoint in a configuration file, use the [\](http://msdn.microsoft.com/en-us/13aa23b7-2f08-4add-8dbf-a99f8127c017) element. - + [!code-xml[S_UEHelloWorld#5](../../../samples/snippets/common/VS_Snippets_CFX/s_uehelloworld/common/serviceapp2.config#5)] When the method is called (that is, when the hosting application attempts to start the service), the system looks for a [\](../../../docs/framework/configure-apps/file-schema/wcf/service.md) element with a name attribute that specifies "UE.Samples.HelloService". If the [\](../../../docs/framework/configure-apps/file-schema/wcf/service.md) element is found, the system loads the specified class and creates endpoints using the endpoint definitions provided in the configuration file. This mechanism allows you to load and start a service with two lines of code while keeping binding and addressing information out of your code. The advantage of this approach is that these changes can be made without having to recompile or redeploy the application. The optional headers are declared in a [\](../../../docs/framework/configure-apps/file-schema/wcf/headers-element.md). The following is an example of the elements used to specify endpoints for a service in a configuration file that distinguishes between two headers: "Gold" clients from http://tempuri1.org/ and "Standard" clients from http://tempuri2.org/. The client calling this service must have the appropriate [\](../../../docs/framework/configure-apps/file-schema/wcf/headers-element.md) in its configuration file. - + [!code-xml[S_UEHelloWorld#1](../../../samples/snippets/common/VS_Snippets_CFX/s_uehelloworld/common/serviceapp.config#1)] Headers can also be set on individual messages instead of all messages on an endpoint (as shown previously). This is done by using to create a new context in a client application to add a custom header to the outgoing message, as shown in the following example. @@ -70,7 +70,7 @@ All communication with a [!INCLUDE[indigo1](../../../includes/indigo1-md.md)] se The following example demonstrates how to specify the full endpoint address in code. - [!code-csharp[S_UEHelloWorld#2](../../../samples/snippets/csharp/VS_Snippets_CFX/s_uehelloworld/cs/snippet.cs#2)] + [!code-csharp[S_UEHelloWorld#2](../../../samples/snippets/csharp/VS_Snippets_CFX/s_uehelloworld/cs/snippet.cs#2)] The following example demonstrates how to add a relative address ("MyService") to the base address of the service host. diff --git a/docs/framework/wcf/specifying-client-run-time-behavior.md b/docs/framework/wcf/specifying-client-run-time-behavior.md index 2d1e92975a174..01d3589a8fb00 100644 --- a/docs/framework/wcf/specifying-client-run-time-behavior.md +++ b/docs/framework/wcf/specifying-client-run-time-behavior.md @@ -40,8 +40,8 @@ manager: "erikre" - You do so only in controlled debugging scenarios. The following code example shows a client configuration file that instructs [!INCLUDE[indigo2](../../../includes/indigo2-md.md)] to return managed exception information from a client callback object in SOAP messages. - - + + [!code-xml[SCA.CallbackContract#4](../../../samples/snippets/csharp/VS_Snippets_CFX/sca.callbackcontract/cs/client.exe.config#4)] ## Using the ClientViaBehavior Behavior You can use the behavior to specify the Uniform Resource Identifier for which the transport channel should be created. Use this behavior when the immediate network destination is not the intended processor of the message. This enables multiple-hop conversations when the calling application does not necessarily know the ultimate destination or when the destination `Via` header is not an address. diff --git a/docs/framework/wcf/wcf-client-overview.md b/docs/framework/wcf/wcf-client-overview.md index 66e1835a1c2a0..544a535d97b24 100644 --- a/docs/framework/wcf/wcf-client-overview.md +++ b/docs/framework/wcf/wcf-client-overview.md @@ -80,7 +80,7 @@ svcutil /language:vb /out:ClientCode.vb /config:app.config http://computerName/M For example, a generated configuration file for an `ISampleService` used in the preceding examples contains the following endpoint information. - + [!code-xml[C_GeneratedCodeFiles#19](../../../samples/snippets/csharp/VS_Snippets_CFX/c_generatedcodefiles/common/client.exe.config#19)] This configuration file specifies a target endpoint in the `` element. [!INCLUDE[crabout](../../../includes/crabout-md.md)] using multiple target endpoints, see the or the constructors. diff --git a/samples/snippets/common/VS_Snippets_CFX/c_generatedcodefiles/common/client.exe.config b/samples/snippets/common/VS_Snippets_CFX/c_generatedcodefiles/common/client.exe.config deleted file mode 100644 index 71f74b21d7373..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_generatedcodefiles/common/client.exe.config +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config b/samples/snippets/common/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config deleted file mode 100644 index 66a6923f493bd..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto-wcfserviceandasmxclient/common/app.config +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_configureclientbinding/common/client.exe.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_configureclientbinding/common/client.exe.config deleted file mode 100644 index 7f9e820add69a..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_configureclientbinding/common/client.exe.config +++ /dev/null @@ -1,22 +0,0 @@ -// - - - - - - - - - - - - - - - - -// \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/app.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/app.config deleted file mode 100644 index a227b1d96fa2e..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/app.config +++ /dev/null @@ -1,30 +0,0 @@ -//This is the config for the topic: How to: Create a Custom Reliable Session Binding with HTTPS -// - - - - - - - - - - - - - - - - - - - - - - - -// \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/web.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/web.config deleted file mode 100644 index 2c96be4cac601..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/web.config +++ /dev/null @@ -1,36 +0,0 @@ -//This is the config for the topic: How to: Create a Custom Reliable Session Binding with HTTPS -// - - - - - - - - - - - - - - - - - - - - - - - - - - -// \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_enablestreaming/common/app.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_enablestreaming/common/app.config deleted file mode 100644 index a72dccd08331a..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_enablestreaming/common/app.config +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_hostiniis/common/web.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_hostiniis/common/web.config deleted file mode 100644 index aa29c36ec3297..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_hostiniis/common/web.config +++ /dev/null @@ -1,24 +0,0 @@ -// - - - - - - - - - - - - - - - - - - -// \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_hostinwas/common/app.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_hostinwas/common/app.config deleted file mode 100644 index 1ce9a5897f4bd..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_hostinwas/common/app.config +++ /dev/null @@ -1,23 +0,0 @@ -//This is the config for the topic: How to: Host a WCF Service in WAS -// - - - - - - - - - - - - - - - - - -// \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_hostinwas/common/web.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_hostinwas/common/web.config deleted file mode 100644 index f403f2eeab60f..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_hostinwas/common/web.config +++ /dev/null @@ -1,24 +0,0 @@ -//This is the config for the topic: How to: Host a WCF Service in WAS -// - - - - - - - - - - - - - - - - - - - - -// \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_usereliablesession/common/app.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_usereliablesession/common/app.config deleted file mode 100644 index 83506f4b91800..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_usereliablesession/common/app.config +++ /dev/null @@ -1,32 +0,0 @@ -//This is the config for the topic: HowTo Use Reliable Session -// - - - - - - - - binding="wsHttpBinding" - bindingConfiguration="Binding1" - contract="Microsoft.ServiceModel.Samples.ICalculator" /> - - - - - - - - - - - - - - - -// \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/c_howto_usereliablesession/common/web.config b/samples/snippets/common/VS_Snippets_CFX/c_howto_usereliablesession/common/web.config deleted file mode 100644 index 5628b25b9711f..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_howto_usereliablesession/common/web.config +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - binding="wsHttpBinding" - bindingConfiguration="Binding1" - contract="Microsoft.ServiceModel.Samples.ICalculator" /> - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/c_schemaimportexport/common/source.config b/samples/snippets/common/VS_Snippets_CFX/c_schemaimportexport/common/source.config deleted file mode 100644 index f64e2b1f514bb..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/c_schemaimportexport/common/source.config +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Alice - Bob - Charlie - - - - - - - - Auburn - 40000 - - - Bellevue - 80000 - - - Cedar Creek - 10000 - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/clientproxycodesample/common/client.exe.config b/samples/snippets/common/VS_Snippets_CFX/clientproxycodesample/common/client.exe.config deleted file mode 100644 index 067f7b662694f..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/clientproxycodesample/common/client.exe.config +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/snippets/common/VS_Snippets_CFX/clientproxycodesample/common/hostapplication.exe.config b/samples/snippets/common/VS_Snippets_CFX/clientproxycodesample/common/hostapplication.exe.config deleted file mode 100644 index 8941741df619f..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/clientproxycodesample/common/hostapplication.exe.config +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/snippets/common/VS_Snippets_CFX/custompolicysample/common/app.config b/samples/snippets/common/VS_Snippets_CFX/custompolicysample/common/app.config deleted file mode 100644 index 6888d3744bba4..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/custompolicysample/common/app.config +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/custompolicysample/common/client.exe.config b/samples/snippets/common/VS_Snippets_CFX/custompolicysample/common/client.exe.config deleted file mode 100644 index aaed3fd978811..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/custompolicysample/common/client.exe.config +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/interceptors/common/client.exe.config b/samples/snippets/common/VS_Snippets_CFX/interceptors/common/client.exe.config deleted file mode 100644 index 72a148dd8ac54..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/interceptors/common/client.exe.config +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/interceptors/common/hostapplication.exe.config b/samples/snippets/common/VS_Snippets_CFX/interceptors/common/hostapplication.exe.config deleted file mode 100644 index 43841f362e474..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/interceptors/common/hostapplication.exe.config +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/snippets/common/VS_Snippets_CFX/sca.callbackcontract/common/client.exe.config b/samples/snippets/common/VS_Snippets_CFX/sca.callbackcontract/common/client.exe.config deleted file mode 100644 index 13216665b3b23..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/sca.callbackcontract/common/client.exe.config +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/sca.callbackcontract/common/hostapplication.exe.config b/samples/snippets/common/VS_Snippets_CFX/sca.callbackcontract/common/hostapplication.exe.config deleted file mode 100644 index cc68a958128a3..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/sca.callbackcontract/common/hostapplication.exe.config +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/snippets/common/VS_Snippets_CFX/sca.session/common/client.exe.config b/samples/snippets/common/VS_Snippets_CFX/sca.session/common/client.exe.config deleted file mode 100644 index 4001e8a8484d8..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/sca.session/common/client.exe.config +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/sca.session/common/hostapplication.exe.config b/samples/snippets/common/VS_Snippets_CFX/sca.session/common/hostapplication.exe.config deleted file mode 100644 index 19e04172f07da..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/sca.session/common/hostapplication.exe.config +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/snippets/common/VS_Snippets_CFX/servicethrottlingbehavior/common/client.exe.config b/samples/snippets/common/VS_Snippets_CFX/servicethrottlingbehavior/common/client.exe.config deleted file mode 100644 index 66eb8d5607ffa..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/servicethrottlingbehavior/common/client.exe.config +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/common/VS_Snippets_CFX/servicethrottlingbehavior/common/hostapplication.exe.config b/samples/snippets/common/VS_Snippets_CFX/servicethrottlingbehavior/common/hostapplication.exe.config deleted file mode 100644 index fe779174ca27f..0000000000000 --- a/samples/snippets/common/VS_Snippets_CFX/servicethrottlingbehavior/common/hostapplication.exe.config +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/common/client.exe.config b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/common/client.exe.config index 7f9e820add69a..1f632ce8f75f7 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/common/client.exe.config +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_configureclientbinding/common/client.exe.config @@ -1,4 +1,4 @@ -// + @@ -18,5 +18,4 @@ - -// \ No newline at end of file + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/app.config b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/app.config index a227b1d96fa2e..074c744aa1ff4 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/app.config +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/app.config @@ -1,6 +1,5 @@ -//This is the config for the topic: How to: Create a Custom Reliable Session Binding with HTTPS -// - + + @@ -26,5 +25,4 @@ - -// \ No newline at end of file + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/web.config b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/web.config index 2c96be4cac601..785bd88002dba 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/web.config +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_createreliablesessionhttps/common/web.config @@ -1,7 +1,7 @@ -//This is the config for the topic: How to: Create a Custom Reliable Session Binding with HTTPS -// + + @@ -32,5 +32,4 @@ - -// \ No newline at end of file + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/common/web.config b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/common/web.config index aa29c36ec3297..969672d458b63 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/common/web.config +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/common/web.config @@ -1,4 +1,4 @@ -// + @@ -21,4 +21,4 @@ -// \ No newline at end of file + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/common/app.config b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/common/app.config index 1ce9a5897f4bd..55f5068dda304 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/common/app.config +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostinwas/common/app.config @@ -1,5 +1,5 @@ -//This is the config for the topic: How to: Host a WCF Service in WAS -// + + @@ -20,4 +20,4 @@ -// \ No newline at end of file + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/app.config b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/app.config index 83506f4b91800..d6cfcec9083ce 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/app.config +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/app.config @@ -1,5 +1,5 @@ -//This is the config for the topic: HowTo Use Reliable Session -// + + @@ -29,4 +29,4 @@ -// \ No newline at end of file + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/web.config b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/web.config index 5628b25b9711f..c1b4dad2f2c0e 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/web.config +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_howto_usereliablesession/common/web.config @@ -36,4 +36,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_CFX/c_standalonedatacontractserializer/cs/source.cs b/samples/snippets/csharp/VS_Snippets_CFX/c_standalonedatacontractserializer/cs/source.cs index 4097f54e772ba..fdc364d1e3fb9 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/c_standalonedatacontractserializer/cs/source.cs +++ b/samples/snippets/csharp/VS_Snippets_CFX/c_standalonedatacontractserializer/cs/source.cs @@ -29,10 +29,10 @@ private void Run() { // DataContractSerializer dcs = new DataContractSerializer(typeof(Person)); - //This can now be used to serialize/deserialize Person but not PurchaseOrder. + // This can now be used to serialize/deserialize Person but not PurchaseOrder. // } - // + // [DataContract] public class LibraryPatron { @@ -42,26 +42,26 @@ public class LibraryPatron [DataContract] public class LibraryItem { - //code not shown + // Code not shown. } [DataContract] public class Book : LibraryItem { - //code not shown + // Code not shown. } [DataContract] public class Newspaper : LibraryItem { - //code not shown + // Code not shown. } // private void Run2() { // - //Create a serializer for the inherited types using the knownType parameter. + // Create a serializer for the inherited types using the knownType parameter. Type[] knownTypes = new Type[] { typeof(Book), typeof(Newspaper) }; DataContractSerializer dcs = new DataContractSerializer(typeof(LibraryPatron), knownTypes); @@ -135,7 +135,7 @@ public class Test private void Run() { // - //Construct a purchase order: + // Construct a purchase order: Address adr = new Address(); adr.street = "123 Main St."; PurchaseOrder po = new PurchaseOrder(); diff --git a/samples/snippets/csharp/VS_Snippets_CFX/sca.callbackcontract/cs/client.exe.config b/samples/snippets/csharp/VS_Snippets_CFX/sca.callbackcontract/cs/client.exe.config index 13216665b3b23..a8570556bfd54 100644 --- a/samples/snippets/csharp/VS_Snippets_CFX/sca.callbackcontract/cs/client.exe.config +++ b/samples/snippets/csharp/VS_Snippets_CFX/sca.callbackcontract/cs/client.exe.config @@ -18,7 +18,7 @@ - + - + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml b/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml new file mode 100644 index 0000000000000..c660f44eef4f8 --- /dev/null +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml.cs b/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml.cs new file mode 100644 index 0000000000000..d5ba3a32b1f69 --- /dev/null +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentials.xaml.cs @@ -0,0 +1,99 @@ +// +using System; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Security; +using NorthwindClient.Northwind; +using System.Data.Services.Client; + +namespace NorthwindClient +{ + public partial class ClientCredentials : Window + { + // Create the binding collections and the data service context. + private DataServiceCollection binding; + NorthwindEntities context; + CollectionViewSource customerAddressViewSource; + + // Instantiate the service URI and credentials. + Uri serviceUri = new Uri("http://localhost:12345/Northwind.svc/"); + NetworkCredential credentials = new NetworkCredential(); + + public ClientCredentials() + { + InitializeComponent(); + } + + private void ClientCredentials_Loaded(object sender, RoutedEventArgs e) + { + string userName = string.Empty; + string domain = string.Empty; + SecureString password = new SecureString(); + + // Get credentials for authentication. + LoginWindow login = new LoginWindow(); + login.ShowDialog(); + + if (login.DialogResult == true + && login.userNameBox.Text != string.Empty + && login.passwordBox.SecurePassword.Length != 0) + { + // Instantiate the context. + context = + new NorthwindEntities(serviceUri); + + // Get the user name and domain from the login. + string[] qualifiedUserName = login.userNameBox.Text.Split(new char[] { '\\' }); + if (qualifiedUserName.Length == 2) + { + domain = qualifiedUserName[0]; + userName = qualifiedUserName[1]; + } + else + { + userName = login.userNameBox.Text; + } + password = login.passwordBox.SecurePassword; + + // Set the client authentication credentials. + context.Credentials = + new NetworkCredential(userName, password, domain); + + + // Define an anonymous LINQ query that returns a collection of Customer types. + var query = from c in context.Customers + where c.Country == "Germany" + select c; + + try + { + // Instantiate the binding collection, which executes the query. + binding = new DataServiceCollection(query); + + while (binding.Continuation != null) + { + // Continue to execute the query until all pages are loaded. + binding.Load(context.Execute(binding.Continuation.NextLinkUri)); + } + + // Assign the binding collection to the CollectionViewSource. + customerAddressViewSource = + (CollectionViewSource)this.Resources["customerViewSource"]; + customerAddressViewSource.Source = binding; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + } + else if (login.DialogResult == false) + { + MessageBox.Show("Login cancelled."); + } + } + } +} +// \ No newline at end of file diff --git a/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentialslogin.xaml b/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentialslogin.xaml new file mode 100644 index 0000000000000..551e63e6853e7 --- /dev/null +++ b/samples/snippets/csharp/VS_Snippets_Misc/astoria northwind client/cs/clientcredentialslogin.xaml @@ -0,0 +1,26 @@ + + + + + + + + + + + + +