* fix: MD030/list-marker-space

Spaces after ordered list markers
Find: `^( *)(\d+)\.  `
Replace: `$1$2. `
Filter: *.md

* fix: MD030/list-marker-space

Spaces after asterisk markers
Find: `^( *)\*   `
Replace: `$1* `
Filter: *.md
Undid some from code blocks

* fix: MD030/list-marker-space

Spaces after list markers inside blockquotes
Find: `^( *)>( *)\-   `
Replace: `$1>$2- `
Filter: *.md

* fix: MD030/list-marker-space

Spaces after ordered list markers inside blockquotes
Find: `^( *)>( *)(\d+)\.  `
Replace: `$1>$2$3. `
Filter: *.md

* fix: MD030/list-marker-space

Manually fix remaning issues. Mainly orphan list markers
This commit is contained in:
Nick Schonning 2019-04-26 11:12:08 -04:00 коммит произвёл Bill Wagner
Родитель 296a071c36
Коммит 7c9ab60c0c
122 изменённых файлов: 970 добавлений и 969 удалений

Просмотреть файл

@ -66,11 +66,11 @@ Common properties include:
This is a list of assembly paths (delimited by ';' on Windows and ':' on Linux) which the runtime will be able to resolve by default. Some hosts have hard-coded manifests listing assemblies they can load. Others will put any library in certain locations (next to *coreclr.dll*, for example) on this list.
* `APP_PATHS`
This is a list of paths to probe in for an assembly if it can't be found in the trusted platform assemblies (TPA) list. Because the host has more control over which assemblies are loaded using the TPA list, it is a best practice for hosts to determine which assemblies they expect to load and list them explicitly. If probing at runtime is needed, however, this property can enable that scenario.
* `APP_NI_PATHS`
* `APP_NI_PATHS`
This list is similar to APP_PATHS except that it's meant to be paths that will be probed for native images.
* `NATIVE_DLL_SEARCH_DIRECTORIES`
* `NATIVE_DLL_SEARCH_DIRECTORIES`
This property is a list of paths the loader should probe when looking for native libraries called via p/invoke.
* `PLATFORM_RESOURCE_ROOTS`
* `PLATFORM_RESOURCE_ROOTS`
This list includes paths to probe in for resource satellite assemblies (in culture-specific sub-directories).
In this sample host, the TPA list is constructed by simply listing all libraries in the current directory:
@ -167,11 +167,11 @@ Common AppDomain properties include:
This is a list of assembly paths (delimited by `;` on Windows and `:` on Linux/Mac) which the AppDomain should prioritize loading and give full trust to (even in partially-trusted domains). This list is meant to contain 'Framework' assemblies and other trusted modules, similar to the GAC in .NET Framework scenarios. Some hosts will put any library next to *coreclr.dll* on this list, others have hard-coded manifests listing trusted assemblies for their purposes.
* `APP_PATHS`
This is a list of paths to probe in for an assembly if it can't be found in the trusted platform assemblies (TPA) list. Because the host has more control over which assemblies are loaded using the TPA list, it is a best practice for hosts to determine which assemblies they expect to load and list them explicitly. If probing at runtime is needed, however, this property can enable that scenario.
* `APP_NI_PATHS`
* `APP_NI_PATHS`
This list is very similar to APP_PATHS except that it's meant to be paths that will be probed for native images.
* `NATIVE_DLL_SEARCH_DIRECTORIES`
* `NATIVE_DLL_SEARCH_DIRECTORIES`
This property is a list of paths the loader should probe when looking for native DLLs called via p/invoke.
* `PLATFORM_RESOURCE_ROOTS`
* `PLATFORM_RESOURCE_ROOTS`
This list includes paths to probe in for resource satellite assemblies (in culture-specific sub-directories).
In our [simple sample host](https://github.com/dotnet/samples/tree/master/core/hosting/HostWithMscoree), these properties are set up as follows:

Просмотреть файл

@ -12,15 +12,15 @@ This example shows how to use friend assemblies with assemblies that have strong
2. Use the following sequence of commands with the Strong Name tool to generate a keyfile and to display its public key. For more information, see [Sn.exe (Strong Name Tool)](../../../../framework/tools/sn-exe-strong-name-tool.md).
1. Generate a strong-name key for this example and store it in the file FriendAssemblies.snk:
1. Generate a strong-name key for this example and store it in the file FriendAssemblies.snk:
`sn -k FriendAssemblies.snk`
2. Extract the public key from FriendAssemblies.snk and put it into FriendAssemblies.publickey:
2. Extract the public key from FriendAssemblies.snk and put it into FriendAssemblies.publickey:
`sn -p FriendAssemblies.snk FriendAssemblies.publickey`
3. Display the public key stored in the file FriendAssemblies.publickey:
3. Display the public key stored in the file FriendAssemblies.publickey:
`sn -tp FriendAssemblies.publickey`

Просмотреть файл

@ -8,7 +8,7 @@ Async methods can have the following return types:
- <xref:System.Threading.Tasks.Task%601>, for an async method that returns a value.
- <xref:System.Threading.Tasks.Task>, for an async method that performs an operation but returns no value.
- <xref:System.Threading.Tasks.Task>, for an async method that performs an operation but returns no value.
- `void`, for an event handler.

Просмотреть файл

@ -53,19 +53,19 @@ In the MainWindow.xaml.cs file of the project, make the following changes to the
- Add a `while` loop that performs the following steps for each task in the collection:
1. Awaits a call to `WhenAny` to identify the first task in the collection to finish its download.
1. Awaits a call to `WhenAny` to identify the first task in the collection to finish its download.
```csharp
Task<int> firstFinishedTask = await Task.WhenAny(downloadTasks);
```
2. Removes that task from the collection.
2. Removes that task from the collection.
```csharp
downloadTasks.Remove(firstFinishedTask);
```
3. Awaits `firstFinishedTask`, which is returned by a call to `ProcessURLAsync`. The `firstFinishedTask` variable is a <xref:System.Threading.Tasks.Task%601> where `TReturn` is an integer. The task is already complete, but you await it to retrieve the length of the downloaded website, as the following example shows.
3. Awaits `firstFinishedTask`, which is returned by a call to `ProcessURLAsync`. The `firstFinishedTask` variable is a <xref:System.Threading.Tasks.Task%601> where `TReturn` is an integer. The task is already complete, but you await it to retrieve the length of the downloaded website, as the following example shows.
```csharp
int length = await firstFinishedTask;
@ -224,4 +224,4 @@ namespace ProcessTasksAsTheyFinish
- <xref:System.Threading.Tasks.Task.WhenAny%2A>
- [Fine-Tuning Your Async Application (C#)](../../../../csharp/programming-guide/concepts/async/fine-tuning-your-async-application.md)
- [Asynchronous Programming with async and await (C#)](../../../../csharp/programming-guide/concepts/async/index.md)
- [Async Sample: Fine Tuning Your Application](https://code.msdn.microsoft.com/Async-Fine-Tuning-Your-a676abea)
- [Async Sample: Fine Tuning Your Application](https://code.msdn.microsoft.com/Async-Fine-Tuning-Your-a676abea)

Просмотреть файл

@ -45,19 +45,19 @@ public delegate void EventHandler(object sender, EventArgs e);
3. Declare the event in your publishing class by using one of the following steps.
1. If you have no custom EventArgs class, your Event type will be the non-generic EventHandler delegate. You do not have to declare the delegate because it is already declared in the <xref:System> namespace that is included when you create your C# project. Add the following code to your publisher class.
1. If you have no custom EventArgs class, your Event type will be the non-generic EventHandler delegate. You do not have to declare the delegate because it is already declared in the <xref:System> namespace that is included when you create your C# project. Add the following code to your publisher class.
```csharp
public event EventHandler RaiseCustomEvent;
```
2. If you are using the non-generic version of <xref:System.EventHandler> and you have a custom class derived from <xref:System.EventArgs>, declare your event inside your publishing class and use your delegate from step 2 as the type.
2. If you are using the non-generic version of <xref:System.EventHandler> and you have a custom class derived from <xref:System.EventArgs>, declare your event inside your publishing class and use your delegate from step 2 as the type.
```csharp
public event CustomEventHandler RaiseCustomEvent;
```
3. If you are using the generic version, you do not need a custom delegate. Instead, in your publishing class, you specify your event type as `EventHandler<CustomEventArgs>`, substituting the name of your own class between the angle brackets.
3. If you are using the generic version, you do not need a custom delegate. Instead, in your publishing class, you specify your event type as `EventHandler<CustomEventArgs>`, substituting the name of your own class between the angle brackets.
```csharp
public event EventHandler<CustomEventArgs> RaiseCustomEvent;

Просмотреть файл

@ -34,13 +34,13 @@ Starting with the [!INCLUDE[dnprdnshort](../../../../../includes/dnprdnshort-md.
2. Add an existing model to your application.
1. Add an empty model named `SchoolModel`. To create an empty model, see the [How to: Create a New .edmx File](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/cc716703(v=vs.100)) topic.
1. Add an empty model named `SchoolModel`. To create an empty model, see the [How to: Create a New .edmx File](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/cc716703(v=vs.100)) topic.
The SchoolModel.edmx file is added to your project.
1. Copy the conceptual, storage, and mapping content for the School model from the [School Model](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb896300(v=vs.100)) topic.
1. Copy the conceptual, storage, and mapping content for the School model from the [School Model](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb896300(v=vs.100)) topic.
2. Open the SchoolModel.edmx file and paste the content within the `edmx:Runtime` tags.
2. Open the SchoolModel.edmx file and paste the content within the `edmx:Runtime` tags.
3. Add the following code to your main function. The code initializes the connection string to your database server, views the DDL script, creates the database, adds a new entity to the context, and saves the changes to the database.

Просмотреть файл

@ -113,13 +113,13 @@ To create a package:
7. On the **Program** page of the **Create Package and Program Wizard**, enter the following information:
1. **Name:** `.NET Framework 4.5`
1. **Name:** `.NET Framework 4.5`
2. **Command line:** `dotNetFx45_Full_x86_x64.exe /q /norestart /ChainingPackage ADMINDEPLOYMENT` (command-line options are described in the table after these steps)
2. **Command line:** `dotNetFx45_Full_x86_x64.exe /q /norestart /ChainingPackage ADMINDEPLOYMENT` (command-line options are described in the table after these steps)
3. **Run:** Choose **Hidden**.
3. **Run:** Choose **Hidden**.
4. **Program can run:** Choose the option that specifies that the program can run regardless of whether a user is logged on.
4. **Program can run:** Choose the option that specifies that the program can run regardless of whether a user is logged on.
8. On the **Requirements** page, choose **Next** to accept the default values, and then complete the wizard.

Просмотреть файл

@ -45,11 +45,11 @@ To successfully deploy your .NET Framework application, you must understand how
4. [Probes for the assembly](#step4) using the following steps:
1. If configuration and publisher policy do not affect the original reference and if the bind request was created using the <xref:System.Reflection.Assembly.LoadFrom%2A?displayProperty=nameWithType> method, the runtime checks for location hints.
1. If configuration and publisher policy do not affect the original reference and if the bind request was created using the <xref:System.Reflection.Assembly.LoadFrom%2A?displayProperty=nameWithType> method, the runtime checks for location hints.
2. If a codebase is found in the configuration files, the runtime checks only this location. If this probe fails, the runtime determines that the binding request failed and no other probing occurs.
2. If a codebase is found in the configuration files, the runtime checks only this location. If this probe fails, the runtime determines that the binding request failed and no other probing occurs.
3. Probes for the assembly using the heuristics described in the [probing section](#step4). If the assembly is not found after probing, the runtime requests the Windows Installer to provide the assembly. This acts as an install-on-demand feature.
3. Probes for the assembly using the heuristics described in the [probing section](#step4). If the assembly is not found after probing, the runtime requests the Windows Installer to provide the assembly. This acts as an install-on-demand feature.
> [!NOTE]
> There is no version checking for assemblies without strong names, nor does the runtime check in the global assembly cache for assemblies without strong names.

Просмотреть файл

@ -21,13 +21,13 @@ In some cases, when an app uses two or more app domains with different applicati
5. If the configuration system has not already been initialized, it must complete its initialization. This means, among other things, that the runtime has to create a stable path for a configuration system, which it does as follows:
1. It looks for evidence for the non-default app domain.
1. It looks for evidence for the non-default app domain.
2. It tries to calculate the evidence for the non-default app domain based on the default app domain.
2. It tries to calculate the evidence for the non-default app domain based on the default app domain.
3. The call to get evidence for the default app domain triggers a cross-app domain call from the non-default app domain to the default app domain.
3. The call to get evidence for the default app domain triggers a cross-app domain call from the non-default app domain to the default app domain.
4. As part of the cross-app domain contract in the .NET Framework, the contents of the logical call context also have to be marshaled across app domain boundaries.
4. As part of the cross-app domain contract in the .NET Framework, the contents of the logical call context also have to be marshaled across app domain boundaries.
6. Because the types that are in the logical call context cannot be resolved in the default app domain, an exception is thrown.

Просмотреть файл

@ -45,7 +45,7 @@ In practice, this compatibility can be broken by seemingly inconsequential chang
If your app or component doesn't work as expected on the .NET Framework 4.5 (including its point releases, the .NET Framework 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, or 4.8), use the following checklists:
- If your app was developed to run on any version of the .NET Framework starting with the .NET Framework 4.0, see [Application Compatibility in the .NET Framework](application-compatibility.md) to generate lists of changes between your targeted .NET Framework version and the version on which your app is running.
- If your app was developed to run on any version of the .NET Framework starting with the .NET Framework 4.0, see [Application Compatibility in the .NET Framework](application-compatibility.md) to generate lists of changes between your targeted .NET Framework version and the version on which your app is running.
- If you have a .NET Framework 3.5 app, also see [.NET Framework 4 Migration Issues](../migration-guide/net-framework-4-migration-issues.md).

Просмотреть файл

@ -4,64 +4,57 @@ ms.date: "03/30/2017"
ms.assetid: d23b1a64-2e08-4014-882a-c1dd766bdcc2
---
# Peer-to-Peer Networking Scenarios
Peer-to-peer networking enables or enhances the following scenarios:
## Real-Time Communications (RTC)
- Serverless Instant Messaging
RTC exists today. Computer users can chat and have voice or video conversations with their peers today. However, many of the existing programs and their communications protocols rely on servers to function. If you are participating in an ad-hoc wireless network or are a part of an isolated network, you are unable to use these RTC facilities. Peer-to-peer technology allows the extension of RTC technologies to these additional networking environments.
- Real-time matchmaking and gameplay
Similar to RTC, real-time game play exists today. There are many Web-based game sites that cater to the gaming community via the Internet. They offer the ability to find other gamers with similar interests and play a game together. The problem is that the game sites exist only on the Internet and are geared toward the avid gamer who wants to play against the best gamers in the world. These sites track and provide the statistics to help in the process. However, these sites do not allow a gamer to set up an ad-hoc game among friends in a variety of networking environments. Peer-to-peer networking can provide this capability.
## Collaboration
- Project workspaces solving a goal
Shared workspace applications allow for the creation of ad-hoc workgroups and then allow the workgroup owners to populate the shared workspace with the tools and content that will allow the group to solve a problem. This could include message boards, productivity tools, and files.
- Sharing files with others
A subset of project workspace sharing is the ability to share files. Although this ability exists today with the current version of Windows, it can be enhanced through peer-to-peer networking to make file content available in an easy and friendly way. Allowing easy access to the incredible wealth of content at the edge of the Internet or in ad-hoc computing environments increases the value of network computing.
- Sharing experiences
With wireless connectivity becoming more prevalent, peer-to-peer networking allows you to be online in a group of peers and to be able to share your experiences (such as a sunset, a rock concert, or a vacation cruise) while they are occurring.
## Content Distribution
- Text messages
Peer-to-peer networking can allow for the dissemination of text-based information in the form of files or messages to a large group of users. An example is a news list.
-
- Audio and video
Peer-to-peer networking can also allow for the dissemination of audio or video information to a large group of users, such as a large concert or company meeting. To distribute the content today, you must configure high-capacity servers to collect and distribute the load to hundreds or thousands of users. With peer-to-peer networking, only a handful of peers would actually get their content from the centralized servers. These peers would flood this information out to a few more people who send it to others, and so on. The load of distributing the content is distributed to the peers in the cloud. A peer that wants to receive the content would find the closest distributing peer and get the content from them.
-
- Distribution of product updates
Peer-to-peer networking can also provide an efficient mechanism to distribute software such as product updates (security updates and service packs). A peer that has a connection to a software distribution server can obtain the product update and propagate it to the other members of its group.
-
## Distributed Processing
- Division and distribution of a task
A large computing task can first be divided into separate smaller computing tasks well suited to the computing resources of a peer. A peer could do the dividing of the large computing task. Then, peer-to-peer networking can distribute the individual tasks to the separate peers in the group. Each peer performs its computing task and reports its result back to a centralized accumulation point.
- Aggregation of computer resources
Another way to utilize peer-to-peer networking for distributed processing is to run programs on each peer that run during idle processor times and are part of a larger computing task that is coordinated by a central server. By aggregating the processors of multiple computers, peer-to-peer networking can turn a group of peer computers into a large parallel processor for large computing tasks.
-
Peer-to-peer networking enables or enhances the following scenarios:
## Real-Time Communications (RTC)
- Serverless Instant Messaging
RTC exists today. Computer users can chat and have voice or video conversations with their peers today. However, many of the existing programs and their communications protocols rely on servers to function. If you are participating in an ad-hoc wireless network or are a part of an isolated network, you are unable to use these RTC facilities. Peer-to-peer technology allows the extension of RTC technologies to these additional networking environments.
- Real-time matchmaking and gameplay
Similar to RTC, real-time game play exists today. There are many Web-based game sites that cater to the gaming community via the Internet. They offer the ability to find other gamers with similar interests and play a game together. The problem is that the game sites exist only on the Internet and are geared toward the avid gamer who wants to play against the best gamers in the world. These sites track and provide the statistics to help in the process. However, these sites do not allow a gamer to set up an ad-hoc game among friends in a variety of networking environments. Peer-to-peer networking can provide this capability.
## Collaboration
- Project workspaces solving a goal
Shared workspace applications allow for the creation of ad-hoc workgroups and then allow the workgroup owners to populate the shared workspace with the tools and content that will allow the group to solve a problem. This could include message boards, productivity tools, and files.
- Sharing files with others
A subset of project workspace sharing is the ability to share files. Although this ability exists today with the current version of Windows, it can be enhanced through peer-to-peer networking to make file content available in an easy and friendly way. Allowing easy access to the incredible wealth of content at the edge of the Internet or in ad-hoc computing environments increases the value of network computing.
- Sharing experiences
With wireless connectivity becoming more prevalent, peer-to-peer networking allows you to be online in a group of peers and to be able to share your experiences (such as a sunset, a rock concert, or a vacation cruise) while they are occurring.
## Content Distribution
- Text messages
Peer-to-peer networking can allow for the dissemination of text-based information in the form of files or messages to a large group of users. An example is a news list.
- Audio and video
Peer-to-peer networking can also allow for the dissemination of audio or video information to a large group of users, such as a large concert or company meeting. To distribute the content today, you must configure high-capacity servers to collect and distribute the load to hundreds or thousands of users. With peer-to-peer networking, only a handful of peers would actually get their content from the centralized servers. These peers would flood this information out to a few more people who send it to others, and so on. The load of distributing the content is distributed to the peers in the cloud. A peer that wants to receive the content would find the closest distributing peer and get the content from them.
- Distribution of product updates
Peer-to-peer networking can also provide an efficient mechanism to distribute software such as product updates (security updates and service packs). A peer that has a connection to a software distribution server can obtain the product update and propagate it to the other members of its group.
## Distributed Processing
- Division and distribution of a task
A large computing task can first be divided into separate smaller computing tasks well suited to the computing resources of a peer. A peer could do the dividing of the large computing task. Then, peer-to-peer networking can distribute the individual tasks to the separate peers in the group. Each peer performs its computing task and reports its result back to a centralized accumulation point.
- Aggregation of computer resources
Another way to utilize peer-to-peer networking for distributed processing is to run programs on each peer that run during idle processor times and are part of a larger computing task that is coordinated by a central server. By aggregating the processors of multiple computers, peer-to-peer networking can turn a group of peer computers into a large parallel processor for large computing tasks.
## See also
- <xref:System.Net.PeerToPeer.Collaboration>

Просмотреть файл

@ -47,13 +47,13 @@ A constrained execution region (CER) is part of a mechanism for authoring reliab
- <xref:System.Runtime.ConstrainedExecution.Cer.None>. The method, type, or assembly has no concept of a CER and is most likely not safe to call within a CER without substantial mitigation from state corruption. It does not take advantage of CER guarantees. This implies the following:
1. Under exceptional conditions the method might fail.
1. Under exceptional conditions the method might fail.
2. The method might or might not report that it failed.
2. The method might or might not report that it failed.
3. The method is not written to use a CER, the most likely scenario.
3. The method is not written to use a CER, the most likely scenario.
4. If a method, type, or assembly is not explicitly identified to succeed, it is implicitly identified as <xref:System.Runtime.ConstrainedExecution.Cer.None>.
4. If a method, type, or assembly is not explicitly identified to succeed, it is implicitly identified as <xref:System.Runtime.ConstrainedExecution.Cer.None>.
- <xref:System.Runtime.ConstrainedExecution.Cer.Success>. Under exceptional conditions, the method is guaranteed to succeed. To achieve this level of reliability you should always construct a CER around the method that is called, even when it is called from within a non-CER region. A method is successful if it accomplishes what is intended, although success can be viewed subjectively. For example, marking Count with `ReliabilityContractAttribute(Cer.Success)` implies that when it is run under a CER, it always returns a count of the number of elements in the <xref:System.Collections.ArrayList> and it can never leave the internal fields in an undetermined state. However, the <xref:System.Threading.Interlocked.CompareExchange%2A> method is marked as success as well, with the understanding that success may mean the value could not be replaced with a new value due to a race condition. The key point is that the method behaves in the way it is documented to behave, and CER code does not need to be written to expect any unusual behavior beyond what correct but unreliable code would look like.

Просмотреть файл

@ -71,9 +71,9 @@ HRESULT CorBindToRuntime (
2. By changing the process default mode to the version 1 compatibility mode, where the <xref:System.Security.Principal.WindowsIdentity> object does not flow across any asynchronous point, regardless of the <xref:System.Threading.ExecutionContext> settings on the current thread. How you change the default mode depends on whether you use a managed executable or an unmanaged hosting interface to load the CLR:
1. For managed executables, you must set the `enabled` attribute of the [\<legacyImpersonationPolicy>](../../../../docs/framework/configure-apps/file-schema/runtime/legacyimpersonationpolicy-element.md) element to `true`.
1. For managed executables, you must set the `enabled` attribute of the [\<legacyImpersonationPolicy>](../../../../docs/framework/configure-apps/file-schema/runtime/legacyimpersonationpolicy-element.md) element to `true`.
2. For unmanaged hosting interfaces, set the `STARTUP_LEGACY_IMPERSONATION` flag in the `flags` parameter when calling the `CorBindToRuntimeEx` function.
2. For unmanaged hosting interfaces, set the `STARTUP_LEGACY_IMPERSONATION` flag in the `flags` parameter when calling the `CorBindToRuntimeEx` function.
The version 1 compatibility mode applies to the entire process and to all the application domains in the process.

Просмотреть файл

@ -118,9 +118,9 @@ HRESULT CorBindToRuntimeEx (
2. By changing the process default mode to the version 1 compatibility mode, where the <xref:System.Security.Principal.WindowsIdentity> object does not flow across any asynchronous point, regardless of the <xref:System.Threading.ExecutionContext> settings on the current thread. How you change the default mode depends on whether you use a managed executable or an unmanaged hosting interface to load the CLR:
1. For managed executables, you must set the `enabled` attribute of the [\<legacyImpersonationPolicy>](../../../../docs/framework/configure-apps/file-schema/runtime/legacyimpersonationpolicy-element.md) element to `true`.
1. For managed executables, you must set the `enabled` attribute of the [\<legacyImpersonationPolicy>](../../../../docs/framework/configure-apps/file-schema/runtime/legacyimpersonationpolicy-element.md) element to `true`.
2. For unmanaged hosting interfaces, set the `STARTUP_LEGACY_IMPERSONATION` flag in the `startupFlags` parameter when calling the `CorBindToRuntimeEx` function.
2. For unmanaged hosting interfaces, set the `STARTUP_LEGACY_IMPERSONATION` flag in the `startupFlags` parameter when calling the `CorBindToRuntimeEx` function.
The version 1 compatibility mode applies to the entire process and to all the application domains in the process.

Просмотреть файл

@ -60,11 +60,11 @@ This topic lists the best practices for creating data contracts that can evolve
8. In later versions, new data members can be added. They should always follow these rules:
1. The <xref:System.Runtime.Serialization.DataMemberAttribute.IsRequired%2A> property should always be left at its default value of `false`.
1. The <xref:System.Runtime.Serialization.DataMemberAttribute.IsRequired%2A> property should always be left at its default value of `false`.
2. If a default value of `null` or zero for the member is unacceptable, a callback method should be provided using the <xref:System.Runtime.Serialization.OnDeserializingAttribute> to provide a reasonable default in case the member is not present in the incoming stream. For more information about the callback, see [Version-Tolerant Serialization Callbacks](../../../docs/framework/wcf/feature-details/version-tolerant-serialization-callbacks.md).
2. If a default value of `null` or zero for the member is unacceptable, a callback method should be provided using the <xref:System.Runtime.Serialization.OnDeserializingAttribute> to provide a reasonable default in case the member is not present in the incoming stream. For more information about the callback, see [Version-Tolerant Serialization Callbacks](../../../docs/framework/wcf/feature-details/version-tolerant-serialization-callbacks.md).
3. The <xref:System.Runtime.Serialization.DataMemberAttribute.Order?displayProperty=nameWithType> property should be used to make sure that all of the newly added data members appear after the existing data members. The recommended way of doing this is as follows: None of the data members in the first version of the data contract should have their `Order` property set. All of the data members added in version 2 of the data contract should have their `Order` property set to 2. All of the data members added in version 3 of the data contract should have their `Order` set to 3, and so on. It is permissible to have more than one data member set to the same `Order` number.
3. The <xref:System.Runtime.Serialization.DataMemberAttribute.Order?displayProperty=nameWithType> property should be used to make sure that all of the newly added data members appear after the existing data members. The recommended way of doing this is as follows: None of the data members in the first version of the data contract should have their `Order` property set. All of the data members added in version 2 of the data contract should have their `Order` property set to 2. All of the data members added in version 3 of the data contract should have their `Order` set to 3, and so on. It is permissible to have more than one data member set to the same `Order` number.
9. Do not remove data members in later versions, even if the <xref:System.Runtime.Serialization.DataMemberAttribute.IsRequired%2A> property was left at its default property of `false` in prior versions.

Просмотреть файл

@ -4,200 +4,207 @@ ms.date: "03/30/2017"
ms.assetid: 05d2321c-8acb-49d7-a6cd-8ef2220c6775
---
# Using Service Trace Viewer for Viewing Correlated Traces and Troubleshooting
This topic describes the format of trace data, how to view it, and approaches that use the Service Trace Viewer to troubleshoot your application.
## Using the Service Trace Viewer Tool
The Windows Communication Foundation (WCF) Service Trace Viewer tool helps you correlate diagnostic traces produced by WCF listeners to locate the root cause of an error. The tool gives you a way to easily view, group, and filter traces so that you can diagnose, repair and verify issues with WCF services. For more information about using this tool, see [Service Trace Viewer Tool (SvcTraceViewer.exe)](../../../../../docs/framework/wcf/service-trace-viewer-tool-svctraceviewer-exe.md).
This topic contains screenshots of traces generated by running the [Tracing and Message Logging](../../../../../docs/framework/wcf/samples/tracing-and-message-logging.md) sample, when viewed using the [Service Trace Viewer Tool (SvcTraceViewer.exe)](../../../../../docs/framework/wcf/service-trace-viewer-tool-svctraceviewer-exe.md). This topic demonstrates how to understand trace content, activities and their correlation, and how to analyze large numbers of traces when troubleshooting.
## Viewing Trace Content
A trace event contains the following most significant information:
- Activity name when set.
- Emission time.
- Trace level.
- Trace source name.
- Process name.
- Thread id.
- A unique trace identifier, which is a URL that points to a destination in Microsoft Docs, from which you can obtain more information related to the trace.
All of these can be seen in the upper right panel in the Service Trace Viewer, or in the **Basic Information** section in the formatted view of the lower-right panel when selecting a trace.
This topic describes the format of trace data, how to view it, and approaches that use the Service Trace Viewer to troubleshoot your application.
## Using the Service Trace Viewer Tool
The Windows Communication Foundation (WCF) Service Trace Viewer tool helps you correlate diagnostic traces produced by WCF listeners to locate the root cause of an error. The tool gives you a way to easily view, group, and filter traces so that you can diagnose, repair and verify issues with WCF services. For more information about using this tool, see [Service Trace Viewer Tool (SvcTraceViewer.exe)](../../../../../docs/framework/wcf/service-trace-viewer-tool-svctraceviewer-exe.md).
This topic contains screenshots of traces generated by running the [Tracing and Message Logging](../../../../../docs/framework/wcf/samples/tracing-and-message-logging.md) sample, when viewed using the [Service Trace Viewer Tool (SvcTraceViewer.exe)](../../../../../docs/framework/wcf/service-trace-viewer-tool-svctraceviewer-exe.md). This topic demonstrates how to understand trace content, activities and their correlation, and how to analyze large numbers of traces when troubleshooting.
## Viewing Trace Content
A trace event contains the following most significant information:
- Activity name when set.
- Emission time.
- Trace level.
- Trace source name.
- Process name.
- Thread id.
- A unique trace identifier, which is a URL that points to a destination in Microsoft Docs, from which you can obtain more information related to the trace.
All of these can be seen in the upper right panel in the Service Trace Viewer, or in the **Basic Information** section in the formatted view of the lower-right panel when selecting a trace.
> [!NOTE]
> If the client and the service are on the same machine, the traces for both applications will be present. These can be filtered using the **Process Name** column.
In addition, the formatted view also provides a description for the trace and additional detailed information when available. The latter can include exception type and message, call stacks, message action, from/to fields, and other exception information.
In the XML view, useful xml tags include the following:
- `<SubType>` (trace level).
- `<TimeCreated>`.
- `<Source>` (trace source name).
- `<Correlation>` (activity id set when emitting the trace).
- `<Execution>` (process and thread id).
- `<Computer>`.
- `<ExtendedData>`, including `<Action>`, `<MessageID>` and the `<ActivityId>` set in the message header when sending a message.
If you examine the "Sent a message over a channel" trace, you may see the following content.
```xml
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>262163</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2006-08-04T18:45:30.8491051Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{27c6331d-8998-43aa-a382-03239013a6bd}"/>
<Execution ProcessName="client" ProcessID="1808" ThreadID="1" />
<Channel />
<Computer>TEST1</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/library/System.ServiceModel.Channels.MessageSent.aspx</TraceIdentifier>
<Description>Sent a message over a channel.</Description>
<AppDomain>client.exe</AppDomain>
<Source>System.ServiceModel.Channels.ClientFramingDuplexSessionChannel/35191196</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTransmitTraceRecord">
<MessageProperties>
<AllowOutputBatching>False</AllowOutputBatching>
</MessageProperties>
<MessageHeaders>
<Action d4p1:mustUnderstand="1" xmlns:d4p1="http://www.w3.org/2003/05/soap-envelope" xmlns="http://www.w3.org/2005/08/addressing">http://Microsoft.ServiceModel.Samples/ICalculator/Multiply</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:7c6670d8-4c9c-496e-b6a0-2ceb6db35338</MessageID>
<ActivityId CorrelationId="b02e2189-0816-4387-980c-dd8e306440f5" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">27c6331d-8998-43aa-a382-03239013a6bd</ActivityId>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
<To d4p1:mustUnderstand="1" xmlns:d4p1="http://www.w3.org/2003/05/soap-envelope" xmlns="http://www.w3.org/2005/08/addressing">net.tcp://localhost/servicemodelsamples/service</To>
</MessageHeaders>
<RemoteAddress>net.tcp://localhost/servicemodelsamples/service</RemoteAddress>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
```
## ServiceModel E2E Tracing
When the `System.ServiceModel` trace source is set with a `switchValue` other than Off, and `ActivityTracing`, WCF creates activities and transfers for WCF processing.
An activity is a logical unit of processing that groups all traces related to that processing unit. For example, you can define one activity for each request. Transfers create a causal relationship between activities within endpoints. Propagating the activity ID enables you to relate activities across endpoints. This can be done by setting `propagateActivity`=`true` in configuration at every endpoint. Activities, transfers, and propagation allow you to perform error correlation. In this way, you can find the root cause of an error more quickly.
On the client, one WCF activity is created for each object model call (for example, Open ChannelFactory, Add, Divide, and so on.) Each of the operation calls is processed in a "Process Action" activity.
In the following screenshot, extracted from the [Tracing and Message Logging](../../../../../docs/framework/wcf/samples/tracing-and-message-logging.md) sample the left panel displays the list of activities created in the client process, sorted by creation time. The following is a chronological list of activities:
- Constructed the channel factory (ClientBase).
- Opened the channel factory.
- Processed the Add action.
- Set up the Secure Session (this OCCURRED on the first request) and processed three security infrastructure response messages: RST, RSTR, SCT (Process message 1, 2, 3).
- Processed the Subtract, Multiply, and Divide requests.
- Closed the channel factory, and doing so closed the Secure session and processed the security message response Cancel.
We see the security infrastructure messages because of the wsHttpBinding.
> If the client and the service are on the same machine, the traces for both applications will be present. These can be filtered using the **Process Name** column.
In addition, the formatted view also provides a description for the trace and additional detailed information when available. The latter can include exception type and message, call stacks, message action, from/to fields, and other exception information.
In the XML view, useful xml tags include the following:
- `<SubType>` (trace level).
- `<TimeCreated>`.
- `<Source>` (trace source name).
- `<Correlation>` (activity id set when emitting the trace).
- `<Execution>` (process and thread id).
- `<Computer>`.
- `<ExtendedData>`, including `<Action>`, `<MessageID>` and the `<ActivityId>` set in the message header when sending a message.
If you examine the "Sent a message over a channel" trace, you may see the following content.
```xml
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>262163</EventID>
<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2006-08-04T18:45:30.8491051Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{27c6331d-8998-43aa-a382-03239013a6bd}"/>
<Execution ProcessName="client" ProcessID="1808" ThreadID="1" />
<Channel />
<Computer>TEST1</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information">
<TraceIdentifier>http://msdn.microsoft.com/library/System.ServiceModel.Channels.MessageSent.aspx</TraceIdentifier>
<Description>Sent a message over a channel.</Description>
<AppDomain>client.exe</AppDomain>
<Source>System.ServiceModel.Channels.ClientFramingDuplexSessionChannel/35191196</Source>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTransmitTraceRecord">
<MessageProperties>
<AllowOutputBatching>False</AllowOutputBatching>
</MessageProperties>
<MessageHeaders>
<Action d4p1:mustUnderstand="1" xmlns:d4p1="http://www.w3.org/2003/05/soap-envelope" xmlns="http://www.w3.org/2005/08/addressing">http://Microsoft.ServiceModel.Samples/ICalculator/Multiply</Action>
<MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:7c6670d8-4c9c-496e-b6a0-2ceb6db35338</MessageID>
<ActivityId CorrelationId="b02e2189-0816-4387-980c-dd8e306440f5" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">27c6331d-8998-43aa-a382-03239013a6bd</ActivityId>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
<To d4p1:mustUnderstand="1" xmlns:d4p1="http://www.w3.org/2003/05/soap-envelope" xmlns="http://www.w3.org/2005/08/addressing">net.tcp://localhost/servicemodelsamples/service</To>
</MessageHeaders>
<RemoteAddress>net.tcp://localhost/servicemodelsamples/service</RemoteAddress>
</ExtendedData>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
```
## ServiceModel E2E Tracing
When the `System.ServiceModel` trace source is set with a `switchValue` other than Off, and `ActivityTracing`, WCF creates activities and transfers for WCF processing.
An activity is a logical unit of processing that groups all traces related to that processing unit. For example, you can define one activity for each request. Transfers create a causal relationship between activities within endpoints. Propagating the activity ID enables you to relate activities across endpoints. This can be done by setting `propagateActivity`=`true` in configuration at every endpoint. Activities, transfers, and propagation allow you to perform error correlation. In this way, you can find the root cause of an error more quickly.
On the client, one WCF activity is created for each object model call (for example, Open ChannelFactory, Add, Divide, and so on.) Each of the operation calls is processed in a "Process Action" activity.
In the following screenshot, extracted from the [Tracing and Message Logging](../../../../../docs/framework/wcf/samples/tracing-and-message-logging.md) sample the left panel displays the list of activities created in the client process, sorted by creation time. The following is a chronological list of activities:
- Constructed the channel factory (ClientBase).
- Opened the channel factory.
- Processed the Add action.
- Set up the Secure Session (this OCCURRED on the first request) and processed three security infrastructure response messages: RST, RSTR, SCT (Process message 1, 2, 3).
- Processed the Subtract, Multiply, and Divide requests.
- Closed the channel factory, and doing so closed the Secure session and processed the security message response Cancel.
We see the security infrastructure messages because of the wsHttpBinding.
> [!NOTE]
> In WCF, we show response messages being processed initially in a separate activity (Process message) before we correlate them to the corresponding Process Action activity that includes the request message, through a transfer. This happens for infrastructure messages and asynchronous requests and is due to the fact that we must inspect the message, read the activityId header, and identify the existing Process Action activity with that id to correlate to it. For synchronous requests, we are blocking for the response and hence know which Process action the response relates to.
> In WCF, we show response messages being processed initially in a separate activity (Process message) before we correlate them to the corresponding Process Action activity that includes the request message, through a transfer. This happens for infrastructure messages and asynchronous requests and is due to the fact that we must inspect the message, read the activityId header, and identify the existing Process Action activity with that id to correlate to it. For synchronous requests, we are blocking for the response and hence know which Process action the response relates to.
The following image shows WCF client activities listed by creation time (left panel) and their nested activities and traces (upper right panel):
![Screenshot showing WCF client activities listed by creation time.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-client-activities-creation-time.gif)
When we select an activity in the left panel, we can see nested activities and traces on the upper right panel. Therefore, this is a reduced hierarchical view of the list of activities on the left, based on the selected parent activity. Because the selected Process action Add is the first request made, this activity contains the Set Up Secure Session activity (transfer to, transfer back from), and traces for the actual processing of the Add action.
If we double click the Process action Add activity in the left panel, we can see a graphical representation of the client WCF activities related to Add. The first activity on the left is the root activity (0000), which is the default activity. WCF transfers out of the ambient activity. If this is not defined, WCF transfers out of 0000. Here, the second activity, Process Action Add, transfers out of 0. Then we see Setup Secure Session.
![Screenshot showing WCF client activities listed by creation time.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-client-activities-creation-time.gif)
The following image shows a graph view of WCF client activities, specifically Ambient Activity (here 0), Process action, and Set Up Secure Session:
When we select an activity in the left panel, we can see nested activities and traces on the upper right panel. Therefore, this is a reduced hierarchical view of the list of activities on the left, based on the selected parent activity. Because the selected Process action Add is the first request made, this activity contains the Set Up Secure Session activity (transfer to, transfer back from), and traces for the actual processing of the Add action.
![Graph in the Trace Viewer showing Ambient Activity and Process action.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-activities-graph-ambient-process.gif)
On the upper right panel, we can see all traces related to the Process Action Add activity. Specifically, we have sent the request message ("Sent a message over a channel") and received the response ("Received a message over a channel") in the same activity. This is shown in the following graph. For clarity, the Set up Secure Session activity is collapsed in the graph.
The following image shows a list of traces for the Process Action activity. We send the request and receive the response in the same activity.
![Screenshot of Trace Viewer showing a list of traces for the Process Action activity](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/process-action-traces.gif)
Here, we load client traces only for clarity, but service traces (request message received and response message sent) appear in the same activity if they are also loaded in the tool and `propagateActivity` was set to `true.` This is shown in a later illustration.
On the service, the activity model maps to the WCF concepts as follows:
1. We construct and open a ServiceHost (this may create several host-related activities, for instance, in the case of security).
2. We create a Listen At activity for each listener in the ServiceHost (with transfers in and out of Open ServiceHost).
3. When the listener detects a communication request initiated by the client, it transfers to a "Receive Bytes" activity, in which all bytes sent from the client are processed. In this activity, we can see any connection errors that have happened during the client-service interaction.
4. For each set of bytes that is received that corresponds to a message, we process these bytes in a "Process Message" activity, where we create the WCF Message object. In this activity, we see errors related to a bad envelope or a malformed message.
5. Once the message is formed, we transfer to a Process Action activity. If `propagateActivity` is set to `true` on both the client and service, this activity has the same id as the one defined in the client, and described previously. From this stage we start to benefit from direct correlation across endpoints, because all traces emitted in WCF that are related to the request are in that same activity, including the response message processing.
6. For out-of-process action, we create an "Execute user code" activity to isolate traces emitted in user code from the ones emitted in WCF. In the preceding example, the "Service sends Add response" trace is emitted in the "Execute User code" activity not in the activity propagated by the client, if applicable.
In the illustration that follows, the first activity on the left is the root activity (0000), which is the default activity. The next three activities are to open the ServiceHost. The activity in column 5 is the listener, and the remaining activities (6 to 8) describe the WCF processing of a message, from bytes processing to user code activation.
If we double click the Process action Add activity in the left panel, we can see a graphical representation of the client WCF activities related to Add. The first activity on the left is the root activity (0000), which is the default activity. WCF transfers out of the ambient activity. If this is not defined, WCF transfers out of 0000. Here, the second activity, Process Action Add, transfers out of 0. Then we see Setup Secure Session.
The following image shows a graph view of WCF service activities:
The following image shows a graph view of WCF client activities, specifically Ambient Activity (here 0), Process action, and Set Up Secure Session:
![Screenshot of Trace Viewer showing a list of WCF service activities](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-service-activities.gif)
![Graph in the Trace Viewer showing Ambient Activity and Process action.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-activities-graph-ambient-process.gif)
The following screenshot shows the activities for both the client and service, and highlights the Process Action Add activity across processes (orange). Arrows relate the request and response messages sent and received by the client and service. The traces of Process Action are separated across processes in the graph, but shown as part of the same activity in the upper-right panel. In this panel, we can see client traces for sent messages followed by service traces for received and processed messages.
The following images shows a graph view of both WCF client and service activities
![Graph from Trace Viewer that shows both WCF client and service activities.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-client-service-activities.gif)
In the following error scenario, error and warning traces at the service and client are related. An exception is first thrown in user code on the service (right-most green activity that includes a warning trace for the exception "The service cannot process this request in user code."). When the response is sent to the client, a warning trace is again emitted to denote the fault message (left pink activity). The client then closes its WCF client (yellow activity on the lower-left side), which aborts the connection to the service. The service throws an error (longest pink activity on the right).
![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/wcfc-e2etrace9s.gif "wcfc_e2etrace9s")
Error correlation across the service and client
The sample used to generate these traces is a series of synchronous requests using the wsHttpBinding. There are deviations from this graph for scenarios without security, or with asynchronous requests, where the Process Action activity encompasses the begin and end operations that constitute the asynchronous call, and shows transfers to a callback activity. For more information about additional scenarios, see [End-To-End Tracing Scenarios](../../../../../docs/framework/wcf/diagnostics/tracing/end-to-end-tracing-scenarios.md).
## Troubleshooting Using the Service Trace Viewer
When you load trace files in the Service Trace Viewer Tool, you can select any red or yellow activity on the left panel to track down the cause of a problem in your application. The 000 activity typically has unhandled exceptions that bubble up to the user.
The following image shows how to select a red or yellow activity to locate the root of a problem.
![Screenshot of red or yellow activities for locating the root of a problem.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/service-trace-viewer.gif)
On the upper right panel, we can see all traces related to the Process Action Add activity. Specifically, we have sent the request message ("Sent a message over a channel") and received the response ("Received a message over a channel") in the same activity. This is shown in the following graph. For clarity, the Set up Secure Session activity is collapsed in the graph.
On the upper right panel, you can examine traces for the activity you selected on the left. You can then examine red or yellow traces in that panel and see how they are correlated. In the preceding graph, we see warning traces both for the client and service in the same Process Action activity.
If these traces do not provide you with the root cause of the error, you can utilize the graph by double-clicking the selected activity on the left panel (here Process action). The graph with related activities is then displayed. You can then expand related activities (by clicking the "+" signs) to find the first emitted trace in red or yellow in a related activity. Keep expanding the activities that happened just before the red or yellow trace of interest, following transfers to related activities or message flows across endpoints, until you track the root cause of the problem.
![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/wcfc-e2etrace9s.gif "wcfc_e2etrace9s")
Expanding activities to track the root cause of a problem
If ServiceModel `ActivityTracing` is off but ServiceModel tracing is on, you can see ServiceModel traces emitted in the 0000 activity. However, this requires more effort to understand the correlation of these traces.
If Message Logging is enabled, you can use the Message Tab to see which message is impacted by the error. By double-clicking a message in red or yellow, you can see the graph view of the related activities. These activities are the ones most closely related to the request where an error happened.
![Screenshot of Trace Viewer with message logging enabled.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/message-logging-enabled.gif)
The following image shows a list of traces for the Process Action activity. We send the request and receive the response in the same activity.
![Screenshot of Trace Viewer showing a list of traces for the Process Action activity](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/process-action-traces.gif)
Here, we load client traces only for clarity, but service traces (request message received and response message sent) appear in the same activity if they are also loaded in the tool and `propagateActivity` was set to `true.` This is shown in a later illustration.
On the service, the activity model maps to the WCF concepts as follows:
1. We construct and open a ServiceHost (this may create several host-related activities, for instance, in the case of security).
2. We create a Listen At activity for each listener in the ServiceHost (with transfers in and out of Open ServiceHost).
3. When the listener detects a communication request initiated by the client, it transfers to a "Receive Bytes" activity, in which all bytes sent from the client are processed. In this activity, we can see any connection errors that have happened during the client-service interaction.
4. For each set of bytes that is received that corresponds to a message, we process these bytes in a "Process Message" activity, where we create the WCF Message object. In this activity, we see errors related to a bad envelope or a malformed message.
5. Once the message is formed, we transfer to a Process Action activity. If `propagateActivity` is set to `true` on both the client and service, this activity has the same id as the one defined in the client, and described previously. From this stage we start to benefit from direct correlation across endpoints, because all traces emitted in WCF that are related to the request are in that same activity, including the response message processing.
6. For out-of-process action, we create an "Execute user code" activity to isolate traces emitted in user code from the ones emitted in WCF. In the preceding example, the "Service sends Add response" trace is emitted in the "Execute User code" activity not in the activity propagated by the client, if applicable.
In the illustration that follows, the first activity on the left is the root activity (0000), which is the default activity. The next three activities are to open the ServiceHost. The activity in column 5 is the listener, and the remaining activities (6 to 8) describe the WCF processing of a message, from bytes processing to user code activation.
The following image shows a graph view of WCF service activities:
![Screenshot of Trace Viewer showing a list of WCF service activities](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-service-activities.gif)
The following screenshot shows the activities for both the client and service, and highlights the Process Action Add activity across processes (orange). Arrows relate the request and response messages sent and received by the client and service. The traces of Process Action are separated across processes in the graph, but shown as part of the same activity in the upper-right panel. In this panel, we can see client traces for sent messages followed by service traces for received and processed messages.
The following images shows a graph view of both WCF client and service activities
![Graph from Trace Viewer that shows both WCF client and service activities.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/wcf-client-service-activities.gif)
In the following error scenario, error and warning traces at the service and client are related. An exception is first thrown in user code on the service (right-most green activity that includes a warning trace for the exception "The service cannot process this request in user code."). When the response is sent to the client, a warning trace is again emitted to denote the fault message (left pink activity). The client then closes its WCF client (yellow activity on the lower-left side), which aborts the connection to the service. The service throws an error (longest pink activity on the right).
![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/wcfc-e2etrace9s.gif "wcfc_e2etrace9s")
Error correlation across the service and client
The sample used to generate these traces is a series of synchronous requests using the wsHttpBinding. There are deviations from this graph for scenarios without security, or with asynchronous requests, where the Process Action activity encompasses the begin and end operations that constitute the asynchronous call, and shows transfers to a callback activity. For more information about additional scenarios, see [End-To-End Tracing Scenarios](../../../../../docs/framework/wcf/diagnostics/tracing/end-to-end-tracing-scenarios.md).
## Troubleshooting Using the Service Trace Viewer
When you load trace files in the Service Trace Viewer Tool, you can select any red or yellow activity on the left panel to track down the cause of a problem in your application. The 000 activity typically has unhandled exceptions that bubble up to the user.
The following image shows how to select a red or yellow activity to locate the root of a problem.
![Screenshot of red or yellow activities for locating the root of a problem.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/service-trace-viewer.gif)
On the upper right panel, you can examine traces for the activity you selected on the left. You can then examine red or yellow traces in that panel and see how they are correlated. In the preceding graph, we see warning traces both for the client and service in the same Process Action activity.
If these traces do not provide you with the root cause of the error, you can utilize the graph by double-clicking the selected activity on the left panel (here Process action). The graph with related activities is then displayed. You can then expand related activities (by clicking the "+" signs) to find the first emitted trace in red or yellow in a related activity. Keep expanding the activities that happened just before the red or yellow trace of interest, following transfers to related activities or message flows across endpoints, until you track the root cause of the problem.
![Using the Trace Viewer](../../../../../docs/framework/wcf/diagnostics/tracing/media/wcfc-e2etrace9s.gif "wcfc_e2etrace9s")
Expanding activities to track the root cause of a problem
If ServiceModel `ActivityTracing` is off but ServiceModel tracing is on, you can see ServiceModel traces emitted in the 0000 activity. However, this requires more effort to understand the correlation of these traces.
If Message Logging is enabled, you can use the Message Tab to see which message is impacted by the error. By double-clicking a message in red or yellow, you can see the graph view of the related activities. These activities are the ones most closely related to the request where an error happened.
![Screenshot of Trace Viewer with message logging enabled.](./media/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting/message-logging-enabled.gif)
To start troubleshooting, you can also pick a red or yellow message trace and double click it to track the root cause.
To start troubleshooting, you can also pick a red or yellow message trace and double click it to track the root cause.
## See also
- [End-To-End Tracing Scenarios](../../../../../docs/framework/wcf/diagnostics/tracing/end-to-end-tracing-scenarios.md)

Просмотреть файл

@ -38,23 +38,23 @@ Stream-oriented transports such as TCP and Named Pipes operate on a continuous s
1. Create a class that implements <xref:System.ServiceModel.Channels.StreamUpgradeInitiator>.
1. Override the <xref:System.ServiceModel.Channels.StreamUpgradeInitiator.InitiateUpgrade%2A> method to take in the stream to be upgraded, and return the upgraded stream. This method works synchronously; there are analogous methods to initiate the upgrade asynchronously.
1. Override the <xref:System.ServiceModel.Channels.StreamUpgradeInitiator.InitiateUpgrade%2A> method to take in the stream to be upgraded, and return the upgraded stream. This method works synchronously; there are analogous methods to initiate the upgrade asynchronously.
2. Override the <xref:System.ServiceModel.Channels.StreamUpgradeInitiator.GetNextUpgrade%2A> method to check for additional upgrades.
2. Override the <xref:System.ServiceModel.Channels.StreamUpgradeInitiator.GetNextUpgrade%2A> method to check for additional upgrades.
2. Create a class that implements <xref:System.ServiceModel.Channels.StreamUpgradeAcceptor>.
1. Override the <xref:System.ServiceModel.Channels.StreamUpgradeAcceptor.AcceptUpgrade%2A> method to take in the stream to be upgraded, and return the upgraded stream. This method works synchronously; there are analogous methods to accept the upgrade asynchronously.
1. Override the <xref:System.ServiceModel.Channels.StreamUpgradeAcceptor.AcceptUpgrade%2A> method to take in the stream to be upgraded, and return the upgraded stream. This method works synchronously; there are analogous methods to accept the upgrade asynchronously.
2. Override the <xref:System.ServiceModel.Channels.StreamUpgradeAcceptor.CanUpgrade%2A> method to determine if the upgrade requested is supported by this upgrade acceptor at this point in the upgrade process.
2. Override the <xref:System.ServiceModel.Channels.StreamUpgradeAcceptor.CanUpgrade%2A> method to determine if the upgrade requested is supported by this upgrade acceptor at this point in the upgrade process.
3. Create a class the implements <xref:System.ServiceModel.Channels.StreamUpgradeProvider>. Override the <xref:System.ServiceModel.Channels.StreamUpgradeProvider.CreateUpgradeAcceptor%2A> and the <xref:System.ServiceModel.Channels.StreamUpgradeProvider.CreateUpgradeInitiator%2A> methods to return instances of the acceptor and initiator defined in steps 2 and 1.
4. Create a class that implements <xref:System.ServiceModel.Channels.StreamUpgradeBindingElement>.
1. Override the <xref:System.ServiceModel.Channels.StreamUpgradeBindingElement.BuildClientStreamUpgradeProvider%2A> method on the client and the <xref:System.ServiceModel.Channels.StreamUpgradeBindingElement.BuildServerStreamUpgradeProvider%2A> method on the service.
1. Override the <xref:System.ServiceModel.Channels.StreamUpgradeBindingElement.BuildClientStreamUpgradeProvider%2A> method on the client and the <xref:System.ServiceModel.Channels.StreamUpgradeBindingElement.BuildServerStreamUpgradeProvider%2A> method on the service.
2. Override the <xref:System.ServiceModel.Channels.BindingElement.BuildChannelFactory%2A> method on the client and the <xref:System.ServiceModel.Channels.BindingElement.BuildChannelListener%2A> method on the service to add the upgrade Binding Element to <xref:System.ServiceModel.Channels.BindingContext.BindingParameters%2A>.
2. Override the <xref:System.ServiceModel.Channels.BindingElement.BuildChannelFactory%2A> method on the client and the <xref:System.ServiceModel.Channels.BindingElement.BuildChannelListener%2A> method on the service to add the upgrade Binding Element to <xref:System.ServiceModel.Channels.BindingContext.BindingParameters%2A>.
5. Add the new stream upgrade binding element to bindings on the server and client machines.

Просмотреть файл

@ -1,64 +1,65 @@
---
title: "Extensible Objects"
ms.date: "03/30/2017"
helpviewer_keywords:
helpviewer_keywords:
- "extensible objects [WCF]"
ms.assetid: bc88cefc-31fb-428e-9447-6d20a7d452af
---
# Extensible Objects
The extensible object pattern is used to either extend existing runtime classes with new functionality or to add new state to an object. Extensions, attached to one of the extensible objects, enable behaviors at very different stages in processing to access shared state and functionality attached to a common extensible object that they can access.
## The IExtensibleObject\<T> Pattern
There are three interfaces in the extensible object pattern: <xref:System.ServiceModel.IExtensibleObject%601>, <xref:System.ServiceModel.IExtension%601>, and <xref:System.ServiceModel.IExtensionCollection%601>.
The <xref:System.ServiceModel.IExtensibleObject%601> interface is implemented by types that allow <xref:System.ServiceModel.IExtension%601> objects to customize their functionality.
Extensible objects allow dynamic aggregation of <xref:System.ServiceModel.IExtension%601> objects. <xref:System.ServiceModel.IExtension%601> objects are characterized by the following interface:
```
public interface IExtension<T>
where T : IExtensibleObject<T>
{
void Attach(T owner);
void Detach(T owner);
}
```
The type restriction guarantees that extensions can only be defined for classes that are <xref:System.ServiceModel.IExtensibleObject%601>. <xref:System.ServiceModel.IExtension%601.Attach%2A> and <xref:System.ServiceModel.IExtension%601.Detach%2A> provide notification of aggregation or disaggregation.
It is valid for implementations to restrict when they may be added and removed from an owner. For example, you can disallow removal entirely, disallowing adding or removing extensions when the owner or extension are in a certain state, disallow adding to multiple owners concurrently, or allow only a single addition followed by a single remove.
<xref:System.ServiceModel.IExtension%601> does not imply any interactions with other standard managed interfaces. Specifically, the <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType> method on the owner object does not normally detach its extensions.
When an extension is added to the collection, <xref:System.ServiceModel.IExtension%601.Attach%2A> is called before it goes into the collection. When an extension is removed from the collection, <xref:System.ServiceModel.IExtension%601.Detach%2A> is called after it is removed. This means (assuming appropriate synchronization) an extension can count on only being found in the collection while it is between <xref:System.ServiceModel.IExtension%601.Attach%2A> and <xref:System.ServiceModel.IExtension%601.Detach%2A>.
The object passed to <xref:System.ServiceModel.IExtensionCollection%601.FindAll%2A> or <xref:System.ServiceModel.IExtensionCollection%601.Find%2A> need not be <xref:System.ServiceModel.IExtension%601> (for example, you can pass any object), but the returned extension is an <xref:System.ServiceModel.IExtension%601>.
If no extension in the collection is an <xref:System.ServiceModel.IExtension%601>, <xref:System.ServiceModel.IExtensionCollection%601.Find%2A> returns null, and <xref:System.ServiceModel.IExtensionCollection%601.FindAll%2A> returns an empty collection. If multiple extensions implement <xref:System.ServiceModel.IExtension%601>, <xref:System.ServiceModel.IExtensionCollection%601.Find%2A> returns one of them. The value returned from <xref:System.ServiceModel.IExtensionCollection%601.FindAll%2A> is a snapshot.
There are two main scenarios. The first scenario uses the <xref:System.ServiceModel.IExtensibleObject%601.Extensions%2A> property as a type-based dictionary to insert state on an object to enable another component to look it up using the type.
The second scenario uses the <xref:System.ServiceModel.IExtension%601.Attach%2A> and <xref:System.ServiceModel.IExtension%601.Detach%2A> properties to enable an object to participate in custom behavior, such as registering for events, watching state transitions, and so on.
The <xref:System.ServiceModel.IExtensionCollection%601> interface is a collection of the <xref:System.ServiceModel.IExtension%601> objects that allow for retrieving the <xref:System.ServiceModel.IExtension%601> by its type. <xref:System.ServiceModel.IExtensionCollection%601.Find%2A?displayProperty=nameWithType> returns the most recently added object that is an <xref:System.ServiceModel.IExtension%601> of that type.
### Extensible Objects in Windows Communication Foundation
There are four extensible objects in Windows Communication Foundation (WCF):
- <xref:System.ServiceModel.ServiceHostBase> – This is the base class for the services host. Extensions of this class can be used to extend the behavior of the <xref:System.ServiceModel.ServiceHostBase> itself or to store the state for each service.
- <xref:System.ServiceModel.InstanceContext> – This class connects an instance of the services type with the service runtime. It contains information about the instance as well as a reference to the <xref:System.ServiceModel.InstanceContext>'s containing <xref:System.ServiceModel.ServiceHostBase>. Extensions of this class can be used to extend the behavior of the <xref:System.ServiceModel.InstanceContext> or to store the state for each service.
- <xref:System.ServiceModel.OperationContext> – This class represents the operation information that the runtime gathers for each operation. This includes information such as the incoming message headers, the incoming message properties, the incoming security identity, and other information. Extensions of this class can either extend the behavior of <xref:System.ServiceModel.OperationContext> or store the state for each operation.
- <xref:System.ServiceModel.IContextChannel> – This interface allows for the inspection of each state for the channels and proxies built by the WCF runtime. Extensions of this class can either extend the behavior of <xref:System.ServiceModel.IClientChannel> or can use it to store the state for each channel.
-
The following code example shows the use of a simple extension to track <xref:System.ServiceModel.InstanceContext> objects.
[!code-csharp[IInstanceContextInitializer#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/initializer.cs#1)]
The extensible object pattern is used to either extend existing runtime classes with new functionality or to add new state to an object. Extensions, attached to one of the extensible objects, enable behaviors at very different stages in processing to access shared state and functionality attached to a common extensible object that they can access.
## The IExtensibleObject\<T> Pattern
There are three interfaces in the extensible object pattern: <xref:System.ServiceModel.IExtensibleObject%601>, <xref:System.ServiceModel.IExtension%601>, and <xref:System.ServiceModel.IExtensionCollection%601>.
The <xref:System.ServiceModel.IExtensibleObject%601> interface is implemented by types that allow <xref:System.ServiceModel.IExtension%601> objects to customize their functionality.
Extensible objects allow dynamic aggregation of <xref:System.ServiceModel.IExtension%601> objects. <xref:System.ServiceModel.IExtension%601> objects are characterized by the following interface:
```csharp
public interface IExtension<T>
where T : IExtensibleObject<T>
{
void Attach(T owner);
void Detach(T owner);
}
```
The type restriction guarantees that extensions can only be defined for classes that are <xref:System.ServiceModel.IExtensibleObject%601>. <xref:System.ServiceModel.IExtension%601.Attach%2A> and <xref:System.ServiceModel.IExtension%601.Detach%2A> provide notification of aggregation or disaggregation.
It is valid for implementations to restrict when they may be added and removed from an owner. For example, you can disallow removal entirely, disallowing adding or removing extensions when the owner or extension are in a certain state, disallow adding to multiple owners concurrently, or allow only a single addition followed by a single remove.
<xref:System.ServiceModel.IExtension%601> does not imply any interactions with other standard managed interfaces. Specifically, the <xref:System.IDisposable.Dispose%2A?displayProperty=nameWithType> method on the owner object does not normally detach its extensions.
When an extension is added to the collection, <xref:System.ServiceModel.IExtension%601.Attach%2A> is called before it goes into the collection. When an extension is removed from the collection, <xref:System.ServiceModel.IExtension%601.Detach%2A> is called after it is removed. This means (assuming appropriate synchronization) an extension can count on only being found in the collection while it is between <xref:System.ServiceModel.IExtension%601.Attach%2A> and <xref:System.ServiceModel.IExtension%601.Detach%2A>.
The object passed to <xref:System.ServiceModel.IExtensionCollection%601.FindAll%2A> or <xref:System.ServiceModel.IExtensionCollection%601.Find%2A> need not be <xref:System.ServiceModel.IExtension%601> (for example, you can pass any object), but the returned extension is an <xref:System.ServiceModel.IExtension%601>.
If no extension in the collection is an <xref:System.ServiceModel.IExtension%601>, <xref:System.ServiceModel.IExtensionCollection%601.Find%2A> returns null, and <xref:System.ServiceModel.IExtensionCollection%601.FindAll%2A> returns an empty collection. If multiple extensions implement <xref:System.ServiceModel.IExtension%601>, <xref:System.ServiceModel.IExtensionCollection%601.Find%2A> returns one of them. The value returned from <xref:System.ServiceModel.IExtensionCollection%601.FindAll%2A> is a snapshot.
There are two main scenarios. The first scenario uses the <xref:System.ServiceModel.IExtensibleObject%601.Extensions%2A> property as a type-based dictionary to insert state on an object to enable another component to look it up using the type.
The second scenario uses the <xref:System.ServiceModel.IExtension%601.Attach%2A> and <xref:System.ServiceModel.IExtension%601.Detach%2A> properties to enable an object to participate in custom behavior, such as registering for events, watching state transitions, and so on.
The <xref:System.ServiceModel.IExtensionCollection%601> interface is a collection of the <xref:System.ServiceModel.IExtension%601> objects that allow for retrieving the <xref:System.ServiceModel.IExtension%601> by its type. <xref:System.ServiceModel.IExtensionCollection%601.Find%2A?displayProperty=nameWithType> returns the most recently added object that is an <xref:System.ServiceModel.IExtension%601> of that type.
### Extensible Objects in Windows Communication Foundation
There are four extensible objects in Windows Communication Foundation (WCF):
- <xref:System.ServiceModel.ServiceHostBase> – This is the base class for the services host. Extensions of this class can be used to extend the behavior of the <xref:System.ServiceModel.ServiceHostBase> itself or to store the state for each service.
- <xref:System.ServiceModel.InstanceContext> – This class connects an instance of the services type with the service runtime. It contains information about the instance as well as a reference to the <xref:System.ServiceModel.InstanceContext>'s containing <xref:System.ServiceModel.ServiceHostBase>. Extensions of this class can be used to extend the behavior of the <xref:System.ServiceModel.InstanceContext> or to store the state for each service.
- <xref:System.ServiceModel.OperationContext> – This class represents the operation information that the runtime gathers for each operation. This includes information such as the incoming message headers, the incoming message properties, the incoming security identity, and other information. Extensions of this class can either extend the behavior of <xref:System.ServiceModel.OperationContext> or store the state for each operation.
- <xref:System.ServiceModel.IContextChannel> – This interface allows for the inspection of each state for the channels and proxies built by the WCF runtime. Extensions of this class can either extend the behavior of <xref:System.ServiceModel.IClientChannel> or can use it to store the state for each channel.
The following code example shows the use of a simple extension to track <xref:System.ServiceModel.InstanceContext> objects.
[!code-csharp[IInstanceContextInitializer#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/iinstancecontextinitializer/cs/initializer.cs#1)]
## See also
- <xref:System.ServiceModel.IExtensibleObject%601>

Просмотреть файл

@ -13,15 +13,15 @@ The Identity Model infrastructure in Windows Communication Foundation (WCF) prov
1. Create a custom claim by passing the claim type, resource value and right to the <xref:System.IdentityModel.Claims.Claim.%23ctor%28System.String%2CSystem.Object%2CSystem.String%29> constructor.
1. Decide on a unique value for the claim type.
1. Decide on a unique value for the claim type.
The claim type is a unique string identifier. It is the custom claim designer's responsibility to ensure that the string identifier that is used for the claim type is unique. For a list of claim types that are defined by WCF, see the <xref:System.IdentityModel.Claims.ClaimTypes> class.
2. Choose the primitive data type and value for the resource.
2. Choose the primitive data type and value for the resource.
A resource is an object. The CLR type of the resource can be a primitive, such as <xref:System.String> or <xref:System.Int32>, or any serializable type. The CLR type of the resource must be serializable, because claims are serialized at various points by WCF. Primitive types are serializable.
3. Choose a right that is defined by WCF or a unique value for a custom right.
3. Choose a right that is defined by WCF or a unique value for a custom right.
A right is a unique string identifier. The rights that are defined by WCF are defined in the <xref:System.IdentityModel.Claims.Rights> class.
@ -36,11 +36,11 @@ The Identity Model infrastructure in Windows Communication Foundation (WCF) prov
1. Create a custom claim by passing the claim type, resource value and right to the <xref:System.IdentityModel.Claims.Claim.%23ctor%28System.String%2CSystem.Object%2CSystem.String%29> constructor.
1. Decide on a unique value for the claim type.
1. Decide on a unique value for the claim type.
The claim type is a unique string identifier. It is the custom claim designer's responsibility to ensure that the string identifier that is used for the claim type is unique. For a list of claim types that are defined by WCF, see the <xref:System.IdentityModel.Claims.ClaimTypes> class.
2. Choose or define a serializable non-primitive type for the resource.
2. Choose or define a serializable non-primitive type for the resource.
A resource is an object. The CLR type of the resource must be serializable, because claims are serialized at various points by WCF. Primitive types are already serializable.
@ -51,7 +51,7 @@ The Identity Model infrastructure in Windows Communication Foundation (WCF) prov
[!code-csharp[c_CustomClaim#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_customclaim/cs/c_customclaim.cs#2)]
[!code-vb[c_CustomClaim#2](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_customclaim/vb/c_customclaim.vb#2)]
3. Choose a right that is defined by WCF or a unique value for a custom right.
3. Choose a right that is defined by WCF or a unique value for a custom right.
A right is a unique string identifier. The rights that are defined by WCF are defined in the <xref:System.IdentityModel.Claims.Rights> class.

Просмотреть файл

@ -37,15 +37,15 @@ Large enterprises often require that applications are developed in compliance wi
3. Use the <xref:System.Configuration?displayProperty=nameWithType> namespace types to:
1. Add the extension to the [\<behaviorExtensions>](../../../../docs/framework/configure-apps/file-schema/wcf/behaviorextensions.md) section using a fully-qualified type name and lock the element.
1. Add the extension to the [\<behaviorExtensions>](../../../../docs/framework/configure-apps/file-schema/wcf/behaviorextensions.md) section using a fully-qualified type name and lock the element.
[!code-csharp[LockdownValidation#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/hostapplication.cs#5)]
2. Add the behavior element to the `EndpointBehaviors` property of the [\<commonBehaviors>](../../../../docs/framework/configure-apps/file-schema/wcf/commonbehaviors.md) section and lock the element. (To install the validator on the service, the validator must be an <xref:System.ServiceModel.Description.IServiceBehavior> and added to the `ServiceBehaviors` property.) The following code example shows the proper configuration after steps a. and b., with the sole exception that there is no strong name.
2. Add the behavior element to the `EndpointBehaviors` property of the [\<commonBehaviors>](../../../../docs/framework/configure-apps/file-schema/wcf/commonbehaviors.md) section and lock the element. (To install the validator on the service, the validator must be an <xref:System.ServiceModel.Description.IServiceBehavior> and added to the `ServiceBehaviors` property.) The following code example shows the proper configuration after steps a. and b., with the sole exception that there is no strong name.
[!code-csharp[LockdownValidation#6](../../../../samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/hostapplication.cs#6)]
3. Save the machine.config file. The following code example performs all the tasks in step 3 but saves a copy of the modified machine.config file locally.
3. Save the machine.config file. The following code example performs all the tasks in step 3 but saves a copy of the modified machine.config file locally.
[!code-csharp[LockdownValidation#7](../../../../samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/hostapplication.cs#7)]

Просмотреть файл

@ -12,9 +12,9 @@ This topic is the third of three topics that discusses how to implement a discov
2. Add references to the following assemblies:
1. System.ServiceModel
1. System.ServiceModel
2. System.ServiceModel.Discovery
2. System.ServiceModel.Discovery
3. Add the GeneratedClient.cs found at the bottom of this topic to the project.

Просмотреть файл

@ -37,11 +37,11 @@ This topic describes how to create a long-running workflow service. Long running
3. In the project properties dialog, select the **Web** tab.
1. Under **Start Action** select **Specific Page** and specify `Service1.xamlx`.
1. Under **Start Action** select **Specific Page** and specify `Service1.xamlx`.
![Workflow Service Project Web Properties](./media/creating-a-long-running-workflow-service/start-action-specific-page-option.png "Create the web hosted workflow service - Specific Page option")
2. Under **Servers** select **Use Local IIS Web server**.
2. Under **Servers** select **Use Local IIS Web server**.
![Local Web Server Settings](./media/creating-a-long-running-workflow-service/use-local-web-server.png "Create the web hosted workflow service - Use Local IIS Web Server option")
@ -61,67 +61,67 @@ This topic describes how to create a long-running workflow service. Long running
6. Drag and drop a **ReceiveAndSendReply** activity template into the **Sequential Service** activity. This set of activities will receive a message from a client and send a reply back.
1. Select the **Receive** activity and set the properties highlighted in the following illustration.
1. Select the **Receive** activity and set the properties highlighted in the following illustration.
![Set Receive Activity Properties](./media/creating-a-long-running-workflow-service/set-receive-activity-properties.png "Set the Receive activity properties.")
The DisplayName property sets the name displayed for the Receive activity in the designer. The ServiceContractName and OperationName properties specify the name of the service contract and operation that are implemented by the Receive activity. For more information about how contracts are used in Workflow services see [Using Contracts in Workflow](../../../../docs/framework/wcf/feature-details/using-contracts-in-workflow.md).
2. Click the **Define...** link in the **ReceiveStartOrder** activity and set the properties shown in the following illustration. Notice that the **Parameters** radio button is selected, a parameter named `p_customerName` is bound to the `customerName` variable. This configures the **Receive** activity to receive some data and bind that data to local variables.
2. Click the **Define...** link in the **ReceiveStartOrder** activity and set the properties shown in the following illustration. Notice that the **Parameters** radio button is selected, a parameter named `p_customerName` is bound to the `customerName` variable. This configures the **Receive** activity to receive some data and bind that data to local variables.
![Setting the data received by the Receive activity](./media/creating-a-long-running-workflow-service/set-properties-for-receive-content.png "Set the properties for data received by the Receive activity.")
3. Select The **SendReplyToReceive** activity and set the highlighted property shown in the following illustration.
3. Select The **SendReplyToReceive** activity and set the highlighted property shown in the following illustration.
![Setting the properties of the SendReply activity](./media/creating-a-long-running-workflow-service/set-properties-for-reply-activities.png "SetReplyProperties")
4. Click the **Define...** link in the **SendReplyToStartOrder** activity and set the properties shown in the following illustration. Notice that the **Parameters** radio button is selected; a parameter named `p_orderId` is bound to the `orderId` variable. This setting specifies that the SendReplyToStartOrder activity will return a value of type string to the caller.
4. Click the **Define...** link in the **SendReplyToStartOrder** activity and set the properties shown in the following illustration. Notice that the **Parameters** radio button is selected; a parameter named `p_orderId` is bound to the `orderId` variable. This setting specifies that the SendReplyToStartOrder activity will return a value of type string to the caller.
![Configuring the SendReply activity content data](./media/creating-a-long-running-workflow-service/setreplycontent-for-sendreplytostartorder-activity.png "Configure setting for SetReplyToStartOrder activity.")
5. Drag and drop an Assign activity in between the **Receive** and **SendReply** activities and set the properties as shown in the following illustration:
5. Drag and drop an Assign activity in between the **Receive** and **SendReply** activities and set the properties as shown in the following illustration:
![Adding an assign activity](./media/creating-a-long-running-workflow-service/add-an-assign-activity.png "Add an assign activity.")
This creates a new order ID and places the value in the orderId variable.
6. Select the **ReplyToStartOrder** activity. In the properties window click the ellipsis button for **CorrelationInitializers**. Select the **Add initializer** link, enter `orderIdHandle` in the Initializer text box, select Query correlation initializer for the Correlation type, and select p_orderId under the XPATH Queries dropdown box. These settings are shown in the following illustration. Click **OK**. This initializes a correlation between the client and this instance of the workflow service. When a message containing this order ID is received it is routed to this instance of the workflow service.
6. Select the **ReplyToStartOrder** activity. In the properties window click the ellipsis button for **CorrelationInitializers**. Select the **Add initializer** link, enter `orderIdHandle` in the Initializer text box, select Query correlation initializer for the Correlation type, and select p_orderId under the XPATH Queries dropdown box. These settings are shown in the following illustration. Click **OK**. This initializes a correlation between the client and this instance of the workflow service. When a message containing this order ID is received it is routed to this instance of the workflow service.
![Adding a correlation initializer](./media/creating-a-long-running-workflow-service/add-correlationinitializers.png "Add a correlation initializer.")
7. Drag and drop another **ReceiveAndSendReply** activity to the end of the workflow (outside the **Sequence** containing the first **Receive** and **SendReply** activities). This will receive the second message sent by the client and respond to it.
1. Select the **Sequence** that contains the newly added **Receive** and **SendReply** activities and click the **Variables** button. Add the variable highlighted in the following illustration:
1. Select the **Sequence** that contains the newly added **Receive** and **SendReply** activities and click the **Variables** button. Add the variable highlighted in the following illustration:
![Adding new variables](./media/creating-a-long-running-workflow-service/add-the-itemid-variable.png "Add the ItemId variable.")
2. Select the **Receive** activity and set the properties shown in the following illustration:
2. Select the **Receive** activity and set the properties shown in the following illustration:
![Set the Receive acitivity properties](./media/creating-a-long-running-workflow-service/set-receive-activities-properties.png "Set the Receive activities properties.")
3. Click the **Define...** link in the **ReceiveAddItem** activity and add the parameters shown in the following illustration:This configures the receive activity to accept two parameters, the order ID and the ID of the item being ordered.
3. Click the **Define...** link in the **ReceiveAddItem** activity and add the parameters shown in the following illustration:This configures the receive activity to accept two parameters, the order ID and the ID of the item being ordered.
![Specifying parameters for the second receive](./media/creating-a-long-running-workflow-service/add-receive-two-parameters.png "Configure the receive activity to receive two parameters.")
4. Click the **CorrelateOn** ellipsis button and enter `orderIdHandle`. Under **XPath Queries**, click the drop down arrow and select `p_orderId`. This configures the correlation on the second receive activity. For more information about correlation see [Correlation](../../../../docs/framework/wcf/feature-details/correlation.md).
4. Click the **CorrelateOn** ellipsis button and enter `orderIdHandle`. Under **XPath Queries**, click the drop down arrow and select `p_orderId`. This configures the correlation on the second receive activity. For more information about correlation see [Correlation](../../../../docs/framework/wcf/feature-details/correlation.md).
![Setting the CorrelatesOn property](./media/creating-a-long-running-workflow-service/correlateson-setting.png "Set the CorrelatesOn property.")
5. Drag and drop an **If** activity immediately after the **ReceiveAddItem** activity. This activity acts just like an if statement.
5. Drag and drop an **If** activity immediately after the **ReceiveAddItem** activity. This activity acts just like an if statement.
1. Set the **Condition** property to `itemId=="Zune HD" (itemId="Zune HD" for Visual Basic)`
1. Set the **Condition** property to `itemId=="Zune HD" (itemId="Zune HD" for Visual Basic)`
2. Drag and drop an **Assign** activity in to the **Then** section and another into the **Else** section set the properties of the **Assign** activities as shown in the following illustration.
2. Drag and drop an **Assign** activity in to the **Then** section and another into the **Else** section set the properties of the **Assign** activities as shown in the following illustration.
![Assigning the result of the service call](./media/creating-a-long-running-workflow-service/assign-result-of-service-call.png "Assign the result of the service call.")
If the condition is `true` the **Then** section will be executed. If the condition is `false` the **Else** section is executed.
3. Select the **SendReplyToReceive** activity and set the **DisplayName** property shown in the following illustration.
3. Select the **SendReplyToReceive** activity and set the **DisplayName** property shown in the following illustration.
![Setting the SendReply activity properties](./media/creating-a-long-running-workflow-service/send-reply-activity-property.png "Set the SendReply activity property.")
4. Click the **Define ...** link in the **SetReplyToAddItem** activity and configure it as shown in the following illustration. This configures the **SendReplyToAddItem** activity to return the value in the `orderResult` variable.
4. Click the **Define ...** link in the **SetReplyToAddItem** activity and configure it as shown in the following illustration. This configures the **SendReplyToAddItem** activity to return the value in the `orderResult` variable.
![Setting the data binding for the SendReply activity](./media/creating-a-long-running-workflow-service/set-property-for-sendreplytoadditem.gif "Set property for SendReplyToAddItem activity.")
@ -143,9 +143,9 @@ This topic describes how to create a long-running workflow service. Long running
2. Add references to the following assemblies to the `OrderClient` project
1. System.ServiceModel.dll
1. System.ServiceModel.dll
2. System.ServiceModel.Activities.dll
2. System.ServiceModel.Activities.dll
3. Add a service reference to the workflow service and specify `OrderService` as the namespace.
@ -184,7 +184,7 @@ This topic describes how to create a long-running workflow service. Long running
6. To verify that the workflow service has been persisted, start the SQL Server Management Studio by going to the **Start** menu, Selecting **All Programs**, **Microsoft SQL Server 2008**, **SQL Server Management Studio**.
1. In the left hand pane expand, **Databases**, **SQLPersistenceStore**, **Views** and right click **System.Activities.DurableInstancing.Instances** and select **Select Top 1000 Rows**. In the **Results** pane verify you see at least one instance listed. There may be other instances from prior runs if an exception occurred while running. You can delete existing rows by right clicking **System.Activities.DurableInstancing.Instances** and selecting **Edit Top 200 rows**, pressing the **Execute** button, selecting all rows in the results pane and selecting **delete**. To verify the instance displayed in the database is the instance your application created, verify the instances view is empty prior to running the client. Once the client is running re-run the query (Select Top 1000 Rows) and verify a new instance has been added.
1. In the left hand pane expand, **Databases**, **SQLPersistenceStore**, **Views** and right click **System.Activities.DurableInstancing.Instances** and select **Select Top 1000 Rows**. In the **Results** pane verify you see at least one instance listed. There may be other instances from prior runs if an exception occurred while running. You can delete existing rows by right clicking **System.Activities.DurableInstancing.Instances** and selecting **Edit Top 200 rows**, pressing the **Execute** button, selecting all rows in the results pane and selecting **delete**. To verify the instance displayed in the database is the instance your application created, verify the instances view is empty prior to running the client. Once the client is running re-run the query (Select Top 1000 Rows) and verify a new instance has been added.
7. Press enter to send the add item message to the workflow service. The client will display the following text:

Просмотреть файл

@ -79,15 +79,15 @@ When using Windows authentication as a security mechanism, the Security Support
2. Require SSPI negotiation:
1. If you are using standard bindings, set the `NegotiateServiceCredential` property to `true`.
1. If you are using standard bindings, set the `NegotiateServiceCredential` property to `true`.
2. If you are using custom bindings, set the `AuthenticationMode` attribute of the `Security` element to `SspiNegotiated`.
2. If you are using custom bindings, set the `AuthenticationMode` attribute of the `Security` element to `SspiNegotiated`.
3. Require the SSPI negotiation to use Kerberos by disallowing the use of NTLM:
1. Do this in code, with the following statement: `ChannelFactory.Credentials.Windows.AllowNtlm = false`
1. Do this in code, with the following statement: `ChannelFactory.Credentials.Windows.AllowNtlm = false`
2. Or you can do this in the configuration file by setting the `allowNtlm` attribute to `false`. This attribute is contained in the [\<windows>](../../../../docs/framework/configure-apps/file-schema/wcf/windows-of-clientcredentials-element.md).
2. Or you can do this in the configuration file by setting the `allowNtlm` attribute to `false`. This attribute is contained in the [\<windows>](../../../../docs/framework/configure-apps/file-schema/wcf/windows-of-clientcredentials-element.md).
### NTLM Protocol

Просмотреть файл

@ -12,9 +12,9 @@ This topic is the second of four topics that discusses how to implement a discov
2. Add references to the following assemblies:
1. System.ServiceModel
1. System.ServiceModel
2. System.ServiceModel.Discovery
2. System.ServiceModel.Discovery
3. Add a new class to the project called `CalculatorService`.

Просмотреть файл

@ -209,11 +209,11 @@ Workflow services and clients can participate in transactions. For a service op
1. Add a new Console Application project called `Service` to the solution. Add references to the following assemblies:
1. System.Activities.dll
1. System.Activities.dll
2. System.ServiceModel.dll
2. System.ServiceModel.dll
3. System.ServiceModel.Activities.dll
3. System.ServiceModel.Activities.dll
2. Open the generated Program.cs file and the following code:

Просмотреть файл

@ -23,21 +23,21 @@ Windows Communication Foundation (WCF) clients are wire-level compatible with We
The following class is part of the [Interoperating with WSE](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms752257%28v=vs.90%29) sample:
1. Create a class that derives from the <xref:System.ServiceModel.Channels.Binding> class.
1. Create a class that derives from the <xref:System.ServiceModel.Channels.Binding> class.
The following code example creates a class named `WseHttpBinding` that derives from the <xref:System.ServiceModel.Channels.Binding> class.
[!code-csharp[c_WCFClientToWSEService#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wsehttpbinding.cs#1)]
[!code-vb[c_WCFClientToWSEService#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_wcfclienttowseservice/vb/wsehttpbinding.vb#1)]
2. Add properties to the class that specify the WSE turnkey assertion used by the WSE service, whether derived keys are required, whether secure sessions are used, whether signature confirmations are required, and the message protection settings. In WSE 3.0, a turnkey assertion specifies the security requirements for a client or Web service—similar to the authentication mode of a binding in WCF.
2. Add properties to the class that specify the WSE turnkey assertion used by the WSE service, whether derived keys are required, whether secure sessions are used, whether signature confirmations are required, and the message protection settings. In WSE 3.0, a turnkey assertion specifies the security requirements for a client or Web service—similar to the authentication mode of a binding in WCF.
The following code example defines the `SecurityAssertion`, `RequireDerivedKeys`, `EstablishSecurityContext`, and `MessageProtectionOrder` properties that specify the WSE turnkey assertion, whether derived keys are required, whether secure sessions are used, whether signature confirmations are required, and the message protection settings, respectively.
[!code-csharp[c_WCFClientToWSEService#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wsehttpbinding.cs#3)]
[!code-vb[c_WCFClientToWSEService#3](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_wcfclienttowseservice/vb/wsehttpbinding.vb#3)]
3. Override the <xref:System.ServiceModel.Channels.Binding.CreateBindingElements%2A> method to set the binding properties.
3. Override the <xref:System.ServiceModel.Channels.Binding.CreateBindingElements%2A> method to set the binding properties.
The following code example specifies the transport, message encoding, and message protection settings by getting the values of the `SecurityAssertion` and `MessageProtectionOrder` properties.

Просмотреть файл

@ -21,21 +21,21 @@ Windows Communication Foundation (WCF) clients are wire-level compatible with We
The following class is part of the [Interoperating with WSE](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms752257%28v=vs.90%29) sample.
1. Create a class that derives from the <xref:System.ServiceModel.Channels.Binding> class.
1. Create a class that derives from the <xref:System.ServiceModel.Channels.Binding> class.
The following code example creates a class named `WseHttpBinding` that derives from the <xref:System.ServiceModel.Channels.Binding> class.
[!code-csharp[c_WCFClientToWSEService#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wsehttpbinding.cs#1)]
[!code-vb[c_WCFClientToWSEService#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_wcfclienttowseservice/vb/wsehttpbinding.vb#1)]
2. Add properties to the class that specify the WSE turnkey assertion, whether derived keys are required, whether secure sessions are used, whether signature confirmations are required, and the message protection settings.
2. Add properties to the class that specify the WSE turnkey assertion, whether derived keys are required, whether secure sessions are used, whether signature confirmations are required, and the message protection settings.
The following code example defines the `SecurityAssertion`, `RequireDerivedKeys`, `EstablishSecurityContext`, and `MessageProtectionOrder` properties. They specify the WSE turnkey assertion, whether derived keys are required, whether secure sessions are used, whether signature confirmations are required, and the message protection settings, respectively.
[!code-csharp[c_WCFClientToWSEService#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_wcfclienttowseservice/cs/wsehttpbinding.cs#3)]
[!code-vb[c_WCFClientToWSEService#3](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_wcfclienttowseservice/vb/wsehttpbinding.vb#3)]
3. Override the <xref:System.ServiceModel.Channels.Binding.CreateBindingElements%2A> method to set the binding properties.
3. Override the <xref:System.ServiceModel.Channels.Binding.CreateBindingElements%2A> method to set the binding properties.
The following code example specifies the transport, message encoding, and message protection settings by getting the values of the `SecurityAssertion` and `MessageProtectionOrder` properties.

Просмотреть файл

@ -12,11 +12,11 @@ Windows Communication Foundation (WCF) services are wire-level compatible with W
To specify that the August 2004 version of the WS-Addressing specification is used for message encoding, a custom binding must be created.
1. Add a child [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md) to the [\<bindings>](../../../../docs/framework/configure-apps/file-schema/wcf/bindings.md) of the service's configuration file.
1. Add a child [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md) to the [\<bindings>](../../../../docs/framework/configure-apps/file-schema/wcf/bindings.md) of the service's configuration file.
2. Specify a name for the binding, by adding a [\<binding>](../../../../docs/framework/misc/binding.md) to the [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md) and setting the `name` attribute.
2. Specify a name for the binding, by adding a [\<binding>](../../../../docs/framework/misc/binding.md) to the [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md) and setting the `name` attribute.
3. Specify an authentication mode and the version of the WS-Security specifications that are used to secure messages that are compatible with WSE 3.0, by adding a child [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md) to the [\<binding>](../../../../docs/framework/misc/binding.md).
3. Specify an authentication mode and the version of the WS-Security specifications that are used to secure messages that are compatible with WSE 3.0, by adding a child [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md) to the [\<binding>](../../../../docs/framework/misc/binding.md).
To set the authentication mode, set the `authenicationMode` attribute of the [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md). An authentication mode is roughly equivalent to a turnkey security assertion in WSE 3.0. The following table maps authentication modes in WCF to turnkey security assertions in WSE 3.0.
@ -33,16 +33,16 @@ Windows Communication Foundation (WCF) services are wire-level compatible with W
To set the version of the WS-Security specification that is used to secure SOAP messages, set the `messageSecurityVersion` attribute of the [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md). To interoperate with WSE 3.0, set the value of the `messageSecurityVersion` attribute to <xref:System.ServiceModel.MessageSecurityVersion.WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10%2A>.
4. Specify that the August 2004 version of the WS-Addressing specification is used by WCF by adding a [\<textMessageEncoding>](../../../../docs/framework/configure-apps/file-schema/wcf/textmessageencoding.md) and set the `messageVersion` to its value to <xref:System.ServiceModel.Channels.MessageVersion.Soap11WSAddressingAugust2004%2A>.
4. Specify that the August 2004 version of the WS-Addressing specification is used by WCF by adding a [\<textMessageEncoding>](../../../../docs/framework/configure-apps/file-schema/wcf/textmessageencoding.md) and set the `messageVersion` to its value to <xref:System.ServiceModel.Channels.MessageVersion.Soap11WSAddressingAugust2004%2A>.
> [!NOTE]
> When you are using SOAP 1.2, set the `messageVersion` attribute to <xref:System.ServiceModel.Channels.MessageVersion.Soap12WSAddressingAugust2004%2A>.
2. Specify that the service uses the custom binding.
1. Set the `binding` attribute of the [\<endpoint>](../../../../docs/framework/configure-apps/file-schema/wcf/endpoint-element.md) element to `customBinding`.
1. Set the `binding` attribute of the [\<endpoint>](../../../../docs/framework/configure-apps/file-schema/wcf/endpoint-element.md) element to `customBinding`.
2. Set the `bindingConfiguration` attribute of the [\<endpoint>](../../../../docs/framework/configure-apps/file-schema/wcf/endpoint-element.md) element to the value specified in the `name` attribute of the [\<binding>](../../../../docs/framework/misc/binding.md) for the custom binding.
2. Set the `bindingConfiguration` attribute of the [\<endpoint>](../../../../docs/framework/configure-apps/file-schema/wcf/endpoint-element.md) element to the value specified in the `name` attribute of the [\<binding>](../../../../docs/framework/misc/binding.md) for the custom binding.
## Example
The following code example specifies that the `Service.HelloWorldService` uses a custom binding to interoperate with WSE 3.0 clients. The custom binding specifies that the August 2004 version of the WS-Addressing and the WS-Security 1.1 set of specifications are used to encode the exchanged messages. The messages are secured using the <xref:System.ServiceModel.Configuration.AuthenticationMode.AnonymousForCertificate> authentication mode.

Просмотреть файл

@ -22,13 +22,13 @@ By using a stateful security context token (SCT) in a secure session, the sessio
- Create a custom binding that specifies that SOAP messages are protected by a secure session that uses a stateful SCT.
1. Define a custom binding, by adding a [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md) to the configuration file for the service.
1. Define a custom binding, by adding a [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md) to the configuration file for the service.
```xml
<customBinding>
```
2. Add a [\<binding>](../../../../docs/framework/misc/binding.md) child element to the [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md).
2. Add a [\<binding>](../../../../docs/framework/misc/binding.md) child element to the [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md).
Specify a binding name by setting the `name` attribute to a unique name within the configuration file.
@ -36,7 +36,7 @@ By using a stateful security context token (SCT) in a secure session, the sessio
<binding name="StatefulSCTSecureSession">
```
3. Specify the authentication mode for messages sent to and from this service by adding a [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md) child element to the [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md).
3. Specify the authentication mode for messages sent to and from this service by adding a [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md) child element to the [\<customBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/custombinding.md).
Specify that a secure session is used by setting the `authenticationMode` attribute to `SecureConversation`. Specify that stateful SCTs are used by setting the `requireSecurityContextCancellation` attribute to `false`.
@ -45,7 +45,7 @@ By using a stateful security context token (SCT) in a secure session, the sessio
requireSecurityContextCancellation="false">
```
4. Specify how the client is authenticated while the secure session is established by adding a [\<secureConversationBootstrap>](../../../../docs/framework/configure-apps/file-schema/wcf/secureconversationbootstrap.md) child element to the [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md).
4. Specify how the client is authenticated while the secure session is established by adding a [\<secureConversationBootstrap>](../../../../docs/framework/configure-apps/file-schema/wcf/secureconversationbootstrap.md) child element to the [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md).
Specify how the client is authenticated by setting the `authenticationMode` attribute.
@ -53,13 +53,13 @@ By using a stateful security context token (SCT) in a secure session, the sessio
<secureConversationBootstrap authenticationMode="UserNameForCertificate" />
```
5. Specify the message encoding by adding an encoding element, such as [\<textMessageEncoding>](../../../../docs/framework/configure-apps/file-schema/wcf/textmessageencoding.md).
5. Specify the message encoding by adding an encoding element, such as [\<textMessageEncoding>](../../../../docs/framework/configure-apps/file-schema/wcf/textmessageencoding.md).
```xml
<textMessageEncoding />
```
6. Specify the transport by adding a transport element, such as the [\<httpTransport>](../../../../docs/framework/configure-apps/file-schema/wcf/httptransport.md).
6. Specify the transport by adding a transport element, such as the [\<httpTransport>](../../../../docs/framework/configure-apps/file-schema/wcf/httptransport.md).
```xml
<httpTransport />

Просмотреть файл

@ -102,7 +102,7 @@ WCF services and clients can use the <xref:System.ServiceModel.NetHttpBinding> b
The callback contract operation is implemented as an asynchronous method.
1. Implement the client code.
1. Implement the client code.
```csharp
class Program
@ -127,7 +127,7 @@ WCF services and clients can use the <xref:System.ServiceModel.NetHttpBinding> b
The CallbackHandler is repeated here for clarity. The client application creates a new InstanceContext and specifies the implementation of the callback interface. Next it creates an instance of the proxy class sending a reference to the newly created InstanceContext. When the client calls the service, the service will call the client using the callback contract specified.
2. Configure the client
2. Configure the client
```xml
<?xml version="1.0" encoding="utf-8" ?>

Просмотреть файл

@ -24,13 +24,13 @@ A replay attack occurs when an attacker copies a stream of messages between two
2. Use the <xref:System.ServiceModel.Channels.SecurityBindingElement.LocalClientSettings%2A> property to return a reference to the <xref:System.ServiceModel.Channels.LocalClientSecuritySettings> class and set any of the following properties, as appropriate:
1. `DetectReplay`. A Boolean value. This governs whether the client should detect replays from the server. The default is `true`.
1. `DetectReplay`. A Boolean value. This governs whether the client should detect replays from the server. The default is `true`.
2. `MaxClockSkew`. A <xref:System.TimeSpan> value. Governs how much time skew the replay mechanism can tolerate between the client and the server. The security mechanism examines the time stamp sent and determines whether it was sent too far back in the past. The default is 5 minutes.
2. `MaxClockSkew`. A <xref:System.TimeSpan> value. Governs how much time skew the replay mechanism can tolerate between the client and the server. The security mechanism examines the time stamp sent and determines whether it was sent too far back in the past. The default is 5 minutes.
3. `ReplayWindow`. A `TimeSpan` value. This governs how long a message can live in the network after the server sends it (through intermediaries) before reaching the client. The client tracks the signatures of the messages sent within the latest `ReplayWindow` for the purposes of replay detection.
3. `ReplayWindow`. A `TimeSpan` value. This governs how long a message can live in the network after the server sends it (through intermediaries) before reaching the client. The client tracks the signatures of the messages sent within the latest `ReplayWindow` for the purposes of replay detection.
4. `ReplayCacheSize`. An integer value. The client stores the signatures of the message in a cache. This setting specifies how many signatures the cache can store. If the number of messages sent within the last replay window reaches the cache limit, new messages are rejected until the oldest cached signatures reach the time limit. The default is 500000.
4. `ReplayCacheSize`. An integer value. The client stores the signatures of the message in a cache. This setting specifies how many signatures the cache can store. If the number of messages sent within the last replay window reaches the cache limit, new messages are rejected until the oldest cached signatures reach the time limit. The default is 500000.
### To control replay detection on the service using code

Просмотреть файл

@ -15,9 +15,9 @@ Windows Communication Foundation (WCF) can send messages using either buffered o
1. To stream data, the `OperationContract` for the service must satisfy two requirements:
1. The parameter that holds the data to be streamed must be the only parameter in the method. For example, if the input message is the one to be streamed, the operation must have exactly one input parameter. Similarly, if the output message is to be streamed, the operation must have either exactly one output parameter or a return value.
1. The parameter that holds the data to be streamed must be the only parameter in the method. For example, if the input message is the one to be streamed, the operation must have exactly one input parameter. Similarly, if the output message is to be streamed, the operation must have either exactly one output parameter or a return value.
2. At least one of the types of the parameter and return value must be either <xref:System.IO.Stream>, <xref:System.ServiceModel.Channels.Message>, or <xref:System.Xml.Serialization.IXmlSerializable>.
2. At least one of the types of the parameter and return value must be either <xref:System.IO.Stream>, <xref:System.ServiceModel.Channels.Message>, or <xref:System.Xml.Serialization.IXmlSerializable>.
The following is an example of a contract for streamed data.
@ -28,28 +28,28 @@ Windows Communication Foundation (WCF) can send messages using either buffered o
2. Streaming must be enabled on the binding. You set a `TransferMode` property, which can take one of the following values:
1. `Buffered`,
1. `Buffered`,
2. `Streamed`, which enables streaming communication in both directions.
2. `Streamed`, which enables streaming communication in both directions.
3. `StreamedRequest`, which enables streaming the request only.
3. `StreamedRequest`, which enables streaming the request only.
4. `StreamedResponse`, which enables streaming the response only.
4. `StreamedResponse`, which enables streaming the response only.
The `BasicHttpBinding` exposes the `TransferMode` property on the binding, as does `NetTcpBinding` and `NetNamedPipeBinding`. The `TransferMode` property can also be set on the transport binding element and used in a custom binding.
The following samples show how to set `TransferMode` by code and by changing the configuration file. The samples also both set the `maxReceivedMessageSize` property to 64 MB, which places a cap on the maximum allowable size of messages on receive. The default `maxReceivedMessageSize` is 64 KB, which is usually too low for streaming scenarios. Set this quota setting as appropriate depending on the maximum size of messages your application expects to receive. Also note that `maxBufferSize` controls the maximum size that is buffered, and set it appropriately.
1. The following configuration snippet from the sample shows setting the `TransferMode` property to streaming on the `basicHttpBinding` and a custom HTTP binding.
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.
2. The following code snippet shows setting the `TransferMode` property to streaming on the `basicHttpBinding` and a custom HTTP binding.
[!code-csharp[c_HowTo_EnableStreaming_code#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_enablestreaming_code/cs/c_howto_enablestreaming_code.cs#2)]
[!code-vb[c_HowTo_EnableStreaming_code#2](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto_enablestreaming_code/vb/c_howto_enablestreaming_code.vb#2)]
3. The following code snippet shows setting the `TransferMode` property to streaming on a custom TCP binding.
3. The following code snippet shows setting the `TransferMode` property to streaming on a custom TCP binding.
[!code-csharp[c_HowTo_EnableStreaming_code#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_enablestreaming_code/cs/c_howto_enablestreaming_code.cs#3)]
[!code-vb[c_HowTo_EnableStreaming_code#3](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto_enablestreaming_code/vb/c_howto_enablestreaming_code.vb#3)]

Просмотреть файл

@ -22,9 +22,9 @@ This topic explains how to implement a discovery proxy. For more information abo
3. Add the following references to the project
1. System.ServiceModel.dll
1. System.ServiceModel.dll
2. System.Servicemodel.Discovery.dll
2. System.Servicemodel.Discovery.dll
> [!CAUTION]
> Ensure that you reference version 4.0 or greater of these assemblies.
@ -976,4 +976,4 @@ namespace Microsoft.Samples.Discovery
- [WCF Discovery Overview](../../../../docs/framework/wcf/feature-details/wcf-discovery-overview.md)
- [How to: Implement a Discoverable Service that Registers with the Discovery Proxy](../../../../docs/framework/wcf/feature-details/discoverable-service-that-registers-with-the-discovery-proxy.md)
- [How to: Implement a Client Application that Uses the Discovery Proxy to Find a Service](../../../../docs/framework/wcf/feature-details/client-app-discovery-proxy-to-find-a-service.md)
- [How to: Test the Discovery Proxy](../../../../docs/framework/wcf/feature-details/how-to-test-the-discovery-proxy.md)
- [How to: Test the Discovery Proxy](../../../../docs/framework/wcf/feature-details/how-to-test-the-discovery-proxy.md)

Просмотреть файл

@ -51,7 +51,7 @@ This topic describes the steps required to set up Windows Process Activation Ser
As a convenience, the following two steps are implemented in a batch file called RemoveNetTcpSiteBinding.cmd located in the sample directory.
1. Remove net.tcp from the list of enabled protocols by running the following command in an administrator-level Command Prompt window.
1. Remove net.tcp from the list of enabled protocols by running the following command in an administrator-level Command Prompt window.
```
%windir%\system32\inetsrv\appcmd.exe set app
@ -61,7 +61,7 @@ This topic describes the steps required to set up Windows Process Activation Ser
> [!NOTE]
> This command is a single line of text.
2. Remove the net.tcp site binding by running the following command in an elevated Command Prompt window:
2. Remove the net.tcp site binding by running the following command in an elevated Command Prompt window:
```
%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site"

Просмотреть файл

@ -17,7 +17,7 @@ To make an X.509 certificate accessible to Windows Communication Foundation (WCF
1. Give the account under which WCF is running read access to the file that contains the private key associated with the X.509 certificate.
1. Determine whether WCF requires read access to the private key for the X.509 certificate.
1. Determine whether WCF requires read access to the private key for the X.509 certificate.
The following table details whether a private key must be available when using an X.509 certificate.
@ -28,14 +28,14 @@ To make an X.509 certificate accessible to Windows Communication Foundation (WCF
|Encrypting an outbound SOAP message.|No|
|Decrypting an inbound SOAP message.|Yes|
2. Determine the certificate store location and name in which the certificate is stored.
2. Determine the certificate store location and name in which the certificate is stored.
The certificate store in which the certificate is stored is specified either in application code or in configuration. For example, the following example specifies that the certificate is located in the `CurrentUser` certificate store named `My`.
[!code-csharp[x509Accessible#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/x509accessible/cs/source.cs#1)]
[!code-vb[x509Accessible#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/x509accessible/vb/source.vb#1)]
3. Determine where the private key for the certificate is located on the computer by using the [FindPrivateKey](../../../../docs/framework/wcf/samples/findprivatekey.md) tool.
3. Determine where the private key for the certificate is located on the computer by using the [FindPrivateKey](../../../../docs/framework/wcf/samples/findprivatekey.md) tool.
The [FindPrivateKey](../../../../docs/framework/wcf/samples/findprivatekey.md) tool requires the certificate store name, certificate store location, and something that uniquely identifies the certificate. The tool accepts either the certificate's subject name or its thumbprint as a unique identifier. For more information about how to determine the thumbprint for a certificate, see [How to: Retrieve the Thumbprint of a Certificate](../../../../docs/framework/wcf/feature-details/how-to-retrieve-the-thumbprint-of-a-certificate.md).
@ -45,7 +45,7 @@ To make an X.509 certificate accessible to Windows Communication Foundation (WCF
findprivatekey.exe My CurrentUser -t "46 dd 0e 7a ed 0b 7a 31 9b 02 a3 a0 43 7a d8 3f 60 40 92 9d" -a
```
4. Determine the account that WCF is running under.
4. Determine the account that WCF is running under.
The following table details the account under which WCF is running for a given scenario.
@ -56,7 +56,7 @@ To make an X.509 certificate accessible to Windows Communication Foundation (WCF
|Service that is hosted in IIS 6.0 ([!INCLUDE[ws2003](../../../../includes/ws2003-md.md)]) or IIS 7.0 ([!INCLUDE[wv](../../../../includes/wv-md.md)]).|NETWORK SERVICE|
|Service that is hosted in IIS 5.X ([!INCLUDE[wxp](../../../../includes/wxp-md.md)]).|Controlled by the `<processModel>` element in the Machine.config file. The default account is ASPNET.|
5. Grant read access to the file that contains the private key to the account that WCF is running under, using a tool such as icacls.exe.
5. Grant read access to the file that contains the private key to the account that WCF is running under, using a tool such as icacls.exe.
The following code example edits the discretionary access control list (DACL) for the specified file to grant the NETWORK SERVICE account read (:R) access to the file.

Просмотреть файл

@ -43,13 +43,13 @@ By default, when a user name and password is used for authentication, Windows Co
> [!TIP]
> For more information on using \<netTcpBinding> in this context, see [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-nettcpbinding.md)
1. In the configuration file, under the [\<system.serviceModel>](../../../../docs/framework/configure-apps/file-schema/wcf/system-servicemodel.md) element, add a [\<bindings>](../../../../docs/framework/configure-apps/file-schema/wcf/bindings.md) element.
1. In the configuration file, under the [\<system.serviceModel>](../../../../docs/framework/configure-apps/file-schema/wcf/system-servicemodel.md) element, add a [\<bindings>](../../../../docs/framework/configure-apps/file-schema/wcf/bindings.md) element.
2. Add a [\<wsHttpBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/wshttpbinding.md) or [\<basicHttpBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/basichttpbinding.md) element to the bindings section. For more information about creating an WCF binding element, see [How to: Specify a Service Binding in Configuration](../../../../docs/framework/wcf/how-to-specify-a-service-binding-in-configuration.md).
2. Add a [\<wsHttpBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/wshttpbinding.md) or [\<basicHttpBinding>](../../../../docs/framework/configure-apps/file-schema/wcf/basichttpbinding.md) element to the bindings section. For more information about creating an WCF binding element, see [How to: Specify a Service Binding in Configuration](../../../../docs/framework/wcf/how-to-specify-a-service-binding-in-configuration.md).
3. Set the `mode` attribute of the [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-wshttpbinding.md) or [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-basichttpbinding.md) to `Message`, `Transport`, or `TransportWithMessageCredential`.
3. Set the `mode` attribute of the [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-wshttpbinding.md) or [\<security>](../../../../docs/framework/configure-apps/file-schema/wcf/security-of-basichttpbinding.md) to `Message`, `Transport`, or `TransportWithMessageCredential`.
4. Set the `clientCredentialType` attribute of the [\<message>](../../../../docs/framework/configure-apps/file-schema/wcf/message-of-wshttpbinding.md) or [\<transport>](../../../../docs/framework/configure-apps/file-schema/wcf/transport-of-wshttpbinding.md).
4. Set the `clientCredentialType` attribute of the [\<message>](../../../../docs/framework/configure-apps/file-schema/wcf/message-of-wshttpbinding.md) or [\<transport>](../../../../docs/framework/configure-apps/file-schema/wcf/transport-of-wshttpbinding.md).
When using message security, set the `clientCredentialType` attribute of the [\<message>](../../../../docs/framework/configure-apps/file-schema/wcf/message-of-wshttpbinding.md) to `UserName`.
@ -78,22 +78,22 @@ By default, when a user name and password is used for authentication, Windows Co
2. Configure a behavior that specifies that a custom user name and password validator is used to validate user name and password pairs for incoming <xref:System.IdentityModel.Tokens.UserNameSecurityToken> security tokens.
1. As a child to the [\<system.serviceModel>](../../../../docs/framework/configure-apps/file-schema/wcf/system-servicemodel.md) element, add a [\<behaviors>](../../../../docs/framework/configure-apps/file-schema/wcf/behaviors.md) element.
1. As a child to the [\<system.serviceModel>](../../../../docs/framework/configure-apps/file-schema/wcf/system-servicemodel.md) element, add a [\<behaviors>](../../../../docs/framework/configure-apps/file-schema/wcf/behaviors.md) element.
2. Add a [\<serviceBehaviors>](../../../../docs/framework/configure-apps/file-schema/wcf/servicebehaviors.md) to the [\<behaviors>](../../../../docs/framework/configure-apps/file-schema/wcf/behaviors.md) element.
2. Add a [\<serviceBehaviors>](../../../../docs/framework/configure-apps/file-schema/wcf/servicebehaviors.md) to the [\<behaviors>](../../../../docs/framework/configure-apps/file-schema/wcf/behaviors.md) element.
3. Add a [\<behavior>](../../../../docs/framework/configure-apps/file-schema/wcf/behavior-of-servicebehaviors.md) element and set the `name` attribute to an appropriate value.
3. Add a [\<behavior>](../../../../docs/framework/configure-apps/file-schema/wcf/behavior-of-servicebehaviors.md) element and set the `name` attribute to an appropriate value.
4. Add a [\<serviceCredentials>](../../../../docs/framework/configure-apps/file-schema/wcf/servicecredentials.md) to the [\<behavior>](../../../../docs/framework/configure-apps/file-schema/wcf/behavior-of-servicebehaviors.md) element.
4. Add a [\<serviceCredentials>](../../../../docs/framework/configure-apps/file-schema/wcf/servicecredentials.md) to the [\<behavior>](../../../../docs/framework/configure-apps/file-schema/wcf/behavior-of-servicebehaviors.md) element.
5. Add a [\<userNameAuthentication>](../../../../docs/framework/configure-apps/file-schema/wcf/usernameauthentication.md) to the [\<serviceCredentials>](../../../../docs/framework/configure-apps/file-schema/wcf/servicecredentials.md).
5. Add a [\<userNameAuthentication>](../../../../docs/framework/configure-apps/file-schema/wcf/usernameauthentication.md) to the [\<serviceCredentials>](../../../../docs/framework/configure-apps/file-schema/wcf/servicecredentials.md).
6. Set the `userNamePasswordValidationMode` to `Custom`.
6. Set the `userNamePasswordValidationMode` to `Custom`.
> [!IMPORTANT]
> If the `userNamePasswordValidationMode` value is not set, WCF uses Windows authentication instead of the custom user name and password validator.
7. Set the `customUserNamePasswordValidatorType` to the type that represents your custom user name and password validator.
7. Set the `customUserNamePasswordValidatorType` to the type that represents your custom user name and password validator.
The following example shows the `<serviceCredentials>` fragment to this point.

Просмотреть файл

@ -131,10 +131,10 @@ This topic outlines the basic steps required to create a routing configuration t
> [!NOTE]
> The PrefixEndpointAddress filter does not evaluate the host name when performing a match, because a single host can be referred to by using a variety of host names that may all be valid ways of referring to the host from the client application. For example, all of the following may refer to the same host:
>
> - localhost
> - 127.0.0.1
> - `www.contoso.com`
> - ContosoWeb01
> - localhost
> - 127.0.0.1
> - `www.contoso.com`
> - ContosoWeb01
4. The final filter must support the routing of messages that arrive at the general endpoint without the custom header. For this scenario, the messages should alternate between the regularCalc and roundingCalc services. To support the "round robin" routing of these messages, use a custom filter that allows one filter instance to match for each message processed. The following defines two instances of a RoundRobinMessageFilter, which are grouped together to indicate that they should alternate between each other.

Просмотреть файл

@ -27,17 +27,17 @@ This topic describes the fundamental programming tasks used to create a secure W
You have three choices:
1. `Transport`
1. `Transport`
Transport security depends on the mechanism that the binding you have selected uses. For example, if you are using `WSHttpBinding` then the security mechanism is Secure Sockets Layer (SSL) (also the mechanism for the HTTPS protocol). Generally speaking, the main advantage of transport security is that it delivers good throughput no matter which transport you are using. However, it does have two limitations: The first is that the transport mechanism dictates the credential type used to authenticate a user. This is a drawback only if a service needs to interoperate with other services that demand different types of credentials. The second is that, because the security is not applied at the message level, security is implemented in a hop-by-hop manner rather than end-to-end. This latter limitation is an issue only if the message path between client and service includes intermediaries. For more information about which transport to use, see [Choosing a Transport](../../../../docs/framework/wcf/feature-details/choosing-a-transport.md). For more information about using transport security, see [Transport Security Overview](../../../../docs/framework/wcf/feature-details/transport-security-overview.md).
2. `Message`
2. `Message`
Message security means that every message includes the necessary headers and data to keep the message secure. Because the composition of the headers varies, you can include any number of credentials. This becomes a factor if you are interoperating with other services that demand a specific credential type that a transport mechanism can't supply, or if the message must be used with more than one service, where each service demands a different credential type.
For more information, see [Message Security](../../../../docs/framework/wcf/feature-details/message-security-in-wcf.md).
3. `TransportWithMessageCredential`
3. `TransportWithMessageCredential`
This choice uses the transport layer to secure the message transfer, while every message includes the rich credentials other services need. This combines the performance advantage of transport security with the rich credentials advantage of message security. This is available with the following bindings: <xref:System.ServiceModel.BasicHttpBinding>, <xref:System.ServiceModel.WSFederationHttpBinding>, <xref:System.ServiceModel.NetPeerTcpBinding>, and <xref:System.ServiceModel.WSHttpBinding>.

Просмотреть файл

@ -21,9 +21,9 @@ Extended Protection is a security initiative to protect against man-in-the-middl
4. This sample requires the client to establish a secure channel with the server and so it requires the presence of a server certificate which can be installed from Internet Information Services (IIS) Manager.
1. Open the IIS manager -> Server certificates (from the feature view tab).
1. Open the IIS manager -> Server certificates (from the feature view tab).
2. For the purpose of testing this sample, you can create a self-signed certificate. (If you dont want Internet Explorer to prompt you about the certificate not being secure, you can install it in the Trusted Certificate Root authority store).
2. For the purpose of testing this sample, you can create a self-signed certificate. (If you dont want Internet Explorer to prompt you about the certificate not being secure, you can install it in the Trusted Certificate Root authority store).
5. Go to the Actions pane for the Default Web site. Click Edit Site -> Bindings. Add HTTPS as a type if it is not already present, with port number 443, and assign the SSL certificate created in the above step.

Просмотреть файл

@ -17,11 +17,11 @@ When Windows Communication Foundation (WCF) receives a SOAP message signed using
Because Windows ships with a set of default certificate chains for trusted certificate authorities, it may not be necessary to install the certificate chain for all certificate authorities.
1. Export the certification authority certificate chain.
1. Export the certification authority certificate chain.
Exactly how this is done depends on the certification authority. If the certification authority is running Microsoft Certificate Services, select **Download a CA certificate, certificate chain, or CRL**, and then choose **Download CA certificate**.
2. Import the certification authority certificate chain.
2. Import the certification authority certificate chain.
In the Microsoft Management Console (MMC), open the Certificates snap-in. For the certificate store that WCF is configured to retrieve X.509 certificates from, select the **Trusted Root** **Certification Authorities** folder. Under the **Trusted Root Certification Authorities** folder, right-click the **Certificates** folder, point to **All Tasks**, and then click **Import**. Provide the file exported in step a.

Просмотреть файл

@ -31,11 +31,11 @@ Services and client applications that use data types that are serializable using
4. Make the generated serialization code available to your application by using one of the following options:
1. Compile the generated serialization code into a separate assembly with the name [*original assembly*].XmlSerializers.dll (for example, MyApp.XmlSerializers.dll). Your application must be able to load the assembly, which must be signed with the same key as the original assembly. If you recompile the original assembly, you must regenerate the serialization assembly.
1. Compile the generated serialization code into a separate assembly with the name [*original assembly*].XmlSerializers.dll (for example, MyApp.XmlSerializers.dll). Your application must be able to load the assembly, which must be signed with the same key as the original assembly. If you recompile the original assembly, you must regenerate the serialization assembly.
2. Compile the generated serialization code into a separate assembly and use the <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute> on the service contract that uses the <xref:System.ServiceModel.XmlSerializerFormatAttribute>. Set the <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute.AssemblyName%2A> or <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute.CodeBase%2A> properties to point to the compiled serialization assembly.
2. Compile the generated serialization code into a separate assembly and use the <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute> on the service contract that uses the <xref:System.ServiceModel.XmlSerializerFormatAttribute>. Set the <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute.AssemblyName%2A> or <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute.CodeBase%2A> properties to point to the compiled serialization assembly.
3. Compile the generated serialization code into your application assembly and add the <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute> to the service contract that uses the <xref:System.ServiceModel.XmlSerializerFormatAttribute>. Do not set the <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute.AssemblyName%2A> or <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute.CodeBase%2A> properties. The default serialization assembly is assumed to be the current assembly.
3. Compile the generated serialization code into your application assembly and add the <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute> to the service contract that uses the <xref:System.ServiceModel.XmlSerializerFormatAttribute>. Do not set the <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute.AssemblyName%2A> or <xref:System.Xml.Serialization.XmlSerializerAssemblyAttribute.CodeBase%2A> properties. The default serialization assembly is assumed to be the current assembly.
### To generate XmlSerializer serialization code in Visual Studio

Просмотреть файл

@ -41,7 +41,7 @@ In this tutorial, you learn how to:
2. Add a reference in the **GettingStartedClient** project to the <xref:System.ServiceModel> assembly:
1. In the **Solution Explorer** window, select the **References** folder under the **GettingStartedClient** project, and then select **Add Reference** from the shortcut menu.
1. In the **Solution Explorer** window, select the **References** folder under the **GettingStartedClient** project, and then select **Add Reference** from the shortcut menu.
2. In the **Add Reference** window, under **Assemblies** on the left side of the window, select **Framework**.

Просмотреть файл

@ -28,11 +28,11 @@ In Windows Communication Foundation (WCF) applications, a service operation can
1. A service contract interface with:
1. A synchronous `SampleMethod` operation.
1. A synchronous `SampleMethod` operation.
2. An asynchronous `BeginSampleMethod` operation.
2. An asynchronous `BeginSampleMethod` operation.
3. An asynchronous `BeginServiceAsyncMethod`/`EndServiceAsyncMethod` operation pair.
3. An asynchronous `BeginServiceAsyncMethod`/`EndServiceAsyncMethod` operation pair.
2. A service implementation using a <xref:System.IAsyncResult?displayProperty=nameWithType> object.

Просмотреть файл

@ -518,9 +518,9 @@ public class RemotingServer : MarshalByRefObject
4. We need to modify the servers configuration file by doing the following two things as shown in the example below:
1. Declare a \<client> section that describes the endpoint for the sessionful object. This is necessary because the server also acts as a client in this situation.
1. Declare a \<client> section that describes the endpoint for the sessionful object. This is necessary because the server also acts as a client in this situation.
2. Declare endpoints for the factory and sessionful object. This is necessary to allow the client to communicate with the service endpoints to acquire the EndpointAddress10 and to create the sessionful channel.
2. Declare endpoints for the factory and sessionful object. This is necessary to allow the client to communicate with the service endpoints to acquire the EndpointAddress10 and to create the sessionful channel.
```xml
<configuration>
@ -587,13 +587,13 @@ public class RemotingServer : MarshalByRefObject
6. In order to create and use this sessionful object, the client must do the following steps:
1. Create a channel to the ISessionBoundFactory service.
1. Create a channel to the ISessionBoundFactory service.
2. Use that channel to invoke that service to obtain an EndpointAddress10.
2. Use that channel to invoke that service to obtain an EndpointAddress10.
3. Use the EndpointAddress10 to create a channel to obtain a sessionful object.
3. Use the EndpointAddress10 to create a channel to obtain a sessionful object.
4. Interact with the sessionful object to demonstrate it remains the same instance across multiple calls.
4. Interact with the sessionful object to demonstrate it remains the same instance across multiple calls.
```csharp
ChannelFactory<ISessionBoundFactory> channelFactory =

Просмотреть файл

@ -48,7 +48,7 @@ Services frequently publish metadata to enable automatic generation and configur
10. On the client computer, run client.exe.
1. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)).
1. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)).
### To clean up after the sample

Просмотреть файл

@ -36,9 +36,9 @@ The ConfigurationCodeGenerator is a tool that you can use to expose your custom
The command generates three .cs files for the `BindingElement` (if you specified the /be: option), five .cs files for the standard `Binding` (if you specified the /sb: option), and a .xml file.
1. If you used the /be option, one of the .cs files implements the `BindingElementExtensionSection` for your binding element. This code exposes your `BindingElement` to the configuration system, so that other custom bindings can use your binding element. The other files have classes that represent defaults and constants. The files have `//TODO` comments to remind you to update the default values.
1. If you used the /be option, one of the .cs files implements the `BindingElementExtensionSection` for your binding element. This code exposes your `BindingElement` to the configuration system, so that other custom bindings can use your binding element. The other files have classes that represent defaults and constants. The files have `//TODO` comments to remind you to update the default values.
2. If you specified the /sb option, two of the .cs files implement a `StandardBindingElement` and a `StandardBindingCollectionElement` respectively, which exposes your standard binding to the configuration system. The other files have classes that represent defaults and constants. The files have `//TODO` comments to remind you to update the default values.
2. If you specified the /sb option, two of the .cs files implement a `StandardBindingElement` and a `StandardBindingCollectionElement` respectively, which exposes your standard binding to the configuration system. The other files have classes that represent defaults and constants. The files have `//TODO` comments to remind you to update the default values.
If you specified the /sb: option the CodeToAddTo\<*YourStdBinding*>.cs has code that you must manually add into the class that implements your standard binding.

Просмотреть файл

@ -122,36 +122,36 @@ Equation(0 + 100 - 50 * 17.65 / 2 = 441.25)
1. On the service computer:
1. Create a virtual directory named servicemodelsamples on the service computer.
1. Create a virtual directory named servicemodelsamples on the service computer.
2. Copy the service program files from \inetpub\wwwroot\servicemodelsamples to the virtual directory on the service computer. Ensure that you copy the files in the \bin subdirectory.
2. Copy the service program files from \inetpub\wwwroot\servicemodelsamples to the virtual directory on the service computer. Ensure that you copy the files in the \bin subdirectory.
3. Copy the Setup.bat and Cleanup.bat files to the service computer.
3. Copy the Setup.bat and Cleanup.bat files to the service computer.
4. Run the following command in a Developer Command Prompt for Visual Studio opened with administrator privileges: `Setup.bat service`. This creates the service certificate with the subject name matching the name of the computer the batch file was run on.
4. Run the following command in a Developer Command Prompt for Visual Studio opened with administrator privileges: `Setup.bat service`. This creates the service certificate with the subject name matching the name of the computer the batch file was run on.
> [!NOTE]
> The Setup.bat batch file is designed to be run from a Visual Studio 2010 Command Prompt. It requires that the path environment variable point to the directory where the SDK is installed. This environment variable is automatically set within a Visual Studio 2010 Command Prompt.
5. Change the [\<serviceCertificate>](../../../../docs/framework/configure-apps/file-schema/wcf/servicecertificate-of-servicecredentials.md) inside the Service.exe.config file to reflect the subject name of the certificate generated in the previous step.
5. Change the [\<serviceCertificate>](../../../../docs/framework/configure-apps/file-schema/wcf/servicecertificate-of-servicecredentials.md) inside the Service.exe.config file to reflect the subject name of the certificate generated in the previous step.
6. Run Service.exe from a command prompt.
6. Run Service.exe from a command prompt.
2. On the client computer:
1. Copy the client program files from the \client\bin\ folder to the client computer. Also copy the Cleanup.bat file.
1. Copy the client program files from the \client\bin\ folder to the client computer. Also copy the Cleanup.bat file.
2. Run Cleanup.bat to remove any old certificates from previous samples.
2. Run Cleanup.bat to remove any old certificates from previous samples.
3. Export the service's certificate by opening a Developer Command Prompt for Visual Studio with administrative privileges, and running the following command on the service computer (substitute `%SERVER_NAME%` with the fully-qualified name of the computer where the service is running):
3. Export the service's certificate by opening a Developer Command Prompt for Visual Studio with administrative privileges, and running the following command on the service computer (substitute `%SERVER_NAME%` with the fully-qualified name of the computer where the service is running):
```
certmgr -put -r LocalMachine -s My -c -n %SERVER_NAME% %SERVER_NAME%.cer
```
4. Copy %SERVER_NAME%.cer to the client computer (substitute %SERVER_NAME% with the fully-qualified name of the computer where the service is running).
4. Copy %SERVER_NAME%.cer to the client computer (substitute %SERVER_NAME% with the fully-qualified name of the computer where the service is running).
5. Import the service's certificate by opening a Developer Command Prompt for Visual Studio with administrative privileges, and running the following command on the client computer (substitute %SERVER_NAME% with the fully-qualified name of the computer where the service is running):
5. Import the service's certificate by opening a Developer Command Prompt for Visual Studio with administrative privileges, and running the following command on the client computer (substitute %SERVER_NAME% with the fully-qualified name of the computer where the service is running):
```
certmgr.exe -add -c %SERVER_NAME%.cer -s -r CurrentUser TrustedPeople
@ -159,7 +159,7 @@ Equation(0 + 100 - 50 * 17.65 / 2 = 441.25)
Steps c, d, and e are not necessary if the certificate is issued by a Trusted Issuer.
6. Modify the clients App.config file as follows:
6. Modify the clients App.config file as follows:
```xml
<client>
@ -172,9 +172,9 @@ Equation(0 + 100 - 50 * 17.65 / 2 = 441.25)
</client>
```
7. If the service is running under an account other than the NetworkService or LocalSystem account in a domain environment, you might need to modify the endpoint identity for the service endpoint inside the client's App.config file to set the appropriate UPN or SPN based on the account that is used to run the service. For more information about endpoint identity, see the [Service Identity and Authentication](../../../../docs/framework/wcf/feature-details/service-identity-and-authentication.md) topic.
7. If the service is running under an account other than the NetworkService or LocalSystem account in a domain environment, you might need to modify the endpoint identity for the service endpoint inside the client's App.config file to set the appropriate UPN or SPN based on the account that is used to run the service. For more information about endpoint identity, see the [Service Identity and Authentication](../../../../docs/framework/wcf/feature-details/service-identity-and-authentication.md) topic.
8. Run Client.exe from a command prompt.
8. Run Client.exe from a command prompt.
### To clean up after the sample

Просмотреть файл

@ -37,13 +37,13 @@ This sample demonstrates how to implement a custom encoder using the Windows Com
2. The configuration information is read.
1. The service configuration registers the custom configuration handler.
1. The service configuration registers the custom configuration handler.
2. The service host is created and opened.
2. The service host is created and opened.
3. The custom configuration element creates and returns the custom binding element.
3. The custom configuration element creates and returns the custom binding element.
4. The custom binding element creates and returns a message encoder factory.
4. The custom binding element creates and returns a message encoder factory.
3. A message is received.

Просмотреть файл

@ -162,7 +162,7 @@ ChannelFactory<ICalculator> cf = new ChannelFactory<ICalculator>(endpoint.Bin
10. On the client machine, run the MetadataResolverClient or the SvcutilClient from VS.
1. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)).
1. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)).
#### To clean up after the sample

Просмотреть файл

@ -308,15 +308,15 @@ Processing Purchase Order: 97897eff-f926-4057-a32b-af8fb11b9bf9
2. If the service is run first, it will check to ensure that the queue is present. If the queue is not present, the service will create one. You can run the service first to create the queue, or you can create one via the MSMQ Queue Manager. Follow these steps to create a queue in Windows 2008.
1. Open Server Manager in Visual Studio 2012.
1. Open Server Manager in Visual Studio 2012.
2. Expand the **Features** tab.
2. Expand the **Features** tab.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
4. Check the **Transactional** box.
4. Check the **Transactional** box.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md).

Просмотреть файл

@ -124,23 +124,23 @@ public class PriceChangeEventArgs : EventArgs
1. Set up the service machine:
1. On the service machine, create a virtual directory named ServiceModelSamples. The batch file Setupvroot.bat from the [One-Time Setup Procedure for the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/one-time-setup-procedure-for-the-wcf-samples.md) can be used to create the disk directory and virtual directory.
1. On the service machine, create a virtual directory named ServiceModelSamples. The batch file Setupvroot.bat from the [One-Time Setup Procedure for the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/one-time-setup-procedure-for-the-wcf-samples.md) can be used to create the disk directory and virtual directory.
2. Copy the service program files from %SystemDrive%\Inetpub\wwwroot\servicemodelsamples to the ServiceModelSamples virtual directory on the service machine. Be sure to include the files in the \bin directory.
2. Copy the service program files from %SystemDrive%\Inetpub\wwwroot\servicemodelsamples to the ServiceModelSamples virtual directory on the service machine. Be sure to include the files in the \bin directory.
3. Test that you can access the service from the client machine using a browser.
3. Test that you can access the service from the client machine using a browser.
2. Set up the client machines:
1. Copy the client program files from the \client\bin\ folder, under the language-specific folder, to the client machines.
1. Copy the client program files from the \client\bin\ folder, under the language-specific folder, to the client machines.
2. In each client configuration file, change the address value of the endpoint definition to match the new address of your service. Replace any references to "localhost" with a fully-qualified domain name in the address.
2. In each client configuration file, change the address value of the endpoint definition to match the new address of your service. Replace any references to "localhost" with a fully-qualified domain name in the address.
3. Set up the data source machine:
1. Copy the data source program files from the \datasource\bin\ folder, under the language-specific folder, to the data source machine.
1. Copy the data source program files from the \datasource\bin\ folder, under the language-specific folder, to the data source machine.
2. In the data source configuration file, change the address value of the endpoint definition to match the new address of your service. Replace any references to "localhost" with a fully-qualified domain name in the address.
2. In the data source configuration file, change the address value of the endpoint definition to match the new address of your service. Replace any references to "localhost" with a fully-qualified domain name in the address.
4. On the client machines, launch Client.exe from a command prompt.

Просмотреть файл

@ -28,9 +28,9 @@ Extended Protection is a security initiative for protecting against man-in-the-m
4. This sample requires the client to establish a secure channel with the server, so it requires the presence of a server certificate which can be installed from Internet Information Services (IIS) Manager.
1. Open IIS Manager. Open **Server certificates**, which appears in the **Feature View** tab when the root node (machine name) is selected.
1. Open IIS Manager. Open **Server certificates**, which appears in the **Feature View** tab when the root node (machine name) is selected.
2. For the purpose of testing this sample, create a self-signed certificate. If you do not want Internet Explorer to prompt you about the certificate not being secure, install the certificate in the Trusted Certificate Root authority store.
2. For the purpose of testing this sample, create a self-signed certificate. If you do not want Internet Explorer to prompt you about the certificate not being secure, install the certificate in the Trusted Certificate Root authority store.
5. Open the **Actions** pane for the default Web site. Click **Edit Site**, **Bindings**. Add HTTPS as a type if not already present, with port number 443. Assign the SSL certificate created in the preceding step.

Просмотреть файл

@ -46,21 +46,21 @@ You must enable several ports or programs in the firewall so that the Windows Co
2. On Windows 7 or Windows Server 2008 R2, follow these steps.
1. Click **Advanced settings** in the left column of the Windows Firewall window.
1. Click **Advanced settings** in the left column of the Windows Firewall window.
2. Click **Inbound Rules** in the left column.
2. Click **Inbound Rules** in the left column.
3. Click **New Rules** in the right column.
3. Click **New Rules** in the right column.
4. Select **Port** and click **next**.
4. Select **Port** and click **next**.
5. Select **TCP** and enter `8000, 8001, 8002, 8003, 9000, 80, 443` in the **Specific local ports** field.
5. Select **TCP** and enter `8000, 8001, 8002, 8003, 9000, 80, 443` in the **Specific local ports** field.
6. Click **Next**.
6. Click **Next**.
7. Select **Allow the connection**, and click **Next** .
7. Select **Allow the connection**, and click **Next** .
8. Select **Domain** and **Private**, and click **Next**.
8. Select **Domain** and **Private**, and click **Next**.
9. Name this rule `WCF-WF 4.0 Samples`, and click **Finish**.
@ -68,15 +68,15 @@ You must enable several ports or programs in the firewall so that the Windows Co
3. On [!INCLUDE[wv](../../../../includes/wv-md.md)] or [!INCLUDE[lserver](../../../../includes/lserver-md.md)], follow these steps.
1. Click **Allow a program through Windows Firewall**.
1. Click **Allow a program through Windows Firewall**.
2. On the **Exceptions** tab, click **Add Port**.
2. On the **Exceptions** tab, click **Add Port**.
3. Enter a name, enter 8000 as the port number, and select the **TCP** option.
3. Enter a name, enter 8000 as the port number, and select the **TCP** option.
4. Click the **Change Scope** button, select the **My Network** (subnet) only option, and click **OK**.
4. Click the **Change Scope** button, select the **My Network** (subnet) only option, and click **OK**.
5. Repeat steps b to d for ports 8001, 8002, 8003, 9000, 80, and 443.
5. Repeat steps b to d for ports 8001, 8002, 8003, 9000, 80, and 443.
4. Click **OK** to close the firewall applet.

Просмотреть файл

@ -15,9 +15,9 @@ This sample demonstrates the Windows Communication Foundation (WCF) Routing Serv
> [!NOTE]
> If you press F5, the Calculator Client automatically starts. If you press CTRL+SHIFT+B (build), you must start following applications yourself.
>
> 1. Calculator client (./CalculatorClient/bin/client.exe
> 2. Calculator service (./CalculatorService/bin/service.exe)
> 3. Routing service (./RoutingService/bin/RoutingService.exe)
> 1. Calculator client (./CalculatorClient/bin/client.exe
> 2. Calculator service (./CalculatorService/bin/service.exe)
> 3. Routing service (./RoutingService/bin/RoutingService.exe)
3. Press ENTER to start the client.

Просмотреть файл

@ -40,13 +40,13 @@ To run the samples that are hosted by Internet Information Services (IIS), you m
8. Make sure the following items are selected:
1. **.NET Extensibility**
1. **.NET Extensibility**
2. **ASP.NET**
2. **ASP.NET**
3. **ISAPI Extensions**
3. **ISAPI Extensions**
4. **ISAPI Filters**
4. **ISAPI Filters**
9. Under the item labeled **World Wide Web Services**, expand **Common Http Features**.
@ -98,13 +98,13 @@ To run the samples that are hosted by Internet Information Services (IIS), you m
8. Make sure the following items are selected:
1. **.NET Extensibility**
1. **.NET Extensibility**
2. **ASP.NET**
2. **ASP.NET**
3. **ISAPI Extensions**
3. **ISAPI Extensions**
4. **ISAPI Filters**
4. **ISAPI Filters**
9. Expand the item labeled **Web Management Tools**, and then select **IIS Management Console**.

Просмотреть файл

@ -269,15 +269,15 @@ static void DisplayOrderStatus()
2. If the service is run first, it will check to ensure that the queue is present. If the queue is not present, the service will create one. You can run the service first to create the queue, or you can create one via the MSMQ Queue Manager. Follow these steps to create a queue in Windows 2008.
1. Open Server Manager in Visual Studio 2012.
1. Open Server Manager in Visual Studio 2012.
2. Expand the **Features** tab.
2. Expand the **Features** tab.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
4. Check the **Transactional** box.
4. Check the **Transactional** box.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md).

Просмотреть файл

@ -112,15 +112,15 @@ Console.ReadLine();
2. If the service is run first, it will check to ensure that the queue is present. If the queue is not present, the service will create one. You can run the service first to create the queue, or you can create one via the MSMQ Queue Manager. Follow these steps to create a queue in Windows 2008.
1. Open Server Manager in Visual Studio 2012.
1. Open Server Manager in Visual Studio 2012.
2. Expand the **Features** tab.
2. Expand the **Features** tab.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
4. Check the **Transactional** box.
4. Check the **Transactional** box.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md).

Просмотреть файл

@ -14,15 +14,15 @@ This sample demonstrates how to implement an application that uses WS-Security w
2. If the service is run first, it will check to ensure that the queue is present. If the queue is not present, the service will create one. You can run the service first to create the queue, or you can create one via the MSMQ Queue Manager. Follow these steps to create a queue in Windows 2008.
1. Open Server Manager in Visual Studio 2012.
1. Open Server Manager in Visual Studio 2012.
2. Expand the **Features** tab.
2. Expand the **Features** tab.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
4. Check the **Transactional** box.
4. Check the **Transactional** box.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md).

Просмотреть файл

@ -155,7 +155,7 @@ Press <ENTER> to terminate client.
14. On the client machine, launch Client.exe from a command prompt window.
1. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)).
1. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)).
### To clean up after the sample

Просмотреть файл

@ -213,15 +213,15 @@ Status of order 70cf9d63-3dfa-4e69-81c2-23aa4478ebed :Pending
2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/one-time-setup-procedure-for-the-wcf-samples.md). In addition, you must install the WCF non-HTTP activation components:
1. From the **Start** menu, choose **Control Panel**.
1. From the **Start** menu, choose **Control Panel**.
2. Select **Programs and Features**.
2. Select **Programs and Features**.
3. Click **Turn Windows Features on or off**.
3. Click **Turn Windows Features on or off**.
4. Under **Features Summary**, click **Add Features**.
4. Under **Features Summary**, click **Add Features**.
5. Expand the **Microsoft .NET Framework 3.0** node and check the **Windows Communication Foundation Non-HTTP Activation** feature.
5. Expand the **Microsoft .NET Framework 3.0** node and check the **Windows Communication Foundation Non-HTTP Activation** feature.
3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md).
@ -229,21 +229,21 @@ Status of order 70cf9d63-3dfa-4e69-81c2-23aa4478ebed :Pending
5. The MSMQ activation service runs as Network Service by default. Therefore, the queue that is used to activate the application must have receive and peek permissions for Network Service. This can be added by using the Message Queuing MMC:
1. From the **Start** menu, click **Run**, then type `Compmgmt.msc` and press ENTER.
1. From the **Start** menu, click **Run**, then type `Compmgmt.msc` and press ENTER.
2. Under **Services and Applications**, expand **Message Queuing**.
2. Under **Services and Applications**, expand **Message Queuing**.
3. Click **Private Queues**.
3. Click **Private Queues**.
4. Right-click the queue (servicemodelsamples/Service.svc) and choose **Properties**.
4. Right-click the queue (servicemodelsamples/Service.svc) and choose **Properties**.
5. On the **Security** tab, click **Add** and give peek and receive permissions to Network Service.
5. On the **Security** tab, click **Add** and give peek and receive permissions to Network Service.
6. Configure the Windows Process Activation Service (WAS) to support MSMQ activation.
As a convenience, the following steps are implemented in a batch file called AddMsmqSiteBinding.cmd located in the sample directory.
1. To support net.msmq activation, the default Web site must first be bound to the net.msmq protocol. This can be done using appcmd.exe, which is installed with the [!INCLUDE[iisver](../../../../includes/iisver-md.md)] management toolset. From an elevated (administrator) command prompt, run the following command.
1. To support net.msmq activation, the default Web site must first be bound to the net.msmq protocol. This can be done using appcmd.exe, which is installed with the [!INCLUDE[iisver](../../../../includes/iisver-md.md)] management toolset. From an elevated (administrator) command prompt, run the following command.
```console
%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site"
@ -255,7 +255,7 @@ Status of order 70cf9d63-3dfa-4e69-81c2-23aa4478ebed :Pending
This command adds a net.msmq site binding to the default Web site.
2. Although all applications within a site share a common net.msmq binding, each application can enable net.msmq support individually. To enable net.msmq for the /servicemodelsamples application, run the following command from an elevated command prompt.
2. Although all applications within a site share a common net.msmq binding, each application can enable net.msmq support individually. To enable net.msmq for the /servicemodelsamples application, run the following command from an elevated command prompt.
```console
%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/servicemodelsamples" /enabledProtocols:http,net.msmq
@ -278,7 +278,7 @@ Status of order 70cf9d63-3dfa-4e69-81c2-23aa4478ebed :Pending
As a convenience, the following steps are implemented in a batch file called RemoveMsmqSiteBinding.cmd located in the sample directory:
1. Remove net.msmq from the list of enabled protocols by running the following command from an elevated command prompt.
1. Remove net.msmq from the list of enabled protocols by running the following command from an elevated command prompt.
```console
%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/servicemodelsamples" /enabledProtocols:http
@ -287,7 +287,7 @@ Status of order 70cf9d63-3dfa-4e69-81c2-23aa4478ebed :Pending
> [!NOTE]
> This command is a single line of text.
2. Remove the net.msmq site binding by running the following command from an elevated command prompt.
2. Remove the net.msmq site binding by running the following command from an elevated command prompt.
```console
%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" --bindings.[protocol='net.msmq',bindingInformation='localhost']
@ -324,17 +324,17 @@ Status of order 70cf9d63-3dfa-4e69-81c2-23aa4478ebed :Pending
To change the identity that the worker process runs under:
1. Run Inetmgr.exe.
1. Run Inetmgr.exe.
2. Under **Application Pools**, right-click the **AppPool** (typically **DefaultAppPool**) and choose **Set Application Pool Defaults…**.
2. Under **Application Pools**, right-click the **AppPool** (typically **DefaultAppPool**) and choose **Set Application Pool Defaults…**.
3. Change the Identity properties to use the specific user account.
3. Change the Identity properties to use the specific user account.
To change the identity that the Activation Service runs under:
1. Run Services.msc.
1. Run Services.msc.
2. Right-click the **Net.MsmqListener Adapter**, and choose **Properties**.
2. Right-click the **Net.MsmqListener Adapter**, and choose **Properties**.
4. Change the account in the **LogOn** tab.

Просмотреть файл

@ -271,15 +271,15 @@ Processing Purchase Order: 23e0b991-fbf9-4438-a0e2-20adf93a4f89
2. If the service is run first, it will check to ensure that the queue is present. If the queue is not present, the service will create one. You can run the service first to create the queue, or you can create one via the MSMQ Queue Manager. Follow these steps to create a queue in Windows 2008.
1. Open Server Manager in Visual Studio 2012.
1. Open Server Manager in Visual Studio 2012.
2. Expand the **Features** tab.
2. Expand the **Features** tab.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
4. Check the **Transactional** box.
4. Check the **Transactional** box.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md).
@ -317,4 +317,4 @@ Processing Purchase Order: 23e0b991-fbf9-4438-a0e2-20adf93a4f89
>
> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://go.microsoft.com/fwlink/?LinkId=150780) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory.
>
> `<InstallDrive>:\WF_WCF_Samples\WCF\Basic\Binding\Net\MSMQ\Poison\MSMQ4`
> `<InstallDrive>:\WF_WCF_Samples\WCF\Basic\Binding\Net\MSMQ\Poison\MSMQ4`

Просмотреть файл

@ -25,29 +25,29 @@ The Windows Communication Foundation (WCF) samples can be run in a single-machin
1. If the service is hosted in IIS:
1. On the service machine, create a virtual directory named ServiceModelSamples. The batch file Setupvroot.bat included with [One-Time Setup Procedure for the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/one-time-setup-procedure-for-the-wcf-samples.md) can be used to create the disk directory and virtual directory.
1. On the service machine, create a virtual directory named ServiceModelSamples. The batch file Setupvroot.bat included with [One-Time Setup Procedure for the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/one-time-setup-procedure-for-the-wcf-samples.md) can be used to create the disk directory and virtual directory.
2. Copy the service program files from %SystemDrive%\Inetpub\wwwroot\servicemodelsamples to the ServiceModelSamples virtual directory on the service machine. Ensure that you include the files in the \bin directory.
2. Copy the service program files from %SystemDrive%\Inetpub\wwwroot\servicemodelsamples to the ServiceModelSamples virtual directory on the service machine. Ensure that you include the files in the \bin directory.
3. Test that you can access the service from the client machine using a browser.
3. Test that you can access the service from the client machine using a browser.
If the service is self-hosted:
1. On the service machine, create a directory to hold the service files.
1. On the service machine, create a directory to hold the service files.
2. Copy the service program files from the \service\bin\ folder, under the language-specific folder, to the service machine.
2. Copy the service program files from the \service\bin\ folder, under the language-specific folder, to the service machine.
3. In the service configuration file, change the address value of the endpoint definition to match the new address of your service. Replace any references to "localhost" with a fully-qualified domain name in the address.
3. In the service configuration file, change the address value of the endpoint definition to match the new address of your service. Replace any references to "localhost" with a fully-qualified domain name in the address.
4. Launch Service.exe from a command prompt.
4. Launch Service.exe from a command prompt.
2. Copy the client program files from the \client\bin\ folder, under the language-specific folder, to the client machine.
3. Set the endpoint address.
1. If the service is not running under a domain account, open the client configuration file and change the address value of the endpoint definition to match the new address of your service. Replace any references to "localhost" with a fully-qualified domain name in the address.
1. If the service is not running under a domain account, open the client configuration file and change the address value of the endpoint definition to match the new address of your service. Replace any references to "localhost" with a fully-qualified domain name in the address.
2. If the service is running under a domain account, regenerate the client configuration by running Svcutil.exe against the service. For more information about running Svcutil.exe, see [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md). Use the generated file instead of the configuration file in the sample. The generated configuration file has additional identity information, and contains all settings necessary to connect to the service endpoint even though they are the default settings. For more information about identity information, see [Service Identity and Authentication](../../../../docs/framework/wcf/feature-details/service-identity-and-authentication.md), and [\<identity>](../../../../docs/framework/configure-apps/file-schema/wcf/identity.md).
2. If the service is running under a domain account, regenerate the client configuration by running Svcutil.exe against the service. For more information about running Svcutil.exe, see [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md). Use the generated file instead of the configuration file in the sample. The generated configuration file has additional identity information, and contains all settings necessary to connect to the service endpoint even though they are the default settings. For more information about identity information, see [Service Identity and Authentication](../../../../docs/framework/wcf/feature-details/service-identity-and-authentication.md), and [\<identity>](../../../../docs/framework/configure-apps/file-schema/wcf/identity.md).
4. On the client machine, launch Client.exe from a command prompt.
@ -57,13 +57,13 @@ The Windows Communication Foundation (WCF) samples can be run in a single-machin
2. If the service is hosted in IIS:
1. Activate the service using a browser by entering the address `http://localhost/servicemodelsamples/service.svc`.
1. Activate the service using a browser by entering the address `http://localhost/servicemodelsamples/service.svc`.
2. In the solution, choose the **Debug** menu and the **Attach to Process** menu item.
2. In the solution, choose the **Debug** menu and the **Attach to Process** menu item.
3. Select the **Show processes from all users** check box.
3. Select the **Show processes from all users** check box.
4. Select the host worker process W3wp.exe to debug (select ASPNet_wp.exe on Windows XP).
4. Select the host worker process W3wp.exe to debug (select ASPNet_wp.exe on Windows XP).
3. You can now set breakpoints in the service code and enable breakpoints on exceptions.

Просмотреть файл

@ -57,11 +57,11 @@ This sample demonstrates how to implement and configure a typical service and cl
3. Run the sample by following these steps:
1. Right click the **Service** project and select **Set as StartUp project**, then press **Ctrl+F5**.
1. Right click the **Service** project and select **Set as StartUp project**, then press **Ctrl+F5**.
2. Wait for the console output confirming that the service is up and running.
2. Wait for the console output confirming that the service is up and running.
3. Right click the **Client** project and select **Set as StartUp project**, then press **Ctrl+F5**.
3. Right click the **Client** project and select **Set as StartUp project**, then press **Ctrl+F5**.
> [!IMPORTANT]
> The samples may already be installed on your computer. Check for the following (default) directory before continuing.

Просмотреть файл

@ -52,13 +52,13 @@ This sample may already be installed on your computer. Check for the following (
3. Create a Web application in Internet Information Services (IIS) Manager.
1. In IIS Manager, right click the **Default Web Site** and select **Add an Application**.
1. In IIS Manager, right click the **Default Web Site** and select **Add an Application**.
2. For the **alias**, type in `WebRoutingIntegration`.
2. For the **alias**, type in `WebRoutingIntegration`.
3. For the **Physical Path**, select the Service folder inside the project.
3. For the **Physical Path**, select the Service folder inside the project.
4. Press **OK**.
4. Press **OK**.
4. Start the application, by right-clicking the Web application and selecting **Manage Application** and then **Browse**.

Просмотреть файл

@ -173,18 +173,18 @@ Symbols:
1. Once you install the `TcpSyncStockService` sample, do the following:
1. Open the `TcpSyncStockService` in Visual Studio (Note that the TcpSyncStockService sample is installed with WSE 3.0. It is not part of this sample's code).
1. Open the `TcpSyncStockService` in Visual Studio (Note that the TcpSyncStockService sample is installed with WSE 3.0. It is not part of this sample's code).
2. Set the StockService project as the start up project.
2. Set the StockService project as the start up project.
3. Open StockService.cs in the StockService project and comment out the [Policy] attribute on the `StockService` class. This disables security from the sample. While WCF can interoperate with WSE 3.0 secure endpoints, security is disabled to keep this sample focused on the custom TCP transport.
3. Open StockService.cs in the StockService project and comment out the [Policy] attribute on the `StockService` class. This disables security from the sample. While WCF can interoperate with WSE 3.0 secure endpoints, security is disabled to keep this sample focused on the custom TCP transport.
4. Press F5 to start the `TcpSyncStockService`. The service starts in a new console window.
4. Press F5 to start the `TcpSyncStockService`. The service starts in a new console window.
5. Open this TCP transport sample in Visual Studio.
5. Open this TCP transport sample in Visual Studio.
6. Update the "hostname" variable in TestCode.cs to match the machine name running the `TcpSyncStockService`.
6. Update the "hostname" variable in TestCode.cs to match the machine name running the `TcpSyncStockService`.
7. Press F5 to start the TCP transport sample.
7. Press F5 to start the TCP transport sample.
8. The TCP transport test client starts in a new console. The client requests stock quotes from the service and then displays the results in its console window.
8. The TCP transport test client starts in a new console. The client requests stock quotes from the service and then displays the results in its console window.

Просмотреть файл

@ -137,13 +137,13 @@ public class CustomEndpoint : ServiceEndpoint
2. Enable multiple projects to start up.
1. In **Solution Explorer**, right-click the Standard Endpoints solution and then select **Properties**.
1. In **Solution Explorer**, right-click the Standard Endpoints solution and then select **Properties**.
2. In **Common Properties**, select **Startup Project**, and then click **Multiple Startup Projects**.
2. In **Common Properties**, select **Startup Project**, and then click **Multiple Startup Projects**.
3. Move the Service project to the beginning of the list, with the **Action** set to **Start**.
3. Move the Service project to the beginning of the list, with the **Action** set to **Start**.
4. Move the Client project after the Service project, also with the **Action** set to **Start**.
4. Move the Client project after the Service project, also with the **Action** set to **Start**.
This specifies that the Client project is executed after the Service project.

Просмотреть файл

@ -124,21 +124,21 @@ The Windows Communication Foundation (WCF) samples are intended to share a commo
If it is not listed:
1. Click **Start** and then click **Control Panel**.
1. Click **Start** and then click **Control Panel**.
2. If you do not see the **User Accounts** icon, click **Switch to Category View**.
2. If you do not see the **User Accounts** icon, click **Switch to Category View**.
3. Click the **User Accounts** icon.
3. Click the **User Accounts** icon.
4. Under "or pick a Control Panel icon," click **User Accounts**.
4. Under "or pick a Control Panel icon," click **User Accounts**.
5. In the **User Accounts** dialog box, click the **Advanced** tab.
5. In the **User Accounts** dialog box, click the **Advanced** tab.
6. Click **Advanced**.
6. Click **Advanced**.
7. In the **Local Users and Groups** dialog box, click to expand the **Users** folder.
7. In the **Local Users and Groups** dialog box, click to expand the **Users** folder.
8. In the right pane, double-click **Internet Guest Account**.
8. In the right pane, double-click **Internet Guest Account**.
9. In the **Properties** dialog box, copy the name used as the Internet guest account. By default, the name begins with "USR_" followed by the name of the computer.
@ -160,17 +160,17 @@ The Windows Communication Foundation (WCF) samples are intended to share a commo
If NETWORK SERVICE is not listed:
1. Click **Add**.
1. Click **Add**.
2. In the **Select Users or Groups** dialog box, type the name of the computer followed by a backslash.
2. In the **Select Users or Groups** dialog box, type the name of the computer followed by a backslash.
3. Type **service** after the backslash (no space).
3. Type **service** after the backslash (no space).
4. Click **Check names**.
4. Click **Check names**.
5. If multiple names are found, select **NETWORK SERVICE** and click **OK**.
5. If multiple names are found, select **NETWORK SERVICE** and click **OK**.
6. Click **OK** to close the **Select Users or Groups** dialog box.
6. Click **OK** to close the **Select Users or Groups** dialog box.
6. If you are using Windows XP SP2 with IIS 5.1, check that both Internet Guest Account and ASPNET are listed in the **Group or user names** box.
@ -178,11 +178,11 @@ The Windows Communication Foundation (WCF) samples are intended to share a commo
To check if ASPNET is part of the **Users** security group:
1. On the **Start** menu, click **Control Panel**.
1. On the **Start** menu, click **Control Panel**.
2. Click the **User Accounts** icon.
2. Click the **User Accounts** icon.
3. In the **Group** column, check that the value for **ASPNET** is "Users."
3. In the **Group** column, check that the value for **ASPNET** is "Users."
## See also

Просмотреть файл

@ -71,13 +71,13 @@ This sample demonstrates how to add your own tracing events into the stream of a
10. Test the service using the WCF Test Client.
1. In the WCF Test Client, double-click **Add()** under the ICalculator service node.
1. In the WCF Test Client, double-click **Add()** under the ICalculator service node.
The **Add()** method appears in the right pane with two parameters.
2. Type in 2 for the first parameter and 3 for the second parameter.
2. Type in 2 for the first parameter and 3 for the second parameter.
3. Click **Invoke** to invoke the method.
3. Click **Invoke** to invoke the method.
11. Go to the **Event Viewer** window that you have already opened. Navigate to **Event Viewer**, **Applications and Services Logs**, **Microsoft**, **Windows**, **Application Server-Applications**.

Просмотреть файл

@ -132,15 +132,15 @@ public partial class OrderProcessorClient : System.ServiceModel.ClientBase<IOrde
2. If the service is run first, it will check to ensure that the queue is present. If the queue is not present, the service will create one. You can run the service first to create the queue, or you can create one via the MSMQ Queue Manager. Follow these steps to create a queue in Windows 2008.
1. Open Server Manager in Visual Studio 2012.
1. Open Server Manager in Visual Studio 2012.
2. Expand the **Features** tab.
2. Expand the **Features** tab.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
3. Right-click **Private Message Queues**, and select **New**, **Private Queue**.
4. Check the **Transactional** box.
4. Check the **Transactional** box.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
5. Enter `ServiceModelSamplesTransacted` as the name of the new queue.
3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](../../../../docs/framework/wcf/samples/building-the-samples.md).

Просмотреть файл

@ -232,47 +232,47 @@ Press <ENTER> to terminate the service.
1. On a service machine running Windows Server 2003 or Windows XP, configure MSDTC to allow incoming network transactions by following these instructions.
1. From the **Start** menu, navigate to **Control Panel**, then **Administrative Tools**, and then **Component Services**.
1. From the **Start** menu, navigate to **Control Panel**, then **Administrative Tools**, and then **Component Services**.
2. Expand **Component Services**. Open the **Computers** folder.
2. Expand **Component Services**. Open the **Computers** folder.
3. Right-click **My Computer** and select **Properties**.
3. Right-click **My Computer** and select **Properties**.
4. On the **MSDTC** tab, click **Security Configuration**.
4. On the **MSDTC** tab, click **Security Configuration**.
5. Check **Network DTC Access** and **Allow Inbound**.
5. Check **Network DTC Access** and **Allow Inbound**.
6. Click **OK**, then click **Yes** to restart the MSDTC service.
6. Click **OK**, then click **Yes** to restart the MSDTC service.
7. Click **OK** to close the dialog box.
7. Click **OK** to close the dialog box.
2. On a service machine running Windows Server 2008 or Windows Vista, configure MSDTC to allow incoming network transactions by following these instructions.
1. From the **Start** menu, navigate to **Control Panel**, then **Administrative Tools**, and then **Component Services**.
1. From the **Start** menu, navigate to **Control Panel**, then **Administrative Tools**, and then **Component Services**.
2. Expand **Component Services**. Open the **Computers** folder. Select **Distributed Transaction Coordinator**.
2. Expand **Component Services**. Open the **Computers** folder. Select **Distributed Transaction Coordinator**.
3. Right-click **DTC Coordinator** and select **Properties**.
3. Right-click **DTC Coordinator** and select **Properties**.
4. On the **Security** tab, check **Network DTC Access** and **Allow Inbound**.
4. On the **Security** tab, check **Network DTC Access** and **Allow Inbound**.
5. Click **OK**, then click **Yes** to restart the MSDTC service.
5. Click **OK**, then click **Yes** to restart the MSDTC service.
6. Click **OK** to close the dialog box.
6. Click **OK** to close the dialog box.
3. On the client machine, configure MSDTC to allow outgoing network transactions:
1. From the **Start** menu, navigate to `Control Panel`, then **Administrative Tools**, and then **Component Services**.
1. From the **Start** menu, navigate to `Control Panel`, then **Administrative Tools**, and then **Component Services**.
2. Right-click **My Computer** and select **Properties**.
2. Right-click **My Computer** and select **Properties**.
3. On the **MSDTC** tab, click **Security Configuration**.
3. On the **MSDTC** tab, click **Security Configuration**.
4. Check **Network DTC Access** and **Allow Outbound**.
4. Check **Network DTC Access** and **Allow Outbound**.
5. Click **OK**, then click **Yes** to restart the MSDTC service.
5. Click **OK**, then click **Yes** to restart the MSDTC service.
6. Click **OK** to close the dialog box.
6. Click **OK** to close the dialog box.
> [!IMPORTANT]
> The samples may already be installed on your machine. Check for the following (default) directory before continuing.

Просмотреть файл

@ -100,7 +100,7 @@ public class MyServiceHost : ServiceHost
- If your client is using Windows credentials and the exception is a <xref:System.ServiceModel.Security.SecurityNegotiationException>, configure Kerberos as follows.
1. Add the identity credentials to the endpoint element in the clients App.config file:
1. Add the identity credentials to the endpoint element in the clients App.config file:
```xml
<endpoint
@ -116,15 +116,15 @@ public class MyServiceHost : ServiceHost
</endpoint>
```
2. Run the self-hosted service under the System or NetworkService account. You can run this command to create a command window under the System account:
2. Run the self-hosted service under the System or NetworkService account. You can run this command to create a command window under the System account:
```console
at 12:36 /interactive "cmd.exe"
```
3. Host the service under Internet Information Services (IIS), which, by default, uses the service principal name (SPN) account.
3. Host the service under Internet Information Services (IIS), which, by default, uses the service principal name (SPN) account.
4. Register a new SPN with the domain using SetSPN. Note that you will need to be a domain administrator in order to do this.
4. Register a new SPN with the domain using SetSPN. Note that you will need to be a domain administrator in order to do this.
For more information about the Kerberos protocol, see [Security Concepts Used in WCF](../../../docs/framework/wcf/feature-details/security-concepts-used-in-wcf.md) and:

Просмотреть файл

@ -23,13 +23,13 @@ If you choose not to use the Windows Service project template, you can write you
1. Create an empty project and create a reference to the necessary namespaces by following these steps:
1. In **Solution Explorer**, right-click the **References** node and click **Add Reference**.
1. In **Solution Explorer**, right-click the **References** node and click **Add Reference**.
2. On the **.NET Framework** tab, scroll to **System.dll** and click **Select**.
2. On the **.NET Framework** tab, scroll to **System.dll** and click **Select**.
3. Scroll to **System.ServiceProcess.dll** and click **Select**.
3. Scroll to **System.ServiceProcess.dll** and click **Select**.
4. Click **OK**.
4. Click **OK**.
2. Add a class and configure it to inherit from <xref:System.ServiceProcess.ServiceBase>:

Просмотреть файл

@ -22,13 +22,13 @@ This sample demonstrates how the messaging activities (<xref:System.ServiceModel
2. Once the URL ACLs are added, use the following steps.
1. Build the solution.
1. Build the solution.
2. Set multiple start-up projects by right-clicking the solution and selecting **Set Startup Projects**.
2. Set multiple start-up projects by right-clicking the solution and selecting **Set Startup Projects**.
3. Add **Service** and **Client** (in that order) as multiple start-up projects.
3. Add **Service** and **Client** (in that order) as multiple start-up projects.
4. Run the application. The client console shows a workflow running twice and the Service window shows the instance ID of those workflows.
4. Run the application. The client console shows a workflow running twice and the Service window shows the instance ID of those workflows.
> [!IMPORTANT]
> The samples may already be installed on your machine. Check for the following (default) directory before continuing.

Просмотреть файл

@ -46,21 +46,21 @@ This sample shows how to create a very basic Request for Proposals (RFP) based p
1. An employee of Company X creates a Request for Proposal (RFP).
1. The employee types in the RFP title and description.
1. The employee types in the RFP title and description.
2. The employee selects the vendors that he wants to invite to submit proposals.
2. The employee selects the vendors that he wants to invite to submit proposals.
2. The employee submits the proposal.
1. An instance of the workflow is created.
1. An instance of the workflow is created.
2. The workflow is waiting for all vendors to submit their proposals.
2. The workflow is waiting for all vendors to submit their proposals.
3. After all proposals are received, the workflow iterates through all the received proposals and selects the best one.
1. Each vendor has a reputation (this sample stores the reputation list in VendorRepository.cs).
1. Each vendor has a reputation (this sample stores the reputation list in VendorRepository.cs).
2. The total value of the proposal is determined by (The value typed in by the vendor) * (The vendor's recorded reputation) / 100.
2. The total value of the proposal is determined by (The value typed in by the vendor) * (The vendor's recorded reputation) / 100.
4. The original requester can see all the submitted proposals. The best proposal is presented in a special section in the report.

Просмотреть файл

@ -58,25 +58,25 @@ This sample demonstrates how to implement a business process using messaging act
2. The requesters manager must approve the request:
1. The manager can reject the request.
1. The manager can reject the request.
2. The manager can return the request to the requester for additional information:
2. The manager can return the request to the requester for additional information:
1. The requester reviews and sends the request back to the manager.
1. The requester reviews and sends the request back to the manager.
3. The manager can approve.
3. The manager can approve.
3. After the requesters manager approves, the department owner must approve the request:
1. The department owner can reject.
1. The department owner can reject.
2. The department owner can approve.
2. The department owner can approve.
4. After the department owner approves, the process requires the approval of 2 HR managers or the CEO:
1. The process can transition to the accepted or rejected state.
1. The process can transition to the accepted or rejected state.
2. If the process is Accepted, a new instance of the `ResumeRequest` workflow is started (`ResumeRequest` is linked to HiringRequest.csproj through a service reference.)
2. If the process is Accepted, a new instance of the `ResumeRequest` workflow is started (`ResumeRequest` is linked to HiringRequest.csproj through a service reference.)
Once the managers approve the hiring of a new employee, HR must find the appropriate candidate. This process is performed by the second workflow (`ResumeRequest`, defined in ResumeRequestService.csproj). This workflow defines the process for submitting a job posting with a career opportunity to Contoso's external Careers Web site, receives resumes from applicants, and monitors the state of the job posting. Positions are available for a fixed time period (until a time expires) or until an employee from Contoso decides to remove it. The `ResumeRequest` workflow consists of the following steps:
@ -213,18 +213,18 @@ This sample demonstrates how to implement a business process using messaging act
3. If the solution fails to execute, verify the following:
1. All services are running.
1. All services are running.
2. The service references are updated.
2. The service references are updated.
1. Open the App_WebReferences folder
1. Open the App_WebReferences folder
2. Right-click **Contoso** and select **Update Web/Service References**.
2. Right-click **Contoso** and select **Update Web/Service References**.
3. Rebuild the solution by pressing CTRL+SHIFT+B in Visual Studio.
3. Rebuild the solution by pressing CTRL+SHIFT+B in Visual Studio.
## Uninstalling
1. Delete the SQL Server instance store by running Cleanup.bat, located in DbSetup folder.
2. Delete the source code form your hard drive.
2. Delete the source code form your hard drive.

Просмотреть файл

@ -22,11 +22,11 @@ This sample demonstrates how to do content-based correlation using a custom <xre
2. Once the URL ACLs are added, use the following steps.
1. Build the solution.
1. Build the solution.
2. Set multiple start-up projects by right-clicking the solution and selecting **Set Startup Projects**. Add **Service** and **Client** (in that order) as multiple start-up projects.
2. Set multiple start-up projects by right-clicking the solution and selecting **Set Startup Projects**. Add **Service** and **Client** (in that order) as multiple start-up projects.
3. Run the application. The client console shows a workflow sending an order and receiving the purchase order id and then subsequently confirming the order. The Service window will show the requests being processed.
3. Run the application. The client console shows a workflow sending an order and receiving the purchase order id and then subsequently confirming the order. The Service window will show the requests being processed.
> [!IMPORTANT]
> The samples may already be installed on your machine. Check for the following (default) directory before continuing.

Просмотреть файл

@ -91,9 +91,9 @@ public sealed class ForEachWithBodyFactory : IActivityTemplateFactory
1. Set the project of your choice as the start-up project of the solution:
1. **CodeTestClient** shows how to use the activity using code.
1. **CodeTestClient** shows how to use the activity using code.
2. **DesignerTestClient** shows how to use the activity within the designer.
2. **DesignerTestClient** shows how to use the activity within the designer.
2. Build and run the project.

Просмотреть файл

@ -20,41 +20,41 @@ This sample demonstrates how to manage workflow instances that have been suspend
1. This sample requires that the following Windows components are enabled:
1. Microsoft Message Queues (MSMQ) Server
1. Microsoft Message Queues (MSMQ) Server
2. SQL Server Express
2. SQL Server Express
2. Set up the SQL Server database.
1. From a Visual Studio 2010 command prompt, run "setup.cmd" from the SuspendedInstanceManagement sample directory, which does the following:
1. From a Visual Studio 2010 command prompt, run "setup.cmd" from the SuspendedInstanceManagement sample directory, which does the following:
1. Creates a persistence database using SQL Server Express. If the persistence database already exists, then it is dropped and re-created
1. Creates a persistence database using SQL Server Express. If the persistence database already exists, then it is dropped and re-created
2. Sets up the database for persistence.
2. Sets up the database for persistence.
3. Adds IIS APPPOOL\DefaultAppPool and NT AUTHORITY\Network Service to the InstanceStoreUsers role that was defined when setting up the database for persistence.
3. Adds IIS APPPOOL\DefaultAppPool and NT AUTHORITY\Network Service to the InstanceStoreUsers role that was defined when setting up the database for persistence.
3. Set up the service queue.
1. In Visual Studio 2010, right-click the **SampleWorkflowApp** project and click **Set as Startup Project**.
1. In Visual Studio 2010, right-click the **SampleWorkflowApp** project and click **Set as Startup Project**.
2. Compile and run the SampleWorkflowApp by pressing **F5**. This will create the required queue.
2. Compile and run the SampleWorkflowApp by pressing **F5**. This will create the required queue.
3. Press **Enter** to stop the SampleWorkflowApp.
3. Press **Enter** to stop the SampleWorkflowApp.
4. Open the Computer Management console by running Compmgmt.msc from a command prompt.
4. Open the Computer Management console by running Compmgmt.msc from a command prompt.
5. Expand **Service and Applications**, **Message Queuing**, **Private Queues**.
5. Expand **Service and Applications**, **Message Queuing**, **Private Queues**.
6. Right click the **ReceiveTx** queue and select **Properties**.
6. Right click the **ReceiveTx** queue and select **Properties**.
7. Select the **Security** tab and allow **Everyone** to have permissions to **Receive Message**, **Peek Message**, and **Send Message**.
7. Select the **Security** tab and allow **Everyone** to have permissions to **Receive Message**, **Peek Message**, and **Send Message**.
4. Now, run the sample.
1. In Visual Studio 2010, run the SampleWorkflowApp project again without debugging by pressing **Ctrl+F5**. Two endpoint addresses will be printed in the console window: one for the application endpoint and then other from the <xref:System.ServiceModel.Activities.WorkflowControlEndpoint>. A workflow instance is then created, and tracking records for that instance will appear in the console window. The workflow instance will throw an exception causing the instance to be suspended and aborted.
1. In Visual Studio 2010, run the SampleWorkflowApp project again without debugging by pressing **Ctrl+F5**. Two endpoint addresses will be printed in the console window: one for the application endpoint and then other from the <xref:System.ServiceModel.Activities.WorkflowControlEndpoint>. A workflow instance is then created, and tracking records for that instance will appear in the console window. The workflow instance will throw an exception causing the instance to be suspended and aborted.
2. The command-line utility can then be used to take further action on any of these instances. The syntax for command line arguments is as follows::
2. The command-line utility can then be used to take further action on any of these instances. The syntax for command line arguments is as follows::
`SuspendedInstanceManagement -Command:[CommandName] -Server:[ServerName] -Database:[DatabaseName] -InstanceId:[InstanceId]`

Просмотреть файл

@ -22,9 +22,9 @@ This sample demonstrates how to batch a set of changes so that they can be undon
2. Click **Open Editing Scope**.
1. This command calls <xref:System.Activities.Presentation.Model.ModelItem.BeginEdit%2A> that creates an editing scope and pushes it onto the editing stack.
1. This command calls <xref:System.Activities.Presentation.Model.ModelItem.BeginEdit%2A> that creates an editing scope and pushes it onto the editing stack.
2. Three activities are then added to the selected <xref:System.Activities.Presentation.Model.ModelItem>. Note that if the editing scope had not been opened with <xref:System.Activities.Presentation.Model.ModelItem.BeginEdit%2A>, three new activities would appear on the designer canvas. Because this operation is still pending within the <xref:System.Activities.Presentation.Model.EditingScope>, the designer is not yet updated.
2. Three activities are then added to the selected <xref:System.Activities.Presentation.Model.ModelItem>. Note that if the editing scope had not been opened with <xref:System.Activities.Presentation.Model.ModelItem.BeginEdit%2A>, three new activities would appear on the designer canvas. Because this operation is still pending within the <xref:System.Activities.Presentation.Model.EditingScope>, the designer is not yet updated.
3. Press **Close Editing Scope** to commit the editing scope. Three activities appear in the designer.

Просмотреть файл

@ -36,7 +36,7 @@ This topic describes the procedure for hosting an instance of the [!INCLUDE[wfd1
8. In **Solution Explorer**, right-click MainWindow.xaml and select **View Code**. Modify the code by following these steps:
1. Add the following namespaces:
1. Add the following namespaces:
```csharp
using System.Activities;
@ -48,7 +48,7 @@ This topic describes the procedure for hosting an instance of the [!INCLUDE[wfd1
using System.ComponentModel;
```
2. To declare a private member field to hold an instance of the <xref:System.Activities.Presentation.WorkflowDesigner>, add the following code to the `MainWindow` class.
2. To declare a private member field to hold an instance of the <xref:System.Activities.Presentation.WorkflowDesigner>, add the following code to the `MainWindow` class.
```csharp
public partial class MainWindow : Window
@ -62,7 +62,7 @@ This topic describes the procedure for hosting an instance of the [!INCLUDE[wfd1
}
```
3. Add the following `AddDesigner` method to the `MainWindow` class. The implementation creates an instance of the <xref:System.Activities.Presentation.WorkflowDesigner>, adds a <xref:System.Activities.Statements.Sequence> activity to it, and places it in middle column of the grid1 **Grid**.
3. Add the following `AddDesigner` method to the `MainWindow` class. The implementation creates an instance of the <xref:System.Activities.Presentation.WorkflowDesigner>, adds a <xref:System.Activities.Statements.Sequence> activity to it, and places it in middle column of the grid1 **Grid**.
```csharp
private void AddDesigner()
@ -81,7 +81,7 @@ This topic describes the procedure for hosting an instance of the [!INCLUDE[wfd1
}
```
4. Register the designer metadata to add designer support for all the built-in activities. This enables you to drop activities from the toolbox onto the original <xref:System.Activities.Statements.Sequence> activity in the [!INCLUDE[wfd2](../../../includes/wfd2-md.md)]. To do this, add the `RegisterMetadata` method to the `MainWindow` class.
4. Register the designer metadata to add designer support for all the built-in activities. This enables you to drop activities from the toolbox onto the original <xref:System.Activities.Statements.Sequence> activity in the [!INCLUDE[wfd2](../../../includes/wfd2-md.md)]. To do this, add the `RegisterMetadata` method to the `MainWindow` class.
```csharp
private void RegisterMetadata()
@ -93,7 +93,7 @@ This topic describes the procedure for hosting an instance of the [!INCLUDE[wfd1
For more information about registering activity designers, see [How to: Create a Custom Activity Designer](how-to-create-a-custom-activity-designer.md).
5. In the `MainWindow` class constructor, add calls to the methods declared previously to register the metadata for designer support and to create the <xref:System.Activities.Presentation.WorkflowDesigner>.
5. In the `MainWindow` class constructor, add calls to the methods declared previously to register the metadata for designer support and to create the <xref:System.Activities.Presentation.WorkflowDesigner>.
```csharp
public MainWindow()

Просмотреть файл

@ -17,9 +17,9 @@ Workflow tracing offers a way to capture diagnostic information using .NET Frame
4. The default analytic trace buffer size is only 4 kilobytes (KB); it is recommended to increase the size to 32 KB. To do this, perform the following steps.
1. Execute the following command in the current framework directory (for example, C:\Windows\Microsoft.NET\Framework\v4.0.21203): `wevtutil um Microsoft.Windows.ApplicationServer.Applications.man`
1. Execute the following command in the current framework directory (for example, C:\Windows\Microsoft.NET\Framework\v4.0.21203): `wevtutil um Microsoft.Windows.ApplicationServer.Applications.man`
2. Change the \<bufferSize> value in the Windows.ApplicationServer.Applications.man file to 32.
2. Change the \<bufferSize> value in the Windows.ApplicationServer.Applications.man file to 32.
```xml
<channel name="Microsoft-Windows-Application Server-Applications/Analytic" chid="ANALYTIC_CHANNEL" symbol="ANALYTIC_CHANNEL" type="Analytic" enabled="false" isolation="Application" message="$(string.MICROSOFT_WINDOWS_APPLICATIONSERVER_APPLICATIONS.channel.ANALYTIC_CHANNEL.message)" >
@ -29,7 +29,7 @@ Workflow tracing offers a way to capture diagnostic information using .NET Frame
</channel>
```
3. Execute the following command in the current framework directory (for example, C:\Windows\Microsoft.NET\Framework\v4.0.21203): `wevtutil im Microsoft.Windows.ApplicationServer.Applications.man`
3. Execute the following command in the current framework directory (for example, C:\Windows\Microsoft.NET\Framework\v4.0.21203): `wevtutil im Microsoft.Windows.ApplicationServer.Applications.man`
> [!NOTE]
> If you are using the .NET Framework 4 Client Profile, you must first register the ETW manifest by running the following command from the .NET Framework 4 directory: `ServiceModelReg.exe –i –c:etw`

Просмотреть файл

@ -142,9 +142,9 @@ Visual inheritance enables you to see the controls on the base form and to add n
8. If you are using Visual C#:
1. In **Solution Explorer**, right-click **Form1** in the **InheritanceTest** project and then choose **Delete**. In the message box that appears, click **OK** to confirm the deletion.
1. In **Solution Explorer**, right-click **Form1** in the **InheritanceTest** project and then choose **Delete**. In the message box that appears, click **OK** to confirm the deletion.
2. Open the Program.cs file and change the line `Application.Run(new Form1());` to `Application.Run(new Form2());`.
2. Open the Program.cs file and change the line `Application.Run(new Form1());` to `Application.Run(new Form2());`.
9. In **Solution Explorer**, right-click the **InheritanceTest** project and select **Set As Startup Project**.

Просмотреть файл

@ -25,9 +25,9 @@ After you have added controls to your form and determined the user interface for
2. In the **Properties** window:
1. Expand the **(DataBindings)** node.
1. Expand the **(DataBindings)** node.
2. Click the arrow next to the <xref:System.Windows.Forms.TextBox.Text%2A> property.
2. Click the arrow next to the <xref:System.Windows.Forms.TextBox.Text%2A> property.
The **DataSource** UI type editor opens.
@ -58,4 +58,4 @@ After you have added controls to your form and determined the user interface for
- <xref:System.Windows.Forms.BindingSource>
- <xref:System.Windows.Forms.BindingNavigator>
- [Add new data sources](/visualstudio/data-tools/add-new-data-sources)
- [Data Sources Window](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/6ckyxa83(v=vs.120))
- [Data Sources Window](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/6ckyxa83(v=vs.120))

Просмотреть файл

@ -36,15 +36,15 @@ ms.assetid: 19438ba2-f687-4417-a2fb-ab1cd69d4ded
6. Configure the <xref:System.Windows.Forms.DataGrid> control that you want to designate the master grid, as follows:
1. Select the <xref:System.Data.DataSet> from the drop-down list in the <xref:System.Windows.Forms.DataGrid.DataSource%2A> property.
1. Select the <xref:System.Data.DataSet> from the drop-down list in the <xref:System.Windows.Forms.DataGrid.DataSource%2A> property.
2. Select the master table (for example, "Customers") from the drop-down list in the <xref:System.Windows.Forms.DataGrid.DataMember%2A> property.
2. Select the master table (for example, "Customers") from the drop-down list in the <xref:System.Windows.Forms.DataGrid.DataMember%2A> property.
7. Configure the <xref:System.Windows.Forms.DataGrid> control that you want to designate the details grid, as follows:
1. Select the <xref:System.Data.DataSet> from the drop-down list in the <xref:System.Windows.Forms.DataGrid.DataSource%2A> property.
1. Select the <xref:System.Data.DataSet> from the drop-down list in the <xref:System.Windows.Forms.DataGrid.DataSource%2A> property.
2. Select the relationship (for example, "Customers.CustOrd") between the master and detail tables from the drop-down list in the <xref:System.Windows.Forms.DataGrid.DataMember%2A> property. In order to see the relationship, expand the node by clicking on the plus (**+**) sign next to the master table in the drop-down list.
2. Select the relationship (for example, "Customers.CustOrd") between the master and detail tables from the drop-down list in the <xref:System.Windows.Forms.DataGrid.DataMember%2A> property. In order to see the relationship, expand the node by clicking on the plus (**+**) sign next to the master table in the drop-down list.
## See also

Просмотреть файл

@ -26,9 +26,9 @@ One of the benefits of Visual Studio is the ability to create professional-looki
2. In the **New Project** dialog box, do the following:
1. In the categories, choose either **Visual Basic** or **Visual C#**.
1. In the categories, choose either **Visual Basic** or **Visual C#**.
2. In the list of templates, choose **Windows Forms Application**.
2. In the list of templates, choose **Windows Forms Application**.
3. Click **OK**. A new Windows Forms project is created.
@ -38,19 +38,19 @@ One of the benefits of Visual Studio is the ability to create professional-looki
6. Add a <xref:System.Windows.Forms.TreeView> control named `treeview1` to the form, and position it on the left side of the <xref:System.Windows.Forms.SplitContainer> control. In the Properties window for `treeView1` do the following:
1. Set the <xref:System.Windows.Forms.Control.Dock%2A> property to <xref:System.Windows.Forms.DockStyle.Fill>.
1. Set the <xref:System.Windows.Forms.Control.Dock%2A> property to <xref:System.Windows.Forms.DockStyle.Fill>.
2. Set the <xref:System.Windows.Forms.TreeView.ImageList%2A> property to `imagelist1.`
2. Set the <xref:System.Windows.Forms.TreeView.ImageList%2A> property to `imagelist1.`
7. Add a <xref:System.Windows.Forms.ListView> control named `listView1` to the form, and position it on the right side of the <xref:System.Windows.Forms.SplitContainer> control. In the Properties window for `listview1` do the following:
1. Set the <xref:System.Windows.Forms.Control.Dock%2A> property to <xref:System.Windows.Forms.DockStyle.Fill>.
1. Set the <xref:System.Windows.Forms.Control.Dock%2A> property to <xref:System.Windows.Forms.DockStyle.Fill>.
2. Set the <xref:System.Windows.Forms.ListView.View%2A> property to <xref:System.Windows.Forms.View.Details>.
2. Set the <xref:System.Windows.Forms.ListView.View%2A> property to <xref:System.Windows.Forms.View.Details>.
3. Open the ColumnHeader Collection Editor by clicking the ellipses (![VisualStudioEllipsesButton screenshot](../media/vbellipsesbutton.png "vbEllipsesButton")) in the <xref:System.Windows.Forms.ListView.Columns%2A> property**.** Add three columns and set their <xref:System.Windows.Forms.ColumnHeader.Text%2A> property to `Name`, `Type`, and `Last Modified`, respectively. Click **OK** to close the dialog box.
3. Open the ColumnHeader Collection Editor by clicking the ellipses (![VisualStudioEllipsesButton screenshot](../media/vbellipsesbutton.png "vbEllipsesButton")) in the <xref:System.Windows.Forms.ListView.Columns%2A> property**.** Add three columns and set their <xref:System.Windows.Forms.ColumnHeader.Text%2A> property to `Name`, `Type`, and `Last Modified`, respectively. Click **OK** to close the dialog box.
4. Set the <xref:System.Windows.Forms.ListView.SmallImageList%2A> property to `imageList1.`
4. Set the <xref:System.Windows.Forms.ListView.SmallImageList%2A> property to `imageList1.`
8. Implement the code to populate the <xref:System.Windows.Forms.TreeView> with nodes and subnodes. Add this code to the `Form1` class.

Просмотреть файл

@ -59,21 +59,21 @@ A lookup table is a table of data that has a column that displays data from reco
3. Click the arrow next to the **Data Source** drop-down box. If a data source has previously been configured for the project or form, it will appear; otherwise, complete the following steps (This example uses the Customers and Orders tables of the Northwind sample database and refers to them in parentheses).
1. Click **Add Project Data Source** to connect to data and create a data source.
1. Click **Add Project Data Source** to connect to data and create a data source.
2. On the **Data Source Configuration Wizard** welcome page, click **Next**.
2. On the **Data Source Configuration Wizard** welcome page, click **Next**.
3. Select **Database** on the **Choose a Data Source Type** page.
3. Select **Database** on the **Choose a Data Source Type** page.
4. Select a data connection from the list of available connections on the **Choose Your Data Connection** page. If your desired data connection is not available, select **New Connection** to create a new data connection.
4. Select a data connection from the list of available connections on the **Choose Your Data Connection** page. If your desired data connection is not available, select **New Connection** to create a new data connection.
5. Click **Yes, save the connection** to save the connection string in the application configuration file.
5. Click **Yes, save the connection** to save the connection string in the application configuration file.
6. Select the database objects to bring into your application. In this case, select a parent table and child table (for example, Customers and Orders) with a foreign key relationship.
6. Select the database objects to bring into your application. In this case, select a parent table and child table (for example, Customers and Orders) with a foreign key relationship.
7. Replace the default dataset name if you want.
7. Replace the default dataset name if you want.
8. Click **Finish**.
8. Click **Finish**.
4. In the **Display Member** drop-down box, select the column name (for example, ContactName) to be displayed in the combo box.

Просмотреть файл

@ -23,11 +23,11 @@ Windows Explorer is a common user-interface choice for applications because of i
2. From the **Toolbox**:
1. Drag a <xref:System.Windows.Forms.SplitContainer> control onto your form.
1. Drag a <xref:System.Windows.Forms.SplitContainer> control onto your form.
2. Drag a <xref:System.Windows.Forms.TreeView> control into **SplitterPanel1** (the panel of the <xref:System.Windows.Forms.SplitContainer> control marked **Panel1**).
2. Drag a <xref:System.Windows.Forms.TreeView> control into **SplitterPanel1** (the panel of the <xref:System.Windows.Forms.SplitContainer> control marked **Panel1**).
3. Drag a <xref:System.Windows.Forms.ListView> control into **SplitterPanel2** (the panel of the <xref:System.Windows.Forms.SplitContainer> control marked **Panel2**).
3. Drag a <xref:System.Windows.Forms.ListView> control into **SplitterPanel2** (the panel of the <xref:System.Windows.Forms.SplitContainer> control marked **Panel2**).
3. Select all three controls by pressing the CTRL key and clicking them in turn. When you select the <xref:System.Windows.Forms.SplitContainer> control, click the splitter bar, rather than the panels.

Просмотреть файл

@ -28,15 +28,15 @@ The masked text box control is an enhanced text box control that supports a decl
1. In **Design** view, select a <xref:System.Windows.Forms.MaskedTextBox>.
1. Click the smart tag to open the **MaskedTextBox Tasks** panel.
1. Click the smart tag to open the **MaskedTextBox Tasks** panel.
2. Click **Set Mask**.
2. Click **Set Mask**.
\- or -
1. In the **Properties** window, select the <xref:System.Windows.Forms.MaskedTextBox.Mask%2A> property.
1. In the **Properties** window, select the <xref:System.Windows.Forms.MaskedTextBox.Mask%2A> property.
2. Click the ellipsis button in the property value column.
2. Click the ellipsis button in the property value column.
The **Input Mask** dialog box appears.

Просмотреть файл

@ -34,15 +34,15 @@ The <xref:System.Windows.Forms.BindingNavigator> control is a special-purpose <x
7. In the **Items Collection Editor**, complete the following:
1. Add a <xref:System.Windows.Forms.ToolStripSeparator> and three <xref:System.Windows.Forms.ToolStripButton> items by selecting the appropriate type of <xref:System.Windows.Forms.ToolStripItem> and clicking the **Add** button.
1. Add a <xref:System.Windows.Forms.ToolStripSeparator> and three <xref:System.Windows.Forms.ToolStripButton> items by selecting the appropriate type of <xref:System.Windows.Forms.ToolStripItem> and clicking the **Add** button.
2. Set the <xref:System.Windows.Forms.ToolStripItem.Name%2A> property of the buttons to **LoadButton**, **SaveButton**, and **CancelButton**, respectively.
2. Set the <xref:System.Windows.Forms.ToolStripItem.Name%2A> property of the buttons to **LoadButton**, **SaveButton**, and **CancelButton**, respectively.
3. Set the <xref:System.Windows.Forms.ToolStripItem.Text%2A> property of the buttons to **Load**, **Save**, and **Cancel**.
3. Set the <xref:System.Windows.Forms.ToolStripItem.Text%2A> property of the buttons to **Load**, **Save**, and **Cancel**.
4. Set the <xref:System.Windows.Forms.ToolStripItem.DisplayStyle%2A> property for each of the buttons to **Text**. Alternatively, you can set this property to **Image** or **ImageAndText**, and set the image to be displayed in the <xref:System.Windows.Forms.ToolStripItem.Image%2A> property.
4. Set the <xref:System.Windows.Forms.ToolStripItem.DisplayStyle%2A> property for each of the buttons to **Text**. Alternatively, you can set this property to **Image** or **ImageAndText**, and set the image to be displayed in the <xref:System.Windows.Forms.ToolStripItem.Image%2A> property.
5. Click **OK** to close the dialog box.The buttons are added to the <xref:System.Windows.Forms.ToolStrip>.
5. Click **OK** to close the dialog box.The buttons are added to the <xref:System.Windows.Forms.ToolStrip>.
8. Right-click the form and choose **View Code**.

Просмотреть файл

@ -48,15 +48,15 @@ This topic lists the following common problems that arise when developing compon
4. If your control is not listed in the dialog box, do the following:
1. Click the **Browse** button.
1. Click the **Browse** button.
2. Browse to the folder that contains the .dll file that contains your control.
2. Browse to the folder that contains the .dll file that contains your control.
3. Select the .dll file and click **Open**.
3. Select the .dll file and click **Open**.
Your control appears in the dialog box.
4. Confirm that your control is selected, and then click **OK**.
4. Confirm that your control is selected, and then click **OK**.
Your control is added to the **Toolbox**.

Просмотреть файл

@ -38,11 +38,11 @@ The following procedures describe the basic steps that you must complete to crea
4. Add a `Main` method to the class.
1. Apply the <xref:System.STAThreadAttribute> to the C# `Main` method to specify your Windows Forms application is a single-threaded apartment. (The attribute is not necessary in Visual Basic, since Windows forms applications developed with Visual Basic use a single-threaded apartment model by default.)
1. Apply the <xref:System.STAThreadAttribute> to the C# `Main` method to specify your Windows Forms application is a single-threaded apartment. (The attribute is not necessary in Visual Basic, since Windows forms applications developed with Visual Basic use a single-threaded apartment model by default.)
2. Call <xref:System.Windows.Forms.Application.EnableVisualStyles%2A> to apply operating system styles to your application.
2. Call <xref:System.Windows.Forms.Application.EnableVisualStyles%2A> to apply operating system styles to your application.
3. Create an instance of the form and run it.
3. Create an instance of the form and run it.
[!code-csharp[System.Windows.Forms.BasicForm#5](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.BasicForm/CS/Form1.cs#5)]
[!code-vb[System.Windows.Forms.BasicForm#5](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.BasicForm/VB/Form1.vb#5)]

Просмотреть файл

@ -10,72 +10,75 @@ helpviewer_keywords:
ms.assetid: 4810dc9f-ea23-4ce1-8ea1-657f0ff1d820
---
# Security in Windows Forms Overview
Before the release of the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)], all code running on a user's computer had the same rights or permissions to access resources that a user of the computer had. For example, if the user was allowed to access the file system, the code was allowed to access the file system; if the user was allowed to access a database, the code was allowed to access that database. Although these rights or permissions may be acceptable for code in executables that the user has explicitly installed on the local computer, they may not be acceptable for potentially malicious code coming from the Internet or a local Intranet. This code should not be able to access the user's computer resources without permission.
The [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)] introduces an infrastructure called Code Access Security that lets you differentiate the permissions, or rights, that code has from the rights that the user has. By default, code coming from the Internet and the Intranet can only run in what is known as partial trust. Partial trust subjects an application to a series of restrictions: among other things, an application is restricted from accessing the local hard disk, and cannot run unmanaged code. The [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)] controls the resources that code is allowed to access based on the identity of that code: where it came from, whether it has a [Strong-Named Assemblies](../app-domains/strong-named-assemblies.md), whether it is signed with a certificate, and so on.
[!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] technology, which you use to deploy Windows Forms applications, helps make it easier for you to develop applications that run in partial trust, in full trust, or in partial trust with elevated permissions. [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] provides features such as Permission Elevation and Trusted Application Deployment so that your application can request full trust or elevated permissions from the local user in a responsible manner.
## Understanding Security in the .NET Framework
Code access security allows code to be trusted to varying degrees, depending on where the code originates and on other aspects of the code's identity. For more information about the evidence the common language runtime uses to determine security policy, see [Evidence](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/7y5x1hcd(v=vs.100)). It helps protect computer systems from malicious code and helps protect trusted code from intentionally or accidentally compromising security. Code access security also gives you more control over what actions your application can perform, because you can specify only those permissions you need your application to have. Code access security affects all managed code that targets the common language runtime, even if that code does not make a single code-access-security permission check. For more information about security in the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)], see [Key Security Concepts](../../standard/security/key-security-concepts.md) and [Code Access Security Basics](../misc/code-access-security-basics.md).
If the user run a Windows Forms executable file directly off of a Web server or a file share, the degree of trust granted to your application depends on where the code resides, and how it is started. When an application runs, it is automatically evaluated and it receives a named permission set from the common language runtime. By default, the code from the local computer is granted the Full Trust permission set, code from a local network is granted the Local Intranet permission set, and code from the Internet is granted the Internet permission set.
Before the release of the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)], all code running on a user's computer had the same rights or permissions to access resources that a user of the computer had. For example, if the user was allowed to access the file system, the code was allowed to access the file system; if the user was allowed to access a database, the code was allowed to access that database. Although these rights or permissions may be acceptable for code in executables that the user has explicitly installed on the local computer, they may not be acceptable for potentially malicious code coming from the Internet or a local Intranet. This code should not be able to access the user's computer resources without permission.
The [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)] introduces an infrastructure called Code Access Security that lets you differentiate the permissions, or rights, that code has from the rights that the user has. By default, code coming from the Internet and the Intranet can only run in what is known as partial trust. Partial trust subjects an application to a series of restrictions: among other things, an application is restricted from accessing the local hard disk, and cannot run unmanaged code. The [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)] controls the resources that code is allowed to access based on the identity of that code: where it came from, whether it has a [Strong-Named Assemblies](../app-domains/strong-named-assemblies.md), whether it is signed with a certificate, and so on.
[!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] technology, which you use to deploy Windows Forms applications, helps make it easier for you to develop applications that run in partial trust, in full trust, or in partial trust with elevated permissions. [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] provides features such as Permission Elevation and Trusted Application Deployment so that your application can request full trust or elevated permissions from the local user in a responsible manner.
## Understanding Security in the .NET Framework
Code access security allows code to be trusted to varying degrees, depending on where the code originates and on other aspects of the code's identity. For more information about the evidence the common language runtime uses to determine security policy, see [Evidence](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/7y5x1hcd(v=vs.100)). It helps protect computer systems from malicious code and helps protect trusted code from intentionally or accidentally compromising security. Code access security also gives you more control over what actions your application can perform, because you can specify only those permissions you need your application to have. Code access security affects all managed code that targets the common language runtime, even if that code does not make a single code-access-security permission check. For more information about security in the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)], see [Key Security Concepts](../../standard/security/key-security-concepts.md) and [Code Access Security Basics](../misc/code-access-security-basics.md).
If the user run a Windows Forms executable file directly off of a Web server or a file share, the degree of trust granted to your application depends on where the code resides, and how it is started. When an application runs, it is automatically evaluated and it receives a named permission set from the common language runtime. By default, the code from the local computer is granted the Full Trust permission set, code from a local network is granted the Local Intranet permission set, and code from the Internet is granted the Internet permission set.
> [!NOTE]
> In the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)] version 1.0 Service Pack 1 and Service Pack 2, the Internet zone code group receives the Nothing permission set. In all other releases of the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)], the Internet zone code group receives the Internet permissions set.
>
> The default permissions granted in each of these permission sets are listed in the [Default Security Policy](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/03kwzyfc(v=vs.100)) topic. Depending on the permissions that the application receives, it either runs correctly or generates a security exception.
>
> Many Windows Forms applications will be deployed using [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)]. The tools used for generating a [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] deployment have different security defaults than what was discussed earlier. For more information, see the following discussion.
The actual permissions granted to your application can be different from the default values, because the security policy can be modified; this means that your application can have permission on one computer, but not on another.
## Developing a More Secure Windows Forms Application
Security is important in all steps of application development. Start by reviewing and following the [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md).
Next, decide whether your application must run in full trust, or whether it should run in partial trust. Running your application in full trust makes it easier to access resources on the local computer, but exposes your application and its users to high security risks if you do not design and develop your application strictly according to the Secure Coding Guidelines topic. Running your application in partial trust makes it easier to develop a more secure application and reduces much risk, but requires more planning in how to implement certain features.
If you choose partial trust (that is, either the Internet or Local Intranet permission sets), decide how you want your application to behave in this environment. Windows Forms provides alternative, more secure ways to implement features when in a semi-trusted environment. Certain parts of your application, such as data access, can be designed and written differently for both partial trust and full trust environments. Some Windows Forms features, such as application settings, are designed to work in partial trust. For more information, see [Application Settings Overview](./advanced/application-settings-overview.md).
If your application needs more permissions than partial trust allows, but you do not want to run in full trust, you can run in partial trust while asserting only those additional permissions you need. For example, if you want to run in partial trust, but must grant your application read-only access to a directory on the user's file system, you can request <xref:System.Security.Permissions.FileIOPermission> only for that directory. Used correctly, this approach can give your application increased functionality and minimize security risks to your users.
When you develop an application that will run in partial trust, keep track of what permissions your application must run and what permissions your application could optionally use. When all the permissions are known, you should make a declarative request for permission at the application level. Requesting permissions informs the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)] run time about which permissions your application needs and which permissions it specifically does not want. For more information about requesting permissions, see [Requesting Permissions](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/yd267cce(v=vs.100)).
When you request optional permissions, you must handle security exceptions that will be generated if your application performs an action that requires permissions not granted to it. Appropriate handling of the <xref:System.Security.SecurityException> will ensure that your application can continue to operate. Your application can use the exception to determine whether a feature should become disabled for the user. For example, an application can disable the **Save** menu option if the required file permission is not granted.
Sometimes, it is difficult to know if you have asserted all the appropriate permissions. A method call which looks innocuous on the surface, for example, may access the file system at some point during its execution. If you do not deploy your application with all the required permissions, it may test fine when you debug it on your desktop, but fail when deployed. Both the [!INCLUDE[dnprdnlong](../../../includes/dnprdnlong-md.md)] SDK and Visual Studio 2005 contain tools for calculating the permissions an application needs: the MT.exe command line tool and the Calculate Permissions feature of Visual Studio, respectively.
The following topics describe additional Windows Forms security features.
|Topic|Description|
|-----------|-----------------|
|- [More Secure File and Data Access in Windows Forms](more-secure-file-and-data-access-in-windows-forms.md)|Describes how to access files and data in a partial trust environment.|
|- [More Secure Printing in Windows Forms](more-secure-printing-in-windows-forms.md)|Describes how to access printing features in a partial trust environment.|
|- [Additional Security Considerations in Windows Forms](additional-security-considerations-in-windows-forms.md)|Describes performing window manipulation, using the Clipboard, and making calls to unmanaged code in a partial trust environment.|
-
### Deploying an Application with the Appropriate Permissions
The most common means of deploying a Windows Forms application to a client computer is with [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)], a deployment technology that describes all of the components your application needs to run. [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] uses XML files called manifests to describe the assemblies and files that make up your application, and also the permissions your application requires.
[!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] has two technologies for requesting elevated permissions on a client computer. Both technologies rely on the use of Authenticode certificates. The certificates help provide some assurance to your users that the application has come from a trusted source.
The following table describes these technologies.
|Elevated permission technology|Description|
|------------------------------------|-----------------|
|Permission Elevation|Prompts the user with a security dialog box the first time your application runs. The **Permission Elevation** dialog box informs the user about who published the application, so that the user can make an informed decision about whether to grant it additional trust|
|Trusted Application Deployment|Involves a system administrator performing a one-time installation of a publisher's Authenticode certificate on a client computer. From that point on, any applications signed with the certificate are regarded as trusted, and can run at full trust on the local computer without additional prompting.|
Which technology you choose will depend on your deployment environment. For more information, see [Choosing a ClickOnce Deployment Strategy](/visualstudio/deployment/choosing-a-clickonce-deployment-strategy).
By default, [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] applications deployed using either Visual Studio or the [!INCLUDE[dnprdnlong](../../../includes/dnprdnlong-md.md)] SDK tools (Mage.exe and MageUI.exe) are configured to run on a client computer that has Full Trust. If you are deploying your application by using partial trust or by using only some additional permissions, you will have to change this default. You can do this with either Visual Studio or the [!INCLUDE[dnprdnlong](../../../includes/dnprdnlong-md.md)] SDK tool MageUI.exe when you configure your deployment. For more information about how to use MageUI.exe, see Walkthrough: Deploying a ClickOnce Application from the Command Line. Also see [How to: Set Custom Permissions for a ClickOnce Application](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2012/hafybdaa(v=vs.110)) or [How to: Set Custom Permissions for a ClickOnce Application](/visualstudio/deployment/how-to-set-custom-permissions-for-a-clickonce-application).
For more information about the security aspects of [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] and Permission Elevation, see [Securing ClickOnce Applications](/visualstudio/deployment/securing-clickonce-applications). For more information about Trusted Application Deployment, see [Trusted Application Deployment Overview](/visualstudio/deployment/trusted-application-deployment-overview).
### Testing the Application
If you have deployed your Windows Forms application by using Visual Studio, you can enable debugging in partial trust or a restricted permission set from the development environment. Also see [How to: Debug a ClickOnce Application with Restricted Permissions](/visualstudio/deployment/how-to-debug-a-clickonce-application-with-restricted-permissions).
> In the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)] version 1.0 Service Pack 1 and Service Pack 2, the Internet zone code group receives the Nothing permission set. In all other releases of the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)], the Internet zone code group receives the Internet permissions set.
>
> The default permissions granted in each of these permission sets are listed in the [Default Security Policy](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/03kwzyfc(v=vs.100)) topic. Depending on the permissions that the application receives, it either runs correctly or generates a security exception.
>
> Many Windows Forms applications will be deployed using [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)]. The tools used for generating a [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] deployment have different security defaults than what was discussed earlier. For more information, see the following discussion.
The actual permissions granted to your application can be different from the default values, because the security policy can be modified; this means that your application can have permission on one computer, but not on another.
## Developing a More Secure Windows Forms Application
Security is important in all steps of application development. Start by reviewing and following the [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md).
Next, decide whether your application must run in full trust, or whether it should run in partial trust. Running your application in full trust makes it easier to access resources on the local computer, but exposes your application and its users to high security risks if you do not design and develop your application strictly according to the Secure Coding Guidelines topic. Running your application in partial trust makes it easier to develop a more secure application and reduces much risk, but requires more planning in how to implement certain features.
If you choose partial trust (that is, either the Internet or Local Intranet permission sets), decide how you want your application to behave in this environment. Windows Forms provides alternative, more secure ways to implement features when in a semi-trusted environment. Certain parts of your application, such as data access, can be designed and written differently for both partial trust and full trust environments. Some Windows Forms features, such as application settings, are designed to work in partial trust. For more information, see [Application Settings Overview](./advanced/application-settings-overview.md).
If your application needs more permissions than partial trust allows, but you do not want to run in full trust, you can run in partial trust while asserting only those additional permissions you need. For example, if you want to run in partial trust, but must grant your application read-only access to a directory on the user's file system, you can request <xref:System.Security.Permissions.FileIOPermission> only for that directory. Used correctly, this approach can give your application increased functionality and minimize security risks to your users.
When you develop an application that will run in partial trust, keep track of what permissions your application must run and what permissions your application could optionally use. When all the permissions are known, you should make a declarative request for permission at the application level. Requesting permissions informs the [!INCLUDE[dnprdnshort](../../../includes/dnprdnshort-md.md)] run time about which permissions your application needs and which permissions it specifically does not want. For more information about requesting permissions, see [Requesting Permissions](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/yd267cce(v=vs.100)).
When you request optional permissions, you must handle security exceptions that will be generated if your application performs an action that requires permissions not granted to it. Appropriate handling of the <xref:System.Security.SecurityException> will ensure that your application can continue to operate. Your application can use the exception to determine whether a feature should become disabled for the user. For example, an application can disable the **Save** menu option if the required file permission is not granted.
Sometimes, it is difficult to know if you have asserted all the appropriate permissions. A method call which looks innocuous on the surface, for example, may access the file system at some point during its execution. If you do not deploy your application with all the required permissions, it may test fine when you debug it on your desktop, but fail when deployed. Both the [!INCLUDE[dnprdnlong](../../../includes/dnprdnlong-md.md)] SDK and Visual Studio 2005 contain tools for calculating the permissions an application needs: the MT.exe command line tool and the Calculate Permissions feature of Visual Studio, respectively.
The following topics describe additional Windows Forms security features.
|Topic|Description|
|-----------|-----------------|
|- [More Secure File and Data Access in Windows Forms](more-secure-file-and-data-access-in-windows-forms.md)|Describes how to access files and data in a partial trust environment.|
|- [More Secure Printing in Windows Forms](more-secure-printing-in-windows-forms.md)|Describes how to access printing features in a partial trust environment.|
|- [Additional Security Considerations in Windows Forms](additional-security-considerations-in-windows-forms.md)|Describes performing window manipulation, using the Clipboard, and making calls to unmanaged code in a partial trust environment.|
### Deploying an Application with the Appropriate Permissions
The most common means of deploying a Windows Forms application to a client computer is with [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)], a deployment technology that describes all of the components your application needs to run. [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] uses XML files called manifests to describe the assemblies and files that make up your application, and also the permissions your application requires.
[!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] has two technologies for requesting elevated permissions on a client computer. Both technologies rely on the use of Authenticode certificates. The certificates help provide some assurance to your users that the application has come from a trusted source.
The following table describes these technologies.
|Elevated permission technology|Description|
|------------------------------------|-----------------|
|Permission Elevation|Prompts the user with a security dialog box the first time your application runs. The **Permission Elevation** dialog box informs the user about who published the application, so that the user can make an informed decision about whether to grant it additional trust|
|Trusted Application Deployment|Involves a system administrator performing a one-time installation of a publisher's Authenticode certificate on a client computer. From that point on, any applications signed with the certificate are regarded as trusted, and can run at full trust on the local computer without additional prompting.|
Which technology you choose will depend on your deployment environment. For more information, see [Choosing a ClickOnce Deployment Strategy](/visualstudio/deployment/choosing-a-clickonce-deployment-strategy).
By default, [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] applications deployed using either Visual Studio or the [!INCLUDE[dnprdnlong](../../../includes/dnprdnlong-md.md)] SDK tools (Mage.exe and MageUI.exe) are configured to run on a client computer that has Full Trust. If you are deploying your application by using partial trust or by using only some additional permissions, you will have to change this default. You can do this with either Visual Studio or the [!INCLUDE[dnprdnlong](../../../includes/dnprdnlong-md.md)] SDK tool MageUI.exe when you configure your deployment. For more information about how to use MageUI.exe, see Walkthrough: Deploying a ClickOnce Application from the Command Line. Also see [How to: Set Custom Permissions for a ClickOnce Application](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2012/hafybdaa(v=vs.110)) or [How to: Set Custom Permissions for a ClickOnce Application](/visualstudio/deployment/how-to-set-custom-permissions-for-a-clickonce-application).
For more information about the security aspects of [!INCLUDE[ndptecclick](../../../includes/ndptecclick-md.md)] and Permission Elevation, see [Securing ClickOnce Applications](/visualstudio/deployment/securing-clickonce-applications). For more information about Trusted Application Deployment, see [Trusted Application Deployment Overview](/visualstudio/deployment/trusted-application-deployment-overview).
### Testing the Application
If you have deployed your Windows Forms application by using Visual Studio, you can enable debugging in partial trust or a restricted permission set from the development environment. Also see [How to: Debug a ClickOnce Application with Restricted Permissions](/visualstudio/deployment/how-to-debug-a-clickonce-application-with-restricted-permissions).
## See also
- [Windows Forms Security](windows-forms-security.md)

Просмотреть файл

@ -41,9 +41,9 @@ ms.assetid: 1fbada8e-4867-4ed1-8d97-62c07dad7ebc
4. **TemplatedParent template properties.** An element has a <xref:System.Windows.FrameworkElement.TemplatedParent%2A> if it was created as part of a template (a <xref:System.Windows.Controls.ControlTemplate> or <xref:System.Windows.DataTemplate>). For details on when this applies, see [TemplatedParent](#templatedparent) later in this topic. Within the template, the following precedence applies:
1. Triggers from the <xref:System.Windows.FrameworkElement.TemplatedParent%2A> template.
1. Triggers from the <xref:System.Windows.FrameworkElement.TemplatedParent%2A> template.
2. Property sets (typically through [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharptla-xaml-md.md)] attributes) in the <xref:System.Windows.FrameworkElement.TemplatedParent%2A> template.
2. Property sets (typically through [!INCLUDE[TLA2#tla_xaml](../../../../includes/tla2sharptla-xaml-md.md)] attributes) in the <xref:System.Windows.FrameworkElement.TemplatedParent%2A> template.
5. **Implicit style.** Applies only to the `Style` property. The `Style` property is filled by any style resource with a key that matches the type of that element. That style resource must exist either in the page or the application; lookup for an implicit style resource does not proceed into the themes.
@ -55,9 +55,9 @@ ms.assetid: 1fbada8e-4867-4ed1-8d97-62c07dad7ebc
9. **Default (theme) style.** For details on when this applies, and how theme styles relate to the templates within theme styles, see [Default (Theme) Styles](#themestyles) later in this topic. Within a default style, the following order of precedence applies:
1. Active triggers in the theme style.
1. Active triggers in the theme style.
2. Setters in the theme style.
2. Setters in the theme style.
10. **Inheritance.** A few dependency properties inherit their values from parent element to child elements, such that they need not be set specifically on each element throughout an application. For details see [Property Value Inheritance](property-value-inheritance.md).

Просмотреть файл

@ -19,13 +19,13 @@ Network administrators often field complaints from users about print jobs that d
1. Identify the print job that the user is complaining about. Users often cannot do this precisely. They may not know the names of the print servers or printers. They may describe the location of the printer in different terminology than was used in setting its <xref:System.Printing.PrintQueue.Location%2A> property. Accordingly, it is a good idea to generate a list of the user's currently submitted jobs. If there is more than one, then communication between the user and the print system administrator can be used to pinpoint the job that is having problems. The substeps are as follows.
1. Obtain a list of all print servers.
1. Obtain a list of all print servers.
2. Loop through the servers to query their print queues.
2. Loop through the servers to query their print queues.
3. Within each pass of the server loop, loop through all the server's queues to query their jobs
3. Within each pass of the server loop, loop through all the server's queues to query their jobs
4. Within each pass of the queue loop, loop through its jobs and gather identifying information about those that were submitted by the complaining user.
4. Within each pass of the queue loop, loop through its jobs and gather identifying information about those that were submitted by the complaining user.
2. When the problematic print job has been identified, examine relevant properties to see what might be the problem. For example, is job in an error state or did the printer servicing the queue go offline before the job could print?

Просмотреть файл

@ -127,19 +127,19 @@ This tutorial explains how to create a localized application by using the LocBam
The seven fields are:
1. **BAML Name**. The name of the BAML resource with respect to the source language satellite assembly.
1. **BAML Name**. The name of the BAML resource with respect to the source language satellite assembly.
2. **Resource Key**. The localized resource identifier.
2. **Resource Key**. The localized resource identifier.
3. **Category**. The value type. See [Localization Attributes and Comments](localization-attributes-and-comments.md).
3. **Category**. The value type. See [Localization Attributes and Comments](localization-attributes-and-comments.md).
4. **Readability**. Whether the value can be read by a localizer. See [Localization Attributes and Comments](localization-attributes-and-comments.md).
4. **Readability**. Whether the value can be read by a localizer. See [Localization Attributes and Comments](localization-attributes-and-comments.md).
5. **Modifiability**. Whether the value can be modified by a localizer. See [Localization Attributes and Comments](localization-attributes-and-comments.md).
5. **Modifiability**. Whether the value can be modified by a localizer. See [Localization Attributes and Comments](localization-attributes-and-comments.md).
6. **Comments**. Additional description of the value to help determine how a value is localized. See [Localization Attributes and Comments](localization-attributes-and-comments.md).
6. **Comments**. Additional description of the value to help determine how a value is localized. See [Localization Attributes and Comments](localization-attributes-and-comments.md).
7. **Value**. The text value to translate to the desired culture.
7. **Value**. The text value to translate to the desired culture.
The following table shows how these fields map to the delimited values of the .csv file:

Просмотреть файл

@ -34,17 +34,17 @@ One of the benefits of ink on a Tablet PC is that it feels a lot like writing wi
1. Actions occurring while the user draws the stroke
1. When the user draws a stroke, the stylus points come in on the pen thread. Stylus plug-ins, including the <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer>, accept the stylus points on the pen thread and have the chance to modify them before the <xref:System.Windows.Controls.InkCanvas> receives them.
1. When the user draws a stroke, the stylus points come in on the pen thread. Stylus plug-ins, including the <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer>, accept the stylus points on the pen thread and have the chance to modify them before the <xref:System.Windows.Controls.InkCanvas> receives them.
2. The <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> renders the stylus points on the dynamic rendering thread. This happens at the same time as the previous step.
2. The <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> renders the stylus points on the dynamic rendering thread. This happens at the same time as the previous step.
3. The <xref:System.Windows.Controls.InkCanvas> receives the stylus points on the UI thread.
3. The <xref:System.Windows.Controls.InkCanvas> receives the stylus points on the UI thread.
2. Actions occurring after the user ends the stroke
1. When the user finishes drawing the stroke, the <xref:System.Windows.Controls.InkCanvas> creates a <xref:System.Windows.Ink.Stroke> object and adds it to the <xref:System.Windows.Controls.InkPresenter>, which statically renders it.
1. When the user finishes drawing the stroke, the <xref:System.Windows.Controls.InkCanvas> creates a <xref:System.Windows.Ink.Stroke> object and adds it to the <xref:System.Windows.Controls.InkPresenter>, which statically renders it.
2. The UI thread alerts the <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> that the stroke is statically rendered, so the <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> removes its visual representation of the stroke.
2. The UI thread alerts the <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> that the stroke is statically rendered, so the <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> removes its visual representation of the stroke.
## Ink collection and Stylus Plug-ins
Each <xref:System.Windows.UIElement> has a <xref:System.Windows.Input.StylusPlugIns.StylusPlugInCollection>. The <xref:System.Windows.Input.StylusPlugIns.StylusPlugIn> objects in the <xref:System.Windows.Input.StylusPlugIns.StylusPlugInCollection> receive and can modify the stylus points on the pen thread. The <xref:System.Windows.Input.StylusPlugIns.StylusPlugIn> objects receive the stylus points according to their order in the <xref:System.Windows.Input.StylusPlugIns.StylusPlugInCollection>.
@ -79,16 +79,16 @@ One of the benefits of ink on a Tablet PC is that it feels a lot like writing wi
1. The user begins the stroke.
1. The <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> creates the visual tree.
1. The <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> creates the visual tree.
2. The user is drawing the stroke.
1. The <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> builds the visual tree.
1. The <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> builds the visual tree.
3. The user ends the stroke.
1. The <xref:System.Windows.Controls.InkPresenter> adds the stroke to its visual tree.
1. The <xref:System.Windows.Controls.InkPresenter> adds the stroke to its visual tree.
2. The Media Integration Layer (MIL) statically renders the strokes.
2. The Media Integration Layer (MIL) statically renders the strokes.
3. The <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> cleans up the visuals.
3. The <xref:System.Windows.Input.StylusPlugIns.DynamicRenderer> cleans up the visuals.

Просмотреть файл

@ -103,9 +103,9 @@ Caching enables you to store data in memory for rapid access. When the data is a
7. Add a reference to the caching assembly by following these steps:
1. In **Solution Explorer**, right-click the name of the project and then click **Add Reference**.
1. In **Solution Explorer**, right-click the name of the project and then click **Add Reference**.
2. Select the **.NET** tab, select `System.Runtime.Caching`, and then click **OK**.
2. Select the **.NET** tab, select `System.Runtime.Caching`, and then click **OK**.
#### To change the target .NET Framework in a Visual C# project
@ -119,9 +119,9 @@ Caching enables you to store data in memory for rapid access. When the data is a
4. Add a reference to the caching assembly by following these steps:
1. Right-click the **References** folder and then click **Add Reference**.
1. Right-click the **References** folder and then click **Add Reference**.
2. Select the **.NET** tab, select `System.Runtime.Caching`, and then click **OK**.
2. Select the **.NET** tab, select `System.Runtime.Caching`, and then click **OK**.
## Adding a Button to the WPF Window
Next, you will add a button control and create an event handler for the button's `Click` event. Later you will add code to so when you click the button, the contents of the text file are cached and displayed.

Просмотреть файл

@ -35,13 +35,13 @@ ms.assetid: 38ce284a-4303-46dd-b699-c9365b22a7dc
4. Handle the [WM_CREATE](/windows/desktop/winmsg/wm-create)notification in your window procedure and do the following:
1. Create a new <xref:System.Windows.Interop.HwndSource> object with the parent window as its `parent` parameter.
1. Create a new <xref:System.Windows.Interop.HwndSource> object with the parent window as its `parent` parameter.
2. Create an instance of your [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content class.
2. Create an instance of your [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content class.
3. Assign a reference to the [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content object to the <xref:System.Windows.Interop.HwndSource.RootVisual%2A> property of the <xref:System.Windows.Interop.HwndSource>.
3. Assign a reference to the [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content object to the <xref:System.Windows.Interop.HwndSource.RootVisual%2A> property of the <xref:System.Windows.Interop.HwndSource>.
4. Get the HWND for the content. The <xref:System.Windows.Interop.HwndSource.Handle%2A> property of the <xref:System.Windows.Interop.HwndSource> object contains the window handle (HWND). To get an HWND that you can use in the unmanaged part of your application, cast `Handle.ToPointer()` to an HWND.
4. Get the HWND for the content. The <xref:System.Windows.Interop.HwndSource.Handle%2A> property of the <xref:System.Windows.Interop.HwndSource> object contains the window handle (HWND). To get an HWND that you can use in the unmanaged part of your application, cast `Handle.ToPointer()` to an HWND.
5. Implement a managed class that contains a static field to hold a reference to your [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content. This class allows you to get a reference to the [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content from your [!INCLUDE[TLA2#tla_win32](../../../../includes/tla2sharptla-win32-md.md)] code.
@ -223,4 +223,4 @@ ms.assetid: 38ce284a-4303-46dd-b699-c9365b22a7dc
## See also
- <xref:System.Windows.Interop.HwndSource>
- [WPF and Win32 Interoperation](wpf-and-win32-interoperation.md)
- [WPF and Win32 Interoperation](wpf-and-win32-interoperation.md)

Просмотреть файл

@ -62,13 +62,13 @@ This topic provides an overview of how to interoperate [!INCLUDE[TLA2#tla_wincli
5. Within the handler (or a function that the handler calls), do the following:
1. Create a new <xref:System.Windows.Interop.HwndSource> object with the parent window HWND as its `parent` parameter.
1. Create a new <xref:System.Windows.Interop.HwndSource> object with the parent window HWND as its `parent` parameter.
2. Create an instance of your [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content class.
2. Create an instance of your [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content class.
3. Assign a reference to the [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content object to the <xref:System.Windows.Interop.HwndSource> object <xref:System.Windows.Interop.HwndSource.RootVisual%2A> property.
3. Assign a reference to the [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content object to the <xref:System.Windows.Interop.HwndSource> object <xref:System.Windows.Interop.HwndSource.RootVisual%2A> property.
4. The <xref:System.Windows.Interop.HwndSource> object <xref:System.Windows.Interop.HwndSource.Handle%2A> property contains the window handle (HWND). To get an HWND that you can use in the unmanaged part of your application, cast `Handle.ToPointer()` to an HWND.
4. The <xref:System.Windows.Interop.HwndSource> object <xref:System.Windows.Interop.HwndSource.Handle%2A> property contains the window handle (HWND). To get an HWND that you can use in the unmanaged part of your application, cast `Handle.ToPointer()` to an HWND.
6. Implement a managed class that contains a static field that holds a reference to your [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content object. This class allows you to get a reference to the [!INCLUDE[TLA2#tla_winclient](../../../../includes/tla2sharptla-winclient-md.md)] content object from your [!INCLUDE[TLA2#tla_win32](../../../../includes/tla2sharptla-win32-md.md)] code, but more importantly it prevents your <xref:System.Windows.Interop.HwndSource> from being inadvertently garbage collected.

Просмотреть файл

@ -111,11 +111,11 @@ Content that can be hosted by an [!INCLUDE[TLA#tla_xbap](../../../../includes/tl
- From the calling page:
1. Instantiate the called <xref:System.Windows.Navigation.PageFunction%601> using the default constructor.
1. Instantiate the called <xref:System.Windows.Navigation.PageFunction%601> using the default constructor.
2. Store the parameters in <xref:System.Windows.Application.Properties%2A>.
2. Store the parameters in <xref:System.Windows.Application.Properties%2A>.
3. Navigate to the called <xref:System.Windows.Navigation.PageFunction%601>.
3. Navigate to the called <xref:System.Windows.Navigation.PageFunction%601>.
- From the called <xref:System.Windows.Navigation.PageFunction%601>:

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше