diff --git a/.editorconfig b/.editorconfig index b2124381e66c8..5a86d76640040 100644 --- a/.editorconfig +++ b/.editorconfig @@ -77,6 +77,9 @@ dotnet_style_prefer_auto_properties = true:suggestion dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring dotnet_style_prefer_conditional_expression_over_return = true:refactoring +# CA2208: Instantiate argument exceptions correctly +dotnet_diagnostic.CA2208.severity = error + # C# files [*.cs] # New line preferences diff --git a/.ghal.rules.json b/.ghal.rules.json deleted file mode 100644 index 61c19446ca364..0000000000000 --- a/.ghal.rules.json +++ /dev/null @@ -1,335 +0,0 @@ -{ - "version": 3, - "configRevision": 4, - - "issue": { - "labeled": { - "processor-conditional-techprodlabels": { - "type": "query", - "value": "length(Issue.labels[?contains(name, '/prod') || contains(name, '/tech')]) != `0`", - "processors": { - "processor-conditional": { - "type": "query", - "value": "length(Issue.labels[?name == 'doc-enhancement' || name == 'product-question' || name == 'in-progress' || name == 'test-issue' || name == 'kudos' || name == 'loc' || name == 'doc-bug' || name == 'product-feedback' || name == 'code-of-conduct' || name == 'support-request' || name == 'duplicate' || name == 'resolved-by-customer' || name == 'docs-experience' || name == 'doc-provided' || name == 'doc-idea' || name == 'needs-more-info']) != `0`", - "actions": { - "labels-remove": ":watch: Not Triaged" - }, - "actions-failed": { - "labels-add": ":watch: Not Triaged" - } - } - } - }, - "processor-conditional-release6": { - "type": "query", - "value": "length(Issue.labels[?name == ':checkered_flag: Release .NET 6']) != `0`", - "actions": { - "projects-add": [ "132" ] - } - } - }, - "opened": { - "processor-default": { - "labels-add": [ ":watch: Not Triaged" ] - }, - "processor-meta-custom": { - "issuetype": { - "(?i)breaking-change$": { - "labels-add": [ "breaking-change", "doc-idea" ], - "projects-add": [ "135" ] - } - } - } - }, - "reopened": { - "processor-default": { - "labels-remove": [ "won't fix" ] - } - }, - "closed": { - "processor-default": { - "labels-remove": [ "in-progress", ":watch: Not Triaged" ] - } - } - }, - "pullrequest": { - "opened": { - "processor-default": { - "milestone-set": "![sprint]" - }, - "processor-conditional": { - "type": "query", - "value": "PullRequest.base.ref != 'live'", - "processors": { - "processor-files": { - "changedfile": { - - "(?i).*_csharplang.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-spec/tech" ] - }, - - "(?i).*_vblang\/spec.*": { - "labels-add": [ "dotnet-visualbasic/prod", "vb-spec/tech" ] - }, - - "(?i).*docs\/architecture.*": { - "labels-add": "dotnet-architecture/prod" - }, - "(?i).*docs\/architecture\/blazor-for-web-forms-developers.*": { - "labels-add": [ "dotnet-architecture/prod", "blazor/tech" ] - }, - "(?i).*docs\/architecture\/cloud-native.*": { - "labels-add": [ "dotnet-architecture/prod", "cloud-native/tech" ] - }, - "(?i).*docs\/architecture\/containerized-lifecycle.*": { - "labels-add": [ "dotnet-architecture/prod", "containerized-lifecycle/tech" ] - }, - "(?i).*docs\/architecture\/grpc-for-wcf-developers.*": { - "labels-add": [ "dotnet-architecture/prod", "grpc/tech" ] - }, - "(?i).*docs\/architecture\/microservices.*": { - "labels-add": [ "dotnet-architecture/prod", "microservices/tech" ] - }, - "(?i).*docs\/architecture\/modernize-with-azure-containers.*": { - "labels-add": [ "dotnet-architecture/prod", "modernize-with-azure-containers/tech" ] - }, - "(?i).*docs\/architecture\/modern-web-apps-azure.*": { - "labels-add": [ "dotnet-architecture/prod", "modern-web-apps-azure/tech" ] - }, - "(?i).*docs\/architecture\/serverless.*": { - "labels-add": [ "dotnet-architecture/prod", "serverless/tech" ] - }, - - "(?i).*docs\/azure.*": { - "labels-add": "dotnet-azure/prod" - }, - - "(?i).*docs\/core.*": { - "labels-add": "dotnet-fundamentals/prod" - }, - "(?i).*docs\/core\/tools.*": { - "labels-add": [ "dotnet-fundamentals/prod", "dotnet-cli/tech" ] - }, - "(?i).*docs\/core\/docker.*": { - "labels-add": [ "dotnet-fundamentals/prod", "dotnet-docker/tech" ] - }, - - "(?i).*docs\/core\/install.*": { - "labels-add": [ "dotnet/prod", "dotnet-install/tech" ] - }, - - "(?i).*docs\/csharp.*": { - "labels-add": "dotnet-csharp/prod" - }, - "(?i).*docs\/csharp\/fundamentals.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/misc.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-diagnostics/tech" ] - }, - "(?i).*docs\/csharp\/whats-new.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-whats-new/tech" ] - }, - "(?i).*docs\/csharp\/how-to.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/linq.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-linq/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/indexers.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/generics.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/strings.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/types.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/statements-expressions-operators.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/interop.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-advanced-concepts/tech" ] - }, - "(?i).*docs\/csharp\/language-reference\/unsafe-code.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-advanced-concepts/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/namespaces.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/arrays.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/concepts\/covariance-contravariance.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-advanced-concepts/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/concepts\/serialization.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/concepts\/expression-trees.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-advanced-concepts/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/concepts\/async.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-async/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/concepts\/linq.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-linq/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/concepts\/attributes.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/xmldoc.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/classes-and-structs.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/delegates.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/file-system.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/events.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/programming-guide\/interfaces.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/tutorials.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-fundamentals/tech" ] - }, - "(?i).*docs\/csharp\/tutorials\/exploration.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-get-started/tech" ] - }, - "(?i).*docs\/csharp\/language-reference.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-language-reference/tech" ] - }, - "(?i).*docs\/csharp\/language-reference\/compiler-messages.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-diagnostics/tech" ] - }, - "(?i).*docs\/csharp\/roslyn-sdk.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-roslyn/tech" ] - }, - "(?i).*docs\/csharp\/tour-of-csharp.*": { - "labels-add": [ "dotnet-csharp/prod", "csharp-get-started/tech" ] - }, - - "(?i).*docs\/framework.*": { - "labels-add": "dotnet-framework/prod" - }, - "(?i).*docs\/framework\/configure-apps\/file-schema\/network.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-networking/tech" ] - }, - "(?i).*docs\/framework\/configure-apps\/file-schema\/wcf.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-wcf/tech" ] - }, - "(?i).*docs\/framework\/data\/adonet.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-data/tech" ] - }, - "(?i).*docs\/framework\/data\/wcf.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-wcf/tech" ] - }, - "(?i).*docs\/framework\/docker.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-docker/tech" ] - }, - "(?i).*docs\/framework\/install.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-install/tech" ] - }, - "(?i).*docs\/framework\/migration-guide.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-appcompat/tech" ] - }, - "(?i).*docs\/framework\/network-programming.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-networking/tech" ] - }, - "(?i).*docs\/framework\/wcf.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-wcf/tech" ] - }, - "(?i).*docs\/framework\/windows-workflow-foundation.*": { - "labels-add": [ "dotnet-framework/prod", "dotnet-wf/tech" ] - }, - - "(?i).*docs\/fsharp.*": { - "labels-add": "dotnet-fsharp/prod" - }, - - "(?i).*docs\/fundamentals.*": { - "labels-add": "dotnet-fundamentals/prod" - }, - - "(?i).*docs\/standard.*": { - "labels-add": "dotnet-fundamentals/prod" - }, - - "(?i).*docs\/standard\/analyzers.*": { - "labels-add": [ "dotnet-fundamentals/prod", "dotnet-analyzers/tech" ] - }, - - "(?i).*docs\/machine-learning.*": { - "labels-add": "dotnet-ml/prod" - }, - - "(?i).*docs\/spark.*": { - "labels-add": "dotnet-spark/prod" - }, - - "(?i).*docs\/standard\/data.*": { - "labels-add": "dotnet-data/prod" - }, - - "(?i).*docs\/standard\/design-guidelines.*": { - "labels-add": [ "dotnet/prod", "dotnet-standard/tech" ] - }, - - "(?i).*docs\/standard\/security.*": { - "labels-add": [ "dotnet/prod", "dotnet-security/tech" ] - }, - - "(?i).*docs\/visual-basic.*": { - "labels-add": "dotnet-visualbasic/prod" - }, - - "(?i).*docs\/visual-basic\/language-reference\/error-messages.*": { - "labels-add": [ "dotnet-visualbasic/prod", "vb-diagnostics/tech" ] - }, - - "(?i).*docs\/visual-basic\/misc.*": { - "labels-add": [ "dotnet-visualbasic/prod", "vb-diagnostics/tech" ] - } - - } - } - } - } - }, - "labeled": { - "processor-conditional-release6": { - "type": "query", - "value": "length(PullRequest.labels[?name == ':checkered_flag: Release .NET 6']) != `0`", - "actions": { - "projects-add": [ "132" ] - } - } - } - }, - "comment": { - "created": { - "processor-comment": { - "body": { - "^#please-review$": { - "condition-1": { - "type": "query", - "value": "Issue.state == 'open' && Issue.user.id == Comment.user.id", - "actions": { - "labels-add": "changes-addressed" - } - } - } - } - } - } - } -} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 968aa0f9ebb3c..d4b11e7024f9c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -55,6 +55,9 @@ # Azure Guide /docs/azure/ @CamSoper +# Azure SDK package list +/docs/azure/includes/ @dotnet/docs + # IoT Guide /docs/iot/ @CamSoper @@ -116,7 +119,7 @@ # XAML Services /docs/framework/xaml-services/ @adegeo # ADO.NET -/docs/framework/data/ @stevestein +/docs/framework/data/ @mcleblanc # NCL /docs/framework/configure-apps/file-schema/network/ @karelz /docs/framework/network-programming/ @karelz diff --git a/.github/workflows/build-validation.yml b/.github/workflows/build-validation.yml index de5b15f8d615a..edcbbf048c853 100644 --- a/.github/workflows/build-validation.yml +++ b/.github/workflows/build-validation.yml @@ -25,8 +25,8 @@ on: branches: [ main ] env: - DOTNET_INSTALLER_CHANNEL: 'release/5.0.1xx' - DOTNET_DO_INSTALL: 'false' + DOTNET_INSTALLER_CHANNEL: '6.0' + DOTNET_DO_INSTALL: 'true' EnableNuGetPackageRestore: 'True' # A workflow run is made up of one or more jobs that can run sequentially or in parallel diff --git a/.github/workflows/check-for-build-warnings.yml b/.github/workflows/check-for-build-warnings.yml index 25f66767ce6bd..b916e8c721459 100644 --- a/.github/workflows/check-for-build-warnings.yml +++ b/.github/workflows/check-for-build-warnings.yml @@ -1,4 +1,4 @@ -name: 'Status checker' +name: 'OPS status checker' on: pull_request_target: @@ -9,6 +9,6 @@ jobs: name: Look for build warnings runs-on: ubuntu-latest steps: - - uses: dotnet/samples/.github/actions/status-checker@main + - uses: dotnet/docs-actions/actions/status-checker@main with: repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/dependencies/dotnet-whatsnew.1.1.0.nupkg b/.github/workflows/dependencies/dotnet-whatsnew.1.1.0.nupkg new file mode 100644 index 0000000000000..0f34039c9e2fc Binary files /dev/null and b/.github/workflows/dependencies/dotnet-whatsnew.1.1.0.nupkg differ diff --git a/.github/workflows/dependencies/run-dotnet-whatsnew.sh b/.github/workflows/dependencies/run-dotnet-whatsnew.sh new file mode 100755 index 0000000000000..b8fd0d48d8ebd --- /dev/null +++ b/.github/workflows/dependencies/run-dotnet-whatsnew.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +# This script runs the .NET CLI, invoking the what's new global tool +# $1 is the +# $2 is the +# $3 is the savedir + +declare -r STARTDATE=$(date "+%F" -d "$(date +'%Y-%m-01') -1 month"); +declare -r ENDDATE=$(date "+%F" -d "$STARTDATE +1 month -1 day"); + +echo "From $STARTDATE to $ENDDATE" + +while getopts o:r:s: option +do +case "${option}" +in +o) OWNER=${OPTARG};; +r) REPO=${OPTARG};; +s) SAVEDIR=${OPTARG};; +esac +done + +dotnet whatsnew \ + --owner $OWNER \ + --repo $REPO \ + --startdate $STARTDATE \ + --enddate $ENDDATE \ + --savedir $SAVEDIR diff --git a/.github/workflows/docs-verifier.yml b/.github/workflows/docs-verifier.yml index 0585b4c4bc96c..6874558a3516f 100644 --- a/.github/workflows/docs-verifier.yml +++ b/.github/workflows/docs-verifier.yml @@ -14,4 +14,4 @@ jobs: uses: actions/checkout@a81bbbf8298c0fa03ea29cdc473d45769f953675 #@v2 - name: Validate - uses: MSDocsBuild/build-verifier@a80f2795ccba7f45787caa3f774aa2fc64eefeff #@v0.0.1 + uses: dotnet/docs-actions/actions/docs-verifier@main diff --git a/.github/workflows/whats-new.yml b/.github/workflows/whats-new.yml new file mode 100644 index 0000000000000..b3b9f0d9c8107 --- /dev/null +++ b/.github/workflows/whats-new.yml @@ -0,0 +1,66 @@ +# This is a basic workflow to help you get started with Actions + +name: 'generate what''s new article' + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the default branch + schedule: + - cron: '0 0 1 * *' # The first of every month + workflow_dispatch: + inputs: + reason: + description: 'The reason for running the workflow' + required: true + default: 'Manual run' + +env: + DOTNET_VERSION: '5.0.301' # set this to the dot net version to use + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "create-what-is-new" + create-what-is-new: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + # Runs a single command using the runners shell + - name: 'Print manual run reason' + if: ${{ github.event_name == 'workflow_dispatch' }} + run: | + echo 'Reason: ${{ github.event.inputs.reason }}' + + # Print dotnet info + - name: Display .NET info + run: dotnet --info + + # Install dotnet-whatsnew global tool + - name: Install dotnet-whatsnew tool + run: | + dotnet tool install --global --add-source ./.github/workflows/dependencies/ dotnet-whatsnew + + # Run dotnet-whatsnew tool + - name: Generate what's new + id: dotnet-whatsnew + env: + GitHubKey: ${{ secrets.GITHUB_TOKEN }} + run: | + ./.github/workflows/dependencies/run-dotnet-whatsnew.sh -o dotnet -r docs -s './docs/whats-new' + + # Create the PR for the new article + - name: create-pull-request + uses: peter-evans/create-pull-request@v3.10.0 + with: + title: 'What''s new article' + commit-message: 'Bot 🤖 generated "What''s new article"' + body: 'Automated creation of What''s new article.' diff --git a/.gitignore b/.gitignore index 772803f974a57..ab6a5d18654f2 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,4 @@ ehthumbs_vista.db # Ionide folder, used in F# for VSCode .ionide/ +docs/core/extensions/snippets/workers/cloud-service/Properties/PublishProfiles/cloudworker.pubxml diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index df4e5d995e731..85123297c415b 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -1009,7 +1009,7 @@ "source_path": "docs/csharp/how-to/safely-cast-using-pattern-matching-is-and-as-operators.md", "redirect_url": "/dotnet/csharp/fundamentals/tutorials/safely-cast-using-pattern-matching-is-and-as-operators" }, - + { "source_path": "docs/csharp/implicitly-typed-lambda-expressions.md", "redirect_url": "/dotnet/csharp/language-reference/operators/lambda-expressions" @@ -3977,764 +3977,2713 @@ "redirect_url": "/dotnet/framework/configure-apps/file-schema/wcf/udpannouncementendpoint", "redirect_document_id": true }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/add.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/add", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/audienceuris.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/audienceuris", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/caches.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/caches", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatereference.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/certificatereference", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatevalidation.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/certificatevalidation", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatevalidator.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/certificatevalidator", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/chunkedcookiehandler.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/chunkedcookiehandler", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthenticationmanager.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/claimsauthenticationmanager", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthorizationmanager.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/claimsauthorizationmanager", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/claimtype.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/claimtype", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/claimtyperequired.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/claimtyperequired", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/clear.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/clear", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/cookiehandler.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/cookiehandler", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/customcookiehandler.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/customcookiehandler", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/federationconfiguration.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/federationconfiguration", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/identityconfiguration.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/identityconfiguration", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/index.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/index", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/issuernameregistry.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/issuernameregistry", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/issuertokenresolver.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/issuertokenresolver", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/nameclaimtype.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/nameclaimtype", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/remove.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/remove", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/roleclaimtype.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/roleclaimtype", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/samlsecuritytokenrequirement.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/samlsecuritytokenrequirement", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/securitytokenhandlerconfiguration.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/securitytokenhandlerconfiguration", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/securitytokenhandlers.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/securitytokenhandlers", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/servicecertificate.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/servicecertificate", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/servicetokenresolver.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/servicetokenresolver", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/sessionsecuritytokencache.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/sessionsecuritytokencache", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/sessiontokenrequirement.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/sessiontokenrequirement", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/system-identitymodel-services.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/system-identitymodel-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/system-identitymodel.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/system-identitymodel", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/tokenreplaycache.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/tokenreplaycache", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/tokenreplaydetection.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/tokenreplaydetection", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/trustedissuers.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/trustedissuers", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/usernamesecuritytokenhandlerrequirement.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/usernamesecuritytokenhandlerrequirement", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/wsfederation.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/wsfederation", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/configure-apps/file-schema/windows-identity-foundation/x509securitytokenhandlerrequirement.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-identity-foundation/file-schema/x509securitytokenhandlerrequirement", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/cross-platform/app-resources-for-libraries-that-target-multiple-platforms.md", + "redirect_url": "/previous-versions/dotnet/framework/cross-platform/app-resources-for-libraries-that-target-multiple-platforms", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/cross-platform/index.md", + "redirect_url": "/previous-versions/dotnet/framework/cross-platform/index", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/cross-platform/passing-a-uri-to-the-windows-runtime.md", + "redirect_url": "/previous-versions/dotnet/framework/cross-platform/passing-a-uri-to-the-windows-runtime", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/cross-platform/portable-class-library.md", + "redirect_url": "/previous-versions/dotnet/framework/cross-platform/portable-class-library", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime.md", + "redirect_url": "/previous-versions/dotnet/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/cross-platform/using-portable-class-library-with-model-view-view-model.md", + "redirect_url": "/previous-versions/dotnet/framework/cross-platform/using-portable-class-library-with-model-view-view-model" + }, { "source_path": "docs/framework/data/adonet/ef/architecture-and-design.md", "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee794151(v=vs.100)" }, { - "source_path": "docs/framework/data/adonet/ef/generating-sql-from-command-trees-best-practices.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee794149(v=vs.100)" + "source_path": "docs/framework/data/adonet/ef/generating-sql-from-command-trees-best-practices.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee794149(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/ef/language-reference/csdl-specification.md", + "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/csdl-spec" + }, + { + "source_path": "docs/framework/data/adonet/ef/language-reference/csdl-ssdl-and-msl-specifications.md", + "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/csdl-spec" + }, + { + "source_path": "docs/framework/data/adonet/ef/language-reference/msl-specification.md", + "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/msl-spec" + }, + { + "source_path": "docs/framework/data/adonet/ef/language-reference/ssdl-specification.md", + "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/ssdl-spec" + }, + { + "source_path": "docs/framework/data/adonet/ef/modification-sql-generation.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee828422(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/ef/provider-manifest-specification.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee828423(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/ef/sql-generation-in-the-sample-provider.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee794152(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/ef/sql-generation.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee789836(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/ef/the-shape-of-the-command-trees.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee789837(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/ef/walkthrough-sql-generation.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee794148(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/ef/writing-an-ef-data-provider.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee789835(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/sql/linq/linq-to-sql-with-tightly-coupled-client-server-applications.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/bb882676(v=vs.100)" + }, + { + "source_path": "docs/framework/data/adonet/sql/sql-server-security.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/sql-server-security", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/overview-of-sql-server-security.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/overview-of-sql-server-security", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/authentication-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/authentication-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/authorization-and-permissions-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/authorization-and-permissions-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/server-and-database-roles-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/server-and-database-roles-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/ownership-and-user-schema-separation-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/ownership-and-user-schema-separation-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/data-encryption-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/data-encryption-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/clr-integration-security-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/clr-integration-security-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/application-security-scenarios-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/application-security-scenarios-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/managing-permissions-with-stored-procedures-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/managing-permissions-with-stored-procedures-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/writing-secure-dynamic-sql-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/writing-secure-dynamic-sql-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/signing-stored-procedures-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/signing-stored-procedures-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/customizing-permissions-with-impersonation-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/customizing-permissions-with-impersonation-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/creating-application-roles-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/creating-application-roles-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/enabling-cross-database-access-in-sql-server.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/enabling-cross-database-access-in-sql-server", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/adonet/sql/sql-server-express-security.md", + "redirect_url": "/previous-versions/dotnet/framework/data/adonet/sql/sql-server-express-security", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/writing-a-windows-store-app-that-consumes-an-odata-service.md", + "redirect_url": "/dotnet/framework/data/wcf/" + }, + { + "source_path": "docs/framework/data/wcf/index.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/index", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/wcf-data-services-overview.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/wcf-data-services-overview", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/getting-started-with-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/getting-started-with-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/exposing-your-data-as-a-service-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/exposing-your-data-as-a-service-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/accessing-data-service-resources-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/accessing-data-service-resources-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/using-a-data-service-in-a-client-application-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/using-a-data-service-in-a-client-application-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/quickstart-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/quickstart-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/creating-the-data-service.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/creating-the-data-service", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/accessing-the-service-from-a-web-browser-wcf-data-services-quickstart", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/creating-the-dotnet-client-application-wcf-data-services-quickstart.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/creating-the-dotnet-client-application-wcf-data-services-quickstart", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/application-scenarios-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/application-scenarios-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/wcf-data-services-resources.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/wcf-data-services-resources", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/defining-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/defining-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/configuring-the-data-service-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-develop-a-wcf-data-service-running-on-iis.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-develop-a-wcf-data-service-running-on-iis", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-enable-access-to-the-data-service-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-enable-access-to-the-data-service-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-enable-paging-of-data-service-results-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-enable-paging-of-data-service-results-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/data-services-providers-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/data-services-providers-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/entity-framework-provider-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/entity-framework-provider-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/create-a-data-service-using-an-adonet-ef-data-wcf.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/create-a-data-service-using-an-adonet-ef-data-wcf", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/reflection-provider-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/reflection-provider-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/create-a-data-service-using-rp-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/create-a-data-service-using-rp-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/create-a-data-service-using-linq-to-sql-wcf.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/create-a-data-service-using-linq-to-sql-wcf", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/custom-data-service-providers-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/custom-data-service-providers-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/streaming-provider-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/streaming-provider-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/service-operations-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/service-operations-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-define-a-service-operation-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-define-a-service-operation-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/feed-customization-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/feed-customization-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-customize-feeds-with-ef-provider-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-customize-feeds-with-ef-provider-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-customize-feeds-with-the-reflection-provider-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-customize-feeds-with-the-reflection-provider-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/interceptors-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/interceptors-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-intercept-data-service-messages-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-intercept-data-service-messages-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/developing-and-deploying-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/developing-and-deploying-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/securing-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/securing-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/hosting-the-data-service-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/hosting-the-data-service-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/data-service-versioning-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/data-service-versioning-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/wcf-data-services-protocol-implementation-details.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/wcf-data-services-protocol-implementation-details", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/using-actions-to-implement-server-side-behavior.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/using-actions-to-implement-server-side-behavior", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/wcf-data-services-client-library.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/wcf-data-services-client-library", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/generating-the-data-service-client-library-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/generating-the-data-service-client-library-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/wcf-data-service-client-utility-datasvcutil-exe.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/wcf-data-service-client-utility-datasvcutil-exe", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-add-a-data-service-reference-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-add-a-data-service-reference-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-manually-generate-client-data-service-classes-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-manually-generate-client-data-service-classes-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/querying-the-data-service-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/query-projections-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/query-projections-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-project-query-results-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-project-query-results-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/linq-considerations-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/linq-considerations-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/object-materialization-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/object-materialization-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-execute-data-service-queries-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-execute-data-service-queries-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-add-query-options-to-a-data-service-query-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-add-query-options-to-a-data-service-query-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/number-of-entities-returned-by-a-query-wcf.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/number-of-entities-returned-by-a-query-wcf", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/loading-deferred-content-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/loading-deferred-content-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-load-related-entities-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-load-related-entities-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-load-paged-results-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-load-paged-results-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/updating-the-data-service-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/updating-the-data-service-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-add-modify-and-delete-entities-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-add-modify-and-delete-entities-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-define-entity-relationships-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-define-entity-relationships-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/attach-an-existing-entity-to-dc-wcf-data.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/attach-an-existing-entity-to-dc-wcf-data", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/asynchronous-operations-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/asynchronous-operations-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-execute-asynchronous-data-service-queries-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-execute-asynchronous-data-service-queries-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/create-an-asynchronous-wpf-application-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/create-an-asynchronous-wpf-application-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/batching-operations-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/batching-operations-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-execute-queries-in-a-batch-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-execute-queries-in-a-batch-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/binding-data-to-controls-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/binding-data-to-controls-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/bind-data-to-wpf-elements-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/bind-data-to-wpf-elements-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-bind-data-using-a-project-data-source-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-bind-data-using-a-project-data-source-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/how-to-customize-data-binding-behaviors-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/how-to-customize-data-binding-behaviors-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/calling-service-operations-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/calling-service-operations-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/managing-the-data-service-context-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/managing-the-data-service-context-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/data/wcf/working-with-binary-data-wcf-data-services.md", + "redirect_url": "/previous-versions/dotnet/framework/data/wcf/working-with-binary-data-wcf-data-services", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/deployment/repair.md", + "redirect_url": "/dotnet/framework/install/repair" + }, + { + "source_path": "docs/framework/deployment/windows/7.md", + "redirect_url": "/dotnet/framework/install/on-windows-7" + }, + { + "source_path": "docs/framework/deployment/windows/8.md", + "redirect_url": "/dotnet/framework/install/on-windows-8" + }, + { + "source_path": "docs/framework/deployment/windows/10.md", + "redirect_url": "/dotnet/framework/install/on-windows-10" + }, + { + "source_path": "docs/framework/deployment/windows/index.md", + "redirect_url": "/dotnet/framework/install/" + }, + { + "source_path": "docs/framework/deployment/windows/installing-dotnet-35-windows-10.md", + "redirect_url": "/dotnet/framework/install/dotnet-35-windows-10" + }, + { + "source_path": "docs/framework/deployment/windows/vista.md", + "redirect_url": "/dotnet/framework/install/on-windows-vista" + }, + { + "source_path": "docs/framework/deployment/windows/xp.md", + "redirect_url": "/dotnet/framework/install/on-windows-xp" + }, + { + "source_path": "docs/framework/docker/aspnetmvc.md", + "redirect_url": "/aspnet/mvc/overview/deployment/docker-aspnetmvc" + }, + { + "source_path": "docs/framework/docker/console.md", + "redirect_url": "/dotnet/framework" + }, + { + "source_path": "docs/framework/docker/index.md", + "redirect_url": "/dotnet/framework" + }, + { + "source_path": "docs/framework/get-started/net-core-and-open-source.md", + "redirect_url": "/dotnet/core/introduction" + }, + { + "source_path": "docs/framework/install/net-framework-3-5-on-windows-8-plus.md", + "redirect_url": "/dotnet/framework/install/dotnet-35-windows-10" + }, + { + "source_path": "docs/framework/install/on-windows-vista.md", + "redirect_url": "/previous-versions/dotnet/framework/install/on-windows-vista", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/install/on-windows-xp.md", + "redirect_url": "/previous-versions/dotnet/framework/install/on-windows-xp", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/install/on-windows-7.md", + "redirect_url": "/previous-versions/dotnet/framework/install/on-windows-7", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/interop/applying-interop-attributes.md", + "redirect_url": "/dotnet/standard/native-interop/apply-interop-attributes", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/interop/com-callable-wrapper.md", + "redirect_url": "/dotnet/standard/native-interop/com-callable-wrapper", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/interop/com-wrappers.md", + "redirect_url": "/dotnet/standard/native-interop/com-wrappers", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/interop/qualifying-net-types-for-interoperation.md", + "redirect_url": "/dotnet/standard/native-interop/qualify-net-types-for-interoperation", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/interop/runtime-callable-wrapper.md", + "redirect_url": "/dotnet/standard/native-interop/runtime-callable-wrapper", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/mef/composition-analysis-tool-mefx.md", + "redirect_url": "/previous-versions/dotnet/framework/mef/composition-analysis-tool-mefx", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/mef/mef-for-net-for-windows-store-apps.md", + "redirect_url": "/previous-versions/dotnet/framework/mef/mef-for-net-for-windows-store-apps", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-7.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-culture-and-asynchronous-operations.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-culture-and-dispatcher-operations-in-wpf-apps.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-default-authorizationcontext.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-eventsource-writeevent-method-calls.md", + "redirect_url": "/dotnet/framework/migration-guide/runtime/4.5-4.5.1" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-grid-control.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.2-4.7" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-horizontal-scrolling-and-virtualization.md", + "redirect_url": "/dotnet/framework/migration-guide/runtime/4.6.1-4.6.2" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-long-path-support.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-memberdescriptor-equals.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + }, + { + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-minfreememorypercentagetoactiveservice-configuration-setting.md", + "redirect_url": "/dotnet/framework/migration-guide/runtime/4.5-4.5.1" + }, + { + "source_path": "docs/framework/migration-guide/minimum-release-dword.md", + "redirect_url": "/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" + }, + { + "source_path": "docs/framework/migration-guide/mitigation-claimsidentity-constructor.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + }, + { + "source_path": "docs/framework/migration-guide/mitigation-cspparameters-parentwindowhandle-expects-an-hwnd.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.2-4.7" + }, + { + "source_path": "docs/framework/migration-guide/net-compatibility-diagnostics.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/release-keys-and-os-versions.md", + "redirect_url": "/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" + }, + { + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-5-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-5-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-7.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/retargeting/index.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-5-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-5-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-7.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/migration-guide/runtime/index.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, + { + "source_path": "docs/framework/misc/binding.md", + "redirect_url": "/dotnet/framework/configure-apps/file-schema/wcf/bindings" + }, + { + "source_path": "docs/framework/misc/code-access-security-basics.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/code-access-security-basics", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/code-access-security-policy-compatibility-and-migration.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/code-access-security-policy-compatibility-and-migration", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/code-access-security.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/code-access-security", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/dangerous-permissions-and-policy-administration.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/dangerous-permissions-and-policy-administration", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/how-to-run-partially-trusted-code-in-a-sandbox.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/how-to-run-partially-trusted-code-in-a-sandbox", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/link-demands.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/link-demands", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/securing-exception-handling.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/securing-exception-handling", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/securing-method-access.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/securing-method-access", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/securing-wrapper-code.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/securing-wrapper-code", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/security-and-public-read-only-array-fields.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/security-and-public-read-only-array-fields", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/security-and-remoting-considerations.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/security-and-remoting-considerations", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/security-and-serialization.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/security-and-serialization", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/security-transparent-code-level-1.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/security-transparent-code-level-1", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/security-transparent-code-level-2.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/security-transparent-code-level-2", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/security-transparent-code.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/security-transparent-code", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/using-libraries-from-partially-trusted-code.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/using-libraries-from-partially-trusted-code", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/misc/using-the-assert-method.md", + "redirect_url": "/previous-versions/dotnet/framework/code-access-security/using-the-assert-method", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/network-programming/httplistener.md", + "redirect_url": "/dotnet/api/system.net.httplistener" + }, + { + "source_path": "docs/framework/net-native/apis-that-rely-on-reflection.md", + "redirect_url": "/windows/uwp/dotnet-native/apis-that-rely-on-reflection" + }, + { + "source_path": "docs/framework/net-native/application-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/application-element-net-native" + }, + { + "source_path": "docs/framework/net-native/assembly-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/assembly-element-net-native" + }, + { + "source_path": "docs/framework/net-native/attributeimplies-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/attributeimplies-element-net-native" + }, + { + "source_path": "docs/framework/net-native/directives-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/directives-element-net-native" + }, + { + "source_path": "docs/framework/net-native/event-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/event-element-net-native" + }, + { + "source_path": "docs/framework/net-native/example-handling-exceptions-when-binding-data.md", + "redirect_url": "/windows/uwp/dotnet-native/example-handling-exceptions-when-binding-data" + }, + { + "source_path": "docs/framework/net-native/example-troubleshooting-dynamic-programming.md", + "redirect_url": "/windows/uwp/dotnet-native/example-troubleshooting-dynamic-programming" + }, + { + "source_path": "docs/framework/net-native/field-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/field-element-net-native" + }, + { + "source_path": "docs/framework/net-native/genericparameter-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/genericparameter-element-net-native" + }, + { + "source_path": "docs/framework/net-native/getting-started-with-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/getting-started-with-net-native" + }, + { + "source_path": "docs/framework/net-native/impliestype-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/impliestype-element-net-native" + }, + { + "source_path": "docs/framework/net-native/index.md", + "redirect_url": "/windows/uwp/dotnet-native/index" + }, + { + "source_path": "docs/framework/net-native/library-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/library-element-net-native" + }, + { + "source_path": "docs/framework/net-native/measuring-startup-improvement-with-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/measuring-startup-improvement-with-net-native" + }, + { + "source_path": "docs/framework/net-native/method-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/method-element-net-native" + }, + { + "source_path": "docs/framework/net-native/methodinstantiation-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/methodinstantiation-element-net-native" + }, + { + "source_path": "docs/framework/net-native/migrating-your-windows-store-app-to-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/migrating-your-windows-store-app-to-net-native" + }, + { + "source_path": "docs/framework/net-native/missinginteropdataexception-class-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/missinginteropdataexception-class-net-native" + }, + { + "source_path": "docs/framework/net-native/missingmetadataexception-class-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/missingmetadataexception-class-net-native" + }, + { + "source_path": "docs/framework/net-native/missingruntimeartifactexception-class-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/missingruntimeartifactexception-class-net-native" + }, + { + "source_path": "docs/framework/net-native/namespace-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/namespace-element-net-native" + }, + { + "source_path": "docs/framework/net-native/net-native-and-compilation.md", + "redirect_url": "/windows/uwp/dotnet-native/net-native-and-compilation" + }, + { + "source_path": "docs/framework/net-native/net-native-general-troubleshooting.md", + "redirect_url": "/windows/uwp/dotnet-native/net-native-general-troubleshooting" + }, + { + "source_path": "docs/framework/net-native/net-native-reflection-api-reference.md", + "redirect_url": "/windows/uwp/dotnet-native/net-native-reflection-api-reference" + }, + { + "source_path": "docs/framework/net-native/parameter-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/parameter-element-net-native" + }, + { + "source_path": "docs/framework/net-native/property-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/property-element-net-native" + }, + { + "source_path": "docs/framework/net-native/reflection-and-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/reflection-and-net-native" + }, + { + "source_path": "docs/framework/net-native/runtime-directive-elements.md", + "redirect_url": "/windows/uwp/dotnet-native/runtime-directive-elements" + }, + { + "source_path": "docs/framework/net-native/runtime-directive-policy-settings.md", + "redirect_url": "/windows/uwp/dotnet-native/runtime-directive-policy-settings" + }, + { + "source_path": "docs/framework/net-native/runtime-directives-rd-xml-configuration-file-reference.md", + "redirect_url": "/windows/uwp/dotnet-native/runtime-directives-rd-xml-configuration-file-reference" + }, + { + "source_path": "docs/framework/net-native/runtime-exceptions-in-net-native-apps.md", + "redirect_url": "/windows/uwp/dotnet-native/runtime-exceptions-in-net-native-apps" + }, + { + "source_path": "docs/framework/net-native/serialization-and-metadata.md", + "redirect_url": "/windows/uwp/dotnet-native/serialization-and-metadata" + }, + { + "source_path": "docs/framework/net-native/subtypes-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/subtypes-element-net-native" + }, + { + "source_path": "docs/framework/net-native/type-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/type-element-net-native" + }, + { + "source_path": "docs/framework/net-native/typeinstantiation-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/typeinstantiation-element-net-native" + }, + { + "source_path": "docs/framework/net-native/typeparameter-element-net-native.md", + "redirect_url": "/windows/uwp/dotnet-native/typeparameter-element-net-native" + }, + { + "source_path": "docs/framework/security/building-my-first-claims-aware-aspnet-web-app.md", + "redirect_url": "/previous-versions/dotnet/framework/security/building-my-first-claims-aware-aspnet-web-app" + }, + { + "source_path": "docs/framework/security/building-my-first-claims-aware-wcf-service.md", + "redirect_url": "/previous-versions/dotnet/framework/security/building-my-first-claims-aware-wcf-service" + }, + { + "source_path": "docs/framework/security/claims-aware-aspnet-app-forms-authentication.md", + "redirect_url": "/previous-versions/dotnet/framework/security/claims-aware-aspnet-app-forms-authentication" + }, + { + "source_path": "docs/framework/security/claims-based-authorization-using-wif.md", + "redirect_url": "/previous-versions/dotnet/framework/security/claims-based-authorization-using-wif" + }, + { + "source_path": "docs/framework/security/claims-based-identity-model.md", + "redirect_url": "/previous-versions/dotnet/framework/security/claims-based-identity-model" + }, + { + "source_path": "docs/framework/security/custom-token-handlers.md", + "redirect_url": "/previous-versions/dotnet/framework/security/custom-token-handlers" + }, + { + "source_path": "docs/framework/security/downloading-the-json-web-token-handler-package.md", + "redirect_url": "/previous-versions/dotnet/framework/security/downloading-the-json-web-token-handler-package" + }, + { + "source_path": "docs/framework/security/downloading-the-validating-issuer-name-registry-package.md", + "redirect_url": "/previous-versions/dotnet/framework/security/downloading-the-validating-issuer-name-registry-package" + }, + { + "source_path": "docs/framework/security/getting-started-with-wif.md", + "redirect_url": "/previous-versions/dotnet/framework/security/getting-started-with-wif" + }, + { + "source_path": "docs/framework/security/guidelines-for-migrating-an-application-built-using-wif-3-5-to-wif-4-5.md", + "redirect_url": "/previous-versions/dotnet/framework/security/guidelines-for-migrating-an-application-built-using-wif-3-5-to-wif-4-5" + }, + { + "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-app-using-windows-authentication.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-app-using-windows-authentication" + }, + { + "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-mvc-web-app-using-wif.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-mvc-web-app-using-wif" + }, + { + "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-web-forms-app-using-wif.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-web-forms-app-using-wif" + }, + { + "source_path": "docs/framework/security/how-to-debug-claims-aware-applications-and-services-using-wif-tracing.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-debug-claims-aware-applications-and-services-using-wif-tracing" + }, + { + "source_path": "docs/framework/security/how-to-display-signed-in-status-using-wif.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-display-signed-in-status-using-wif" + }, + { + "source_path": "docs/framework/security/how-to-enable-token-replay-detection.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-enable-token-replay-detection" + }, + { + "source_path": "docs/framework/security/how-to-enable-wif-for-a-wcf-web-service-application.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-enable-wif-for-a-wcf-web-service-application" + }, + { + "source_path": "docs/framework/security/how-to-enable-wif-tracing.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-enable-wif-tracing" + }, + { + "source_path": "docs/framework/security/how-to-transform-incoming-claims.md", + "redirect_url": "/previous-versions/dotnet/framework/security/how-to-transform-incoming-claims" + }, + { + "source_path": "docs/framework/security/identity-and-access-tool-for-vs.md", + "redirect_url": "/previous-versions/dotnet/framework/security/identity-and-access-tool-for-vs" + }, + { + "source_path": "docs/framework/security/index.md", + "redirect_url": "/previous-versions/dotnet/framework/security/index" + }, + { + "source_path": "docs/framework/security/json-web-token-handler-api-reference.md", + "redirect_url": "https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/wiki" + }, + { + "source_path": "docs/framework/security/json-web-token-handler.md", + "redirect_url": "/previous-versions/dotnet/framework/security/json-web-token-handler" + }, + { + "source_path": "docs/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5.md", + "redirect_url": "/previous-versions/dotnet/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5" + }, + { + "source_path": "docs/framework/security/secure-coding-guidelines-for-unmanaged-code.md", + "redirect_url": "/previous-versions/dotnet/framework/security/secure-coding-guidelines-for-unmanaged-code" + }, + { + "source_path": "docs/framework/security/security-changes.md", + "redirect_url": "/previous-versions/dotnet/framework/security/security-changes" + }, + { + "source_path": "docs/framework/security/validating-issuer-name-registry-api-reference.md", + "redirect_url": "/previous-versions/dotnet/framework/security/validating-issuer-name-registry-api-reference" + }, + { + "source_path": "docs/framework/security/validating-issuer-name-registry.md", + "redirect_url": "/previous-versions/dotnet/framework/security/validating-issuer-name-registry" + }, + { + "source_path": "docs/framework/security/whats-new-in-wif.md", + "redirect_url": "/previous-versions/dotnet/framework/security/whats-new-in-wif" + }, + { + "source_path": "docs/framework/security/wif-and-web-farms.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-and-web-farms" + }, + { + "source_path": "docs/framework/security/wif-api-reference.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-api-reference" + }, + { + "source_path": "docs/framework/security/wif-claims-programming-model.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-claims-programming-model" + }, + { + "source_path": "docs/framework/security/wif-code-sample-index.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-code-sample-index" + }, + { + "source_path": "docs/framework/security/wif-configuration-reference.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-configuration-reference" + }, + { + "source_path": "docs/framework/security/wif-configuration-schema-conventions.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-configuration-schema-conventions" + }, + { + "source_path": "docs/framework/security/wif-extensions.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-extensions" + }, + { + "source_path": "docs/framework/security/wif-features.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-features" + }, + { + "source_path": "docs/framework/security/wif-guidelines.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-guidelines" + }, + { + "source_path": "docs/framework/security/wif-how-tos-index.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-how-tos-index" + }, + { + "source_path": "docs/framework/security/wif-overview.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-overview" + }, + { + "source_path": "docs/framework/security/wif-session-management.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wif-session-management" + }, + { + "source_path": "docs/framework/security/wsfederation-authentication-module-overview.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wsfederation-authentication-module-overview" + }, + { + "source_path": "docs/framework/security/wstrustchannelfactory-and-wstrustchannel.md", + "redirect_url": "/previous-versions/dotnet/framework/security/wstrustchannelfactory-and-wstrustchannel" + }, + { + "source_path": "docs/framework/tools/developer-command-prompt-for-vs.md", + "redirect_url": "/visualstudio/ide/reference/command-prompt-powershell" + }, + { + "source_path": "docs/framework/ui-automation/ui-automation-specification-and-community-promise.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/bb986605(v=vs.100)" + }, + { + "source_path": "docs/framework/unmanaged-api/cor-prf-allowable-after-attach-bitmask.md", + "redirect_url": "/dotnet/framework/unmanaged-api/profiling/cor-prf-monitor-enumeration" + }, + { + "source_path": "docs/framework/wcf/diagnostics/etw/monitoring-service-operation-failures.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff468239(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/extending/extending-wcf.md", + "redirect_url": "/dotnet/framework/wcf/extending/index", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/wcf/feature-details/accessing-identity-information-inside-a-workflow-service.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff452450(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/feature-details/accessing-operationcontext-from-a-workflow-service.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff452697(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/feature-details/content-based-correlation.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee358755(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/feature-details/context-exchange-correlation.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee358724(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/feature-details/how-to-create-a-workflow-service-that-calls-another-workflow-service.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff729672(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/feature-details/how-to-host-a-non-service-workflow-in-iis.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff729688(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/feature-details/migrate-asp-net-web-service-client-to-wcf.md", + "redirect_url": "/dotnet/framework/wcf/feature-details/adopting-wcf" + }, + { + "source_path": "docs/framework/wcf/feature-details/migrate-asp-net-web-service-to-wcf.md", + "redirect_url": "/dotnet/framework/wcf/feature-details/adopting-wcf" + }, + { + "source_path": "docs/framework/wcf/samples/advanced-error-handling.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee667251(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/advanced-filters.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee667249(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/advanced-format-selection.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee662965(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/aspnetrouteintegration.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee662952(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/asynchronous-find-sample.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd483344(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/automatic-format-selection.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee662964(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/avoiding-problems-with-the-using-statement.md", + "redirect_url": "/dotnet/framework/wcf/samples/use-close-abort-release-wcf-client-resources", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/wcf/samples/basic-resource-service.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee662954(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/bridging-and-error-handling.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee667246(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/bytestream-encoder.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee960169(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/conditional-get-and-put.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee818665(v=vs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/configuration-based-activation.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd807499(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/custom-demux.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ms752265(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/customdiscoverymetadata.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd764464(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/discover-a-service-with-unique-listen-uri-mode-sample.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee530015(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/discovery-binding-element-sample.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd807387(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/discovery-extensibility.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd807503(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/discovery-proxy-sample.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd807497(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/dynamic-reconfiguration.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee667250(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/form-post.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee818241(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/hierarchical-configuration-model.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee663221(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/http-acknowledgement-channel.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee960152(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/receivecontext-enabled-wcf-channels.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee534020(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/transacted-batching.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/aa395219(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/web-extensibility.md", + "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee818234(v%3dvs.100)" + }, + { + "source_path": "docs/framework/wcf/samples/index.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/index", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/set-up-instructions.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/set-up-instructions", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/one-time-setup-procedure-for-the-wcf-samples.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/one-time-setup-procedure-for-the-wcf-samples", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/firewall-instructions.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/firewall-instructions", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/internet-information-service-hosting-instructions.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/internet-information-service-hosting-instructions", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/iis-server-certificate-installation-instructions.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/iis-server-certificate-installation-instructions", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/virtual-directory-setup-instructions.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/virtual-directory-setup-instructions", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/installing-message-queuing-msmq.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/installing-message-queuing-msmq", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/building-the-samples.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/building-the-samples", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/running-the-samples.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/running-the-samples", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/basic.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/basic", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/getting-started-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/getting-started-sample", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/ajax.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ajax", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/jsonp.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/jsonp", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/json-serialization.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/json-serialization", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/basic-ajax-service.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/basic-ajax-service", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/ajax-service-using-http-post.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ajax-service-using-http-post", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/ajax-service-without-configuration.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ajax-service-without-configuration", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/ajax-service-using-complex-types-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ajax-service-using-complex-types-sample", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/ajax-service-with-json-and-xml-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ajax-service-with-json-and-xml-sample", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/binding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/basic-binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/basic-binding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/message-security-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-security-sample", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/basicbinding-with-transport-security.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/basicbinding-with-transport-security", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/basicbinding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/basicbinding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/custom-binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-binding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/custom-binding-imperative.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-binding-imperative", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/custom-binding-transport-and-encoding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-binding-transport-and-encoding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/custom-binding-reliable-session.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-binding-reliable-session", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/custom-binding-reliable-session-over-https.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-binding-reliable-session-over-https", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/custom-binding-security.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-binding-security", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/net-binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/net-binding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/net-msmq-binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/net-msmq-binding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/transacted-msmq-binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/transacted-msmq-binding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/volatile-queued-communication.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/volatile-queued-communication", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/dead-letter-queues.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/dead-letter-queues", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/poison-message-handling-in-msmq-4-0.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/poison-message-handling-in-msmq-4-0", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/sessions-and-queues.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/sessions-and-queues", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/two-way-communication.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/two-way-communication", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/srmp.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/srmp", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/message-security-over-message-queuing.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-security-over-message-queuing", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/message-queueing-integration.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-queueing-integration", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/message-queuing-to-wcf.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-queuing-to-wcf", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/wcf-to-message-queuing.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/wcf-to-message-queuing", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/message-correlation.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-correlation", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/nettcpbinding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/nettcpbinding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/default-nettcpbinding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/default-nettcpbinding", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/net-tcp-port-sharing-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/net-tcp-port-sharing-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/language-reference/csdl-specification.md", - "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/csdl-spec" + "source_path": "docs/framework/wcf/samples/netnamedpipebinding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/netnamedpipebinding", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/language-reference/csdl-ssdl-and-msl-specifications.md", - "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/csdl-spec" + "source_path": "docs/framework/wcf/samples/ws-binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ws-binding", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/language-reference/msl-specification.md", - "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/msl-spec" + "source_path": "docs/framework/wcf/samples/ws-2007-federation-http-binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ws-2007-federation-http-binding", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/language-reference/ssdl-specification.md", - "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/ssdl-spec" + "source_path": "docs/framework/wcf/samples/ws-dual-http.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ws-dual-http", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/modification-sql-generation.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee828422(v=vs.100)" + "source_path": "docs/framework/wcf/samples/mtom-encoding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/mtom-encoding", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/provider-manifest-specification.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee828423(v=vs.100)" + "source_path": "docs/framework/wcf/samples/wshttpbinding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/wshttpbinding", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/sql-generation-in-the-sample-provider.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee794152(v=vs.100)" + "source_path": "docs/framework/wcf/samples/ws-reliable-session.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ws-reliable-session", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/sql-generation.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee789836(v=vs.100)" + "source_path": "docs/framework/wcf/samples/ws-transport-security.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ws-transport-security", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/the-shape-of-the-command-trees.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee789837(v=vs.100)" + "source_path": "docs/framework/wcf/samples/message-security-binding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-security-binding", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/walkthrough-sql-generation.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee794148(v=vs.100)" + "source_path": "docs/framework/wcf/samples/message-security-anonymous.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-security-anonymous", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/ef/writing-an-ef-data-provider.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee789835(v=vs.100)" + "source_path": "docs/framework/wcf/samples/message-security-certificate.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-security-certificate", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/adonet/sql/linq/linq-to-sql-with-tightly-coupled-client-server-applications.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/bb882676(v=vs.100)" + "source_path": "docs/framework/wcf/samples/message-security-user-name.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-security-user-name", + "redirect_document_id": false }, { - "source_path": "docs/framework/data/wcf/writing-a-windows-store-app-that-consumes-an-odata-service.md", - "redirect_url": "/dotnet/framework/data/wcf/" + "source_path": "docs/framework/wcf/samples/message-security-windows.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-security-windows", + "redirect_document_id": false }, { - "source_path": "docs/framework/deployment/repair.md", - "redirect_url": "/dotnet/framework/install/repair" + "source_path": "docs/framework/wcf/samples/ws-transport-with-message-credential.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ws-transport-with-message-credential", + "redirect_document_id": false }, { - "source_path": "docs/framework/deployment/windows/7.md", - "redirect_url": "/dotnet/framework/install/on-windows-7" + "source_path": "docs/framework/wcf/samples/ws-transaction-flow.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/ws-transaction-flow", + "redirect_document_id": false }, { - "source_path": "docs/framework/deployment/windows/8.md", - "redirect_url": "/dotnet/framework/install/on-windows-8" + "source_path": "docs/framework/wcf/samples/client.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/client", + "redirect_document_id": false }, { - "source_path": "docs/framework/deployment/windows/10.md", - "redirect_url": "/dotnet/framework/install/on-windows-10" + "source_path": "docs/framework/wcf/samples/client-interoperability.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/client-interoperability", + "redirect_document_id": false }, { - "source_path": "docs/framework/deployment/windows/index.md", - "redirect_url": "/dotnet/framework/install/" + "source_path": "docs/framework/wcf/samples/interoperating-with-asmx-web-services.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/interoperating-with-asmx-web-services", + "redirect_document_id": false }, { - "source_path": "docs/framework/deployment/windows/installing-dotnet-35-windows-10.md", - "redirect_url": "/dotnet/framework/install/dotnet-35-windows-10" + "source_path": "docs/framework/wcf/samples/xmlserializer-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/xmlserializer-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/deployment/windows/vista.md", - "redirect_url": "/dotnet/framework/install/on-windows-vista" + "source_path": "docs/framework/wcf/samples/address-headers.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/address-headers", + "redirect_document_id": false }, { - "source_path": "docs/framework/deployment/windows/xp.md", - "redirect_url": "/dotnet/framework/install/on-windows-xp" + "source_path": "docs/framework/wcf/samples/channel-factory.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/channel-factory", + "redirect_document_id": false }, { - "source_path": "docs/framework/docker/aspnetmvc.md", - "redirect_url": "/aspnet/mvc/overview/deployment/docker-aspnetmvc" + "source_path": "docs/framework/wcf/samples/expected-exceptions.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/expected-exceptions", + "redirect_document_id": false }, { - "source_path": "docs/framework/docker/console.md", - "redirect_url": "/dotnet/framework" + "source_path": "docs/framework/wcf/samples/retrieve-metadata.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/retrieve-metadata", + "redirect_document_id": false }, { - "source_path": "docs/framework/docker/index.md", - "redirect_url": "/dotnet/framework" + "source_path": "docs/framework/wcf/samples/use-close-abort-release-wcf-client-resources.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/use-close-abort-release-wcf-client-resources", + "redirect_document_id": false }, { - "source_path": "docs/framework/get-started/net-core-and-open-source.md", - "redirect_url": "/dotnet/core/introduction" + "source_path": "docs/framework/wcf/samples/typed-client.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/typed-client", + "redirect_document_id": false }, { - "source_path": "docs/framework/install/net-framework-3-5-on-windows-8-plus.md", - "redirect_url": "/dotnet/framework/install/dotnet-35-windows-10" + "source_path": "docs/framework/wcf/samples/contract.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/contract", + "redirect_document_id": false }, { - "source_path": "docs/framework/interop/applying-interop-attributes.md", - "redirect_url": "/dotnet/standard/native-interop/apply-interop-attributes", - "redirect_document_id": true + "source_path": "docs/framework/wcf/samples/data-contracts.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/data-contracts", + "redirect_document_id": false }, { - "source_path": "docs/framework/interop/com-callable-wrapper.md", - "redirect_url": "/dotnet/standard/native-interop/com-callable-wrapper", - "redirect_document_id": true + "source_path": "docs/framework/wcf/samples/basic-data-contract.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/basic-data-contract", + "redirect_document_id": false }, { - "source_path": "docs/framework/interop/com-wrappers.md", - "redirect_url": "/dotnet/standard/native-interop/com-wrappers", - "redirect_document_id": true + "source_path": "docs/framework/wcf/samples/datacontractserializer-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/datacontractserializer-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/interop/qualifying-net-types-for-interoperation.md", - "redirect_url": "/dotnet/standard/native-interop/qualify-net-types-for-interoperation", - "redirect_document_id": true + "source_path": "docs/framework/wcf/samples/known-types.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/known-types", + "redirect_document_id": false }, { - "source_path": "docs/framework/interop/runtime-callable-wrapper.md", - "redirect_url": "/dotnet/standard/native-interop/runtime-callable-wrapper", - "redirect_document_id": true + "source_path": "docs/framework/wcf/samples/object-references.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/object-references", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/poco-support.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/poco-support", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/usage-of-serialization-binder.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/usage-of-serialization-binder", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/message-contracts.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-contracts", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/default-message-contract.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/default-message-contract", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/untyped-request-reply.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/untyped-request-reply", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/unwrapped-messages.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/unwrapped-messages", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-7.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/setting-the-use-and-style-properties.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/setting-the-use-and-style-properties", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-culture-and-asynchronous-operations.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + "source_path": "docs/framework/wcf/samples/xmlreader-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/xmlreader-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-culture-and-dispatcher-operations-in-wpf-apps.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + "source_path": "docs/framework/wcf/samples/service-contracts.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/service-contracts", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-default-authorizationcontext.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + "source_path": "docs/framework/wcf/samples/duplex.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/duplex", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-eventsource-writeevent-method-calls.md", - "redirect_url": "/dotnet/framework/migration-guide/runtime/4.5-4.5.1" + "source_path": "docs/framework/wcf/samples/fault-contract.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/fault-contract", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-grid-control.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.2-4.7" + "source_path": "docs/framework/wcf/samples/one-way.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/one-way", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-horizontal-scrolling-and-virtualization.md", - "redirect_url": "/dotnet/framework/migration-guide/runtime/4.6.1-4.6.2" + "source_path": "docs/framework/wcf/samples/session.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/session", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-long-path-support.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + "source_path": "docs/framework/wcf/samples/stream.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/stream", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-memberdescriptor-equals.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + "source_path": "docs/framework/wcf/samples/xmlserializer-faults.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/xmlserializer-faults", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-minfreememorypercentagetoactiveservice-configuration-setting.md", - "redirect_url": "/dotnet/framework/migration-guide/runtime/4.5-4.5.1" + "source_path": "docs/framework/wcf/samples/datacontractresolver.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/datacontractresolver", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/minimum-release-dword.md", - "redirect_url": "/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" + "source_path": "docs/framework/wcf/samples/knownassemblyattribute.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/knownassemblyattribute", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/mitigation-claimsidentity-constructor.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + "source_path": "docs/framework/wcf/samples/datacontractserializer-datacontractresolver-netdatacontractserializer.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/datacontractserializer-datacontractresolver-netdatacontractserializer", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/mitigation-cspparameters-parentwindowhandle-expects-an-hwnd.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.2-4.7" + "source_path": "docs/framework/wcf/samples/discovery-samples.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/discovery-samples", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/net-compatibility-diagnostics.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/announcements-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/announcements-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/release-keys-and-os-versions.md", - "redirect_url": "/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" + "source_path": "docs/framework/wcf/samples/basic-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/basic-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-5-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/configuration-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/configuration-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-5-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/discovery-with-scopes-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/discovery-with-scopes-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/custom-find-criteria.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-find-criteria", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/workflow-discovery-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/workflow-discovery-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/discovery-router-service.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/discovery-router-service", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-7.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/management.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/management", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/retargeting/index.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/wcf-services-and-event-tracing-for-windows.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/wcf-services-and-event-tracing-for-windows", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-5-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/wcf-analytic-tracing.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/wcf-analytic-tracing", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-5-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/circular-tracing.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/circular-tracing", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/etw-tracing.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/etw-tracing", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/extending-tracing.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/extending-tracing", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/pii-security-lockdown.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/pii-security-lockdown", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-7.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/using-performance-counters.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/using-performance-counters", + "redirect_document_id": false }, { - "source_path": "docs/framework/migration-guide/runtime/index.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/framework/wcf/samples/tracing-and-message-logging.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/tracing-and-message-logging", + "redirect_document_id": false }, { - "source_path": "docs/framework/misc/binding.md", - "redirect_url": "/dotnet/framework/configure-apps/file-schema/wcf/bindings" + "source_path": "docs/framework/wcf/samples/security-validation.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/security-validation", + "redirect_document_id": false }, { - "source_path": "docs/framework/network-programming/httplistener.md", - "redirect_url": "/dotnet/api/system.net.httplistener" + "source_path": "docs/framework/wcf/samples/wmi-provider.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/wmi-provider", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/apis-that-rely-on-reflection.md", - "redirect_url": "/windows/uwp/dotnet-native/apis-that-rely-on-reflection" + "source_path": "docs/framework/wcf/samples/routing-services.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/routing-services", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/application-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/application-element-net-native" + "source_path": "docs/framework/wcf/samples/hello-world-with-the-routing-service.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/hello-world-with-the-routing-service", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/assembly-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/assembly-element-net-native" + "source_path": "docs/framework/wcf/samples/security-in-wcf.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/security-in-wcf", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/attributeimplies-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/attributeimplies-element-net-native" + "source_path": "docs/framework/wcf/samples/cryptographic-agility-in-wcf-security.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/cryptographic-agility-in-wcf-security", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/directives-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/directives-element-net-native" + "source_path": "docs/framework/wcf/samples/services.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/services", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/event-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/event-element-net-native" + "source_path": "docs/framework/wcf/samples/hosting.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/hosting", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/example-handling-exceptions-when-binding-data.md", - "redirect_url": "/windows/uwp/dotnet-native/example-handling-exceptions-when-binding-data" + "source_path": "docs/framework/wcf/samples/windows-process-activation.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/windows-process-activation", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/example-troubleshooting-dynamic-programming.md", - "redirect_url": "/windows/uwp/dotnet-native/example-troubleshooting-dynamic-programming" + "source_path": "docs/framework/wcf/samples/namedpipe-activation.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/namedpipe-activation", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/field-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/field-element-net-native" + "source_path": "docs/framework/wcf/samples/tcp-activation.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/tcp-activation", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/genericparameter-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/genericparameter-element-net-native" + "source_path": "docs/framework/wcf/samples/msmq-activation.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/msmq-activation", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/getting-started-with-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/getting-started-with-net-native" + "source_path": "docs/framework/wcf/samples/systemwebrouting-integration-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/systemwebrouting-integration-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/impliestype-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/impliestype-element-net-native" + "source_path": "docs/framework/wcf/samples/aspnet-compatibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/aspnet-compatibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/index.md", - "redirect_url": "/windows/uwp/dotnet-native/index" + "source_path": "docs/framework/wcf/samples/iis-hosting-using-inline-code.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/iis-hosting-using-inline-code", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/library-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/library-element-net-native" + "source_path": "docs/framework/wcf/samples/windows-service-host.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/windows-service-host", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/measuring-startup-improvement-with-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/measuring-startup-improvement-with-net-native" + "source_path": "docs/framework/wcf/samples/self-host.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/self-host", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/method-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/method-element-net-native" + "source_path": "docs/framework/wcf/samples/service-interoperability.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/service-interoperability", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/methodinstantiation-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/methodinstantiation-element-net-native" + "source_path": "docs/framework/wcf/samples/using-the-wcf-moniker-with-com-clients.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/using-the-wcf-moniker-with-com-clients", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/migrating-your-windows-store-app-to-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/migrating-your-windows-store-app-to-net-native" + "source_path": "docs/framework/wcf/samples/asmx-client-with-a-wcf-service.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/asmx-client-with-a-wcf-service", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/missinginteropdataexception-class-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/missinginteropdataexception-class-net-native" + "source_path": "docs/framework/wcf/samples/behaviors.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/behaviors", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/missingmetadataexception-class-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/missingmetadataexception-class-net-native" + "source_path": "docs/framework/wcf/samples/concurrency.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/concurrency", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/missingruntimeartifactexception-class-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/missingruntimeartifactexception-class-net-native" + "source_path": "docs/framework/wcf/samples/default-service-behavior.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/default-service-behavior", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/namespace-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/namespace-element-net-native" + "source_path": "docs/framework/wcf/samples/instancing.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/instancing", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/net-native-and-compilation.md", - "redirect_url": "/windows/uwp/dotnet-native/net-native-and-compilation" + "source_path": "docs/framework/wcf/samples/metadata-publishing-behavior.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/metadata-publishing-behavior", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/net-native-general-troubleshooting.md", - "redirect_url": "/windows/uwp/dotnet-native/net-native-general-troubleshooting" + "source_path": "docs/framework/wcf/samples/service-transaction-behavior.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/service-transaction-behavior", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/net-native-reflection-api-reference.md", - "redirect_url": "/windows/uwp/dotnet-native/net-native-reflection-api-reference" + "source_path": "docs/framework/wcf/samples/service-debug-behavior.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/service-debug-behavior", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/parameter-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/parameter-element-net-native" + "source_path": "docs/framework/wcf/samples/throttling.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/throttling", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/property-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/property-element-net-native" + "source_path": "docs/framework/wcf/samples/behavior-security.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/behavior-security", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/reflection-and-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/reflection-and-net-native" + "source_path": "docs/framework/wcf/samples/service-auditing-behavior.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/service-auditing-behavior", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/runtime-directive-elements.md", - "redirect_url": "/windows/uwp/dotnet-native/runtime-directive-elements" + "source_path": "docs/framework/wcf/samples/membership-and-role-provider.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/membership-and-role-provider", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/runtime-directive-policy-settings.md", - "redirect_url": "/windows/uwp/dotnet-native/runtime-directive-policy-settings" + "source_path": "docs/framework/wcf/samples/authorizing-access-to-service-operations.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/authorizing-access-to-service-operations", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/runtime-directives-rd-xml-configuration-file-reference.md", - "redirect_url": "/windows/uwp/dotnet-native/runtime-directives-rd-xml-configuration-file-reference" + "source_path": "docs/framework/wcf/samples/impersonating-the-client.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/impersonating-the-client", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/runtime-exceptions-in-net-native-apps.md", - "redirect_url": "/windows/uwp/dotnet-native/runtime-exceptions-in-net-native-apps" + "source_path": "docs/framework/wcf/samples/simplified-configuration-for-wcf-services.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/serialization-and-metadata.md", - "redirect_url": "/windows/uwp/dotnet-native/serialization-and-metadata" + "source_path": "docs/framework/wcf/samples/usage-of-standard-endpoints.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/usage-of-standard-endpoints", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/subtypes-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/subtypes-element-net-native" + "source_path": "docs/framework/wcf/samples/extended-protection-policy.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/extended-protection-policy", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/type-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/type-element-net-native" + "source_path": "docs/framework/wcf/samples/configuration-channel-factory.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/configuration-channel-factory", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/typeinstantiation-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/typeinstantiation-element-net-native" + "source_path": "docs/framework/wcf/samples/addressing.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/addressing", + "redirect_document_id": false }, { - "source_path": "docs/framework/net-native/typeparameter-element-net-native.md", - "redirect_url": "/windows/uwp/dotnet-native/typeparameter-element-net-native" + "source_path": "docs/framework/wcf/samples/imperative.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/imperative", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/building-my-first-claims-aware-aspnet-web-app.md", - "redirect_url": "/previous-versions/dotnet/framework/security/building-my-first-claims-aware-aspnet-web-app" + "source_path": "docs/framework/wcf/samples/multiple-contracts.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/multiple-contracts", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/building-my-first-claims-aware-wcf-service.md", - "redirect_url": "/previous-versions/dotnet/framework/security/building-my-first-claims-aware-wcf-service" + "source_path": "docs/framework/wcf/samples/multiple-endpoints.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/multiple-endpoints", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/claims-aware-aspnet-app-forms-authentication.md", - "redirect_url": "/previous-versions/dotnet/framework/security/claims-aware-aspnet-app-forms-authentication" + "source_path": "docs/framework/wcf/samples/multiple-endpoints-at-a-single-listenuri.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/multiple-endpoints-at-a-single-listenuri", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/claims-based-authorization-using-wif.md", - "redirect_url": "/previous-versions/dotnet/framework/security/claims-based-authorization-using-wif" + "source_path": "docs/framework/wcf/samples/operationcontextscope.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/operationcontextscope", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/claims-based-identity-model.md", - "redirect_url": "/previous-versions/dotnet/framework/security/claims-based-identity-model" + "source_path": "docs/framework/wcf/samples/service-description.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/service-description", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/custom-token-handlers.md", - "redirect_url": "/previous-versions/dotnet/framework/security/custom-token-handlers" + "source_path": "docs/framework/wcf/samples/concurrencymode-reentrant.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/concurrencymode-reentrant", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/downloading-the-json-web-token-handler-package.md", - "redirect_url": "/previous-versions/dotnet/framework/security/downloading-the-json-web-token-handler-package" + "source_path": "docs/framework/wcf/samples/service-security.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/service-security", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/downloading-the-validating-issuer-name-registry-package.md", - "redirect_url": "/previous-versions/dotnet/framework/security/downloading-the-validating-issuer-name-registry-package" + "source_path": "docs/framework/wcf/samples/service-identity-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/service-identity-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/getting-started-with-wif.md", - "redirect_url": "/previous-versions/dotnet/framework/security/getting-started-with-wif" + "source_path": "docs/framework/wcf/samples/syndication.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/syndication", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/guidelines-for-migrating-an-application-built-using-wif-3-5-to-wif-4-5.md", - "redirect_url": "/previous-versions/dotnet/framework/security/guidelines-for-migrating-an-application-built-using-wif-3-5-to-wif-4-5" + "source_path": "docs/framework/wcf/samples/stand-alone-diagnostics-feed-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/stand-alone-diagnostics-feed-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-app-using-windows-authentication.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-app-using-windows-authentication" + "source_path": "docs/framework/wcf/samples/loosely-typed-extensions-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/loosely-typed-extensions-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-mvc-web-app-using-wif.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-mvc-web-app-using-wif" + "source_path": "docs/framework/wcf/samples/web.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/web", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-web-forms-app-using-wif.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-web-forms-app-using-wif" + "source_path": "docs/framework/wcf/samples/basic-http-service.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/basic-http-service", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-debug-claims-aware-applications-and-services-using-wif-tracing.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-debug-claims-aware-applications-and-services-using-wif-tracing" + "source_path": "docs/framework/wcf/samples/soap-and-http-endpoints.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/soap-and-http-endpoints", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-display-signed-in-status-using-wif.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-display-signed-in-status-using-wif" + "source_path": "docs/framework/wcf/samples/aspnet-caching-integration.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/aspnet-caching-integration", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-enable-token-replay-detection.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-enable-token-replay-detection" + "source_path": "docs/framework/wcf/samples/uritemplate-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/uritemplate-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-enable-wif-for-a-wcf-web-service-application.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-enable-wif-for-a-wcf-web-service-application" + "source_path": "docs/framework/wcf/samples/uritemplate-table-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/uritemplate-table-sample", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/uritemplate-table-dispatcher-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/uritemplate-table-dispatcher-sample", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/wcf/samples/extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-enable-wif-tracing.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-enable-wif-tracing" + "source_path": "docs/framework/wcf/samples/binding-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/binding-extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/how-to-transform-incoming-claims.md", - "redirect_url": "/previous-versions/dotnet/framework/security/how-to-transform-incoming-claims" + "source_path": "docs/framework/wcf/samples/wsstreamedhttpbinding.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/wsstreamedhttpbinding", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/identity-and-access-tool-for-vs.md", - "redirect_url": "/previous-versions/dotnet/framework/security/identity-and-access-tool-for-vs" + "source_path": "docs/framework/wcf/samples/channels-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/channels-extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/index.md", - "redirect_url": "/previous-versions/dotnet/framework/security/index" + "source_path": "docs/framework/wcf/samples/local-channel.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/local-channel", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/json-web-token-handler-api-reference.md", - "redirect_url": "https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/wiki" + "source_path": "docs/framework/wcf/samples/reliable-secure-profile.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/reliable-secure-profile", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/json-web-token-handler.md", - "redirect_url": "/previous-versions/dotnet/framework/security/json-web-token-handler" + "source_path": "docs/framework/wcf/samples/custom-channel-dispatcher.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-channel-dispatcher", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5.md", - "redirect_url": "/previous-versions/dotnet/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5" + "source_path": "docs/framework/wcf/samples/chunking-channel.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/chunking-channel", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/secure-coding-guidelines-for-unmanaged-code.md", - "redirect_url": "/previous-versions/dotnet/framework/security/secure-coding-guidelines-for-unmanaged-code" + "source_path": "docs/framework/wcf/samples/httpcookiesession.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/httpcookiesession", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/security-changes.md", - "redirect_url": "/previous-versions/dotnet/framework/security/security-changes" + "source_path": "docs/framework/wcf/samples/custom-message-interceptor.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-message-interceptor", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/validating-issuer-name-registry-api-reference.md", - "redirect_url": "/previous-versions/dotnet/framework/security/validating-issuer-name-registry-api-reference" + "source_path": "docs/framework/wcf/samples/instancing-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/instancing-extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/validating-issuer-name-registry.md", - "redirect_url": "/previous-versions/dotnet/framework/security/validating-issuer-name-registry" + "source_path": "docs/framework/wcf/samples/durable-instance-context.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/durable-instance-context", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/whats-new-in-wif.md", - "redirect_url": "/previous-versions/dotnet/framework/security/whats-new-in-wif" + "source_path": "docs/framework/wcf/samples/custom-lifetime.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-lifetime", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-and-web-farms.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-and-web-farms" + "source_path": "docs/framework/wcf/samples/instancing-initialization.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/instancing-initialization", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-api-reference.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-api-reference" + "source_path": "docs/framework/wcf/samples/pooling.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/pooling", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-claims-programming-model.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-claims-programming-model" + "source_path": "docs/framework/wcf/samples/interop-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/interop-extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-code-sample-index.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-code-sample-index" + "source_path": "docs/framework/wcf/samples/dispatch-by-body-element.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/dispatch-by-body-element", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-configuration-reference.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-configuration-reference" + "source_path": "docs/framework/wcf/samples/route-by-body.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/route-by-body", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-configuration-schema-conventions.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-configuration-schema-conventions" + "source_path": "docs/framework/wcf/samples/message-encoder-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-encoder-extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-extensions.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-extensions" + "source_path": "docs/framework/wcf/samples/custom-message-encoder-custom-text-encoder.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-message-encoder-custom-text-encoder", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-features.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-features" + "source_path": "docs/framework/wcf/samples/custom-message-encoder-compression-encoder.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-message-encoder-compression-encoder", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-guidelines.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-guidelines" + "source_path": "docs/framework/wcf/samples/metadata-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/metadata-extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-how-tos-index.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-how-tos-index" + "source_path": "docs/framework/wcf/samples/custom-secure-metadata-endpoint.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-secure-metadata-endpoint", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-overview.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-overview" + "source_path": "docs/framework/wcf/samples/custom-wsdl-publication.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-wsdl-publication", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wif-session-management.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wif-session-management" + "source_path": "docs/framework/wcf/samples/security-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/security-extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wsfederation-authentication-module-overview.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wsfederation-authentication-module-overview" + "source_path": "docs/framework/wcf/samples/durable-issued-token-provider.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/durable-issued-token-provider", + "redirect_document_id": false }, { - "source_path": "docs/framework/security/wstrustchannelfactory-and-wstrustchannel.md", - "redirect_url": "/previous-versions/dotnet/framework/security/wstrustchannelfactory-and-wstrustchannel" + "source_path": "docs/framework/wcf/samples/saml-token-provider.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/saml-token-provider", + "redirect_document_id": false }, { - "source_path": "docs/framework/tools/developer-command-prompt-for-vs.md", - "redirect_url": "/visualstudio/ide/reference/command-prompt-powershell" + "source_path": "docs/framework/wcf/samples/supporting-tokens.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/supporting-tokens", + "redirect_document_id": false }, { - "source_path": "docs/framework/ui-automation/ui-automation-specification-and-community-promise.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/bb986605(v=vs.100)" + "source_path": "docs/framework/wcf/samples/token-authenticator.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/token-authenticator", + "redirect_document_id": false }, { - "source_path": "docs/framework/unmanaged-api/cor-prf-allowable-after-attach-bitmask.md", - "redirect_url": "/dotnet/framework/unmanaged-api/profiling/cor-prf-monitor-enumeration" + "source_path": "docs/framework/wcf/samples/token-provider.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/token-provider", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/diagnostics/etw/monitoring-service-operation-failures.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff468239(v=vs.100)" + "source_path": "docs/framework/wcf/samples/user-name-password-validator.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/user-name-password-validator", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/extending/extending-wcf.md", - "redirect_url": "/dotnet/framework/wcf/extending/index", - "redirect_document_id": true + "source_path": "docs/framework/wcf/samples/x-509-certificate-validator.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/x-509-certificate-validator", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/feature-details/accessing-identity-information-inside-a-workflow-service.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff452450(v=vs.100)" + "source_path": "docs/framework/wcf/samples/authorization-policy.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/authorization-policy", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/feature-details/accessing-operationcontext-from-a-workflow-service.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff452697(v=vs.100)" + "source_path": "docs/framework/wcf/samples/custom-token.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-token", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/feature-details/content-based-correlation.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee358755(v=vs.100)" + "source_path": "docs/framework/wcf/samples/client-validation.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/client-validation", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/feature-details/context-exchange-correlation.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee358724(v=vs.100)" + "source_path": "docs/framework/wcf/samples/syndication-extensibility-samples.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/syndication-extensibility-samples", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/feature-details/how-to-create-a-workflow-service-that-calls-another-workflow-service.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff729672(v=vs.100)" + "source_path": "docs/framework/wcf/samples/strongly-typed-extensions-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/strongly-typed-extensions-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/feature-details/how-to-host-a-non-service-workflow-in-iis.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ff729688(v=vs.100)" + "source_path": "docs/framework/wcf/samples/feed-formatter-json.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/feed-formatter-json", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/feature-details/migrate-asp-net-web-service-client-to-wcf.md", - "redirect_url": "/dotnet/framework/wcf/feature-details/adopting-wcf" + "source_path": "docs/framework/wcf/samples/streaming-feeds-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/streaming-feeds-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/feature-details/migrate-asp-net-web-service-to-wcf.md", - "redirect_url": "/dotnet/framework/wcf/feature-details/adopting-wcf" + "source_path": "docs/framework/wcf/samples/transport-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/transport-extensibility", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/advanced-error-handling.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee667251(v=vs.100)" + "source_path": "docs/framework/wcf/samples/udp-activation.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/udp-activation", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/advanced-filters.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee667249(v=vs.100)" + "source_path": "docs/framework/wcf/samples/transport-custom-transactions-over-udp-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/transport-custom-transactions-over-udp-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/advanced-format-selection.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee662965(v=vs.100)" + "source_path": "docs/framework/wcf/samples/transport-udp.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/transport-udp", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/aspnetrouteintegration.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee662952(v=vs.100)" + "source_path": "docs/framework/wcf/samples/transport-wse-3-0-tcp-interoperability.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/transport-wse-3-0-tcp-interoperability", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/asynchronous-find-sample.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd483344(v=vs.100)" + "source_path": "docs/framework/wcf/samples/operation-formatter-and-operation-selector.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/operation-formatter-and-operation-selector", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/automatic-format-selection.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee662964(v=vs.100)" + "source_path": "docs/framework/wcf/samples/custom-message-filter.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-message-filter", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/avoiding-problems-with-the-using-statement.md", - "redirect_url": "/dotnet/framework/wcf/samples/use-close-abort-release-wcf-client-resources", - "redirect_document_id": true + "source_path": "docs/framework/wcf/samples/custom-service-host.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/custom-service-host", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/basic-resource-service.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee662954(v=vs.100)" + "source_path": "docs/framework/wcf/samples/datacontract-surrogate.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/datacontract-surrogate", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/bridging-and-error-handling.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee667246(v=vs.100)" + "source_path": "docs/framework/wcf/samples/extending-control-over-error-handling-and-reporting.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/extending-control-over-error-handling-and-reporting", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/bytestream-encoder.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee960169(v=vs.100)" + "source_path": "docs/framework/wcf/samples/message-inspectors.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/message-inspectors", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/conditional-get-and-put.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee818665(v=vs.100)" + "source_path": "docs/framework/wcf/samples/webcontenttypemapper-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/webcontenttypemapper-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/configuration-based-activation.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd807499(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/scenario.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/scenario", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/custom-demux.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ms752265(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/data-binding-scenarios.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/data-binding-scenarios", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/customdiscoverymetadata.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd764464(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/data-binding-in-a-windows-forms-client.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/data-binding-in-a-windows-forms-client", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/discover-a-service-with-unique-listen-uri-mode-sample.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee530015(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/data-binding-in-an-aspnet-client.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/data-binding-in-an-aspnet-client", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/discovery-binding-element-sample.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd807387(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/data-binding-in-a-wpf-client.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/data-binding-in-a-wpf-client", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/discovery-extensibility.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd807503(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/discovery-security-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/discovery-security-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/discovery-proxy-sample.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/dd807497(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/federation-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/federation-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/dynamic-reconfiguration.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee667250(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/weakly-typed-json-serialization-sample.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/weakly-typed-json-serialization-sample", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/form-post.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee818241(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/trusted-facade-service.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/trusted-facade-service", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/hierarchical-configuration-model.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee663221(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/design-patterns-list-based-publish-subscribe.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/design-patterns-list-based-publish-subscribe", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/http-acknowledgement-channel.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee960152(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/tool-samples.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/tool-samples", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/receivecontext-enabled-wcf-channels.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee534020(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/configurationcodegenerator.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/configurationcodegenerator", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/transacted-batching.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/aa395219(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/customchannelstester.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/customchannelstester", + "redirect_document_id": false }, { - "source_path": "docs/framework/wcf/samples/web-extensibility.md", - "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee818234(v%3dvs.100)" + "source_path": "docs/framework/wcf/samples/findprivatekey.md", + "redirect_url": "/previous-versions/dotnet/framework/wcf/samples/findprivatekey", + "redirect_document_id": false }, { "source_path": "docs/framework/wcf/wcf-system-requirements.md", @@ -5130,6 +7079,241 @@ "source_path": "docs/framework/windows-workflow-foundation/samples/xaml-activation.md", "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee960215(v%3dvs.100)" }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/index.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/index", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/application.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/application", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/document-approval-process.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/document-approval-process", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/corporate-purchase-process.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/corporate-purchase-process", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/hiring-process.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/hiring-process", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/visual-workflow-tracking.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/visual-workflow-tracking", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/suspended-instance-management.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/suspended-instance-management", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/basic.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/basic", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/built-in-activities.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/built-in-activities", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/fault-handling-in-a-flowchart-activity-using-trycatch.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/fault-handling-in-a-flowchart-activity-using-trycatch", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/load-from-xaml.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/load-from-xaml", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/using-the-pick-activity.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/using-the-pick-activity", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/custom-activities.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/custom-activities", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/code-bodied.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/code-bodied", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/custom-composite-using-native-activity.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/custom-composite-using-native-activity", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/custom-activity-designers.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/custom-activity-designers", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/custom-composite-designers-workflow-item-presenter.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/custom-composite-designers-workflow-item-presenter", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/custom-composite-designers-workflow-items-presenter.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/custom-composite-designers-workflow-items-presenter", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/using-the-expressiontextbox-in-a-custom-activity-designer.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/using-the-expressiontextbox-in-a-custom-activity-designer", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/using-editing-scope.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/using-editing-scope", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/designer.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/designer", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/removing-the-view-state-the-designer-adds-to-an-xaml-file.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/removing-the-view-state-the-designer-adds-to-an-xaml-file", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/programming-model-item-tree.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/programming-model-item-tree", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/property-grid-extensibility.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/property-grid-extensibility", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/designer-rehosting.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/designer-rehosting", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/execution.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/execution", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/creating-and-running-a-workflow-instance.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/creating-and-running-a-workflow-instance", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/workflowhostingendpoint-resume-bookmark.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/workflowhostingendpoint-resume-bookmark", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/bookmark-resolver-for-workflowhostingendpoint.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/bookmark-resolver-for-workflowhostingendpoint", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/tracking.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/tracking", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/custom-tracking.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/custom-tracking", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/tracking-events-into-event-tracing-in-windows.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/tracking-events-into-event-tracing-in-windows", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/sql-tracking.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/sql-tracking", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/scenario.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/scenario", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/activity-library.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/activity-library", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/sendmail-custom-activity.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/sendmail-custom-activity", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/throttled-parallel-foreach.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/throttled-parallel-foreach", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/database-access-activities.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/database-access-activities", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/externalized-policy-activity-in-net-framework-4-5.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/externalized-policy-activity-in-net-framework-4-5", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/non-generic-foreach.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/non-generic-foreach", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/non-generic-parallelforeach.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/non-generic-parallelforeach", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/get-workflowinstanceid.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/get-workflowinstanceid", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/accessing-operationcontext.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/accessing-operationcontext", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/linq-message-query-correlation.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/linq-message-query-correlation", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/asynchronous-communication.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/asynchronous-communication", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/wpf-and-wf-integration-in-xaml.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/wpf-and-wf-integration-in-xaml", + "redirect_document_id": false + }, + { + "source_path": "docs/framework/windows-workflow-foundation/samples/external-ruleset-toolkit.md", + "redirect_url": "/previous-versions/dotnet/framework/windows-workflow-foundation/samples/external-ruleset-toolkit", + "redirect_document_id": false + }, { "source_path": "docs/framework/windows-workflow-foundation/using-the-interop-activity-in-a-net-framework-4-workflow.md", "redirect_url": "/previous-versions/dotnet/netframework-4.0/ee264174(v%3dvs.100)" @@ -12498,6 +14682,86 @@ "source_path": "docs/standard/data/index.md", "redirect_url": "/dotnet/standard/data/xml/index" }, + { + "source_path": "docs/standard/data/xml/xslt-transformations-with-the-xsltransform-class.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xslt-transformations-with-the-xsltransform-class", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/implementation-of-discretionary-behaviors-in-the-xsltransform-class.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/implementation-of-discretionary-behaviors-in-the-xsltransform-class", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xsltransform-class-implements-the-xslt-processor.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xsltransform-class-implements-the-xslt-processor", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/outputs-from-an-xsltransform.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/outputs-from-an-xsltransform", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xslt-transformations-over-different-stores.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xslt-transformations-over-different-stores", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/resolving-external-xslt-style-sheets-and-documents.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/resolving-external-xslt-style-sheets-and-documents", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xsltargumentlist-for-style-sheet-parameters-and-extension-objects.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xsltargumentlist-for-style-sheet-parameters-and-extension-objects", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xslt-stylesheet-scripting-using-msxsl-script.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xslt-stylesheet-scripting-using-msxsl-script", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/support-for-the-msxsl-node-set-function.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/support-for-the-msxsl-node-set-function", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/node-sets-in-transformations.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/node-sets-in-transformations", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/result-tree-fragment-in-transformations.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/result-tree-fragment-in-transformations", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xpathnavigator-in-transformations.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xpathnavigator-in-transformations", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xpathnodeiterator-in-transformations.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xpathnodeiterator-in-transformations", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xpathdocument-input-to-xsltransform.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xpathdocument-input-to-xsltransform", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xmldatadocument-input-to-xsltransform.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xmldatadocument-input-to-xsltransform", + "redirect_document_id": false + }, + { + "source_path": "docs/standard/data/xml/xmldocument-input-to-xsltransform.md", + "redirect_url": "/previous-versions/dotnet/framework/data/xml/xslt/xmldocument-input-to-xsltransform", + "redirect_document_id": false + }, { "source_path": "docs/standard/design-guidelines/choosing-between-anonymous-and-tuple.md", "redirect_url": "/dotnet/standard/base-types/choosing-between-anonymous-and-tuple" diff --git a/.repoman.yml b/.repoman.yml new file mode 100644 index 0000000000000..973c746490f31 --- /dev/null +++ b/.repoman.yml @@ -0,0 +1,353 @@ +revision: 1 +schema-version: 1 +owner-ms-alias: adegeo + +config: + DocMetadata: + Headers: + - ["---", "#### "] + + ParserRegex: "^\\* (.*): (.*)$" + + +issues: + + unlabeled: "labeled" + + labeled: + + # Handle issues with /prod /tech labels from label bot + # Manages the Not Triaged label for issues missing/having an org category issue + - check: + - type: query + value: "length(Issue.labels[?contains(name, '/prod') || contains(name, '/tech')]) != `0`" + pass: + - check: + - type: query + value: "length(Issue.labels[?name == 'doc-enhancement' || name == 'product-question' || name == 'in-progress' || name == 'test-issue' || name == 'kudos' || name == 'loc' || name == 'doc-bug' || name == 'product-feedback' || name == 'code-of-conduct' || name == 'support-request' || name == 'duplicate' || name == 'resolved-by-customer' || name == 'docs-experience' || name == 'doc-provided' || name == 'doc-idea' || name == 'needs-more-info']) != `0`" + pass: + - labels-remove: [":watch: Not Triaged"] + fail: + - labels-add: [":watch: Not Triaged"] + + # Add to .NET 6 project if .NET 6 label added + - check: + - type: query + value: "length(Issue.labels[?name == ':checkered_flag: Release .NET 6']) != `0`" + pass: + - projects-add: [132] + + opened: + # New issue opened, add Not Triaged + - labels-add: [":watch: Not Triaged"] + + # If breaking change issue metadata, add labels + - check: + - type: metadata-comment + name: "issue type" + value: "(?i)breaking-change$" + pass: + - labels-add: ["breaking-change", "doc-idea"] + - projects-add: [135] + + reopened: + + # Remove won't fix label + - labels-remove: ["won't fix"] + + closed: + + # Issue closed, remove in-progress and not triaged labels + - labels-remove: ["in-progress", ":watch: Not Triaged"] + +pull_request: + + reopened: opened + + opened: + + # Set default sprint for new PRs + - milestone-set: "![sprint]" + + - check: + - type: query + value: "PullRequest.base.ref != 'live'" + pass: + - files-changed: + # csharplang + - path: "(?i).*_csharplang.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-spec/tech"] + + # vbspec + - path: "(?i).*_vblang\/spec.*" + run: + - labels-add: ["dotnet-visualbasic/prod", "vb-spec/tech"] + + # architecture + - path: "(?i).*docs\/architecture.*" + run: + - labels-add: ["dotnet-architecture/prod"] + - path: "(?i).*docs\/architecture\/blazor-for-web-forms-developers.*" + run: + - labels-add: ["dotnet-architecture/prod", "blazor/tech"] + - path: "(?i).*docs\/architecture\/cloud-native.*" + run: + - labels-add: ["dotnet-architecture/prod", "cloud-native/tech"] + - path: "(?i).*docs\/architecture\/containerized-lifecycle.*" + run: + - labels-add: ["dotnet-architecture/prod", "containerized-lifecycle/tech"] + - path: "(?i).*docs\/architecture\/grpc-for-wcf-developers.*" + run: + - labels-add: ["dotnet-architecture/prod", "grpc/tech"] + - path: "(?i).*docs\/architecture\/microservices.*" + run: + - labels-add: ["dotnet-architecture/prod", "microservices/tech"] + - path: "(?i).*docs\/architecture\/modernize-with-azure-containers.*" + run: + - labels-add: ["dotnet-architecture/prod", "modernize-with-azure-containers/tech"] + - path: "(?i).*docs\/architecture\/modern-web-apps-azure.*" + run: + - labels-add: ["dotnet-architecture/prod", "modern-web-apps-azure/tech"] + - path: "(?i).*docs\/architecture\/serverless.*" + run: + - labels-add: ["dotnet-architecture/prod", "serverless/tech"] + + # azure + - path: "(?i).*docs\/azure.*" + run: + - labels-add: ["dotnet-azure/prod"] + + # core + - path: "(?i).*docs\/core.*" + run: + - labels-add: ["dotnet-fundamentals/prod"] + - path: "(?i).*docs\/core\/tools.*" + run: + - labels-add: ["dotnet-fundamentals/prod", "dotnet-cli/tech"] + - path: "(?i).*docs\/core\/docker.*" + run: + - labels-add: ["dotnet-fundamentals/prod", "dotnet-docker/tech"] + + # core/install + - path: "(?i).*docs\/core\/install.*" + run: + - labels-add: ["dotnet/prod", "dotnet-install/tech"] + + # csharp + - path: "(?i).*docs\/csharp.*" + run: + - labels-add: ["dotnet-csharp/prod"] + - path: "(?i).*docs\/csharp\/fundamentals.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/misc.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-diagnostics/tech"] + - path: "(?i).*docs\/csharp\/whats-new.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-whats-new/tech"] + - path: "(?i).*docs\/csharp\/how-to.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/linq.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-linq/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/indexers.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/generics.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/strings.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/types.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/statements-expressions-operators.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/interop.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-advanced-concepts/tech"] + - path: "(?i).*docs\/csharp\/language-reference\/unsafe-code.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-advanced-concepts/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/namespaces.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/arrays.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/concepts\/covariance-contravariance.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-advanced-concepts/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/concepts\/serialization.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/concepts\/expression-trees.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-advanced-concepts/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/concepts\/async.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-async/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/concepts\/linq.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-linq/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/concepts\/attributes.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/xmldoc.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/classes-and-structs.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/delegates.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/file-system.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/events.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/programming-guide\/interfaces.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/tutorials.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-fundamentals/tech"] + - path: "(?i).*docs\/csharp\/tutorials\/exploration.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-get-started/tech"] + - path: "(?i).*docs\/csharp\/language-reference.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-language-reference/tech"] + - path: "(?i).*docs\/csharp\/language-reference\/compiler-messages.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-diagnostics/tech"] + - path: "(?i).*docs\/csharp\/roslyn-sdk.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-roslyn/tech"] + - path: "(?i).*docs\/csharp\/tour-of-csharp.*" + run: + - labels-add: ["dotnet-csharp/prod", "csharp-get-started/tech"] + + # framework + - path: "(?i).*docs\/framework.*" + run: + - labels-add: ["dotnet-framework/prod"] + - path: "(?i).*docs\/framework\/configure-apps\/file-schema\/network.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-networking/tech" ] + - path: "(?i).*docs\/framework\/configure-apps\/file-schema\/wcf.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-wcf/tech" ] + - path: "(?i).*docs\/framework\/data\/adonet.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-data/tech" ] + - path: "(?i).*docs\/framework\/data\/wcf.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-wcf/tech" ] + - path: "(?i).*docs\/framework\/docker.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-docker/tech" ] + - path: "(?i).*docs\/framework\/install.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-install/tech" ] + - path: "(?i).*docs\/framework\/migration-guide.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-appcompat/tech" ] + - path: "(?i).*docs\/framework\/network-programming.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-networking/tech" ] + - path: "(?i).*docs\/framework\/wcf.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-wcf/tech" ] + - path: "(?i).*docs\/framework\/windows-workflow-foundation.*" + run: + - labels-add: [ "dotnet-framework/prod", "dotnet-wf/tech" ] + + # fsharp + - path: "(?i).*docs\/fsharp.*" + run: + - labels-add: ["dotnet-fsharp/prod"] + + # fundamentals + - path: "(?i).*docs\/fundamentals.*" + run: + - labels-add: ["dotnet-fundamentals/prod"] + + # standard + - path: "(?i).*docs\/standard.*" + run: + - labels-add: ["dotnet-fundamentals/prod"] + + # analyzers + - path: "(?i).*docs\/standard\/analyzers.*" + run: + - labels-add: [ "dotnet-fundamentals/prod", "dotnet-analyzers/tech" ] + + # machine learning + - path: "(?i).*docs\/machine-learning.*" + run: + - labels-add: ["dotnet-ml/prod"] + + # spark + - path: "(?i).*docs\/spark.*" + run: + - labels-add: ["dotnet-spark/prod"] + + # data + - path: "(?i).*docs\/standard\/data.*" + run: + - labels-add: ["dotnet-data/prod"] + + # design guidelines + - path: "(?i).*docs\/standard\/design-guidelines.*" + run: + - labels-add: [ "dotnet/prod", "dotnet-standard/tech" ] + + # security + - path: "(?i).*docs\/standard\/security.*" + run: + - labels-add: [ "dotnet/prod", "dotnet-security/tech" ] + + # visual-basic + - path: "(?i).*docs\/visual-basic.*" + run: + - labels-add: ["dotnet-visualbasic/prod"] + + # visual-basic lang ref error messages + - path: "(?i).*docs\/visual-basic\/language-reference\/error-messages.*" + run: + - labels-add: [ "dotnet-visualbasic/prod", "vb-diagnostics/tech" ] + + # visual-basic misc + - path: "(?i).*docs\/visual-basic\/misc.*" + run: + - labels-add: ["dotnet-visualbasic/prod", "vb-diagnostics/tech"] + + labeled: + + # Add to .NET 6 project if .NET 6 label added + - check: + - type: query + value: "length(Issue.labels[?name == ':checkered_flag: Release .NET 6']) != `0`" + pass: + - projects-add: [132] + +issue_comment: + + created: + + # someone creates a comment with #please-review in it, add changes-addressed label + - check: + - type: query + value: "Issue.state == 'open' && Issue.user.id == Comment.user.id" + - type: comment-body + value: ^#please-review$ + pass: + - labels-add: ["changes-addressed"] diff --git a/docfx.json b/docfx.json index 08e04b395f992..7848460455a85 100644 --- a/docfx.json +++ b/docfx.json @@ -205,6 +205,7 @@ "docs/framework/configure-apps/file-schema/**/**.md": "reference", "docs/framework/data/adonet/ef/language-reference/*-entity-sql.md": "language-reference", "docs/framework/debug-trace-profile/*-mda.md": "reference", + "docs/framework/migration-guide/**/**.md": "reference", "docs/framework/performance/*-etw-events.md": "reference", "docs/framework/tools/**/**.md": "reference", "docs/framework/unmanaged-api/**/**.md": "reference", @@ -217,6 +218,7 @@ "docs/framework/**/how-to*.md": "how-to", "docs/framework/**/troubleshooting*.md": "troubleshooting", "docs/fsharp/language-reference/**/**.md": "language-reference", + "docs/iot/**/*.*": "conceptual", "docs/fundamentals/code-analysis/**.md": "reference", "docs/fundamentals/code-analysis/quality-rules/**.md": "reference", "docs/fundamentals/code-analysis/style-rules/**.md": "reference", @@ -295,6 +297,7 @@ "docs/fsharp/**/**.md": "cartermp", "docs/fundamentals/code-analysis/**/**.md": "gewarren", "docs/fundamentals/syslib-diagnostics/**/**.md": "gewarren", + "docs/iot/**/*.*": "camsoper", "docs/machine-learning/**/**.md": "luisquintanilla", "docs/spark/**/**.md": "luisquintanilla", "docs/standard/**/**.md": "gewarren", @@ -379,6 +382,7 @@ "docs/fsharp/**/**.md": "phcart", "docs/fundamentals/code-analysis/**/*.md": "gewarren", "docs/fundamentals/syslib-diagnostics/**/**.md": "gewarren", + "docs/iot/**/*.*": "casoper", "docs/machine-learning/**/**.md": "luquinta", "docs/spark/**/**.md": "luquinta", "docs/standard/**/**.md": "gewarren", diff --git a/docs/architecture/blazor-for-web-forms-developers/components.md b/docs/architecture/blazor-for-web-forms-developers/components.md index eea0a1492ec89..a04914888319f 100644 --- a/docs/architecture/blazor-for-web-forms-developers/components.md +++ b/docs/architecture/blazor-for-web-forms-developers/components.md @@ -219,7 +219,7 @@ In Blazor, you can register handlers for DOM UI events directly using directive @code { void OnClick() { - Console.WriteLine("The button was clicked!); + Console.WriteLine("The button was clicked!"); } } ``` diff --git a/docs/architecture/cloud-native/candidate-apps.md b/docs/architecture/cloud-native/candidate-apps.md index def93939149e4..34a130d00c34c 100644 --- a/docs/architecture/cloud-native/candidate-apps.md +++ b/docs/architecture/cloud-native/candidate-apps.md @@ -19,7 +19,7 @@ What type of application might be a candidate for cloud native? - A system with where individual features must release *without* a full redeployment of the entire system -- An application developed by teams with expertise in different technology stacks +- An application developed by teams with expertise in different technology stacks - An application with components that must scale independently @@ -75,7 +75,7 @@ With the introduction behind, we now dive into a much more detailed look at clou - [Beyond the Twelve-Factor Application](https://content.pivotal.io/blog/beyond-the-twelve-factor-app) -- [What is Infrastructure as Code](/azure/devops/learn/what-is-infrastructure-as-code) +- [What is Infrastructure as Code](/devops/deliver/what-is-infrastructure-as-code) - [Uber Engineering's Micro Deploy: Deploying Daily with Confidence](https://eng.uber.com/micro-deploy/) diff --git a/docs/architecture/cloud-native/definition.md b/docs/architecture/cloud-native/definition.md index c0b66377b2af4..ffe432ec1b513 100644 --- a/docs/architecture/cloud-native/definition.md +++ b/docs/architecture/cloud-native/definition.md @@ -275,7 +275,7 @@ Backing services are discussed in detail Chapter 5, *Cloud-Native Data Patterns* As you've seen, cloud-native systems embrace microservices, containers, and modern system design to achieve speed and agility. But, that's only part of the story. How do you provision the cloud environments upon which these systems run? How do you rapidly deploy app features and updates? How do you round out the full picture? -Enter the widely accepted practice of [Infrastructure as Code](/azure/devops/learn/what-is-infrastructure-as-code), or IaC. +Enter the widely accepted practice of [Infrastructure as Code](/devops/deliver/what-is-infrastructure-as-code), or IaC. With IaC, you automate platform provisioning and application deployment. You essentially apply software engineering practices such as testing and versioning to your DevOps practices. Your infrastructure and deployments are automated, consistent, and repeatable. @@ -285,7 +285,7 @@ Tools like [Azure Resource Manager](/azure/azure-resource-manager/management/ove Under the hood, IaC is idempotent, meaning that you can run the same script over and over without side effects. If the team needs to make a change, they edit and rerun the script. Only the updated resources are affected. -In the article, [What is Infrastructure as Code](/azure/devops/learn/what-is-infrastructure-as-code), Author Sam Guckenheimer describes how, "Teams who implement IaC can deliver stable environments rapidly and at scale. Teams avoid manual configuration of environments and enforce consistency by representing the desired state of their environments via code. Infrastructure deployments with IaC are repeatable and prevent runtime issues caused by configuration drift or missing dependencies. DevOps teams can work together with a unified set of practices and tools to deliver applications and their supporting infrastructure rapidly, reliably, and at scale." +In the article, [What is Infrastructure as Code](/devops/deliver/what-is-infrastructure-as-code), Author Sam Guckenheimer describes how, "Teams who implement IaC can deliver stable environments rapidly and at scale. Teams avoid manual configuration of environments and enforce consistency by representing the desired state of their environments via code. Infrastructure deployments with IaC are repeatable and prevent runtime issues caused by configuration drift or missing dependencies. DevOps teams can work together with a unified set of practices and tools to deliver applications and their supporting infrastructure rapidly, reliably, and at scale." ### Automating deployments diff --git a/docs/architecture/cloud-native/infrastructure-as-code.md b/docs/architecture/cloud-native/infrastructure-as-code.md index b5acdb53816d2..b87edfa797dd0 100644 --- a/docs/architecture/cloud-native/infrastructure-as-code.md +++ b/docs/architecture/cloud-native/infrastructure-as-code.md @@ -8,7 +8,7 @@ ms.date: 05/13/2020 Cloud-native systems embrace microservices, containers, and modern system design to achieve speed and agility. They provide automated build and release stages to ensure consistent and quality code. But, that's only part of the story. How do you provision the cloud environments upon which these systems run? -Modern cloud-native applications embrace the widely accepted practice of [Infrastructure as Code](/azure/devops/learn/what-is-infrastructure-as-code), or `IaC`. With IaC, you automate platform provisioning. You essentially apply software engineering practices such as testing and versioning to your DevOps practices. Your infrastructure and deployments are automated, consistent, and repeatable. Just as continuous delivery automated the traditional model of manual deployments, Infrastructure as Code (IaC) is evolving how application environments are managed. +Modern cloud-native applications embrace the widely accepted practice of [Infrastructure as Code](/devops/deliver/what-is-infrastructure-as-code), or `IaC`. With IaC, you automate platform provisioning. You essentially apply software engineering practices such as testing and versioning to your DevOps practices. Your infrastructure and deployments are automated, consistent, and repeatable. Just as continuous delivery automated the traditional model of manual deployments, Infrastructure as Code (IaC) is evolving how application environments are managed. Tools like Azure Resource Manager (ARM), Terraform, and the Azure Command Line Interface (CLI) enable you to declaratively script the cloud infrastructure you require. @@ -119,7 +119,7 @@ Figure 10-17 shows a YAML snippet that lists the version of Azure CLI and the de **Figure 10-17** - Azure CLI script -In the article, [What is Infrastructure as Code](/azure/devops/learn/what-is-infrastructure-as-code), Author Sam Guckenheimer describes how, "Teams who implement IaC can deliver stable environments rapidly and at scale. Teams avoid manual configuration of environments and enforce consistency by representing the desired state of their environments via code. Infrastructure deployments with IaC are repeatable and prevent runtime issues caused by configuration drift or missing dependencies. DevOps teams can work together with a unified set of practices and tools to deliver applications and their supporting infrastructure rapidly, reliably, and at scale." +In the article, [What is Infrastructure as Code](/devops/deliver/what-is-infrastructure-as-code), Author Sam Guckenheimer describes how, "Teams who implement IaC can deliver stable environments rapidly and at scale. Teams avoid manual configuration of environments and enforce consistency by representing the desired state of their environments via code. Infrastructure deployments with IaC are repeatable and prevent runtime issues caused by configuration drift or missing dependencies. DevOps teams can work together with a unified set of practices and tools to deliver applications and their supporting infrastructure rapidly, reliably, and at scale." >[!div class="step-by-step"] >[Previous](feature-flags.md) diff --git a/docs/architecture/cloud-native/relational-vs-nosql-data.md b/docs/architecture/cloud-native/relational-vs-nosql-data.md index 0dd20d7b78dc4..6712f9c69d77d 100644 --- a/docs/architecture/cloud-native/relational-vs-nosql-data.md +++ b/docs/architecture/cloud-native/relational-vs-nosql-data.md @@ -44,21 +44,23 @@ The theorem states that distributed data systems will offer a trade-off between - *Partition Tolerance.* Guarantees the system continues to operate even if a replicated data node fails or loses connectivity with other replicated data nodes. +CAP theorem explains the tradeoffs associated with managing consistency and availability during a network partition; however tradeoffs with respect to consistency and performance also exist with the absence of a network partition. CAP theorem is often further extended to [PACELC](http://www.cs.umd.edu/~abadi/papers/abadi-pacelc.pdf) to explain the tradeoffs more comprehensively. + Relational databases typically provide consistency and availability, but not partition tolerance. They're typically provisioned to a single server and scale vertically by adding more resources to the machine. Many relational database systems support built-in replication features where copies of the primary database can be made to other secondary server instances. Write operations are made to the primary instance and replicated to each of the secondaries. Upon a failure, the primary instance can fail over to a secondary to provide high availability. Secondaries can also be used to distribute read operations. While writes operations always go against the primary replica, read operations can be routed to any of the secondaries to reduce system load. -Data can also be horizontally partitioned across multiple nodes, such as with [sharding](/azure/sql-database/sql-database-elastic-scale-introduction). But, sharding dramatically increases operational overhead by spitting data across many pieces that cannot easily communicate. It can be costly and time consuming to manage. It can end up impacting performance, table joins, and referential integrity. +Data can also be horizontally partitioned across multiple nodes, such as with [sharding](/azure/sql-database/sql-database-elastic-scale-introduction). But, sharding dramatically increases operational overhead by spitting data across many pieces that cannot easily communicate. It can be costly and time consuming to manage. Relational features that include table joins, transactions, and referential integrity require steep performance penalties in sharded deployments. -If data replicas were to lose network connectivity in a "highly consistent" relational database cluster, you wouldn't be able to write to the database. The system would reject the write operation as it can't replicate that change to the other data replica. Every data replica has to update before the transaction can complete. +Replication consistency and recovery point objectives can be tuned by configuring whether replication occurs synchronously or asynchronously. If data replicas were to lose network connectivity in a "highly consistent" or synchronous relational database cluster, you wouldn't be able to write to the database. The system would reject the write operation as it can't replicate that change to the other data replica. Every data replica has to update before the transaction can complete. -NoSQL databases typically support high availability and partition tolerance. They scale out horizontally, often across commodity servers. This approach provides tremendous availability, both within and across geographical regions at a reduced cost. You partition and replicate data across these machines, or nodes, providing redundancy and fault tolerance. The downside is consistency. A change to data on one NoSQL node can take some time to propagate to other nodes. Typically, a NoSQL database node will provide an immediate response to a query - even if the data that is presented is stale and hasn't updated yet. +NoSQL databases typically support high availability and partition tolerance. They scale out horizontally, often across commodity servers. This approach provides tremendous availability, both within and across geographical regions at a reduced cost. You partition and replicate data across these machines, or nodes, providing redundancy and fault tolerance. Consistency is typically tuned through consensus protocols or quorum mechanisms. They provide more control when navigating tradeoffs between tuning synchronous versus asynchronous replication in relational systems. -If data replicas were to lose connectivity in a "highly available" NoSQL database cluster, you could still complete a write operation to the database. The database cluster would allow the write operation and update each data replica as it becomes available. +If data replicas were to lose connectivity in a "highly available" NoSQL database cluster, you could still complete a write operation to the database. The database cluster would allow the write operation and update each data replica as it becomes available. NoSQL databases that support multiple writable replicas can further strengthen high availability by avoiding the need for failover when optimizing recovery time objective. -This kind of result is known as eventual consistency, a characteristic of distributed data systems where ACID transactions aren't supported. It's a brief delay between the update of a data item and time that it takes to propagate that update to each of the replica nodes. Under normal conditions, the lag is typically short, but can increase when problems arise. For example, what would happen if you were to update a product item in a NoSQL database in the United States and query that same data item from a replica node in Europe? You would receive the earlier product information, until the cluster updates the European node with the product change. By immediately returning a query result and not waiting for all replica nodes to update, you gain enormous scale and volume, but with the possibility of presenting older data. +Moden NoSQL databases typically implement partitioning capabilities as a feature of their system design. Partition management is often built-in to the database, and routing is achieved through placement hints - often called partition keys. A flexible data models enables the NoSQL databases to lower the burden of schema management and improve availablity when deploying application updates that require data model changes. -High availability and massive scalability are often more critical to the business than strong consistency. Developers can implement techniques and patterns such as Sagas, CQRS, and asynchronous messaging to embrace eventual consistency. +High availability and massive scalability are often more critical to the business than relational table joins and referential integrity. Developers can implement techniques and patterns such as Sagas, CQRS, and asynchronous messaging to embrace eventual consistency. > Nowadays, care must be taken when considering the CAP theorem constraints. A new type of database, called NewSQL, has emerged which extends the relational database engine to support both horizontal scalability and the scalable performance of NoSQL systems. @@ -68,13 +70,11 @@ Based upon specific data requirements, a cloud-native-based microservice can imp | Consider a NoSQL datastore when: | Consider a relational database when: | | :-------- | :-------- | -| You have high volume workloads that require large scale | Your workload volume is consistent and requires medium to large scale | -| Your workloads don't require ACID guarantees | ACID guarantees are required | -| Your data is dynamic and frequently changes | Your data is predictable and highly structured | -| Data can be expressed without relationships | Data is best expressed relationally | -| You need fast writes and write safety isn't critical | Write safety is a requirement | -| Data retrieval is simple and tends to be flat | You work with complex queries and reports| -| Your data requires a wide geographic distribution | Your users are more centralized | +| You have high volume workloads that require predictable latency at large scale (e.g. latency measured in milliseconds while performing millions of transactions per second) | Your workload volume generally fits within thousands of transactions per second | +| Your data is dynamic and frequently changes | Your data is highly structured and requires referential integrity | +| Relationships can be de-normalized data models | Relationships are expressed through table joins on normalized data models | +| Data retrieval is simple and expressed without table joins | You work with complex queries and reports| +| Data is typically replicated across geographies and requires finer control over consistency, availablity, and performance | Data is typically centralized, or can be replicated regions asynchronously | | Your application will be deployed to commodity hardware, such as with public clouds | Your application will be deployed to large, high-end hardware | In the next sections, we'll explore the options available in the Azure cloud for storing and managing your cloud-native data. @@ -159,7 +159,7 @@ If your services require fast response from anywhere in the world, high availabi ![Overview of Cosmos DB](./media/cosmos-db-overview.png) -**Figure 5-12**: Overview of Cosmos DB +**Figure 5-12**: Overview of Azure Cosmos DB The previous figure presents many of the built-in cloud-native capabilities available in Cosmos DB. In this section, we’ll take a closer look at them. @@ -203,10 +203,10 @@ In the previous table, note the [Table API](/azure/cosmos-db/table-introduction) | | Azure Table Storage | Azure Cosmos DB | | :-------- | :-------- |:-------- | | Latency | Fast | Single-digit millisecond latency for reads and writes anywhere in the world | -| Throughput | Limit of 20,000 operations per table | 10 Million operations per table | +| Throughput | Limit of 20,000 operations per table | Unlimited operations per table | | Global Distribution | Single region with optional single secondary read region | Turnkey distributions to all regions with automatic failover | | Indexing | Available for partition and row key properties only | Automatic indexing of all properties | -| Pricing | Based on storage | Based on throughput | +| Pricing | Optimized for cold workloads (low throughput : storage ratio) | Optimizied for hot workloads (high throughput : storage ratio) | Microservices that consume Azure Table storage can easily migrate to the Cosmos DB Table API. No code changes are required. @@ -285,7 +285,7 @@ One of the more time-consuming tasks is migrating data from one data platform to - Azure Database for MySQL - Azure Database for MariaDB - Azure Database for PostgreSQL -- CosmosDB +- Azure Cosmos DB The service provides recommendations to guide you through the changes required to execute a migration, both small or large. diff --git a/docs/architecture/cloud-native/scale-containers-serverless.md b/docs/architecture/cloud-native/scale-containers-serverless.md index 945ddaed0c14a..27cdb114d19fc 100644 --- a/docs/architecture/cloud-native/scale-containers-serverless.md +++ b/docs/architecture/cloud-native/scale-containers-serverless.md @@ -10,7 +10,7 @@ There are two ways to scale an application: up or out. The former refers to addi ## The simple solution: scaling up -Upgrading an existing host server with increased CPU, memory, disk I/O speed, and network I/O speed is known as *scaling up*. Scaling up a cloud-native application involves choosing more capable resources from the cloud vendor. For example, you can a new node pool with larger VMs in your Kubernetes cluster. Then, migrate your containerized services to the new pool. +Upgrading an existing host server with increased CPU, memory, disk I/O speed, and network I/O speed is known as *scaling up*. Scaling up a cloud-native application involves choosing more capable resources from the cloud vendor. For example, you can create a new node pool with larger VMs in your Kubernetes cluster. Then, migrate your containerized services to the new pool. Serverless apps scale up by choosing the [premium Functions plan](/azure/azure-functions/functions-scale) or premium instance sizes from a dedicated app service plan. diff --git a/docs/architecture/dapr-for-net-developers/publish-subscribe.md b/docs/architecture/dapr-for-net-developers/publish-subscribe.md index 4748a8e27ee22..59085ba94c519 100644 --- a/docs/architecture/dapr-for-net-developers/publish-subscribe.md +++ b/docs/architecture/dapr-for-net-developers/publish-subscribe.md @@ -302,7 +302,7 @@ public interface IEventBus void Publish(IntegrationEvent integrationEvent); void Subscribe() - where TEvent : IntegrationEvent + where T : IntegrationEvent where THandler : IIntegrationEventHandler; } ``` diff --git a/docs/architecture/dapr-for-net-developers/service-invocation.md b/docs/architecture/dapr-for-net-developers/service-invocation.md index 3a6376ae8eb5c..03f3245655523 100644 --- a/docs/architecture/dapr-for-net-developers/service-invocation.md +++ b/docs/architecture/dapr-for-net-developers/service-invocation.md @@ -87,11 +87,11 @@ The Dapr [.NET SDK](https://github.com/dapr/dotnet-sdk) provides .NET developers The preferred way to call an HTTP endpoint is to use Dapr's rich integration with `HttpClient`. The following example submits an order by calling the `submit` method of the `orderservice` application: ```csharp -var httpClient = DaprClient.CreateHttpClient(); +var httpClient = DaprClient.CreateInvokeHttpClient(); await httpClient.PostAsJsonAsync("http://orderservice/submit", order); ``` -In the example, `DaprClient.CreateHttpClient` returns an `HttpClient` instance that is used to perform Dapr service invocation. The returned `HttpClient` uses a special Dapr message handler that rewrites URIs of outgoing requests. The host name is interpreted as the application ID of the service to call. The rewritten request that's actually being called is: +In the example, `DaprClient.CreateInvokeHttpClient` returns an `HttpClient` instance that is used to perform Dapr service invocation. The returned `HttpClient` uses a special Dapr message handler that rewrites URIs of outgoing requests. The host name is interpreted as the application ID of the service to call. The rewritten request that's actually being called is: ```http http://127.0.0.1:3500/v1/invoke/orderservice/method/submit @@ -99,16 +99,16 @@ http://127.0.0.1:3500/v1/invoke/orderservice/method/submit This example uses the default value for the Dapr HTTP endpoint, which is `http://127.0.0.1:/`. The value of `dapr-http-port` is taken from the `DAPR_HTTP_PORT` environment variable. If it's not set, the default port number `3500` is used. -Alternatively, you can configure a custom endpoint in the call to `DaprClient.CreateHttpClient`: +Alternatively, you can configure a custom endpoint in the call to `DaprClient.CreateInvokeHttpClient`: ```csharp -var httpClient = DaprClient.CreateHttpClient(daprEndpoint = "localhost:4000"); +var httpClient = DaprClient.CreateInvokeHttpClient(daprEndpoint = "localhost:4000"); ``` You can also directly set the base address by specifying the application ID. This makes it possible to use relative URIs when making a call: ```csharp -var httpClient = DaprClient.CreateHttpClient("orderservice"); +var httpClient = DaprClient.CreateInvokeHttpClient("orderservice"); await httpClient.PostAsJsonAsync("/submit"); ``` diff --git a/docs/architecture/microservices/implement-resilient-applications/implement-resilient-entity-framework-core-sql-connections.md b/docs/architecture/microservices/implement-resilient-applications/implement-resilient-entity-framework-core-sql-connections.md index 625971e917410..638a998206fc4 100644 --- a/docs/architecture/microservices/implement-resilient-applications/implement-resilient-entity-framework-core-sql-connections.md +++ b/docs/architecture/microservices/implement-resilient-applications/implement-resilient-entity-framework-core-sql-connections.md @@ -43,7 +43,7 @@ If you try to execute that transaction when using an EF execution strategy (retr > System.InvalidOperationException: The configured execution strategy 'SqlServerRetryingExecutionStrategy' does not support user initiated transactions. Use the execution strategy returned by 'DbContext.Database.CreateExecutionStrategy()' to execute all the operations in the transaction as a retriable unit. -The solution is to manually invoke the EF execution strategy with a delegate representing everything that needs to be executed. If a transient failure occurs, the execution strategy will invoke the delegate again. For example, the following code show how it's implemented in eShopOnContainers with two multiple DbContexts (\_catalogContext and the IntegrationEventLogContext) when updating a product and then saving the ProductPriceChangedIntegrationEvent object, which needs to use a different DbContext. +The solution is to manually invoke the EF execution strategy with a delegate representing everything that needs to be executed. If a transient failure occurs, the execution strategy will invoke the delegate again. For example, the following code shows how it's implemented in eShopOnContainers with two multiple DbContexts (\_catalogContext and the IntegrationEventLogContext) when updating a product and then saving the ProductPriceChangedIntegrationEvent object, which needs to use a different DbContext. ```csharp public async Task UpdateProduct( diff --git a/docs/architecture/microservices/implement-resilient-applications/index.md b/docs/architecture/microservices/implement-resilient-applications/index.md index b171bb7c0fc3e..ba78ffb48bc6c 100644 --- a/docs/architecture/microservices/implement-resilient-applications/index.md +++ b/docs/architecture/microservices/implement-resilient-applications/index.md @@ -21,7 +21,7 @@ The many individual components of your application should also incorporate healt > The Polly library is still used to add resilience to database connections, specially while starting up the services. >[!WARNING] -> All code samples in this section were valid before using Linkerd and are not updated to reflect the current actual code. So they make sense in the context of this section. +> All code samples and images in this section were valid before using Linkerd and are not updated to reflect the current actual code. So they make sense in the context of this section. >[!div class="step-by-step"] >[Previous](../microservice-ddd-cqrs-patterns/microservice-application-layer-implementation-web-api.md) diff --git a/docs/architecture/microservices/implement-resilient-applications/media/monitor-app-health/health-check-json-response.png b/docs/architecture/microservices/implement-resilient-applications/media/monitor-app-health/health-check-json-response.png index df5605dd3c215..f22552f8b9df6 100644 Binary files a/docs/architecture/microservices/implement-resilient-applications/media/monitor-app-health/health-check-json-response.png and b/docs/architecture/microservices/implement-resilient-applications/media/monitor-app-health/health-check-json-response.png differ diff --git a/docs/architecture/microservices/implement-resilient-applications/monitor-app-health.md b/docs/architecture/microservices/implement-resilient-applications/monitor-app-health.md index 334438cc085d0..4e3380382ad09 100644 --- a/docs/architecture/microservices/implement-resilient-applications/monitor-app-health.md +++ b/docs/architecture/microservices/implement-resilient-applications/monitor-app-health.md @@ -1,7 +1,7 @@ --- title: Health monitoring description: Explore one way of implementing health monitoring. -ms.date: 01/13/2021 +ms.date: 06/23/2021 --- # Health monitoring @@ -193,9 +193,9 @@ app.UseHealthChecks("/hc", new HealthCheckOptions() ### Query your microservices to report about their health status -When you've configured health checks as described in this article and you have the microservice running in Docker, you can directly check from a browser if it's healthy. You have to publish the container port in the Docker host, so you can access the container through the external Docker host IP or through `localhost`, as shown in figure 8-8. +When you've configured health checks as described in this article and you have the microservice running in Docker, you can directly check from a browser if it's healthy. You have to publish the container port in the Docker host, so you can access the container through the external Docker host IP or through `host.docker.internal`, as shown in figure 8-8. -![Screenshot of the JSON response returned by a health check.](./media/monitor-app-health/health-check-json-response.png) +![Screenshot of the JSON response returned by a health check.](media/monitor-app-health/health-check-json-response.png) **Figure 8-8**. Checking health status of a single service from a browser @@ -224,11 +224,11 @@ Sample configuration file for health check UI: "HealthChecks": [ { "Name": "Ordering HTTP Check", - "Uri": "http://localhost:5102/hc" + "Uri": "http://host.docker.internal:5102/hc" }, { "Name": "Ordering HTTP Background Check", - "Uri": "http://localhost:5111/hc" + "Uri": "http://host.docker.internal:5111/hc" }, //... ]} diff --git a/docs/architecture/microservices/microservice-ddd-cqrs-patterns/nosql-database-persistence-infrastructure.md b/docs/architecture/microservices/microservice-ddd-cqrs-patterns/nosql-database-persistence-infrastructure.md index 6838c0359d0db..ff365a45c3985 100644 --- a/docs/architecture/microservices/microservice-ddd-cqrs-patterns/nosql-database-persistence-infrastructure.md +++ b/docs/architecture/microservices/microservice-ddd-cqrs-patterns/nosql-database-persistence-infrastructure.md @@ -1,7 +1,7 @@ --- title: Using NoSQL databases as a persistence infrastructure description: Understand the use of NoSql databases in general, and Azure Cosmos DB in particular, as an option to implement persistence. -ms.date: 01/13/2021 +ms.date: 06/23/2021 --- # Use NoSQL databases as a persistence infrastructure @@ -282,7 +282,7 @@ The following code shows the `.env` file with the Azure Cosmos DB connection str # .env file, in eShopOnContainers root folder # Other Docker environment variables -ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost +ESHOP_EXTERNAL_DNS_NAME_OR_IP=host.docker.internal ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP= #ESHOP_AZURE_COSMOSDB= diff --git a/docs/architecture/microservices/multi-container-microservice-net-applications/data-driven-crud-microservice.md b/docs/architecture/microservices/multi-container-microservice-net-applications/data-driven-crud-microservice.md index 6c1b20b8b109f..8a0afd6c96800 100644 --- a/docs/architecture/microservices/multi-container-microservice-net-applications/data-driven-crud-microservice.md +++ b/docs/architecture/microservices/multi-container-microservice-net-applications/data-driven-crud-microservice.md @@ -1,7 +1,7 @@ --- title: Creating a simple data-driven CRUD microservice description: .NET Microservices Architecture for Containerized .NET Applications | Understand the creation of a simple CRUD (data-driven) microservice within the context of a microservices application. -ms.date: 01/13/2021 +ms.date: 06/23/2021 --- # Creating a simple data-driven CRUD microservice @@ -229,7 +229,7 @@ You can use the ASP.NET Core settings and add a ConnectionString property to you ```json { "ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=[PLACEHOLDER]", - "ExternalCatalogBaseUrl": "http://localhost:5101", + "ExternalCatalogBaseUrl": "http://host.docker.internal:5101", "Logging": { "IncludeScopes": false, "LogLevel": { diff --git a/docs/architecture/microservices/multi-container-microservice-net-applications/implement-api-gateways-with-ocelot.md b/docs/architecture/microservices/multi-container-microservice-net-applications/implement-api-gateways-with-ocelot.md index 4e1ec1ff04470..b17e257360aad 100644 --- a/docs/architecture/microservices/multi-container-microservice-net-applications/implement-api-gateways-with-ocelot.md +++ b/docs/architecture/microservices/multi-container-microservice-net-applications/implement-api-gateways-with-ocelot.md @@ -1,7 +1,7 @@ --- title: Implementing API Gateways with Ocelot description: Learn how to implement API Gateways with Ocelot and how to use Ocelot in a container-based environment. -ms.date: 03/02/2020 +ms.date: 06/23/2021 --- # Implement API Gateways with Ocelot @@ -122,7 +122,7 @@ docker-compose run --service-ports catalog-api This command only runs the catalog-api service container plus dependencies that are specified in the docker-compose.yml. In this case, the SQL Server container and RabbitMQ container. -Then, you can directly access the Catalog microservice and see its methods through the Swagger UI accessing directly through that "external" port, in this case `http://localhost:5101/swagger`: +Then, you can directly access the Catalog microservice and see its methods through the Swagger UI accessing directly through that "external" port, in this case `http://host.docker.internal:5101/swagger`: ![Screenshot of Swagger UI showing the Catalog.API REST API.](./media/implement-api-gateways-with-ocelot/test-catalog-microservice.png) @@ -356,13 +356,13 @@ By splitting the API Gateway into multiple API Gateways, different development t Now, if you run eShopOnContainers with the API Gateways (included by default in VS when opening eShopOnContainers-ServicesAndWebApps.sln solution or if running "docker-compose up"), the following sample routes will be performed. -For instance, when visiting the upstream URL `http://localhost:5202/api/v1/c/catalog/items/2/` served by the webshoppingapigw API Gateway, you get the same result from the internal Downstream URL `http://catalog-api/api/v1/2` within the Docker host, as in the following browser. +For instance, when visiting the upstream URL `http://host.docker.internal:5202/api/v1/c/catalog/items/2/` served by the webshoppingapigw API Gateway, you get the same result from the internal Downstream URL `http://catalog-api/api/v1/2` within the Docker host, as in the following browser. ![Screenshot of a browser showing a response going through API gateway.](./media/implement-api-gateways-with-ocelot/access-microservice-through-url.png) **Figure 6-35**. Accessing a microservice through a URL provided by the API Gateway -Because of testing or debugging reasons, if you wanted to directly access to the Catalog Docker container (only at the development environment) without passing through the API Gateway, since 'catalog-api' is a DNS resolution internal to the Docker host (service discovery handled by docker-compose service names), the only way to directly access the container is through the external port published in the docker-compose.override.yml, which is provided only for development tests, such as `http://localhost:5101/api/v1/Catalog/items/1` in the following browser. +Because of testing or debugging reasons, if you wanted to directly access to the Catalog Docker container (only at the development environment) without passing through the API Gateway, since 'catalog-api' is a DNS resolution internal to the Docker host (service discovery handled by docker-compose service names), the only way to directly access the container is through the external port published in the docker-compose.override.yml, which is provided only for development tests, such as `http://host.docker.internal:5101/api/v1/Catalog/items/1` in the following browser. ![Screenshot of a browser showing a direct response to the Catalog.api.](./media/implement-api-gateways-with-ocelot/direct-access-microservice-testing.png) @@ -502,7 +502,7 @@ services.AddAuthentication(options => }); ``` -If you try to access any secured microservice, like the Basket microservice with a ReRoute URL based on the API Gateway like `http://localhost:5202/api/v1/b/basket/1`, then you'll get a 401 Unauthorized unless you provide a valid token. On the other hand, if a ReRoute URL is authenticated, Ocelot will invoke whatever downstream scheme is associated with it (the internal microservice URL). +If you try to access any secured microservice, like the Basket microservice with a ReRoute URL based on the API Gateway like `http://host.docker.internal:5202/api/v1/b/basket/1`, then you'll get a 401 Unauthorized unless you provide a valid token. On the other hand, if a ReRoute URL is authenticated, Ocelot will invoke whatever downstream scheme is associated with it (the internal microservice URL). **Authorization at Ocelot's ReRoutes tier.** Ocelot supports claims-based authorization evaluated after the authentication. You set the authorization at a route level by adding the following lines to the ReRoute configuration. diff --git a/docs/architecture/microservices/multi-container-microservice-net-applications/media/subscribe-events/display-item-price-change.png b/docs/architecture/microservices/multi-container-microservice-net-applications/media/subscribe-events/display-item-price-change.png index 29fd982f50dfc..b5e3e96f5ab19 100644 Binary files a/docs/architecture/microservices/multi-container-microservice-net-applications/media/subscribe-events/display-item-price-change.png and b/docs/architecture/microservices/multi-container-microservice-net-applications/media/subscribe-events/display-item-price-change.png differ diff --git a/docs/architecture/microservices/multi-container-microservice-net-applications/multi-container-applications-docker-compose.md b/docs/architecture/microservices/multi-container-microservice-net-applications/multi-container-applications-docker-compose.md index 7c158262bbf48..2e610451d3648 100644 --- a/docs/architecture/microservices/multi-container-microservice-net-applications/multi-container-applications-docker-compose.md +++ b/docs/architecture/microservices/multi-container-microservice-net-applications/multi-container-applications-docker-compose.md @@ -1,7 +1,7 @@ --- title: Defining your multi-container application with docker-compose.yml description: How to specify microservices composition for a multicontainer application with docker-compose.yml. -ms.date: 01/13/2021 +ms.date: 06/23/2021 --- # Defining your multi-container application with docker-compose.yml @@ -304,7 +304,7 @@ services: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sqldata;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=[PLACEHOLDER]} - - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://localhost:5202/api/v1/catalog/items/[0]/pic/} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG_URL:-http://host.docker.internal:5202/api/v1/catalog/items/[0]/pic/} - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} @@ -331,7 +331,7 @@ services: - identityUrl=http://identity-api - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} - - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING_URL:-http://localhost:5110/api/v1/campaigns/[0]/pic/} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING_URL:-http://host.docker.internal:5110/api/v1/campaigns/[0]/pic/} - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME} - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY} - AzureServiceBusEnabled=False @@ -410,7 +410,7 @@ The following example shows an .env file like the [.env](https://github.com/dotn ```sh # .env file -ESHOP_EXTERNAL_DNS_NAME_OR_IP=localhost +ESHOP_EXTERNAL_DNS_NAME_OR_IP=host.docker.internal ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP=10.121.122.92 ``` diff --git a/docs/architecture/microservices/multi-container-microservice-net-applications/subscribe-events.md b/docs/architecture/microservices/multi-container-microservice-net-applications/subscribe-events.md index de7f8b298355c..6844567403e43 100644 --- a/docs/architecture/microservices/multi-container-microservice-net-applications/subscribe-events.md +++ b/docs/architecture/microservices/multi-container-microservice-net-applications/subscribe-events.md @@ -1,7 +1,7 @@ --- title: Subscribing to events description: .NET Microservices Architecture for Containerized .NET Applications | Understand the details of publishing and subscription to integration events. -ms.date: 01/13/2021 +ms.date: 06/23/2021 --- # Subscribing to events @@ -272,7 +272,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Even The event handler needs to verify whether the product exists in any of the basket instances. It also updates the item price for each related basket line item. Finally, it creates an alert to be displayed to the user about the price change, as shown in Figure 6-24. -![Screenshot of a browser showing the price change notification on the user cart.](./media/subscribe-events/display-item-price-change.png) +![Screenshot of a browser showing the price change notification on the user cart.](media/subscribe-events/display-item-price-change.png) **Figure 6-24**. Displaying an item price change in a basket, as communicated by integration events diff --git a/docs/architecture/porting-existing-aspnet-apps/example-migration-eshop.md b/docs/architecture/porting-existing-aspnet-apps/example-migration-eshop.md index 1dc443dbdbc99..d54c3da5b96e3 100644 --- a/docs/architecture/porting-existing-aspnet-apps/example-migration-eshop.md +++ b/docs/architecture/porting-existing-aspnet-apps/example-migration-eshop.md @@ -845,5 +845,5 @@ Rather than relying on config files for its settings, WCF clients and other .NET - [Deep Dive into EF Core HasData](/archive/msdn-magazine/2018/august/data-points-deep-dive-into-ef-core-hasdata-seeding) >[!div class="step-by-step"] ->[Previous](more-migration-scenarios.md) ->[Next](deployment-scenarios.md) +>[Previous](strategies-migrating-in-production.md) +>[Next](more-migration-scenarios.md) diff --git a/docs/architecture/porting-existing-aspnet-apps/logging-differences.md b/docs/architecture/porting-existing-aspnet-apps/logging-differences.md index bd672e359d05e..4ca4070a1e3a6 100644 --- a/docs/architecture/porting-existing-aspnet-apps/logging-differences.md +++ b/docs/architecture/porting-existing-aspnet-apps/logging-differences.md @@ -50,5 +50,5 @@ You can reference the `Microsoft.Extensions.Logging` package from .NET Framework - [Microsoft.Extensions.Logging NuGet Package](https://www.nuget.org/packages/microsoft.extensions.logging/) >[!div class="step-by-step"] ->[Previous](middleware-modules-handlers.md) ->[Next](routing-differences.md) +>[Previous](routing-differences.md) +>[Next](comparing-razor-pages-aspnet-mvc.md) diff --git a/docs/architecture/porting-existing-aspnet-apps/more-migration-scenarios.md b/docs/architecture/porting-existing-aspnet-apps/more-migration-scenarios.md index e7ff4b67001c2..dd53f6a86a243 100644 --- a/docs/architecture/porting-existing-aspnet-apps/more-migration-scenarios.md +++ b/docs/architecture/porting-existing-aspnet-apps/more-migration-scenarios.md @@ -233,7 +233,7 @@ Most ASP.NET MVC and Web API apps do not use a large number of custom filters. S ## Route constraints -ASP.NET Core uses route constraints to help ensure requests are routed properly to route a request. [ASP.NET Core supports a large number of different route constraints for this purpose]/aspnet/core/fundamentals/routing#route-constraint-reference). Route constraints can be applied in the route table, but most apps built with ASP.NET MVC 5 and/or [ASP.NET Web API 2](/aspnet/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2#route-constraints) use inline route constraints applied to attribute routes. Inline route constraints use a format like this one: +ASP.NET Core uses route constraints to help ensure requests are routed properly to route a request. [ASP.NET Core supports a large number of different route constraints for this purpose](/aspnet/core/fundamentals/routing#route-constraint-reference). Route constraints can be applied in the route table, but most apps built with ASP.NET MVC 5 and/or [ASP.NET Web API 2](/aspnet/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2#route-constraints) use inline route constraints applied to attribute routes. Inline route constraints use a format like this one: ```csharp [Route("/customer/{id:int}")] diff --git a/docs/architecture/porting-existing-aspnet-apps/routing-differences.md b/docs/architecture/porting-existing-aspnet-apps/routing-differences.md index 730088e0eb39f..54ce2278a4ddd 100644 --- a/docs/architecture/porting-existing-aspnet-apps/routing-differences.md +++ b/docs/architecture/porting-existing-aspnet-apps/routing-differences.md @@ -183,4 +183,4 @@ Using this attribute, classes inheriting from this type would route URLs to acti >[!div class="step-by-step"] >[Previous](configuration-differences.md) ->[Next](comparing-razor-pages-aspnet-mvc.md) +>[Next](logging-differences.md) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index f1258782761b6..a013e7de86ba1 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -10,21 +10,22 @@ | Azure Object Anchors Conversion | NuGet [0.2.0-beta.1](https://www.nuget.org/packages/Azure.MixedReality.ObjectAnchors.Conversion/0.2.0-beta.1) | [docs](/dotnet/api/overview/azure/MixedReality.ObjectAnchors.Conversion-readme-pre) | GitHub [0.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.MixedReality.ObjectAnchors.Conversion_0.2.0-beta.1/sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/) | | Azure Remote Rendering | NuGet [1.0.1](https://www.nuget.org/packages/Azure.MixedReality.RemoteRendering/1.0.1) | [docs](/dotnet/api/overview/azure/MixedReality.RemoteRendering-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.MixedReality.RemoteRendering_1.0.1/sdk/remoterendering/Azure.MixedReality.RemoteRendering/) | | Azure Video Analyzer Edge | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Media.VideoAnalyzer.Edge/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Media.VideoAnalyzer.Edge-readme-pre) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.VideoAnalyzer.Edge_1.0.0-beta.4/sdk/videoanalyzer/Azure.Media.VideoAnalyzer.Edge/) | -| Cognitive Search | NuGet [11.2.1](https://www.nuget.org/packages/Azure.Search.Documents/11.2.1)
NuGet [11.3.0-beta.2](https://www.nuget.org/packages/Azure.Search.Documents/11.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.2.1/sdk/search/Azure.Search.Documents/)
GitHub [11.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.3.0-beta.2/sdk/search/Azure.Search.Documents/) | +| CloudNative CloudEvents with Event Grid | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents_1.0.0-beta.2/sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/) | +| Cognitive Search | NuGet [11.3.0](https://www.nuget.org/packages/Azure.Search.Documents/11.3.0) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.3.0/sdk/search/Azure.Search.Documents/) | | Communication Chat | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Chat/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Chat-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Chat_1.0.1/sdk/communication/Azure.Communication.Chat/) | | Communication Common | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Common/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Common-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_1.0.1/sdk/communication/Azure.Communication.Common/) | | Communication Identity | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Identity/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Identity-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Identity_1.0.1/sdk/communication/Azure.Communication.Identity/) | | Communication Phone Numbers | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.PhoneNumbers/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.PhoneNumbers-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.PhoneNumbers_1.0.1/sdk/communication/Azure.Communication.PhoneNumbers/) | | Communication SMS | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Sms/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Sms-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.0.1/sdk/communication/Azure.Communication.Sms/) | -| ConfidentialLedger | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.0.0-beta.2/sdk/confidentialledger/Azure.Security.ConfidentialLedger/) | +| ConfidentialLedger | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Security.ConfidentialLedger-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.0.0-beta.2/sdk/confidentialledger/Azure.Security.ConfidentialLedger/) | | ConfidentialLedger | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Storage.ConfidentialLedger/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Storage.ConfidentialLedger-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.ConfidentialLedger_1.0.0-beta.1/sdk/confidentialledger/Azure.Storage.ConfidentialLedger/) | | Container Registry | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Containers.ContainerRegistry/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Containers.ContainerRegistry-readme-pre) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Containers.ContainerRegistry_1.0.0-beta.3/sdk/containerregistry/Azure.Containers.ContainerRegistry/) | | Core | NuGet [1.15.0](https://www.nuget.org/packages/Azure.Core/1.15.0) | [docs](/dotnet/api/overview/azure/Core-readme) | GitHub [1.15.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core_1.15.0/sdk/core/Azure.Core/) | -| Core - AMQP | NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Core.Amqp/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Core.Amqp-readme-pre) | GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Amqp_1.1.0-beta.1/sdk/core/Azure.Core.Amqp/) | +| Core - AMQP | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Core.Amqp/1.1.0) | [docs](/dotnet/api/overview/azure/Core.Amqp-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Amqp_1.1.0/sdk/core/Azure.Core.Amqp/) | | Cosmos DB | NuGet [4.0.0-preview3](https://www.nuget.org/packages/Azure.Cosmos/4.0.0-preview3) | [docs](/dotnet/api/azure.cosmos) | GitHub [4.0.0-preview3](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/4.0.0-preview3) | | Digital Twins - Core | NuGet [1.2.2](https://www.nuget.org/packages/Azure.DigitalTwins.Core/1.2.2) | [docs](/dotnet/api/overview/azure/DigitalTwins.Core-readme) | GitHub [1.2.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.DigitalTwins.Core_1.2.2/sdk/digitaltwins/Azure.DigitalTwins.Core/) | | Document Translation | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Translation.Document/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Translation.Document-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Document_1.0.0-beta.2/sdk/translation/Azure.AI.Translation.Document/) | -| Event Grid | NuGet [4.3.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid/4.3.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid-readme) | GitHub [4.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_4.3.0/sdk/eventgrid/Azure.Messaging.EventGrid/) | +| Event Grid | NuGet [4.4.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid/4.4.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid-readme) | GitHub [4.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_4.4.0/sdk/eventgrid/Azure.Messaging.EventGrid/) | | Event Hubs | NuGet [5.4.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.4.1)
NuGet [5.5.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.5.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs-readme) | GitHub [5.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.4.1/sdk/eventhub/Azure.Messaging.EventHubs/)
GitHub [5.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.5.0-beta.1/sdk/eventhub/Azure.Messaging.EventHubs/) | | Event Hubs - Event Processor | NuGet [5.4.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor/5.4.1)
NuGet [5.5.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor/5.5.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs.Processor-readme) | GitHub [5.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs.Processor_5.4.1/sdk/eventhub/Azure.Messaging.EventHubs.Processor/)
GitHub [5.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs.Processor_5.5.0-beta.1/sdk/eventhub/Azure.Messaging.EventHubs.Processor/) | | Event Hubs - Schema Registry | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Data.SchemaRegistry/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Data.SchemaRegistry-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.SchemaRegistry_1.0.0-beta.2/sdk/schemaregistry/Azure.Data.SchemaRegistry/) | @@ -32,17 +33,17 @@ | Form Recognizer | NuGet [3.1.1](https://www.nuget.org/packages/Azure.AI.FormRecognizer/3.1.1) | [docs](/dotnet/api/overview/azure/AI.FormRecognizer-readme) | GitHub [3.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.FormRecognizer_3.1.1/sdk/formrecognizer/Azure.AI.FormRecognizer/) | | Identity | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Identity/1.4.0)
NuGet [1.5.0-beta.1](https://www.nuget.org/packages/Azure.Identity/1.5.0-beta.1) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.4.0/sdk/identity/Azure.Identity/)
GitHub [1.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.5.0-beta.1/sdk/identity/Azure.Identity/) | | IoT Device Update | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.IoT.DeviceUpdate/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/IoT.DeviceUpdate-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.DeviceUpdate_1.0.0-beta.2/sdk/deviceupdate/Azure.Iot.DeviceUpdate/) | -| Key Vault - Administration | NuGet [4.0.0-beta.5](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.0.0-beta.5) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme-pre) | GitHub [4.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.0.0-beta.5/sdk/keyvault/Azure.Security.KeyVault.Administration/) | -| Key Vault - Certificates | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.1.1)
NuGet [4.2.0-beta.6](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.2.0-beta.6) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Certificates-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Certificates/)
GitHub [4.2.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.2.0-beta.6/sdk/keyvault/Azure.Security.KeyVault.Certificates/) | -| Key Vault - Keys | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.1.1)
NuGet [4.2.0-beta.6](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.2.0-beta.6) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Keys-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Keys/)
GitHub [4.2.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.2.0-beta.6/sdk/keyvault/Azure.Security.KeyVault.Keys/) | -| Key Vault - Secrets | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.1.1)
NuGet [4.2.0-beta.5](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.2.0-beta.5) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Secrets-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Secrets/)
GitHub [4.2.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.2.0-beta.5/sdk/keyvault/Azure.Security.KeyVault.Secrets/) | +| Key Vault - Administration | NuGet [4.0.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.0.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme) | GitHub [4.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.0.0/sdk/keyvault/Azure.Security.KeyVault.Administration/) | +| Key Vault - Certificates | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Certificates-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Certificates/) | +| Key Vault - Keys | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Keys-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Keys/) | +| Key Vault - Secrets | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Secrets-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Secrets/) | | Media Analytics Edge | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Media.Analytics.Edge/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Media.Analytics.Edge-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.Analytics.Edge_1.0.0-beta.1/sdk/mediaservices/Azure.Media.Analytics.Edge) | | Metrics Advisor | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.MetricsAdvisor/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.MetricsAdvisor-readme-pre) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.MetricsAdvisor_1.0.0-beta.4/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/) | | Monitor OpenTelemetry Exporter | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.0.0-beta.2/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) | -| Monitor Query | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Monitor.Query/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.0.0-beta.1/sdk/monitor/Azure.Monitor.Query/) | +| Monitor Query | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Monitor.Query/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.0.0-beta.1/sdk/monitor/Azure.Monitor.Query/) | | Purview Catalog | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.Purview.Catalog/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.Purview.Catalog-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Purview.Catalog_1.0.0-beta.1/sdk/purview/Azure.Analytics.Purview.Catalog/) | | Purview Scanning | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.Purview.Scanning/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.Purview.Scanning-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Purview.Scanning_1.0.0-beta.1/sdk/purview/Azure.Analytics.Purview.Scanning/) | -| Service Bus | NuGet [7.1.2](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.1.2)
NuGet [7.2.0-beta.3](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.2.0-beta.3) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.1.2/sdk/servicebus/Azure.Messaging.ServiceBus/)
GitHub [7.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.2.0-beta.3/sdk/servicebus/Azure.Messaging.ServiceBus/) | +| Service Bus | NuGet [7.2.0](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.2.0) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.2.0/sdk/servicebus/Azure.Messaging.ServiceBus/) | | Storage - Blobs | NuGet [12.9.0](https://www.nuget.org/packages/Azure.Storage.Blobs/12.9.0) | [docs](/dotnet/api/overview/azure/Storage.Blobs-readme) | GitHub [12.9.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs_12.9.0/sdk/storage/Azure.Storage.Blobs/) | | Storage - Blobs Batch | NuGet [12.6.0](https://www.nuget.org/packages/Azure.Storage.Blobs.Batch/12.6.0) | [docs](/dotnet/api/overview/azure/Storage.Blobs.Batch-readme) | GitHub [12.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.Batch_12.6.0/sdk/storage/Azure.Storage.Blobs.Batch/) | | Storage - Blobs ChangeFeed | NuGet [12.0.0-preview.13](https://www.nuget.org/packages/Azure.Storage.Blobs.ChangeFeed/12.0.0-preview.13) | [docs](/dotnet/api/overview/azure/Storage.Blobs.ChangeFeed-readme-pre) | GitHub [12.0.0-preview.13](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.ChangeFeed_12.0.0-preview.13/sdk/storage/Azure.Storage.Blobs.ChangeFeed/) | @@ -56,11 +57,11 @@ | Synapse - Monitoring | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Analytics.Synapse.Monitoring/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Monitoring-readme-pre) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Monitoring_1.0.0-beta.3/sdk/synapse/Azure.Analytics.Synapse.Monitoring/) | | Synapse - Spark | NuGet [1.0.0-preview.6](https://www.nuget.org/packages/Azure.Analytics.Synapse.Spark/1.0.0-preview.6) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Spark-readme-pre) | GitHub [1.0.0-preview.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Spark_1.0.0-preview.6/sdk/synapse/Azure.Analytics.Synapse.Spark/) | | System Memory Data | NuGet [1.0.2](https://www.nuget.org/packages/System.Memory.Data/1.0.2) | [docs](/dotnet/api/overview/azure/System.Memory.Data-readme) | GitHub [1.0.2](https://github.com/Azure/azure-sdk-for-net/tree/System.Memory.Data_1.0.2/sdk/core/System.Memory.Data/) | -| Tables | NuGet [12.0.0](https://www.nuget.org/packages/Azure.Data.Tables/12.0.0) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.0.0/sdk/tables/Azure.Data.Tables/) | -| Text Analytics | NuGet [5.1.0-beta.7](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.1.0-beta.7) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme-pre) | GitHub [5.1.0-beta.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.1.0-beta.7/sdk/textanalytics/Azure.AI.TextAnalytics/) | -| WebJobs Extensions - Event Grid | NuGet [3.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventGrid/3.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventGrid-readme-pre) | GitHub [3.0.0-beta.3](https://github.com/Azure/azure-functions-eventgrid-extension/tree/v2.1.0/src/EventGridExtension) | -| WebJobs Extensions - Event Hubs | NuGet [5.0.0-beta.6](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventHubs/5.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventHubs-readme-pre) | GitHub [5.0.0-beta.6](https://github.com/Azure/azure-webjobs-sdk-extensions) | -| WebJobs Extensions - Service Bus | NuGet [5.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/5.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.ServiceBus-readme-pre) | GitHub [5.0.0-beta.3](https://github.com/Azure/azure-functions-servicebus-extension/tree/v4.1.2) | +| Tables | NuGet [12.0.1](https://www.nuget.org/packages/Azure.Data.Tables/12.0.1) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.0.1/sdk/tables/Azure.Data.Tables/) | +| Text Analytics | NuGet [5.0.0](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.0.0)
NuGet [5.1.0-beta.7](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.1.0-beta.7) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme) | GitHub [5.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.0.0/sdk/textanalytics/Azure.AI.TextAnalytics/)
GitHub [5.1.0-beta.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.1.0-beta.7/sdk/textanalytics/Azure.AI.TextAnalytics/) | +| WebJobs Extensions - Event Grid | NuGet [3.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventGrid/3.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventGrid-readme-pre) | GitHub [3.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.EventGrid_3.0.0-beta.3/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/) | +| WebJobs Extensions - Event Hubs | NuGet [5.0.0-beta.6](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventHubs/5.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventHubs-readme-pre) | GitHub [5.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.EventHubs_5.0.0-beta.6/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/) | +| WebJobs Extensions - Service Bus | NuGet [5.0.0-beta.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/5.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.ServiceBus-readme-pre) | GitHub [5.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.ServiceBus_5.0.0-beta.4/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/) | | WebJobs Extensions - WebPubSub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.WebPubSub/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.WebPubSub_1.0.0-beta.1/sdk/webpubsub/Microsoft.Azure.WebJobs.Extensions.WebPubSub/) | | WebPubSub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.WebPubSub/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.WebPubSub-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.WebPubSub_1.0.0-beta.1/sdk/webpubsub/Azure.Messaging.WebPubSub/) | | Resource Management - App Configuration | NuGet [1.0.0-preview.1](https://www.nuget.org/packages/Azure.ResourceManager.AppConfiguration/1.0.0-preview.1) | [docs](/dotnet/api/overview/azure/ResourceManager.AppConfiguration-readme-pre) | GitHub [1.0.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.AppConfiguration_1.0.0-preview.1/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/) | @@ -107,11 +108,10 @@ | Microsoft.Azure.Management.KubernetesConfiguration | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Management.KubernetesConfiguration/1.0.0) | | | | Microsoft.Azure.Management.ProviderHub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Management.ProviderHub/1.0.0-beta.1) | | | | Microsoft.Azure.Management.Purview | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Management.Purview/1.0.0-beta.1) | | | -| Microsoft.Azure.Management.Quantum | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Management.Quantum/1.0.0-beta.1) | | | +| Microsoft.Azure.Management.Quantum | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Microsoft.Azure.Management.Quantum/1.0.0-beta.2) | | | | Microsoft.Azure.Management.ServiceFabricManagedClusters | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Management.ServiceFabricManagedClusters/1.0.0)
NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Management.ServiceFabricManagedClusters/1.0.0-beta.1) | | | | Microsoft.Azure.Management.StoragePool | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Management.StoragePool/1.0.0) | | | | Microsoft.Azure.Management.VideoAnalyzer | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Management.VideoAnalyzer/1.0.0-beta.1) | | | -| Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/1.0.0-beta.1) | | | | Microsoft.Azure.SignalR.Emulator | NuGet [1.0.0-preview1-10767](https://www.nuget.org/packages/Microsoft.Azure.SignalR.Emulator/1.0.0-preview1-10767) | | | | Anomaly Detector | NuGet [3.0.0-preview.3](https://www.nuget.org/packages/Azure.AI.AnomalyDetector/3.0.0-preview.3) | [docs](/dotnet/api/overview/azure/AI.AnomalyDetector-readme-pre) | GitHub [3.0.0-preview.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.AnomalyDetector_3.0.0-preview.3/sdk/anomalydetector/Azure.AI.AnomalyDetector/) | | Anomaly Detector | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.AnomalyDetector/1.0.0)
NuGet [1.0.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.AnomalyDetector/1.0.0-preview.1) | | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.AnomalyDetector_1.0.0-preview.1/sdk/cognitiveservices/AnomalyDetector) | @@ -155,7 +155,8 @@ | Client Runtime - Azure Test Framework | NuGet [1.7.7](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime.Azure.TestFramework/1.7.7) | | GitHub [1.7.7](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Rest.ClientRuntime.Azure.TestFramework_1.7.7/sdk/mgmtcommon/TestFramework/ClientRuntime.Azure.TestFramework) | | Client Runtime - ETW | NuGet [2.1.3](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime.Etw/2.1.3) | | GitHub [2.1.3](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/mgmtcommon/ClientRuntime.Etw) | | Client Runtime - Log4Net | NuGet [2.1.4](https://www.nuget.org/packages/Microsoft.Rest.ClientRuntime.Log4Net/2.1.4) | | GitHub [2.1.4](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/mgmtcommon/ClientRuntime.Log4Net) | -| Cognitive Search | NuGet [11.2.1](https://www.nuget.org/packages/Azure.Search.Documents/11.2.1)
NuGet [11.3.0-beta.2](https://www.nuget.org/packages/Azure.Search.Documents/11.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.2.1/sdk/search/Azure.Search.Documents/)
GitHub [11.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.3.0-beta.2/sdk/search/Azure.Search.Documents/) | +| CloudNative CloudEvents with Event Grid | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents_1.0.0-beta.2/sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/) | +| Cognitive Search | NuGet [11.3.0](https://www.nuget.org/packages/Azure.Search.Documents/11.3.0) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.3.0/sdk/search/Azure.Search.Documents/) | | Commerce Usage Aggregates | NuGet [1.5.3](https://www.nuget.org/packages/Microsoft.Azure.Commerce.UsageAggregates/1.5.3) | | | | Common | NuGet [2.2.1](https://www.nuget.org/packages/Microsoft.Azure.Common/2.2.1) | | | | Common - Authentication | NuGet [1.7.0-preview](https://www.nuget.org/packages/Microsoft.Azure.Common.Authentication/1.7.0-preview) | | | @@ -166,19 +167,19 @@ | Communication Phone Numbers | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.PhoneNumbers/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.PhoneNumbers-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.PhoneNumbers_1.0.1/sdk/communication/Azure.Communication.PhoneNumbers/) | | Communication SMS | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Sms/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Sms-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.0.1/sdk/communication/Azure.Communication.Sms/) | | Computer Vision | NuGet [7.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.ComputerVision/7.0.0) | | GitHub [7.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Vision.ComputerVision_6.0.0-preview.1/sdk/cognitiveservices/Vision.ComputerVision) | -| ConfidentialLedger | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.0.0-beta.2/sdk/confidentialledger/Azure.Security.ConfidentialLedger/) | +| ConfidentialLedger | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Security.ConfidentialLedger-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.0.0-beta.2/sdk/confidentialledger/Azure.Security.ConfidentialLedger/) | | ConfidentialLedger | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Storage.ConfidentialLedger/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Storage.ConfidentialLedger-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.ConfidentialLedger_1.0.0-beta.1/sdk/confidentialledger/Azure.Storage.ConfidentialLedger/) | | Configuration Manager | NuGet [4.0.0](https://www.nuget.org/packages/Microsoft.Azure.ConfigurationManager/4.0.0) | | | | Container Registry | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Containers.ContainerRegistry/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Containers.ContainerRegistry-readme-pre) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Containers.ContainerRegistry_1.0.0-beta.3/sdk/containerregistry/Azure.Containers.ContainerRegistry/) | | Container Registry | NuGet [1.0.0-preview.2](https://www.nuget.org/packages/Microsoft.Azure.ContainerRegistry/1.0.0-preview.2) | | GitHub [1.0.0-preview.2](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.ContainerRegistry_1.0.0-preview.2/sdk/containerregistry/Microsoft.Azure.ContainerRegistry/) | | Content Moderator | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.ContentModerator/2.0.0) | | | | Core | NuGet [1.15.0](https://www.nuget.org/packages/Azure.Core/1.15.0) | [docs](/dotnet/api/overview/azure/Core-readme) | GitHub [1.15.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core_1.15.0/sdk/core/Azure.Core/) | -| Core - AMQP | NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Core.Amqp/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Core.Amqp-readme-pre) | GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Amqp_1.1.0-beta.1/sdk/core/Azure.Core.Amqp/) | +| Core - AMQP | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Core.Amqp/1.1.0) | [docs](/dotnet/api/overview/azure/Core.Amqp-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Amqp_1.1.0/sdk/core/Azure.Core.Amqp/) | | Core Newtonsoft Json | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Core.NewtonsoftJson/1.0.0)
NuGet [1.0.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.Core.NewtonsoftJson/1.0.0-preview.1) | | | -| Core Spatial | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial/1.0.0)
NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial/1.0.0-beta.1) | | | +| Core Spatial | NuGet [1.1.0](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial/1.1.0) | | | | Core Spatial Newtonsoft Json | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial.NewtonsoftJson/1.0.0)
NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.Core.Spatial.NewtonsoftJson/1.0.0-beta.1) | | | | Cosmos DB | NuGet [4.0.0-preview3](https://www.nuget.org/packages/Azure.Cosmos/4.0.0-preview3) | [docs](/dotnet/api/azure.cosmos) | GitHub [4.0.0-preview3](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/4.0.0-preview3) | -| Cosmos DB | NuGet [3.19.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.19.0)
NuGet [3.19.0-preview1](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.19.0-preview1) | [docs](/dotnet/api/overview/azure/cosmosdb) | GitHub [3.19.0](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/3.12.0/Microsoft.Azure.Cosmos) | +| Cosmos DB | NuGet [3.20.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.20.0) | [docs](/dotnet/api/overview/azure/cosmosdb) | GitHub [3.20.0](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/3.12.0/Microsoft.Azure.Cosmos) | | Cosmos DB - BulkExecutor | NuGet [2.5.1-preview](https://www.nuget.org/packages/Microsoft.Azure.CosmosDB.BulkExecutor/2.5.1-preview) | | GitHub [2.5.1-preview](https://github.com/Azure/azure-cosmosdb-bulkexecutor-dotnet-getting-started) | | Cosmos DB - Direct | NuGet [3.20.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Direct/3.20.0) | | GitHub [3.20.0](https://github.com/Azure/azure-cosmos-dotnet-v3) | | Cosmos DB - Encryption | NuGet [1.0.0-previewV15](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption/1.0.0-previewV15) | | GitHub [1.0.0-previewV15](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/encryption/1.0.0-preview4/Microsoft.Azure.Cosmos.Encryption) | @@ -196,8 +197,8 @@ | Document DB - Core | NuGet [2.14.1](https://www.nuget.org/packages/Microsoft.Azure.DocumentDB.Core/2.14.1) | | GitHub [2.14.1](https://github.com/Azure/azure-cosmos-dotnet-v2) | | Document Translation | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Translation.Document/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Translation.Document-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Document_1.0.0-beta.2/sdk/translation/Azure.AI.Translation.Document/) | | Entity Search | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.EntitySearch/2.0.0) | | | -| Event Grid | NuGet [4.3.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid/4.3.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid-readme) | GitHub [4.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_4.3.0/sdk/eventgrid/Azure.Messaging.EventGrid/) | -| Event Grid | NuGet [3.2.0](https://www.nuget.org/packages/Microsoft.Azure.EventGrid/3.2.0) | [docs](/dotnet/api/overview/azure/eventgrid) | GitHub [3.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.EventGrid_3.2.0/sdk/eventgrid/Microsoft.Azure.EventGrid/) | +| Event Grid | NuGet [4.4.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid/4.4.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid-readme) | GitHub [4.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_4.4.0/sdk/eventgrid/Azure.Messaging.EventGrid/) | +| Event Grid | NuGet [3.2.1](https://www.nuget.org/packages/Microsoft.Azure.EventGrid/3.2.1) | [docs](/dotnet/api/overview/azure/eventgrid) | GitHub [3.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.EventGrid_3.2.1/sdk/eventgrid/Microsoft.Azure.EventGrid/) | | Event Hubs | NuGet [5.4.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.4.1)
NuGet [5.5.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.5.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs-readme) | GitHub [5.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.4.1/sdk/eventhub/Azure.Messaging.EventHubs/)
GitHub [5.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.5.0-beta.1/sdk/eventhub/Azure.Messaging.EventHubs/) | | Event Hubs | NuGet [4.3.2](https://www.nuget.org/packages/Microsoft.Azure.EventHubs/4.3.2) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.EventHubs-readme) | GitHub [4.3.2](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.EventHubs_4.3.2/sdk/eventhub/Microsoft.Azure.EventHubs/) | | Event Hubs - Event Processor | NuGet [5.4.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor/5.4.1)
NuGet [5.5.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor/5.5.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs.Processor-readme) | GitHub [5.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs.Processor_5.4.1/sdk/eventhub/Azure.Messaging.EventHubs.Processor/)
GitHub [5.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs.Processor_5.5.0-beta.1/sdk/eventhub/Azure.Messaging.EventHubs.Processor/) | @@ -227,13 +228,13 @@ | Jobs - Core | NuGet [0.3.2-beta](https://www.nuget.org/packages/Microsoft.Azure.Jobs.Core/0.3.2-beta) | | GitHub [0.3.2-beta](https://github.com/Azure/azure-webjobs-sdk) | | Jobs - Service Bus | NuGet [0.3.2-beta](https://www.nuget.org/packages/Microsoft.Azure.Jobs.ServiceBus/0.3.2-beta) | | GitHub [0.3.2-beta](https://github.com/Azure/azure-webjobs-sdk) | | Key Vault | NuGet [3.0.5](https://www.nuget.org/packages/Microsoft.Azure.KeyVault/3.0.5) | | GitHub [3.0.5](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.KeyVault_3.0.5/sdk/keyvault/Microsoft.Azure.KeyVault/) | -| Key Vault - Administration | NuGet [4.0.0-beta.5](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.0.0-beta.5) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme-pre) | GitHub [4.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.0.0-beta.5/sdk/keyvault/Azure.Security.KeyVault.Administration/) | -| Key Vault - Certificates | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.1.1)
NuGet [4.2.0-beta.6](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.2.0-beta.6) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Certificates-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Certificates/)
GitHub [4.2.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.2.0-beta.6/sdk/keyvault/Azure.Security.KeyVault.Certificates/) | +| Key Vault - Administration | NuGet [4.0.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.0.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme) | GitHub [4.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.0.0/sdk/keyvault/Azure.Security.KeyVault.Administration/) | +| Key Vault - Certificates | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Certificates-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Certificates/) | | Key Vault - Core | NuGet [3.0.5](https://www.nuget.org/packages/Microsoft.Azure.KeyVault.Core/3.0.5) | | GitHub [3.0.5](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.KeyVault.Core_3.0.5/sdk/keyvault/Microsoft.Azure.KeyVault.Core/) | | Key Vault - Cryptography | NuGet [3.0.5](https://www.nuget.org/packages/Microsoft.Azure.KeyVault.Cryptography/3.0.5) | | GitHub [3.0.5](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.KeyVault.Cryptography_3.0.5/sdk/keyvault/Microsoft.Azure.KeyVault.Cryptography/) | | Key Vault - Extensions | NuGet [3.0.5](https://www.nuget.org/packages/Microsoft.Azure.KeyVault.Extensions/3.0.5) | | GitHub [3.0.5](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.KeyVault.Extensions_3.0.5/sdk/keyvault/Microsoft.Azure.KeyVault.Extensions/) | -| Key Vault - Keys | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.1.1)
NuGet [4.2.0-beta.6](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.2.0-beta.6) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Keys-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Keys/)
GitHub [4.2.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.2.0-beta.6/sdk/keyvault/Azure.Security.KeyVault.Keys/) | -| Key Vault - Secrets | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.1.1)
NuGet [4.2.0-beta.5](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.2.0-beta.5) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Secrets-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Secrets/)
GitHub [4.2.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.2.0-beta.5/sdk/keyvault/Azure.Security.KeyVault.Secrets/) | +| Key Vault - Keys | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Keys-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Keys/) | +| Key Vault - Secrets | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Secrets-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Secrets/) | | Key Vault - WebKey | NuGet [3.0.5](https://www.nuget.org/packages/Microsoft.Azure.KeyVault.WebKey/3.0.5) | | GitHub [3.0.5](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.KeyVault.WebKey_3.0.5/sdk/keyvault/Microsoft.Azure.KeyVault.WebKey/) | | Kinect Developer Kit | NuGet [1.0.1](https://www.nuget.org/packages/Microsoft.Azure.Kinect.BodyTracking/1.0.1) | | | | Kinect Developer Kit | NuGet [1.4.1](https://www.nuget.org/packages/Microsoft.Azure.Kinect.Sensor/1.4.1) | | GitHub [1.4.1](https://github.com/Microsoft/Azure-Kinect-Sensor-SDK) | @@ -267,7 +268,7 @@ | Mobile Server - Cross Domain | NuGet [2.0.3](https://www.nuget.org/packages/Microsoft.Azure.Mobile.Server.CrossDomain/2.0.3) | | | | Mobile Service - Resource Broker | NuGet [1.0.2.1](https://www.nuget.org/packages/Microsoft.WindowsAzure.Mobile.Service.ResourceBroker/1.0.2.1) | | | | Monitor OpenTelemetry Exporter | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.0.0-beta.2/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) | -| Monitor Query | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Monitor.Query/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.0.0-beta.1/sdk/monitor/Azure.Monitor.Query/) | +| Monitor Query | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Monitor.Query/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.0.0-beta.1/sdk/monitor/Azure.Monitor.Query/) | | News Search | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.NewsSearch/2.0.0) | | | | Notification Hubs | NuGet [4.1.0](https://www.nuget.org/packages/Microsoft.Azure.NotificationHubs/4.1.0) | | GitHub [4.1.0](https://github.com/Azure/azure-notificationhubs-dotnet) | | Operational Insights | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.OperationalInsights/1.0.0) | | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/operationalinsights/Microsoft.Azure.OperationalInsights) | @@ -281,14 +282,14 @@ | Search - Common | NuGet [10.1.0](https://www.nuget.org/packages/Microsoft.Azure.Search.Common/10.1.0) | | GitHub [10.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Search.Common_10.1.0/sdk/search/Microsoft.Azure.Search.Common/) | | Search - Data | NuGet [10.1.0](https://www.nuget.org/packages/Microsoft.Azure.Search.Data/10.1.0) | | GitHub [10.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Search.Data_10.1.0/sdk/search/Microsoft.Azure.Search.Data/) | | Search - Service | NuGet [10.1.0](https://www.nuget.org/packages/Microsoft.Azure.Search.Service/10.1.0) | | GitHub [10.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Search.Service_10.1.0/sdk/search/Microsoft.Azure.Search.Service/) | -| Service Bus | NuGet [7.1.2](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.1.2)
NuGet [7.2.0-beta.3](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.2.0-beta.3) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.1.2/sdk/servicebus/Azure.Messaging.ServiceBus/)
GitHub [7.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.2.0-beta.3/sdk/servicebus/Azure.Messaging.ServiceBus/) | +| Service Bus | NuGet [7.2.0](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.2.0) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.2.0/sdk/servicebus/Azure.Messaging.ServiceBus/) | | Service Bus | NuGet [5.1.3](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus/5.1.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.ServiceBus-readme) | GitHub [5.1.3](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.ServiceBus_5.1.3/sdk/servicebus/Microsoft.Azure.ServiceBus/) | | Service Bus - Message ID plugin | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus.MessageIdPlugin/2.0.0) | | | | SignalR | NuGet [1.8.2](https://www.nuget.org/packages/Microsoft.Azure.SignalR/1.8.2) | | GitHub [1.8.2](https://github.com/Azure/azure-signalr/tree/v1.5.0/src/Microsoft.Azure.SignalR) | | SignalR - ASP.NET | NuGet [1.8.2](https://www.nuget.org/packages/Microsoft.Azure.SignalR.AspNet/1.8.2) | | GitHub [1.8.2](https://github.com/Azure/azure-signalr/tree/v1.5.0/src/Microsoft.Azure.SignalR.AspNet) | | SignalR - Benchmark | NuGet [1.0.0-preview1-10415](https://www.nuget.org/packages/Microsoft.Azure.SignalR.Benchmark/1.0.0-preview1-10415) | | GitHub [1.0.0-preview1-10415](https://github.com/azure/azure-signalr-bench) | | SignalR - Protocols | NuGet [1.8.2](https://www.nuget.org/packages/Microsoft.Azure.SignalR.Protocols/1.8.2) | | GitHub [1.8.2](https://github.com/Azure/azure-signalr/tree/v1.5.0/src/Microsoft.Azure.SignalR.Protocols) | -| SignalR - Serverless Protocols | NuGet [1.4.1](https://www.nuget.org/packages/Microsoft.Azure.SignalR.Serverless.Protocols/1.4.1) | | GitHub [1.4.1](https://github.com/Azure/azure-functions-signalrservice-extension/tree/v1.2.0/src/Microsoft.Azure.SignalR.Serverless.Protocols) | +| SignalR - Serverless Protocols | NuGet [1.4.2](https://www.nuget.org/packages/Microsoft.Azure.SignalR.Serverless.Protocols/1.4.2) | | GitHub [1.4.2](https://github.com/Azure/azure-functions-signalrservice-extension/tree/v1.2.0/src/Microsoft.Azure.SignalR.Serverless.Protocols) | | Speech | NuGet [1.17.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech/1.17.0) | | | | Speech Remoteconversation | NuGet [1.17.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Remoteconversation/1.17.0) | | | | Speech Xamarin iOS | NuGet [1.17.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Xamarin.iOS/1.17.0) | | | @@ -315,12 +316,12 @@ | Synapse - Monitoring | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Analytics.Synapse.Monitoring/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Monitoring-readme-pre) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Monitoring_1.0.0-beta.3/sdk/synapse/Azure.Analytics.Synapse.Monitoring/) | | Synapse - Spark | NuGet [1.0.0-preview.6](https://www.nuget.org/packages/Azure.Analytics.Synapse.Spark/1.0.0-preview.6) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Spark-readme-pre) | GitHub [1.0.0-preview.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Spark_1.0.0-preview.6/sdk/synapse/Azure.Analytics.Synapse.Spark/) | | System Memory Data | NuGet [1.0.2](https://www.nuget.org/packages/System.Memory.Data/1.0.2) | [docs](/dotnet/api/overview/azure/System.Memory.Data-readme) | GitHub [1.0.2](https://github.com/Azure/azure-sdk-for-net/tree/System.Memory.Data_1.0.2/sdk/core/System.Memory.Data/) | -| Tables | NuGet [12.0.0](https://www.nuget.org/packages/Azure.Data.Tables/12.0.0) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.0.0/sdk/tables/Azure.Data.Tables/) | +| Tables | NuGet [12.0.1](https://www.nuget.org/packages/Azure.Data.Tables/12.0.1) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.0.1/sdk/tables/Azure.Data.Tables/) | | Tables | NuGet [2.0.0-preview](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Table/2.0.0-preview) | | | | Tables | NuGet [2.1.2](https://www.nuget.org/packages/Microsoft.Azure.CosmosDB.Table/2.1.2) | | | | Template | NuGet [1.0.2-preview1](https://www.nuget.org/packages/Microsoft.Azure.Template/1.0.2-preview1) | | | | Test HttpRecorder | NuGet [1.13.3](https://www.nuget.org/packages/Microsoft.Azure.Test.HttpRecorder/1.13.3) | | GitHub [1.13.3](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/mgmtcommon/TestFramework/Microsoft.Azure.Test.HttpRecorder) | -| Text Analytics | NuGet [5.1.0-beta.7](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.1.0-beta.7) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme-pre) | GitHub [5.1.0-beta.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.1.0-beta.7/sdk/textanalytics/Azure.AI.TextAnalytics/) | +| Text Analytics | NuGet [5.0.0](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.0.0)
NuGet [5.1.0-beta.7](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.1.0-beta.7) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme) | GitHub [5.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.0.0/sdk/textanalytics/Azure.AI.TextAnalytics/)
GitHub [5.1.0-beta.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.1.0-beta.7/sdk/textanalytics/Azure.AI.TextAnalytics/) | | Text Analytics | NuGet [4.1.0-preview.2](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Language.TextAnalytics/4.1.0-preview.2) | | GitHub [4.1.0-preview.2](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Language.TextAnalytics_4.1.0-preview.2/sdk/cognitiveservices/Language.TextAnalytics) | | Video Search | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.VideoSearch/2.0.0) | | | | Vision Content Moderator | NuGet [2.1.0-preview.1](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Vision.ContentModerator/2.1.0-preview.1) | | GitHub [2.1.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.CognitiveServices.Vision.ContentModerator_2.1.0-preview.1/sdk/cognitiveservices/Vision.ContentModerator) | @@ -353,8 +354,8 @@ | WebJobs Extensions - Durable Task | NuGet [2.5.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask/2.5.0) | [docs](/dotnet/api/overview/azure/functions) | GitHub [2.5.0](https://github.com/Azure/azure-functions-durable-extension/tree/v2.2.2/src/WebJobs.Extensions.DurableTask) | | WebJobs Extensions - Durable Task Analyzers | NuGet [0.4.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers/0.4.0) | | GitHub [0.4.0](https://github.com/Azure/azure-functions-durable-extension/tree/Analyzer-v0.3.0/src/WebJobs.Extensions.DurableTask.Analyzers) | | WebJobs Extensions - Edge Hub | NuGet [1.0.7](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EdgeHub/1.0.7) | | GitHub [1.0.7](https://github.com/Azure/iotedge/tree/1.0.7/edge-hub) | -| WebJobs Extensions - Event Grid | NuGet [3.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventGrid/3.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventGrid-readme-pre) | GitHub [3.0.0-beta.3](https://github.com/Azure/azure-functions-eventgrid-extension/tree/v2.1.0/src/EventGridExtension) | -| WebJobs Extensions - Event Hubs | NuGet [5.0.0-beta.6](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventHubs/5.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventHubs-readme-pre) | GitHub [5.0.0-beta.6](https://github.com/Azure/azure-webjobs-sdk-extensions) | +| WebJobs Extensions - Event Grid | NuGet [3.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventGrid/3.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventGrid-readme-pre) | GitHub [3.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.EventGrid_3.0.0-beta.3/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/) | +| WebJobs Extensions - Event Hubs | NuGet [5.0.0-beta.6](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventHubs/5.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventHubs-readme-pre) | GitHub [5.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.EventHubs_5.0.0-beta.6/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/) | | WebJobs Extensions - Http | NuGet [3.0.12](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Http/3.0.12) | | GitHub [3.0.12](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/v3.0.2/src/WebJobs.Extensions.Http) | | WebJobs Extensions - Kafka | NuGet [3.3.2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Kafka/3.3.2) | | GitHub [3.3.2](https://github.com/Azure/azure-functions-kafka-extension/tree/3.0.0/src/Microsoft.Azure.WebJobs.Extensions.Kafka) | | WebJobs Extensions - Microsoft Graph | NuGet [1.0.0-beta6](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.MicrosoftGraph/1.0.0-beta6) | | GitHub [1.0.0-beta6](https://github.com/Azure/azure-functions-microsoftgraph-extension) | @@ -365,8 +366,8 @@ | WebJobs Extensions - OpenAPI Core | NuGet [0.7.2-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/0.7.2-preview) | | | | WebJobs Extensions - RabbitMQ | NuGet [1.0.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.RabbitMQ/1.0.0)
NuGet [1.0.0-beta](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.RabbitMQ/1.0.0-beta) | | GitHub [1.0.0](https://github.com/Azure/azure-functions-rabbitmq-extension/tree/v0.2.2029-beta) | | WebJobs Extensions - SendGrid | NuGet [3.0.2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.SendGrid/3.0.2) | | GitHub [3.0.2](https://github.com/Azure/azure-webjobs-sdk-extensions/tree/v3.0.0/src/WebJobs.Extensions.SendGrid) | -| WebJobs Extensions - Service Bus | NuGet [5.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/5.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.ServiceBus-readme-pre) | GitHub [5.0.0-beta.3](https://github.com/Azure/azure-functions-servicebus-extension/tree/v4.1.2) | -| WebJobs Extensions - SignalR Service | NuGet [1.4.1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.SignalRService/1.4.1) | | GitHub [1.4.1](https://github.com/Azure/azure-functions-signalrservice-extension/tree/v1.2.0/src/SignalRServiceExtension) | +| WebJobs Extensions - Service Bus | NuGet [5.0.0-beta.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/5.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.ServiceBus-readme-pre) | GitHub [5.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.ServiceBus_5.0.0-beta.4/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/) | +| WebJobs Extensions - SignalR Service | NuGet [1.4.2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.SignalRService/1.4.2) | | GitHub [1.4.2](https://github.com/Azure/azure-functions-signalrservice-extension/tree/v1.2.0/src/SignalRServiceExtension) | | WebJobs Extensions - Storage | NuGet [4.0.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Storage/4.0.3)
NuGet [5.0.0-beta.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Storage/5.0.0-beta.4) | | GitHub [4.0.3](https://github.com/Azure/azure-webjobs-sdk/tree/master/src/Microsoft.Azure.WebJobs.Extensions.Storage) | | WebJobs Extensions - Storage Blobs | NuGet [5.0.0-beta.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Storage.Blobs/5.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.Storage.Blobs-readme-pre) | | | WebJobs Extensions - Storage Queues | NuGet [5.0.0-beta.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/5.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.Storage.Queues-readme-pre) | | @@ -449,7 +450,7 @@ | Management - Container Service Fluent | NuGet [1.37.1](https://www.nuget.org/packages/Microsoft.Azure.Management.ContainerService.Fluent/1.37.1) | | | | Management - Content Delivery Network | NuGet [6.1.0](https://www.nuget.org/packages/Microsoft.Azure.Management.Cdn/6.1.0) | | GitHub [6.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.Cdn_6.1.0/sdk/cdn/Microsoft.Azure.Management.Cdn/) | | Management - Content Delivery Network Fluent | NuGet [1.37.1](https://www.nuget.org/packages/Microsoft.Azure.Management.Cdn.Fluent/1.37.1) | [docs](/dotnet/api/overview/azure/cdn) | | -| Management - Cosmos DB | NuGet [3.0.0](https://www.nuget.org/packages/Microsoft.Azure.Management.CosmosDB/3.0.0) | | GitHub [3.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.CosmosDB_3.0.0/sdk/cosmosdb/Microsoft.Azure.Management.CosmosDB/) | +| Management - Cosmos DB | NuGet [3.1.0](https://www.nuget.org/packages/Microsoft.Azure.Management.CosmosDB/3.1.0) | | GitHub [3.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.CosmosDB_3.1.0/sdk/cosmosdb/Microsoft.Azure.Management.CosmosDB/) | | Management - Cosmos DB Fluent | NuGet [1.37.1](https://www.nuget.org/packages/Microsoft.Azure.Management.CosmosDB.Fluent/1.37.1) | | | | Management - Customer Insights | NuGet [0.9.1-preview](https://www.nuget.org/packages/Microsoft.Azure.Management.CustomerInsights/0.9.1-preview) | | GitHub [0.9.1-preview](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/customer-insights/Microsoft.Azure.Management.CustomerInsights) | | Management - Customer Insights Fluent | NuGet [1.9.1-beta](https://www.nuget.org/packages/Microsoft.Azure.Management.CustomerInsights.Fluent/1.9.1-beta) | | | @@ -508,7 +509,7 @@ | Management - Maps | NuGet [1.0.2](https://www.nuget.org/packages/Microsoft.Azure.Management.Maps/1.0.2) | | GitHub [1.0.2](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/maps/Microsoft.Azure.Management.Maps) | | Management - Marketplace | NuGet [1.1.0](https://www.nuget.org/packages/Microsoft.Azure.Management.Marketplace/1.1.0)
NuGet [2.0.0-preview](https://www.nuget.org/packages/Microsoft.Azure.Management.Marketplace/2.0.0-preview) | | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.Marketplace_1.1.0/sdk/marketplace/Microsoft.Azure.Management.Marketplace/)
GitHub [2.0.0-preview](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.Marketplace_2.0.0-preview/sdk/marketplace/Microsoft.Azure.Management.Marketplace/) | | Management - Marketplace Ordering | NuGet [1.0.1](https://www.nuget.org/packages/Microsoft.Azure.Management.MarketplaceOrdering/1.0.1) | | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/marketplaceordering/Microsoft.Azure.Management.MarketplaceOrdering) | -| Management - Media Services | NuGet [3.0.5](https://www.nuget.org/packages/Microsoft.Azure.Management.Media/3.0.5) | | GitHub [3.0.5](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.Media_3.0.5/sdk/mediaservices/Microsoft.Azure.Management.Media/) | +| Management - Media Services | NuGet [4.0.0](https://www.nuget.org/packages/Microsoft.Azure.Management.Media/4.0.0) | | GitHub [4.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.Media_4.0.0/sdk/mediaservices/Microsoft.Azure.Management.Media/) | | Management - Migrate Resource Mover | NuGet [2.0.0](https://www.nuget.org/packages/Microsoft.Azure.Management.Migrate.ResourceMover/2.0.0) | | | | Management - Mixed Reality | NuGet [3.0.0](https://www.nuget.org/packages/Microsoft.Azure.Management.MixedReality/3.0.0) | [docs](/dotnet/api/overview/azure/mixed-reality) | GitHub [3.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.MixedReality_3.0.0/sdk/mixedreality/Microsoft.Azure.Management.MixedReality/) | | Management - Monitor | NuGet [0.25.3-preview](https://www.nuget.org/packages/Microsoft.Azure.Management.Monitor/0.25.3-preview) | | GitHub [0.25.3-preview](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Management.Monitor_0.25.3-preview/sdk/monitor/Microsoft.Azure.Management.Monitor/) | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index fe6bc7f76eca3..28ba2aaa572d7 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -10,21 +10,22 @@ | Azure Object Anchors Conversion | NuGet [0.2.0-beta.1](https://www.nuget.org/packages/Azure.MixedReality.ObjectAnchors.Conversion/0.2.0-beta.1) | [docs](/dotnet/api/overview/azure/MixedReality.ObjectAnchors.Conversion-readme-pre) | GitHub [0.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.MixedReality.ObjectAnchors.Conversion_0.2.0-beta.1/sdk/objectanchors/Azure.MixedReality.ObjectAnchors.Conversion/) | | Azure Remote Rendering | NuGet [1.0.1](https://www.nuget.org/packages/Azure.MixedReality.RemoteRendering/1.0.1) | [docs](/dotnet/api/overview/azure/MixedReality.RemoteRendering-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.MixedReality.RemoteRendering_1.0.1/sdk/remoterendering/Azure.MixedReality.RemoteRendering/) | | Azure Video Analyzer Edge | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.Media.VideoAnalyzer.Edge/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Media.VideoAnalyzer.Edge-readme-pre) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.VideoAnalyzer.Edge_1.0.0-beta.4/sdk/videoanalyzer/Azure.Media.VideoAnalyzer.Edge/) | -| Cognitive Search | NuGet [11.2.1](https://www.nuget.org/packages/Azure.Search.Documents/11.2.1)
NuGet [11.3.0-beta.2](https://www.nuget.org/packages/Azure.Search.Documents/11.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.2.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.2.1/sdk/search/Azure.Search.Documents/)
GitHub [11.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.3.0-beta.2/sdk/search/Azure.Search.Documents/) | +| CloudNative CloudEvents with Event Grid | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents_1.0.0-beta.2/sdk/eventgrid/Microsoft.Azure.Messaging.EventGrid.CloudNativeCloudEvents/) | +| Cognitive Search | NuGet [11.3.0](https://www.nuget.org/packages/Azure.Search.Documents/11.3.0) | [docs](/dotnet/api/overview/azure/Search.Documents-readme) | GitHub [11.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Search.Documents_11.3.0/sdk/search/Azure.Search.Documents/) | | Communication Chat | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Chat/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Chat-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Chat_1.0.1/sdk/communication/Azure.Communication.Chat/) | | Communication Common | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Common/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Common-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Common_1.0.1/sdk/communication/Azure.Communication.Common/) | | Communication Identity | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Identity/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Identity-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Identity_1.0.1/sdk/communication/Azure.Communication.Identity/) | | Communication Phone Numbers | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.PhoneNumbers/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.PhoneNumbers-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.PhoneNumbers_1.0.1/sdk/communication/Azure.Communication.PhoneNumbers/) | | Communication SMS | NuGet [1.0.1](https://www.nuget.org/packages/Azure.Communication.Sms/1.0.1) | [docs](/dotnet/api/overview/azure/Communication.Sms-readme) | GitHub [1.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Communication.Sms_1.0.1/sdk/communication/Azure.Communication.Sms/) | -| ConfidentialLedger | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.0.0-beta.2/sdk/confidentialledger/Azure.Security.ConfidentialLedger/) | +| ConfidentialLedger | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Security.ConfidentialLedger/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Security.ConfidentialLedger-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.ConfidentialLedger_1.0.0-beta.2/sdk/confidentialledger/Azure.Security.ConfidentialLedger/) | | ConfidentialLedger | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Storage.ConfidentialLedger/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Storage.ConfidentialLedger-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.ConfidentialLedger_1.0.0-beta.1/sdk/confidentialledger/Azure.Storage.ConfidentialLedger/) | | Container Registry | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Containers.ContainerRegistry/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Containers.ContainerRegistry-readme-pre) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Containers.ContainerRegistry_1.0.0-beta.3/sdk/containerregistry/Azure.Containers.ContainerRegistry/) | | Core | NuGet [1.15.0](https://www.nuget.org/packages/Azure.Core/1.15.0) | [docs](/dotnet/api/overview/azure/Core-readme) | GitHub [1.15.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core_1.15.0/sdk/core/Azure.Core/) | -| Core - AMQP | NuGet [1.1.0-beta.1](https://www.nuget.org/packages/Azure.Core.Amqp/1.1.0-beta.1) | [docs](/dotnet/api/overview/azure/Core.Amqp-readme-pre) | GitHub [1.1.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Amqp_1.1.0-beta.1/sdk/core/Azure.Core.Amqp/) | +| Core - AMQP | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Core.Amqp/1.1.0) | [docs](/dotnet/api/overview/azure/Core.Amqp-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Core.Amqp_1.1.0/sdk/core/Azure.Core.Amqp/) | | Cosmos DB | NuGet [4.0.0-preview3](https://www.nuget.org/packages/Azure.Cosmos/4.0.0-preview3) | [docs](/dotnet/api/azure.cosmos) | GitHub [4.0.0-preview3](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/releases/4.0.0-preview3) | | Digital Twins - Core | NuGet [1.2.2](https://www.nuget.org/packages/Azure.DigitalTwins.Core/1.2.2) | [docs](/dotnet/api/overview/azure/DigitalTwins.Core-readme) | GitHub [1.2.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.DigitalTwins.Core_1.2.2/sdk/digitaltwins/Azure.DigitalTwins.Core/) | | Document Translation | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.Translation.Document/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.Translation.Document-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.Translation.Document_1.0.0-beta.2/sdk/translation/Azure.AI.Translation.Document/) | -| Event Grid | NuGet [4.3.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid/4.3.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid-readme) | GitHub [4.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_4.3.0/sdk/eventgrid/Azure.Messaging.EventGrid/) | +| Event Grid | NuGet [4.4.0](https://www.nuget.org/packages/Azure.Messaging.EventGrid/4.4.0) | [docs](/dotnet/api/overview/azure/Messaging.EventGrid-readme) | GitHub [4.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventGrid_4.4.0/sdk/eventgrid/Azure.Messaging.EventGrid/) | | Event Hubs | NuGet [5.4.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.4.1)
NuGet [5.5.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs/5.5.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs-readme) | GitHub [5.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.4.1/sdk/eventhub/Azure.Messaging.EventHubs/)
GitHub [5.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs_5.5.0-beta.1/sdk/eventhub/Azure.Messaging.EventHubs/) | | Event Hubs - Event Processor | NuGet [5.4.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor/5.4.1)
NuGet [5.5.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.EventHubs.Processor/5.5.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.EventHubs.Processor-readme) | GitHub [5.4.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs.Processor_5.4.1/sdk/eventhub/Azure.Messaging.EventHubs.Processor/)
GitHub [5.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.EventHubs.Processor_5.5.0-beta.1/sdk/eventhub/Azure.Messaging.EventHubs.Processor/) | | Event Hubs - Schema Registry | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Data.SchemaRegistry/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Data.SchemaRegistry-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.SchemaRegistry_1.0.0-beta.2/sdk/schemaregistry/Azure.Data.SchemaRegistry/) | @@ -32,17 +33,17 @@ | Form Recognizer | NuGet [3.1.1](https://www.nuget.org/packages/Azure.AI.FormRecognizer/3.1.1) | [docs](/dotnet/api/overview/azure/AI.FormRecognizer-readme) | GitHub [3.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.FormRecognizer_3.1.1/sdk/formrecognizer/Azure.AI.FormRecognizer/) | | Identity | NuGet [1.4.0](https://www.nuget.org/packages/Azure.Identity/1.4.0)
NuGet [1.5.0-beta.1](https://www.nuget.org/packages/Azure.Identity/1.5.0-beta.1) | [docs](/dotnet/api/overview/azure/Identity-readme) | GitHub [1.4.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.4.0/sdk/identity/Azure.Identity/)
GitHub [1.5.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Identity_1.5.0-beta.1/sdk/identity/Azure.Identity/) | | IoT Device Update | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.IoT.DeviceUpdate/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/IoT.DeviceUpdate-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.IoT.DeviceUpdate_1.0.0-beta.2/sdk/deviceupdate/Azure.Iot.DeviceUpdate/) | -| Key Vault - Administration | NuGet [4.0.0-beta.5](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.0.0-beta.5) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme-pre) | GitHub [4.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.0.0-beta.5/sdk/keyvault/Azure.Security.KeyVault.Administration/) | -| Key Vault - Certificates | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.1.1)
NuGet [4.2.0-beta.6](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.2.0-beta.6) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Certificates-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Certificates/)
GitHub [4.2.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.2.0-beta.6/sdk/keyvault/Azure.Security.KeyVault.Certificates/) | -| Key Vault - Keys | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.1.1)
NuGet [4.2.0-beta.6](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.2.0-beta.6) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Keys-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Keys/)
GitHub [4.2.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.2.0-beta.6/sdk/keyvault/Azure.Security.KeyVault.Keys/) | -| Key Vault - Secrets | NuGet [4.1.1](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.1.1)
NuGet [4.2.0-beta.5](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.2.0-beta.5) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Secrets-readme) | GitHub [4.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.1.1/sdk/keyvault/Azure.Security.KeyVault.Secrets/)
GitHub [4.2.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.2.0-beta.5/sdk/keyvault/Azure.Security.KeyVault.Secrets/) | +| Key Vault - Administration | NuGet [4.0.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Administration/4.0.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Administration-readme) | GitHub [4.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Administration_4.0.0/sdk/keyvault/Azure.Security.KeyVault.Administration/) | +| Key Vault - Certificates | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Certificates/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Certificates-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Certificates_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Certificates/) | +| Key Vault - Keys | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Keys/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Keys-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Keys_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Keys/) | +| Key Vault - Secrets | NuGet [4.2.0](https://www.nuget.org/packages/Azure.Security.KeyVault.Secrets/4.2.0) | [docs](/dotnet/api/overview/azure/Security.KeyVault.Secrets-readme) | GitHub [4.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Security.KeyVault.Secrets_4.2.0/sdk/keyvault/Azure.Security.KeyVault.Secrets/) | | Media Analytics Edge | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Media.Analytics.Edge/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Media.Analytics.Edge-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Media.Analytics.Edge_1.0.0-beta.1/sdk/mediaservices/Azure.Media.Analytics.Edge) | | Metrics Advisor | NuGet [1.0.0-beta.4](https://www.nuget.org/packages/Azure.AI.MetricsAdvisor/1.0.0-beta.4) | [docs](/dotnet/api/overview/azure/AI.MetricsAdvisor-readme-pre) | GitHub [1.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.MetricsAdvisor_1.0.0-beta.4/sdk/metricsadvisor/Azure.AI.MetricsAdvisor/) | | Monitor OpenTelemetry Exporter | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme-pre) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.0.0-beta.2/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) | -| Monitor Query | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Monitor.Query/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.0.0-beta.1/sdk/monitor/Azure.Monitor.Query/) | +| Monitor Query | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Monitor.Query/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.0.0-beta.1/sdk/monitor/Azure.Monitor.Query/) | | Purview Catalog | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.Purview.Catalog/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.Purview.Catalog-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Purview.Catalog_1.0.0-beta.1/sdk/purview/Azure.Analytics.Purview.Catalog/) | | Purview Scanning | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Analytics.Purview.Scanning/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Analytics.Purview.Scanning-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Purview.Scanning_1.0.0-beta.1/sdk/purview/Azure.Analytics.Purview.Scanning/) | -| Service Bus | NuGet [7.1.2](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.1.2)
NuGet [7.2.0-beta.3](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.2.0-beta.3) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.1.2/sdk/servicebus/Azure.Messaging.ServiceBus/)
GitHub [7.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.2.0-beta.3/sdk/servicebus/Azure.Messaging.ServiceBus/) | +| Service Bus | NuGet [7.2.0](https://www.nuget.org/packages/Azure.Messaging.ServiceBus/7.2.0) | [docs](/dotnet/api/overview/azure/Messaging.ServiceBus-readme) | GitHub [7.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.ServiceBus_7.2.0/sdk/servicebus/Azure.Messaging.ServiceBus/) | | Storage - Blobs | NuGet [12.9.0](https://www.nuget.org/packages/Azure.Storage.Blobs/12.9.0) | [docs](/dotnet/api/overview/azure/Storage.Blobs-readme) | GitHub [12.9.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs_12.9.0/sdk/storage/Azure.Storage.Blobs/) | | Storage - Blobs Batch | NuGet [12.6.0](https://www.nuget.org/packages/Azure.Storage.Blobs.Batch/12.6.0) | [docs](/dotnet/api/overview/azure/Storage.Blobs.Batch-readme) | GitHub [12.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.Batch_12.6.0/sdk/storage/Azure.Storage.Blobs.Batch/) | | Storage - Blobs ChangeFeed | NuGet [12.0.0-preview.13](https://www.nuget.org/packages/Azure.Storage.Blobs.ChangeFeed/12.0.0-preview.13) | [docs](/dotnet/api/overview/azure/Storage.Blobs.ChangeFeed-readme-pre) | GitHub [12.0.0-preview.13](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Storage.Blobs.ChangeFeed_12.0.0-preview.13/sdk/storage/Azure.Storage.Blobs.ChangeFeed/) | @@ -56,11 +57,11 @@ | Synapse - Monitoring | NuGet [1.0.0-beta.3](https://www.nuget.org/packages/Azure.Analytics.Synapse.Monitoring/1.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Monitoring-readme-pre) | GitHub [1.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Monitoring_1.0.0-beta.3/sdk/synapse/Azure.Analytics.Synapse.Monitoring/) | | Synapse - Spark | NuGet [1.0.0-preview.6](https://www.nuget.org/packages/Azure.Analytics.Synapse.Spark/1.0.0-preview.6) | [docs](/dotnet/api/overview/azure/Analytics.Synapse.Spark-readme-pre) | GitHub [1.0.0-preview.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Analytics.Synapse.Spark_1.0.0-preview.6/sdk/synapse/Azure.Analytics.Synapse.Spark/) | | System Memory Data | NuGet [1.0.2](https://www.nuget.org/packages/System.Memory.Data/1.0.2) | [docs](/dotnet/api/overview/azure/System.Memory.Data-readme) | GitHub [1.0.2](https://github.com/Azure/azure-sdk-for-net/tree/System.Memory.Data_1.0.2/sdk/core/System.Memory.Data/) | -| Tables | NuGet [12.0.0](https://www.nuget.org/packages/Azure.Data.Tables/12.0.0) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.0.0/sdk/tables/Azure.Data.Tables/) | -| Text Analytics | NuGet [5.1.0-beta.7](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.1.0-beta.7) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme-pre) | GitHub [5.1.0-beta.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.1.0-beta.7/sdk/textanalytics/Azure.AI.TextAnalytics/) | -| WebJobs Extensions - Event Grid | NuGet [3.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventGrid/3.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventGrid-readme-pre) | GitHub [3.0.0-beta.3](https://github.com/Azure/azure-functions-eventgrid-extension/tree/v2.1.0/src/EventGridExtension) | -| WebJobs Extensions - Event Hubs | NuGet [5.0.0-beta.6](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventHubs/5.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventHubs-readme-pre) | GitHub [5.0.0-beta.6](https://github.com/Azure/azure-webjobs-sdk-extensions) | -| WebJobs Extensions - Service Bus | NuGet [5.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/5.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.ServiceBus-readme-pre) | GitHub [5.0.0-beta.3](https://github.com/Azure/azure-functions-servicebus-extension/tree/v4.1.2) | +| Tables | NuGet [12.0.1](https://www.nuget.org/packages/Azure.Data.Tables/12.0.1) | [docs](/dotnet/api/overview/azure/Data.Tables-readme) | GitHub [12.0.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Data.Tables_12.0.1/sdk/tables/Azure.Data.Tables/) | +| Text Analytics | NuGet [5.0.0](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.0.0)
NuGet [5.1.0-beta.7](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.1.0-beta.7) | [docs](/dotnet/api/overview/azure/AI.TextAnalytics-readme) | GitHub [5.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.0.0/sdk/textanalytics/Azure.AI.TextAnalytics/)
GitHub [5.1.0-beta.7](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.TextAnalytics_5.1.0-beta.7/sdk/textanalytics/Azure.AI.TextAnalytics/) | +| WebJobs Extensions - Event Grid | NuGet [3.0.0-beta.3](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventGrid/3.0.0-beta.3) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventGrid-readme-pre) | GitHub [3.0.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.EventGrid_3.0.0-beta.3/sdk/eventgrid/Microsoft.Azure.WebJobs.Extensions.EventGrid/) | +| WebJobs Extensions - Event Hubs | NuGet [5.0.0-beta.6](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.EventHubs/5.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.EventHubs-readme-pre) | GitHub [5.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.EventHubs_5.0.0-beta.6/sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/) | +| WebJobs Extensions - Service Bus | NuGet [5.0.0-beta.4](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/5.0.0-beta.4) | [docs](/dotnet/api/overview/azure/Microsoft.Azure.WebJobs.Extensions.ServiceBus-readme-pre) | GitHub [5.0.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.ServiceBus_5.0.0-beta.4/sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/) | | WebJobs Extensions - WebPubSub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.WebPubSub/1.0.0-beta.1) | | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Microsoft.Azure.WebJobs.Extensions.WebPubSub_1.0.0-beta.1/sdk/webpubsub/Microsoft.Azure.WebJobs.Extensions.WebPubSub/) | | WebPubSub | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Messaging.WebPubSub/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Messaging.WebPubSub-readme-pre) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Messaging.WebPubSub_1.0.0-beta.1/sdk/webpubsub/Azure.Messaging.WebPubSub/) | | Resource Management - App Configuration | NuGet [1.0.0-preview.1](https://www.nuget.org/packages/Azure.ResourceManager.AppConfiguration/1.0.0-preview.1) | [docs](/dotnet/api/overview/azure/ResourceManager.AppConfiguration-readme-pre) | GitHub [1.0.0-preview.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.AppConfiguration_1.0.0-preview.1/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/) | diff --git a/docs/azure/index.yml b/docs/azure/index.yml index 3d35f18b81db2..9c1b6e1fdf0b1 100644 --- a/docs/azure/index.yml +++ b/docs/azure/index.yml @@ -187,9 +187,9 @@ conceptualContent: url: /azure/event-grid/custom-event-quickstart - title: Diagnostics and monitoring links: - - itemType: overview - text: Azure Monitor - url: /azure/azure-monitor/overview + - itemType: quickstart + text: "Azure Monitor Application Insights quickstart" + url: /azure/azure-monitor/app/dotnet-quickstart - itemType: learn text: Capture and view page load times in your Azure web app url: /learn/modules/capture-page-load-times-application-insights/ @@ -197,7 +197,7 @@ conceptualContent: text: Troubleshoot ASP.NET Core on Azure App Service and IIS url: /aspnet/core/test/troubleshoot-azure-iis - itemType: how-to-guide - text: Application Insights with .NET Core ILogger + text: Capture Application Insights telemetry with .NET Core ILogger url: /azure/azure-monitor/app/ilogger - itemType: how-to-guide text: Application Insights for Worker Service applications diff --git a/docs/azure/sdk/azure-sdk-for-dotnet.md b/docs/azure/sdk/azure-sdk-for-dotnet.md index a51ffd58f4d4f..6efb2c468c174 100644 --- a/docs/azure/sdk/azure-sdk-for-dotnet.md +++ b/docs/azure/sdk/azure-sdk-for-dotnet.md @@ -21,10 +21,10 @@ The Azure SDK for .NET is available as series of NuGet packages that can be used To use an Azure SDK package in one of your .NET applications, you want to follow these steps. -1. **Locate the appropriate SDK package -** Use the [package list](/dotnet/azure/sdk/packages) to find the appropriate package for the Azure service you are working with. Be advised that most services have a client package for working with the service and a management package for creating and managing instances of the service. In most cases, you will want the client package. Install this package in your application using NuGet. +1. **Locate the appropriate SDK package -** Use the [package list](packages.md) to find the appropriate package for the Azure service you are working with. Be advised that most services have a client package for working with the service and a management package for creating and managing instances of the service. In most cases, you will want the client package. Install this package in your application using NuGet. -2. **Set up authentication for your application -** To access Azure resources, your application will need to have the appropriate credentials and access rights assigned in Azure. Learn how to configure authentication in [Authenticating .NET applications to Azure](/dotnet/azure/sdk/authentication). +2. **Set up authentication for your application -** To access Azure resources, your application will need to have the appropriate credentials and access rights assigned in Azure. Learn how to configure authentication in [Authenticating .NET applications to Azure](authentication.md). 3. **Write code using the SDK in your application -** When working with Azure services, your code will first create a client object to work with the service and then call methods on that client object to interact with the service. Both synchronous and asynchronous methods are provided. Examples of using each individual SDK package are provided throughout the Azure documentation. -4. **Configure logging for the SDK (optional) -** If you need to diagnose issues between your application and Azure, you can [enable logging in the Azure SDK for .NET](/dotnet/azure/sdk/logging). +4. **Configure logging for the SDK (optional) -** If you need to diagnose issues between your application and Azure, you can [enable logging in the Azure SDK for .NET](logging.md). diff --git a/docs/azure/sdk/dependency-injection.md b/docs/azure/sdk/dependency-injection.md index 373992d28abc1..83ca8d789cb86 100644 --- a/docs/azure/sdk/dependency-injection.md +++ b/docs/azure/sdk/dependency-injection.md @@ -86,7 +86,7 @@ public class MyApiController : ControllerBase ## Store configuration separately from code -In the [Register client](#register-client) section, you explicitly specify the `keyVaultUrl` and `storageUrl` variables. This approach could cause problems when you run code against different environments during development and production. The .NET team suggests [storing such configurations in environment-dependent JSON files](/dotnet/core/extensions/configuration-providers#json-configuration-provider). For example, you can have an _appsettings.Development.json_ file containing development environment settings. Another _appsettings.Production.json_ file would contain production environment settings, and so on. The file format is: +In the [Register client](#register-client) section, you explicitly specify the `keyVaultUrl` and `storageUrl` variables. This approach could cause problems when you run code against different environments during development and production. The .NET team suggests [storing such configurations in environment-dependent JSON files](../../core/extensions/configuration-providers.md#json-configuration-provider). For example, you can have an _appsettings.Development.json_ file containing development environment settings. Another _appsettings.Production.json_ file would contain production environment settings, and so on. The file format is: ```json { @@ -240,6 +240,6 @@ You can also place policy overrides in the _appsettings.json_ file: ## See also -- [Dependency injection in .NET](/dotnet/core/extensions/dependency-injection) -- [Configuration in .NET](/dotnet/core/extensions/configuration) +- [Dependency injection in .NET](../../core/extensions/dependency-injection.md) +- [Configuration in .NET](../../core/extensions/configuration.md) - [Configuration in ASP.NET Core](/aspnet/core/fundamentals/configuration) diff --git a/docs/azure/sdk/logging.md b/docs/azure/sdk/logging.md index fc72e1b0072aa..9ac4ec0039669 100644 --- a/docs/azure/sdk/logging.md +++ b/docs/azure/sdk/logging.md @@ -66,7 +66,7 @@ using AzureEventSourceListener listener = AzureEventSourceListener.CreateConsole ### Log to diagnostic traces -If you implement trace listeners, you can use the `CreateTraceLogger` method to log to the standard .NET event tracing mechanism ([`System.Diagnostics.Tracing`](/dotnet/api/system.diagnostics.tracing)). For more information on event tracing in .NET, see [Trace Listeners](/dotnet/framework/debug-trace-profile/trace-listeners). This example specifies a log level of verbose: +If you implement trace listeners, you can use the `CreateTraceLogger` method to log to the standard .NET event tracing mechanism ([`System.Diagnostics.Tracing`](/dotnet/api/system.diagnostics.tracing)). For more information on event tracing in .NET, see [Trace Listeners](../../framework/debug-trace-profile/trace-listeners.md). This example specifies a log level of verbose: ```csharp using AzureEventSourceListener listener = AzureEventSourceListener.CreateTraceLogger(EventLevel.Verbose); @@ -95,4 +95,4 @@ using AzureEventSourceListener listener = new AzureEventSourceListener((e, messa - [Enable diagnostics logging for apps in Azure App Service](/azure/app-service/troubleshoot-diagnostic-logs) - Review [Azure security logging and auditing](/azure/security/fundamentals/log-audit) options - Learn how to work with [Azure platform logs](/azure/azure-monitor/platform/platform-logs-overview) -- Read more about [.NET Core logging and tracing](/dotnet/core/diagnostics/logging-tracing) +- Read more about [.NET Core logging and tracing](../../core/diagnostics/logging-tracing.md) diff --git a/docs/azure/sdk/thread-safety.md b/docs/azure/sdk/thread-safety.md index d265eac6547b5..aac124df49a1f 100644 --- a/docs/azure/sdk/thread-safety.md +++ b/docs/azure/sdk/thread-safety.md @@ -121,4 +121,4 @@ Further guidance for properly managing and disposing of `HttpClient` instances c ## See also - [Dependency injection with the Azure SDK for .NET](./dependency-injection.md) -- [Dependency injection in .NET](/dotnet/core/extensions/dependency-injection) +- [Dependency injection in .NET](../../core/extensions/dependency-injection.md) diff --git a/docs/breadcrumb/toc.yml b/docs/breadcrumb/toc.yml index 3d863a83fa7fb..1007639f17901 100644 --- a/docs/breadcrumb/toc.yml +++ b/docs/breadcrumb/toc.yml @@ -320,7 +320,7 @@ items: topicHref: /dotnet/csharp/tour-of-csharp/tutorials/index - name: Fundamentals tocHref: /dotnet/csharp/fundamentals/ - topicHref: /dotnet/csharp/fundamentals/type-system/index + topicHref: /dotnet/csharp/fundamentals/types/index - name: What's new tocHref: /dotnet/csharp/whats-new/ topicHref: /dotnet/csharp/whats-new/index @@ -587,4 +587,4 @@ items: topicHref: /dotnet/iot/index - name: What's new tocHref: /dotnet/whats-new/ - topicHref: /dotnet/whats-new/index \ No newline at end of file + topicHref: /dotnet/whats-new/index diff --git a/docs/core/compatibility/6.0.md b/docs/core/compatibility/6.0.md index 8381f34b2ce22..b07e674fae011 100644 --- a/docs/core/compatibility/6.0.md +++ b/docs/core/compatibility/6.0.md @@ -17,6 +17,7 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff - [Assemblies removed from Microsoft.AspNetCore.App shared framework](aspnet-core/6.0/assemblies-removed-from-shared-framework.md) - [Blazor: Parameter name changed in RequestImageFileAsync method](aspnet-core/6.0/blazor-parameter-name-changed-in-method.md) - [Blazor: WebEventDescriptor.EventArgsType property replaced](aspnet-core/6.0/blazor-eventargstype-property-replaced.md) +- [Blazor: Byte array interop](aspnet-core/6.0/byte-array-interop.md) - [Changed MessagePack library in @microsoft/signalr-protocol-msgpack](aspnet-core/6.0/messagepack-library-change.md) - [Kestrel: Log message attributes changed](aspnet-core/6.0/kestrel-log-message-attributes-changed.md) - [Microsoft.AspNetCore.Http.Features split](aspnet-core/6.0/microsoft-aspnetcore-http-features-package-split.md) @@ -40,6 +41,10 @@ If you're migrating an app to .NET 6, the breaking changes listed here might aff - [Standard numeric format parsing precision](core-libraries/6.0/numeric-format-parsing-handles-higher-precision.md) - [Unhandled exceptions from a BackgroundService](core-libraries/6.0/hosting-exception-handling.md) +## JIT compiler + +- [Coerce call arguments according to ECMA-335](jit/6.0/coerce-call-arguments-ecma-335.md) + ## Networking - [WebRequest, WebClient, and ServicePoint are obsolete](networking/6.0/webrequest-deprecated.md) diff --git a/docs/core/compatibility/aspnet-core/6.0/byte-array-interop.md b/docs/core/compatibility/aspnet-core/6.0/byte-array-interop.md new file mode 100644 index 0000000000000..584a87a69be88 --- /dev/null +++ b/docs/core/compatibility/aspnet-core/6.0/byte-array-interop.md @@ -0,0 +1,80 @@ +--- +title: "Breaking change: Blazor: Byte Array Interop" +description: "Learn about the breaking change in ASP.NET Core 6.0 titled Blazor: Byte Array Interop" +no-loc: [ Blazor ] +ms.author: taparik +ms.date: 06/21/2021 +--- +# Blazor: Byte-array interop + +Blazor now supports optimized byte-array interop, which avoids encoding and decoding byte-arrays into Base64 and facilitates a more efficient interop process. This applies to both Blazor Server and Blazor WebAssembly. + +## Version introduced + +ASP.NET Core 6.0 Preview 6 + +## Return byte array from JavaScript to .NET + +### Old behavior + +```typescript +function someJSMethodReturningAByteArray() { + const data = new Uint8Array([ 1, 2, 3 ]); + const base64EncodedData = btoa(String.fromCharCode.apply(null, data as unknown as number[])); + return base64EncodedData; +} +``` + +### New behavior + +```typescript +function someJSMethodReturningAByteArray() { + const data = new Uint8Array([ 1, 2, 3 ]); + return data; +} +``` + +## Receive byte array in JavaScript from .NET + +### Old behavior + +```typescript +function receivesByteArray(data) { + // Previously, data was a Base64-encoded string representing the byte array. +} +``` + +### New behavior + +```typescript +function receivesByteArray(data) { + // Data is a Uint8Array (no longer requires processing the Base64 encoding). +} +``` + +## Reason for change + +This change was made to create a more efficient interop mechanism for byte arrays. + +## Recommended action + +### Receive byte array in JavaScript from .NET + +Consider this .NET interop, where you call into JavaScript passing a byte array: + +```csharp +var bytes = new byte[] { 1, 5, 7 }; +await _jsRuntime.InvokeVoidAsync("receivesByteArray", bytes); +``` + +In the preceding code example, you'd treat the incoming parameter in JavaScript as a byte array instead of a Base64-encoded string. + +### Return byte array from JavaScript to .NET + +If .NET expects a `byte[]`, JavaScript must provide a `Uint8Array`. Previously, it was possible to provide a Base64-encoded array using `btoa`. + +For example, if you have the following code, then you must provide a `Uint8Array` from JavaScript that's _not_ Base64-encoded: + +```csharp +var bytes = await _jsRuntime.InvokeAsync("someJSMethodReturningAByteArray"); +``` diff --git a/docs/core/compatibility/core-libraries/5.0/code-access-security-apis-obsolete.md b/docs/core/compatibility/core-libraries/5.0/code-access-security-apis-obsolete.md index a591c635219ad..33b10dfc78ff7 100644 --- a/docs/core/compatibility/core-libraries/5.0/code-access-security-apis-obsolete.md +++ b/docs/core/compatibility/core-libraries/5.0/code-access-security-apis-obsolete.md @@ -63,7 +63,7 @@ This is a compile-time only change. There is no run-time change from previous ve ## Reason for change -[Code access security (CAS)](../../../../framework/misc/code-access-security.md) is an unsupported legacy technology. The infrastructure to enable CAS exists only in .NET Framework 2.x - 4.x, but is deprecated and not receiving servicing or security fixes. +[Code access security (CAS)](/previous-versions/dotnet/framework/code-access-security/code-access-security) is an unsupported legacy technology. The infrastructure to enable CAS exists only in .NET Framework 2.x - 4.x, but is deprecated and not receiving servicing or security fixes. Due to CAS's deprecation, the [supporting infrastructure was not brought forward to .NET Core](../../../porting/net-framework-tech-unavailable.md) or .NET 5.0+. However, the APIs were brought forward so that apps could cross-compile against .NET Framework and .NET Core. This led to "fail open" scenarios, where some CAS-related APIs exist and are callable but perform no action at run time. This can lead to security issues for components that expect the runtime to honor CAS-related attributes or programmatic API calls. To better communicate that the runtime doesn't respect these attributes or APIs, we have obsoleted the majority of them in .NET 5.0. diff --git a/docs/core/compatibility/core-libraries/6.0/nullable-ref-type-annotation-changes.md b/docs/core/compatibility/core-libraries/6.0/nullable-ref-type-annotation-changes.md index f20a198446c1f..66110a64a37bb 100644 --- a/docs/core/compatibility/core-libraries/6.0/nullable-ref-type-annotation-changes.md +++ b/docs/core/compatibility/core-libraries/6.0/nullable-ref-type-annotation-changes.md @@ -1,7 +1,7 @@ --- title: "Breaking change: Nullable reference type annotation changes" description: Learn about the .NET 6 breaking change in core .NET libraries where some nullable reference type annotations have changed. -ms.date: 02/11/2021 +ms.date: 06/17/2021 --- # Changes to nullable reference type annotations @@ -58,10 +58,33 @@ The following table lists the affected APIs: | | `buffer` parameter type is nullable | Breaking | Preview 1 | | | `buffer` parameter type is nullable | Breaking | Preview 1 | | | `subProtocol` parameter type is nullable | Nonbreaking | Preview 2 | -| Methods that override and [many others that return `bool`](https://github.com/dotnet/runtime/pull/47598/files) | `[NotNullWhen(true)]` added to first, nullable parameter | Breaking | Preview 2 | +| Methods that override and [many others that return `bool`](https://github.com/dotnet/runtime/pull/47598/files) | `[NotNullWhen(true)]` added to first nullable parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `o` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `o` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | +| `DateOnly.Equals(System.Object)` | `NotNullWhen(true)` was added to the `value` parameter | Breaking | Preview 2 | +| `TimeOnly.Equals(System.Object)` | `NotNullWhen(true)` was added to the `value` parameter | Breaking | Preview 2 | +| | `NotNullWhen(true)` was added to the `obj` parameter | Breaking | Preview 2 | ## See also +- [Attributes for null-state static analysis](../../../../csharp/language-reference/attributes/nullable-analysis.md) - [Nullable reference type annotation changes in ASP.NET Core](../../aspnet-core/6.0/nullable-reference-type-annotations-changed.md) diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 8f9a4b43443a2..cd60d56f89534 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -31,6 +31,8 @@ items: href: aspnet-core/6.0/blazor-parameter-name-changed-in-method.md - name: "Blazor: WebEventDescriptor.EventArgsType property replaced" href: aspnet-core/6.0/blazor-eventargstype-property-replaced.md + - name: "Blazor: Byte-array interop" + href: aspnet-core/6.0/byte-array-interop.md - name: "Kestrel: Log message attributes changed" href: aspnet-core/6.0/kestrel-log-message-attributes-changed.md - name: "MessagePack: Library changed in @microsoft/signalr-protocol-msgpack" @@ -71,6 +73,10 @@ items: href: core-libraries/6.0/numeric-format-parsing-handles-higher-precision.md - name: Unhandled exceptions from a BackgroundService href: core-libraries/6.0/hosting-exception-handling.md + - name: JIT compiler + items: + - name: Call argument coercion + href: jit/6.0/coerce-call-arguments-ecma-335.md - name: Networking items: - name: WebRequest, WebClient, and ServicePoint are obsolete @@ -332,7 +338,7 @@ items: - name: Native code can't access Windows Forms objects href: windows-forms/5.0/winforms-objects-not-accessible-from-native-code.md - name: OutputType set to WinExe - href: windows-forms/5.0/automatically-infer-winexe-output-type.md + href: sdk/5.0/automatically-infer-winexe-output-type.md - name: DataGridView doesn't reset custom fonts href: windows-forms/5.0/datagridview-doesnt-reset-custom-font-settings.md - name: Methods throw ArgumentException @@ -346,15 +352,15 @@ items: - name: DataGridView APIs throw InvalidOperationException href: windows-forms/5.0/null-owner-causes-invalidoperationexception.md - name: WinForms apps use Microsoft.NET.Sdk - href: windows-forms/5.0/sdk-and-target-framework-change.md + href: sdk/5.0/sdk-and-target-framework-change.md - name: Removed status bar controls href: windows-forms/5.0/winforms-deprecated-controls.md - name: WPF items: - name: OutputType set to WinExe - href: windows-forms/5.0/automatically-infer-winexe-output-type.md + href: sdk/5.0/automatically-infer-winexe-output-type.md - name: WPF apps use Microsoft.NET.Sdk - href: windows-forms/5.0/sdk-and-target-framework-change.md + href: sdk/5.0/sdk-and-target-framework-change.md - name: .NET Core 3.1 href: 3.1.md - name: .NET Core 3.0 @@ -375,6 +381,8 @@ items: href: aspnet-core/6.0/blazor-parameter-name-changed-in-method.md - name: "Blazor: WebEventDescriptor.EventArgsType property replaced" href: aspnet-core/6.0/blazor-eventargstype-property-replaced.md + - name: "Blazor: Byte-array interop" + href: aspnet-core/6.0/byte-array-interop.md - name: "Kestrel: Log message attributes changed" href: aspnet-core/6.0/kestrel-log-message-attributes-changed.md - name: "MessagePack: Library changed in @microsoft/signalr-protocol-msgpack" @@ -619,6 +627,12 @@ items: href: interop/5.0/casting-rcw-to-inspectable-interface-throws-exception.md - name: No A/W suffix probing on non-Windows platforms href: interop/5.0/function-suffix-pinvoke.md + - name: JIT compiler + items: + - name: .NET 6 + items: + - name: Call argument coercion + href: jit/6.0/coerce-call-arguments-ecma-335.md - name: MSBuild items: - name: .NET 5 @@ -712,7 +726,7 @@ items: - name: Native code can't access Windows Forms objects href: windows-forms/5.0/winforms-objects-not-accessible-from-native-code.md - name: OutputType set to WinExe - href: windows-forms/5.0/automatically-infer-winexe-output-type.md + href: sdk/5.0/automatically-infer-winexe-output-type.md - name: DataGridView doesn't reset custom fonts href: windows-forms/5.0/datagridview-doesnt-reset-custom-font-settings.md - name: Methods throw ArgumentException @@ -726,7 +740,7 @@ items: - name: DataGridView APIs throw InvalidOperationException href: windows-forms/5.0/null-owner-causes-invalidoperationexception.md - name: WinForms apps use Microsoft.NET.Sdk - href: windows-forms/5.0/sdk-and-target-framework-change.md + href: sdk/5.0/sdk-and-target-framework-change.md - name: Removed status bar controls href: windows-forms/5.0/winforms-deprecated-controls.md - name: .NET Core 3.0-3.1 @@ -736,6 +750,6 @@ items: - name: .NET 5 items: - name: OutputType set to WinExe - href: windows-forms/5.0/automatically-infer-winexe-output-type.md + href: sdk/5.0/automatically-infer-winexe-output-type.md - name: WPF apps use Microsoft.NET.Sdk - href: windows-forms/5.0/sdk-and-target-framework-change.md + href: sdk/5.0/sdk-and-target-framework-change.md diff --git a/docs/core/deploying/single-file.md b/docs/core/deploying/single-file.md index 3cf987e5da2a0..ba1cd8701081b 100644 --- a/docs/core/deploying/single-file.md +++ b/docs/core/deploying/single-file.md @@ -13,7 +13,7 @@ Single File deployment is available for both the [framework-dependent deployment ## Output differences from .NET 3.x -In .NET Core 3.x, publishing as a single file produced exactly one file, consisting of the app itself, dependencies, and any other files in the folder during publish. When the app starts, the single file app was extracted to a temporary folder and run from there. Starting with .NET 5, only managed DLLs are bundled with the app into a single executable. When the app starts, the managed DLLs are extracted and loaded in memory, avoiding the extraction to a temporary folder. On Windows, this means that the managed binaries are embedded in the single-file bundle, but the native binaries of the core runtime itself are separate files. To embed those files for extraction and get exactly one output file, like in .NET Core 3.x, set the property `IncludeNativeLibrariesForSelfExtract` to `true`. For more information about extraction, see [Other considerations](#other-considerations). +In .NET Core 3.x, publishing as a single file produced exactly one file, consisting of the app itself, dependencies, and any other files in the folder during publish. When the app starts, the single file app was extracted to a temporary folder and run from there. Starting with .NET 5, only managed DLLs are bundled with the app into a single executable. When the app starts, the managed DLLs are extracted and loaded in memory, avoiding the extraction to a temporary folder. On Windows, this means that the managed binaries are embedded in the single-file bundle, but the native binaries of the core runtime itself are separate files. To embed those files for extraction and get exactly one output file, like in .NET Core 3.x, set the property `IncludeNativeLibrariesForSelfExtract` to `true`. For more information about extraction, see [Including native libraries](#including-native-libraries). ## API incompatibility @@ -51,12 +51,17 @@ Without this file Visual Studio may produce the error "Unable to attach to the p To fix these errors, _mscordbi_ needs to be copied next to the executable. _mscordbi_ is `publish`ed by default in the subdirectory with the application's runtime ID. So, for example, if one were to publish a self-contained single-file executable using the `dotnet` CLI for Windows using the parameters `-r win-x64`, the executable would be placed in _bin/Debug/net5.0/win-x64/publish_. A copy of _mscordbi.dll_ would be present in _bin/Debug/net5.0/win-x64_. -## Other considerations +## Including native libraries Single-file doesn't bundle native libraries by default. On Linux, we prelink the runtime into the bundle and only application native libraries are deployed to the same directory as the single-file app. On Windows, we prelink only the hosting code and both the runtime and application native libraries are deployed to the same directory as the single-file app. This is to ensure a good debugging experience, which requires native files to be excluded from the single file. There is an option to set a flag, `IncludeNativeLibrariesForSelfExtract`, to include native libraries in the single file bundle, but these files will be extracted to a temporary directory in the client machine when the single file application is run. Specifying `IncludeAllContentForSelfExtract` will extract all files before running the executable. This preserves the original .NET Core single-file deployment behavior. +> [!NOTE] +> If extraction is used and the app is running on Linux or MacOS, either `$HOME` or `$DOTNET_BUNDLE_EXTRACT_BASE_DIR` must be set to a path. If `$HOME` is set, the files will be extracted in a directory under _$HOME/.net_, while if `$DOTNET_BUNDLE_EXTRACT_BASE_DIR` is set, it will take precedence and files will be created in directories below that path. To prevent tampering, these directories should not be writable by users or services with different privileges, **not** _/tmp_ or _/var/tmp_ on most systems). + +## Other considerations + Single-file application will have all related PDB files alongside it and will not be bundled by default. If you want to include PDBs inside the assembly for projects you build, set the `DebugType` to `embedded` as described [below](#include-pdb-files-inside-the-bundle) in detail. Managed C++ components aren't well suited for single-file deployment and we recommend that you write applications in C# or another non-managed C++ language to be single-file compatible. diff --git a/docs/core/diagnostics/diagnostics-client-library.md b/docs/core/diagnostics/diagnostics-client-library.md new file mode 100644 index 0000000000000..8e12e5469ba8b --- /dev/null +++ b/docs/core/diagnostics/diagnostics-client-library.md @@ -0,0 +1,59 @@ +--- +title: Diagnostics client library +description: In this article, you'll learn how to use Microsoft.Diagnostics.NETCore.Client library to write your custom diagnostic tool. +ms.date: 06/22/2021 +author: tommcdon +ms.author: tommcdon +--- + +# Diagnostics client library + +**This article applies to: ✔️** .NET Core 3.0 SDK and later versions for target apps, .NET Standard 2.0 to use the library. + +Microsoft.Diagnostics.NETCore.Client (also known as the Diagnostics client library) is a managed library that lets you interact with .NET Core runtime (CoreCLR) for various diagnostics related tasks, such as tracing via [EventPipe](eventpipe.md), requesting a dump, or attaching an ICorProfiler. This library is the backing library behind many diagnostics tools such as [`dotnet-counters`](dotnet-counters.md), [`dotnet-trace`](dotnet-trace.md), [`dotnet-gcdump`](dotnet-gcdump.md), and [`dotnet-dump`](dotnet-dump.md). Using this library, you can write your own diagnostics tools customized for your particular scenario. + +You can acquire [Microsoft.Diagnostics.NETCore.Client](https://www.nuget.org/packages/Microsoft.Diagnostics.NETCore.Client/) by adding a `PackageReference` to your project. The package is hosted on `NuGet.org`. + +The samples in the following sections show how to use Microsoft.Diagnostics.NETCore.Client library. Some of these examples also show parsing the event payloads by using [TraceEvent](https://www.nuget.org/packages/Microsoft.Diagnostics.Tracing.TraceEvent/) library. + +## Attach to a process and print out all GC events + +This snippet shows how to start an EventPipe session using the [.NET runtime provider](../../fundamentals/diagnostics/runtime-events.md) with the GC keyword at informational level. It also shows how to use the `EventPipeEventSource` class provided by the [TraceEvent library](https://www.nuget.org/packages/Microsoft.Diagnostics.Tracing.TraceEvent/) to parse the incoming events and print their names to the console in real time. + +:::code language="csharp" source="snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintRuntimeGCEvents.cs"::: + +## Write a core dump + +This sample shows how to trigger the collection of a [core dump](dumps.md) using `DiagnosticsClient`. + +:::code language="csharp" source="snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TriggerCoreDump.cs"::: + +## Trigger a core dump when CPU usage goes above a threshold + +This sample shows how to monitor the `cpu-usage` counter published by the .NET runtime and request a dump when the CPU usage grows beyond a certain threshold. + +:::code language="csharp" source="snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TriggerDumpOnCpuUsage.cs"::: + +## Trigger a CPU trace for given number of seconds + +This sample shows how to trigger an EventPipe session for certain period of time with the default CLR trace keyword as well as the sample profiler. Afterward, it reads the output stream and writes the bytes out to a file. Essentially this is what [`dotnet-trace`](dotnet-trace.md) uses internally to write a trace file. + +:::code language="csharp" source="snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TraceProcessForDuration.cs"::: + +## Print names of processes that published a diagnostics channel + +This sample shows how to use `DiagnosticsClient.GetPublishedProcesses` API to print the names of the .NET processes that published a diagnostics IPC channel. + +:::code language="csharp" source="snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintProcessStatus.cs"::: + +## Parse events in real time + +This sample shows an example where we create two tasks, one that parses the events coming in live with `EventPipeEventSource` and one that reads the console input for a user input signaling the program to end. If the target app exists before the users presses enter, the app exists gracefully. Otherwise, `inputTask` will send the Stop command to the pipe and exit gracefully. + +:::code language="csharp" source="snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintEventsLive.cs"::: + +## Attach an ICorProfiler profiler + +This sample shows how to attach an ICorProfiler to a process via profiler attach. + +:::code language="csharp" source="snippets/Microsoft.Diagnostics.NETCore.Client/csharp/ProfilerAttach.cs"::: diff --git a/docs/core/diagnostics/eventpipe.md b/docs/core/diagnostics/eventpipe.md index 898c8762eee34..1709a78c62f04 100644 --- a/docs/core/diagnostics/eventpipe.md +++ b/docs/core/diagnostics/eventpipe.md @@ -44,7 +44,7 @@ You can use EventPipe to trace your .NET application in many ways: * Use one of the [diagnostics tools](#tools-that-use-eventpipe) that are built on top of EventPipe. -* Use [Microsoft.Diagnostics.NETCore.Client](https://github.com/dotnet/diagnostics/blob/main/documentation/diagnostics-client-library-instructions.md) library to write your own tool to configure and start EventPipe sessions yourself. +* Use [Microsoft.Diagnostics.NETCore.Client](diagnostics-client-library.md) library to write your own tool to configure and start EventPipe sessions. * Use [environment variables](#trace-using-environment-variables) to start EventPipe. @@ -64,7 +64,7 @@ This is the easiest way to use EventPipe to trace your application. To learn mor ## Trace using environment variables -The preferred mechanism for using EventPipe is to use `dotnet-trace` or the `Microsoft.Diagnostics.NETCore.Client` library. +The preferred mechanism for using EventPipe is to use [`dotnet-trace`](dotnet-trace.md) or the [`Microsoft.Diagnostics.NETCore.Client`](diagnostics-client-library.md) library. However, you can use the following environment variables to set up an EventPipe session on an app and have it write the trace directly to a file. To stop tracing, exit the application. diff --git a/docs/core/diagnostics/index.md b/docs/core/diagnostics/index.md index 4e8c492ee0da5..f9620a092a55e 100644 --- a/docs/core/diagnostics/index.md +++ b/docs/core/diagnostics/index.md @@ -75,6 +75,10 @@ The [dotnet-stack](dotnet-stack.md) tool allows you quickly print the managed st ## .NET Core diagnostics tutorials +### Write your own diagnostic tool + +[The diagnostics client library](diagnostics-client-library.md) lets you write your own custom diagnostic tool best suited for your diagnostic scenario. Look up information in the [Microsoft.Diagnostics.NETCore.Client API reference](microsoft-diagnostics-netcore-client.md). + ### Debug a memory leak [Tutorial: Debug a memory leak](debug-memory-leak.md) walks through finding a memory leak. The [dotnet-counters](dotnet-counters.md) tool is used to confirm the leak and the [dotnet-dump](dotnet-dump.md) tool is used to diagnose the leak. diff --git a/docs/core/diagnostics/microsoft-diagnostics-netcore-client.md b/docs/core/diagnostics/microsoft-diagnostics-netcore-client.md new file mode 100644 index 0000000000000..ba9439d131976 --- /dev/null +++ b/docs/core/diagnostics/microsoft-diagnostics-netcore-client.md @@ -0,0 +1,276 @@ +--- +title: Microsoft.Diagnostics.NETCore.Client API +description: In this article, you'll learn about the Microsoft.Diagnostics.NETCore.Client APIs. +ms.date: 06/22/2021 +author: tommcdon +ms.author: tommcdon +ms.topic: reference +--- + +# Microsoft.Diagnostics.NETCore.Client API + +This section describes the APIs of the diagnostics client library. + +## DiagnosticsClient class + +```cs +public DiagnosticsClient +{ + public DiagnosticsClient(int processId); + + public EventPipeSession StartEventPipeSession( + IEnumerable providers, + bool requestRundown = true, + int circularBufferMB = 256); + + public void WriteDump( + DumpType dumpType, + string dumpPath, + bool logDumpGeneration = false); + + public void AttachProfiler( + TimeSpan attachTimeout, + Guid profilerGuid, + string profilerPath, + byte[] additionalData = null); + + public static IEnumerable GetPublishedProcesses(); +} +``` + +### Constructor + +```csharp +public DiagnosticsClient(int processId); +``` + +Creates a new instance of `DiagnosticsClient` for a compatible .NET process running with process ID of `processId`. + +`processID` : Process ID of the target application. + +### StartEventPipeSession methods + +```csharp +public EventPipeSession StartEventPipeSession( + IEnumerable providers, + bool requestRundown = true, + int circularBufferMB = 256) +``` + +Starts an EventPipe tracing session using the given providers and settings. + +* `providers` : An `IEnumerable` of [`EventPipeProvider`](#eventpipeprovider-class)s to start tracing. +* `requestRundown`: A `bool` specifying whether rundown provider events from the target app's runtime should be requested. +* `circularBufferMB`: An `int` specifying the total size of circular buffer used by the target app's runtime on collecting events. + +```csharp +public EventPipeSession StartEventPipeSession(EventPipeProvider providers, bool requestRundown=true, int circularBufferMB=256) +``` + +* `providers` : An [`EventPipeProvider`](#eventpipeprovider-class) to start tracing. +* `requestRundown`: A `bool` specifying whether rundown provider events from the target app's runtime should be requested. +* `circularBufferMB`: An `int` specifying the total size of circular buffer used by the target app's runtime on collecting events. + +> [!NOTE] +> Rundown events contain payloads that may be needed for post analysis, such as resolving method names of thread samples. Unless you know you do not want this, we recommend setting this to true. In large applications, this may take a while. + +* `circularBufferMB` : The size of the circular buffer to be used as a buffer for writing events within the runtime. + +### WriteDump method + +```csharp +public void WriteDump(DumpType dumpType, string dumpPath, bool logDumpGeneration=false); +``` + +Request a dump for post-mortem debugging of the target application. The type of the dump can be specified using the [`DumpType`](#dumptype-enum) enum. + +* `dumpType` : Type of the dump to be requested. +* `dumpPath` : The path to the dump to be written out to. +* `logDumpGeneration` : If set to `true`, the target application will write out diagnostic logs during dump generation. + +### AttachProfiler method + +```csharp +public void AttachProfiler(TimeSpan attachTimeout, Guid profilerGuid, string profilerPath, byte[] additionalData=null); +``` + +Request to attach an ICorProfiler to the target application. + +* `attachTimeout` : A `TimeSpan` after which attach will be aborted. +* `profilerGuid` : `Guid` of the ICorProfiler to be attached. +* `profilerPath` : Path to the ICorProfiler dll to be attached. +* `additionalData` : Optional additional data that can be passed to the runtime during profiler attach. + +### GetPublishedProcesses method + +```csharp +public static IEnumerable GetPublishedProcesses(); +``` + +Get an `IEnumerable` of process IDs of all the active .NET processes that can be attached to. + +## EventPipeProvider class + +```cs +public class EventPipeProvider +{ + public EventPipeProvider( + string name, + EventLevel eventLevel, + long keywords = 0, + IDictionary arguments = null) + + public string Name { get; } + + public EventLevel EventLevel { get; } + + public long Keywords { get; } + + public IDictionary Arguments { get; } + + public override string ToString(); + + public override bool Equals(object obj); + + public override int GetHashCode(); + + public static bool operator ==(Provider left, Provider right); + + public static bool operator !=(Provider left, Provider right); +} +``` + +### Constructor + +```csharp +public EventPipeProvider( + string name, + EventLevel eventLevel, + long keywords = 0, + IDictionary arguments = null) +``` + +Creates a new instance of `EventPipeProvider` with the given provider name, , keywords, and arguments. + +### Name property + +```csharp +public string Name { get; } +``` + +Gets the name of the Provider. + +### EventLevel property + +```csharp +public EventLevel EventLevel { get; } +``` + +Gets the `EventLevel` of the given instance of [`EventPipeProvider`](#eventpipeprovider-class). + +### Keywords property + +```csharp +public long Keywords { get; } +``` + +Gets a value that represents bitmask for keywords of the `EventSource`. + +### Arguments property + +```csharp +public IDictionary Arguments { get; } +``` + +Gets an `IDictionary` of key-value pair strings representing optional arguments to be passed to `EventSource` representing the given `EventPipeProvider`. + +### Remarks + +This class is immutable, because EventPipe does not allow a provider's configuration to be modified during an EventPipe session as of .NET Core 3.1. + +## EventPipeSession class + +```csharp +public class EventPipeSession : IDisposable +{ + public Stream EventStream { get; } + public void Stop(); +} +``` + +This class represents an ongoing EventPipe session. It is immutable and acts as a handle to an EventPipe session of the given runtime. + +## EventStream property + +```csharp +public Stream EventStream { get; } +``` + +Gets a `Stream` that can be used to read the event stream. + +## Stop method + +```csharp +public void Stop(); +``` + +Stops the given `EventPipe` session. + +## DumpType enum + +```csharp +public enum DumpType +{ + Normal = 1, + WithHeap = 2, + Triage = 3, + Full = 4 +} +``` + +Represents the type of dump that can be requested. + +* `Normal`: Include just the information necessary to capture stack traces for all existing traces for all existing threads in a process. Limited GC heap memory and information. +* `WithHeap`: Includes the GC heaps and information necessary to capture stack traces for all existing threads in a process. +* `Triage`: Include just the information necessary to capture stack traces for all existing traces for all existing threads in a process. Limited GC heap memory and information. +* `Full`: Include all accessible memory in the process. The raw memory data is included at the end, so that the initial structures can be mapped directly without the raw memory information. This option can result in a very large dump file. + +## Exceptions + +Exceptions that are thrown from the library are of type `DiagnosticsClientException` or a derived type. + +```csharp +public class DiagnosticsClientException : Exception +``` + +### UnsupportedCommandException + +```csharp +public class UnsupportedCommandException : DiagnosticsClientException +``` + +This may be thrown when the command is not supported by either the library or the target process's runtime. + +### UnsupportedProtocolException + +```csharp +public class UnsupportedProtocolException : DiagnosticsClientException +``` + +This may be thrown when the target process's runtime is not compatible with the diagnostics IPC protocol used by the library. + +### ServerNotAvailableException + +```csharp +public class ServerNotAvailableException : DiagnosticsClientException +``` + +This may be thrown when the runtime is not available for diagnostics IPC commands, such as early during runtime startup before the runtime is ready for diagnostics commands, or when the runtime is shutting down. + +### ServerErrorException + +```csharp +public class ServerErrorException : DiagnosticsClientException +``` + +This may be thrown when the runtime responds with an error to a given command. diff --git a/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/Microsoft.Diagnostics.NETCore.Client.Samples.csproj b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/Microsoft.Diagnostics.NETCore.Client.Samples.csproj new file mode 100644 index 0000000000000..c374d006c3d84 --- /dev/null +++ b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/Microsoft.Diagnostics.NETCore.Client.Samples.csproj @@ -0,0 +1,13 @@ + + + + Library + netstandard2.0 + + + + + + + + diff --git a/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintEventsLive.cs b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintEventsLive.cs new file mode 100644 index 0000000000000..5293de80a19f3 --- /dev/null +++ b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintEventsLive.cs @@ -0,0 +1,52 @@ +using Microsoft.Diagnostics.NETCore.Client; +using Microsoft.Diagnostics.Tracing; +using Microsoft.Diagnostics.Tracing.EventPipe; +using Microsoft.Diagnostics.Tracing.Parsers; +using System; +using System.Collections.Generic; +using System.Diagnostics.Tracing; +using System.Threading.Tasks; + +public partial class Tracer +{ + public static void PrintEventsLive(int processId) + { + var providers = new List() + { + new EventPipeProvider("Microsoft-Windows-DotNETRuntime", + EventLevel.Informational, (long)ClrTraceEventParser.Keywords.Default) + }; + var client = new DiagnosticsClient(processId); + using (var session = client.StartEventPipeSession(providers, false)) + { + + Task streamTask = Task.Run(() => + { + var source = new EventPipeEventSource(session.EventStream); + source.Clr.All += (TraceEvent obj) => Console.WriteLine(obj.EventName); + try + { + source.Process(); + } + // NOTE: This exception does not currently exist. It is something that needs to be added to TraceEvent. + catch (Exception e) + { + Console.WriteLine("Error encountered while processing events"); + Console.WriteLine(e.ToString()); + } + }); + + Task inputTask = Task.Run(() => + { + Console.WriteLine("Press Enter to exit"); + while (Console.ReadKey().Key != ConsoleKey.Enter) + { + Task.Delay(TimeSpan.FromMilliseconds(100)); + } + session.Stop(); + }); + + Task.WaitAny(streamTask, inputTask); + } + } +} diff --git a/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintProcessStatus.cs b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintProcessStatus.cs new file mode 100644 index 0000000000000..c028f5eccb08a --- /dev/null +++ b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintProcessStatus.cs @@ -0,0 +1,19 @@ +using Microsoft.Diagnostics.NETCore.Client; +using System; +using System.Diagnostics; +using System.Linq; + +public class ProcessTracker +{ + public static void PrintProcessStatus() + { + var processes = DiagnosticsClient.GetPublishedProcesses() + .Select(Process.GetProcessById) + .Where(process => process != null); + + foreach (var process in processes) + { + Console.WriteLine($"{process.ProcessName}"); + } + } +} diff --git a/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintRuntimeGCEvents.cs b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintRuntimeGCEvents.cs new file mode 100644 index 0000000000000..1678af2690b3c --- /dev/null +++ b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/PrintRuntimeGCEvents.cs @@ -0,0 +1,37 @@ +using Microsoft.Diagnostics.NETCore.Client; +using Microsoft.Diagnostics.Tracing; +using Microsoft.Diagnostics.Tracing.EventPipe; +using Microsoft.Diagnostics.Tracing.Parsers; +using System; +using System.Collections.Generic; +using System.Diagnostics.Tracing; + +public class RuntimeGCEventsPrinter +{ + public static void PrintRuntimeGCEvents(int processId) + { + var providers = new List() + { + new EventPipeProvider("Microsoft-Windows-DotNETRuntime", + EventLevel.Informational, (long)ClrTraceEventParser.Keywords.GC) + }; + + var client = new DiagnosticsClient(processId); + using (EventPipeSession session = client.StartEventPipeSession(providers, false)) + { + var source = new EventPipeEventSource(session.EventStream); + + source.Clr.All += (TraceEvent obj) => Console.WriteLine(obj.ToString()); + + try + { + source.Process(); + } + catch (Exception e) + { + Console.WriteLine("Error encountered while processing events"); + Console.WriteLine(e.ToString()); + } + } + } +} diff --git a/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/ProfilerAttach.cs b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/ProfilerAttach.cs new file mode 100644 index 0000000000000..1d9c33fa4de40 --- /dev/null +++ b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/ProfilerAttach.cs @@ -0,0 +1,11 @@ +using System; +using Microsoft.Diagnostics.NETCore.Client; + +public class Profiler +{ + public static void AttachProfiler(int processId, Guid profilerGuid, string profilerPath) + { + var client = new DiagnosticsClient(processId); + client.AttachProfiler(TimeSpan.FromSeconds(10), profilerGuid, profilerPath); + } +} diff --git a/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TraceProcessForDuration.cs b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TraceProcessForDuration.cs new file mode 100644 index 0000000000000..bde60807d5f9c --- /dev/null +++ b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TraceProcessForDuration.cs @@ -0,0 +1,35 @@ +using Microsoft.Diagnostics.Tracing; +using Microsoft.Diagnostics.Tracing.Parsers; +using Microsoft.Diagnostics.NETCore.Client; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.Tracing; +using System.IO; +using System.Threading.Tasks; + +public partial class Tracer +{ + public void TraceProcessForDuration(int processId, int duration, string traceName) + { + var cpuProviders = new List() + { + new EventPipeProvider("Microsoft-Windows-DotNETRuntime", EventLevel.Informational, (long)ClrTraceEventParser.Keywords.Default), + new EventPipeProvider("Microsoft-DotNETCore-SampleProfiler", EventLevel.Informational, (long)ClrTraceEventParser.Keywords.None) + }; + var client = new DiagnosticsClient(processId); + using (var traceSession = client.StartEventPipeSession(cpuProviders)) + { + Task copyTask = Task.Run(async () => + { + using (FileStream fs = new FileStream(traceName, FileMode.Create, FileAccess.Write)) + { + await traceSession.EventStream.CopyToAsync(fs); + } + }); + + Task.WhenAny(copyTask, Task.Delay(TimeSpan.FromMilliseconds(duration * 1000))); + traceSession.Stop(); + } + } +} diff --git a/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TriggerCoreDump.cs b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TriggerCoreDump.cs new file mode 100644 index 0000000000000..d059e5730339d --- /dev/null +++ b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TriggerCoreDump.cs @@ -0,0 +1,10 @@ +using Microsoft.Diagnostics.NETCore.Client; + +public partial class Dumper +{ + public static void TriggerCoreDump(int processId) + { + var client = new DiagnosticsClient(processId); + client.WriteDump(DumpType.Normal, "/tmp/minidump.dmp"); + } +} diff --git a/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TriggerDumpOnCpuUsage.cs b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TriggerDumpOnCpuUsage.cs new file mode 100644 index 0000000000000..fd16ce354e63b --- /dev/null +++ b/docs/core/diagnostics/snippets/Microsoft.Diagnostics.NETCore.Client/csharp/TriggerDumpOnCpuUsage.cs @@ -0,0 +1,52 @@ +using Microsoft.Diagnostics.NETCore.Client; +using Microsoft.Diagnostics.Tracing; +using Microsoft.Diagnostics.Tracing.EventPipe; +using Microsoft.Diagnostics.Tracing.Parsers; +using System; +using System.Collections.Generic; +using System.Diagnostics.Tracing; + +public partial class Dumper +{ + public static void TriggerDumpOnCpuUsage(int processId, int threshold) + { + var providers = new List() + { + new EventPipeProvider( + "System.Runtime", + EventLevel.Informational, + (long)ClrTraceEventParser.Keywords.None, + new Dictionary + { + ["EventCounterIntervalSec"] = "1" + } + ) + }; + var client = new DiagnosticsClient(processId); + using (var session = client.StartEventPipeSession(providers)) + { + var source = new EventPipeEventSource(session.EventStream); + source.Dynamic.All += (TraceEvent obj) => + { + if (obj.EventName.Equals("EventCounters")) + { + var payloadVal = (IDictionary)(obj.PayloadValue(0)); + var payloadFields = (IDictionary)(payloadVal["Payload"]); + if (payloadFields["Name"].ToString().Equals("cpu-usage")) + { + double cpuUsage = Double.Parse(payloadFields["Mean"].ToString()); + if (cpuUsage > (double)threshold) + { + client.WriteDump(DumpType.Normal, "/tmp/minidump.dmp"); + } + } + } + }; + try + { + source.Process(); + } + catch (Exception) {} + } + } +} diff --git a/docs/core/extensions/cloud-service.md b/docs/core/extensions/cloud-service.md new file mode 100644 index 0000000000000..9e0c8efdf2f76 --- /dev/null +++ b/docs/core/extensions/cloud-service.md @@ -0,0 +1,238 @@ +--- +title: Deploy a Worker Service to Azure +description: Learn how to deploy a .NET Worker Service to Azure. +author: IEvangelist +ms.author: dapine +ms.date: 06/18/2021 +ms.topic: tutorial +zone_pivot_groups: development-environment-one +--- + +# Deploy a Worker Service to Azure + +In this article, you'll learn how to deploy a .NET Worker Service to Azure. With your Worker running as an [Azure Container Instance (ACI)](/azure/container-instances) from the [Azure Container Registry (ACR)](/azure/container-registry), it can act as a microservice in the cloud. There are many use cases for long-running services, and the Worker Service exists for this reason. + +In this tutorial, you learn how to: + +> [!div class="checklist"] +> +> - Create a worker service. +> - Create container registry resource. +> - Push an image to container registry. +> - Deploy as container instance. +> - Verify worker service functionality. + +## Prerequisites + +- The [.NET 5.0 SDK or later](https://dotnet.microsoft.com/download/dotnet). +- Docker Desktop ([Windows](https://docs.docker.com/docker-for-windows/install) or [Mac](https://docs.docker.com/docker-for-mac/install)). +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/dotnet). +- Depending on your developer environment of choice: + - [Visual Studio, Visual Studio Code, or Visual Studio for Mac](https://visualstudio.microsoft.com). + - [.NET CLI](../tools/index.md) + - [Azure CLI](/cli/azure/install-azure-cli). + + +[!INCLUDE [zoned-file-new-worker](includes/zoned-file-new-worker.md)] + +### Add Docker support + +:::zone target="docs" pivot="visualstudio" + +In Visual Studio, right-click on the project node in the **Solution Explorer**, and select **Add** > **Docker Support**. You'll be prompted to select a **Target OS**, select **OK** with the default OS selection. + +:::image type="content" source="media/docker-file-options.png" alt-text="Docker File Options"::: + +:::zone-end +:::zone target="docs" pivot="vscode" + +In Visual Studio Code, you'll need the [Docker extension](https://code.visualstudio.com/docs/containers/overview) installed. Open the Command Palette, and select the **Docker: Add Docker files to workspace** option. If prompted to **Select Application Platform** choose **.NET: Core Console**. If prompted to **Select Project**, choose the Worker Service project you created. When prompted to **Select Operating System**, choose the first listed OS. When prompted whether or not to **Include optional Docker Compose files**, select **No**. + +:::zone-end + +Docker support requires a *Dockerfile*. This file is a set of comprehensive instructions, for building your .NET Worker Service as a Docker image. The following is an example *Dockerfile*, and should exist at the root directory of the project file: + +:::code language="dockerfile" source="snippets/workers/cloud-service/Dockerfile"::: + +### Build the Docker image + +To build the Docker image, the Docker Engine must be running. + +:::zone target="docs" pivot="visualstudio" + +Right-click on the *Dockerfile* in the **Solution Explorer**, and select **Build Docker Image**. The **Output** window displays, reporting the `docker build` command progress. + +:::zone-end +:::zone target="docs" pivot="vscode" + +Right-click on the *Dockerfile* in the **Explorer**, and select **Build Image**. When prompted to **Tag image as**, enter `appcloudservice:latest`. The **Docker Task** output terminal displays, reporting the Docker build command progress. + +> [!NOTE] +> If you're _not_ prompted to tag the image, it's possible that Visual Studio Code is relying on an existing *tasks.json*. If the tag used is undesirable, you can change it by updating the `docker-build` configuration item's `dockerBuild/tag` value in the `tasks` array. Consider the following example configuration section: +> +> ```json +> { +> "type": "docker-build", +> "label": "docker-build: release", +> "dependsOn": [ +> "build" +> ], +> "dockerBuild": { +> "tag": "appcloudservice:latest", +> "dockerfile": "${workspaceFolder}/cloud-service/Dockerfile", +> "context": "${workspaceFolder}", +> "pull": true +> }, +> "netCore": { +> "appProject": "${workspaceFolder}/cloud-service/App.CloudService.csproj" +> } +> } +> ``` + +:::zone-end +:::zone target="docs" pivot="cli" + +Open a terminal window in the root directory of the *Dockerfile*, and run the following docker command: + +```console +docker build -t appcloudservice:latest -f Dockerfile . +``` + +:::zone-end + +As the `docker build` command runs, it processes each line in the *Dockerfile* as an instruction step. This command builds the image and creates a local repository named **appcloudservice** that points to the image. + +> [!TIP] +> The generated _Dockerfile_ differs between development environments. For example, if you [Add Docker support](#add-docker-support) from Visual Studio you may experience issues if you attempt to [Build the Docker image](#build-the-docker-image) from Visual Studio Code — as the _Dockerfile_ steps vary. It is best to choose a single _development environment_ and use it through out this tutorial. + +## Create container registry + +An Azure Container Registry (ACR) resource allows you to build, store, and manage container images and artifacts in a private registry. To create a container registry, you'll need to [create a new resource](https://ms.portal.azure.com/#create/Microsoft.ContainerRegistry) in the Azure portal. + +1. Select the **Subscription**, and corresponding **Resource group** (or create a new one). +1. Enter a **Registry name**. +1. Select a **Location**. +1. Select an appropriate **SKU**, for example **Basic**. +1. Select **Review + create**. +1. After seeing **Validation passed**, select **Create**. + +> [!IMPORTANT] +> In order to use this container registry when creating a container instance, you must enable **Admin user**. Select **Access keys**, and enable **Admin user**. + +For more information, see [Quickstart: Create an Azure container registry](/azure/container-registry/container-registry-get-started-portal). + +## Push image to container registry + +With the .NET Docker image built, and the container registry resource created, you can now push the image to container registry. + +:::zone target="docs" pivot="visualstudio" + +Right-click on the project in the **Solution Explorer**, and select **Publish**. The **Publish** dialog displays. For the **Target**, select **Azure** and then **Next**. + +:::image type="content" source="media/publish-dialog-azure.png" lightbox="media/publish-dialog-azure.png" alt-text="Visual Studio: Publish dialog - select Azure"::: + +For the **Specific Target**, select **Azure Container Registry** and then **Next**. + +:::image type="content" source="media/publish-dialog-azure-acr.png" lightbox="media/publish-dialog-azure-acr.png" alt-text="Visual Studio: Publish dialog - select container registry"::: + +Next, for the **Container Registry**, select your **Subscription name** that you used to created the ACR resrouce. From the **Container registries** selection area, select the container registry that you created, and then select **Finish**. + +:::image type="content" source="media/publish-dialog-azure-acr-registry.png" lightbox="media/publish-dialog-azure-acr-registry.png" alt-text="Visual Studio: Publish dialog - select container registry details"::: + +This creates a publish profile, which can be used to publish the image to container registry. Select the **Publish** button to push the image to the container registry, the **Output** window reports the publish progress — and when it completes successfully, you'll see a "Successfully published" message. + +:::zone-end +:::zone target="docs" pivot="vscode" + +Select **Docker** from the **Activity Bar** in Visual Studio Code. Expand the **IMAGES** tree view panel, then expand the `appcloudservice` image node and right-click on the `latest` tag. + +:::image type="content" source="media/vs-code-push-image.png" alt-text="Visual Studio Code: Docker - push image"::: + +The integrated terminal window will report the progress of the `docker push` command to the container registry. + +:::zone-end +:::zone target="docs" pivot="cli" + +Open a terminal window in the root directory of the *Dockerfile*, and run the following Azure CLI command: + +> [!IMPORTANT] +> To interact with Azure resources from the Azure CLI, you must be authenticated for your terminal session. To authenticate, use the [`az login`](/cli/azure/authenticate-azure-cli) command: +> +> ```azurecli +> az login +> ``` +> +> After you're logged in, use the [`az account set`](/cli/azure/account#az_account_set) command to specify your subscription when you have more than one and no default subscription set. +> +> ```azurecli +> az account set --subscription +> ``` + +```azurecli +az acr login -n +``` + +The [`az acr login`](/cli/azure/acr#az_acr_login) command will log in to a container registry through the Docker CLI. To push the image to the container registry, use the [az acr build](/cli/azure/acr#az_acr_build) command with your container registry name as the ``: + +```azurecli +az acr build -r . +``` + +The preceding command: + +- Packs the source into a *tar* file. +- Uploads it to the container registry. +- The container registry unpacks the *tar* file. +- Runs the `docker build` command in the container registry resource against the *Dockerfile*. +- Adds the image to the container registry. + +:::zone-end + +To verify that the image was successfully pushed to the container registry, navigate to the Azure portal. Open the container registry resource, under **Services**, select **Repositories**. You should see the image. + +## Deploy as container instance + +:::zone target="docs" pivot="vscode" + +From Visual Studio Code, select **Docker** from the **Activity Bar**. Expand the **REGISTRIES** node, and select **Connect Registry**. Select **Azure** when prompted, and login if required. + +:::image type="content" source="media/vs-code-connect-registry.png" alt-text="Visual Studio Code - Docker: Connect registry"::: + +Expand the **REGISTRIES** node, select **Azure**, your subscription > the container registry > the image, and then right-click the tag. Select **Deploy Image to Azure Container Instances**. + +:::image type="content" source="media/vs-code-deploy-to-aci.png" alt-text="Visual Studio Code - Docker: Deploy image to Azure Container Instances"::: + +:::zone-end + +:::zone target="docs" pivot="visualstudio,cli" + +To create a container instance, you'll need to [create a new resource](https://ms.portal.azure.com/#create/Microsoft.ContainerInstances) in the Azure portal. + +1. Select the same **Subscription**, and corresponding **Resource group** from the previous section. +1. Enter a **Container name** — `appcloudservice-container`. +1. Select a **Region** that corresponds to the previous **Location** selection. +1. Select **Azure Container Registry** as the **Image source**. +1. Select the **Registry** by the name provided in the previous step. +1. Select the **Image** and **Image tag**. +1. Select **Review + create**. +1. Assuming **Validation passed**, select **Create**. + +For more information, see [Quickstart: Create an Azure container instance](/azure/container-instances/container-instances-quickstart-portal). + +:::zone-end + +## Verify service functionality + +Immediately after the container instance is created, it starts running. From the Azure portal in the container instance resource, select the **Containers** option. + +:::image type="content" source="media/container-instance-running.png" lightbox="media/container-instance-running.png" alt-text="Azure portal: Container instance running"::: + +You'll see the containers, and their current **State**. In this case it will be **Running**. Select **Logs** to see the .NET worker service output. + +## See also + +- [Worker Services in .NET](workers.md) +- [Use scoped services within a `BackgroundService`](scoped-service.md) +- [Create a Windows Service using `BackgroundService`](windows-service.md) +- [Implement the `IHostedService` interface](timer-service.md) +- [Tutorial: Containerize a .NET Core app](../docker/build-container.md) diff --git a/docs/core/extensions/configuration-providers.md b/docs/core/extensions/configuration-providers.md index 70d2d2ef582d7..e1f882a7db3ec 100644 --- a/docs/core/extensions/configuration-providers.md +++ b/docs/core/extensions/configuration-providers.md @@ -88,7 +88,7 @@ An example *appsettings.xml* file with various configuration settings follows: :::code language="xml" source="snippets/configuration/console-xml/appsettings.xml"::: -Repeating elements that use the same element name work if the `name` attribute is used to distinguish the elements: +In .NET 5 and earlier versions, add the `name` attribute to distinguish repeating elements that use the same element name. In .NET 6 and later versions, the XML configuration provider automatically indexes repeating elements. That means you don't have to specify the `name` attribute, except if you want the "0" index in the key and there's only one element. :::code language="xml" source="snippets/configuration/console-xml/repeating-example.xml"::: diff --git a/docs/core/extensions/custom-logging-provider.md b/docs/core/extensions/custom-logging-provider.md index e1ee7e5bd8ee8..2858a7bf34d0a 100644 --- a/docs/core/extensions/custom-logging-provider.md +++ b/docs/core/extensions/custom-logging-provider.md @@ -3,7 +3,7 @@ title: Implement a custom logging provider in .NET description: Learn how to implement a custom logging provider in your .NET applications. author: IEvangelist ms.author: dapine -ms.date: 05/06/2021 +ms.date: 06/22/2021 ms.topic: how-to --- @@ -28,13 +28,15 @@ The `ILogger` implementation category name is typically the logging source. For The preceding code: - Creates a logger instance per category name. -- Checks `_config.LogLevels.ContainsKey(logLevel)` in `IsEnabled`, so each `logLevel` has a unique logger. Loggers should also be enabled for all higher log levels: +- Checks `_getCurrentConfig().LogLevels.ContainsKey(logLevel)` in `IsEnabled`, so each `logLevel` has a unique logger. Loggers should also be enabled for all higher log levels: :::code language="csharp" source="snippets/configuration/console-custom-logging/ColorConsoleLogger.cs" range="16-17"::: +The logger is instantiated with the `name` and a `Func` which will return the current config — this handles updates to the config values as monitored through the callback. + ## Custom logger provider -The `ILoggerProvider` object is responsible for creating logger instances. Maybe it is not needed to create a logger instance per category, but this makes sense for some loggers, like NLog or log4net. Doing this you are also able to choose different logging output targets per category if needed: +The `ILoggerProvider` object is responsible for creating logger instances. It's not necessary to create a logger instance per category, but it makes sense for some loggers, like NLog or log4net. This strategy allows you to choose different logging output targets per category, as in the following example: :::code language="csharp" source="snippets/configuration/console-custom-logging/ColorConsoleLoggerProvider.cs"::: diff --git a/docs/core/extensions/includes/file-new-worker.md b/docs/core/extensions/includes/file-new-worker.md index 63d9cd3f42092..7254108e49664 100644 --- a/docs/core/extensions/includes/file-new-worker.md +++ b/docs/core/extensions/includes/file-new-worker.md @@ -1,13 +1,13 @@ --- author: IEvangelist ms.author: dapine -ms.date: 05/25/2021 +ms.date: 06/01/2021 ms.topic: include --- ## Create a new project -To create a new Worker Service project with Visual Studio, you'd select **File** > **New** > **Project...**. From the **Create a new project** dialog search for "Worker Service", and select Worker Service template. If you'd rather use the .NET CLI, open your favorite .NET CLI tool in a working directory. Run the `dotnet new` command, and replace the `` with your desired project name. +To create a new Worker Service project with Visual Studio, you'd select **File** > **New** > **Project...**. From the **Create a new project** dialog search for "Worker Service", and select Worker Service template. If you'd rather use the .NET CLI, open your favorite terminal in a working directory. Run the `dotnet new` command, and replace the `` with your desired project name. ```dotnetcli dotnet new worker --name diff --git a/docs/core/extensions/includes/zoned-file-new-worker.md b/docs/core/extensions/includes/zoned-file-new-worker.md new file mode 100644 index 0000000000000..ea98388893f03 --- /dev/null +++ b/docs/core/extensions/includes/zoned-file-new-worker.md @@ -0,0 +1,38 @@ +--- +author: IEvangelist +ms.author: dapine +ms.date: 06/02/2021 +ms.topic: include +--- + +## Create a new project + +:::zone target="docs" pivot="visualstudio" + +To create a new Worker Service project with Visual Studio, you'd select **File** > **New** > **Project...**. From the **Create a new project** dialog search for "Worker Service", and select Worker Service template. + +:::zone-end +:::zone target="docs" pivot="vscode" + +To create a new Worker Service project with Visual Studio Code, you can run .NET CLI commands from the integrated terminal. For more information, see [Visual Studio Code: Integrated Terminal](https://code.visualstudio.com/docs/editor/integrated-terminal). + +Open the integrated terminal, and run the `dotnet new` command, and replace the `` with your desired project name. + +```dotnetcli +dotnet new worker --name +``` + +For more information on the .NET CLI new worker service project command, see [dotnet new worker](../../tools/dotnet-new-sdk-templates.md#web-others). + +:::zone-end +:::zone target="docs" pivot="cli" + +To create a new Worker Service project with the .NET CLI, open your favorite terminal in a working directory. Run the `dotnet new` command, and replace the `` with your desired project name. + +```dotnetcli +dotnet new worker --name +``` + +For more information on the .NET CLI new worker service project command, see [dotnet new worker](../../tools/dotnet-new-sdk-templates.md#web-others). + +:::zone-end diff --git a/docs/core/extensions/logging-providers.md b/docs/core/extensions/logging-providers.md index 9ee48de725a93..a439a4c57f19f 100644 --- a/docs/core/extensions/logging-providers.md +++ b/docs/core/extensions/logging-providers.md @@ -222,7 +222,6 @@ Here are some third-party logging frameworks that work with various .NET workloa - [JSNLog](http://jsnlog.com) ([GitHub repo](https://github.com/mperdeck/jsnlog)) - [KissLog.net](https://kisslog.net) ([GitHub repo](https://github.com/catalingavan/KissLog-net)) - [Log4Net](https://logging.apache.org/log4net) ([GitHub repo](https://github.com/apache/logging-log4net)) -- [Loggr](https://loggr.net) ([GitHub repo](https://github.com/imobile3/Loggr.Extensions.Logging)) - [NLog](https://nlog-project.org) ([GitHub repo](https://github.com/NLog/NLog.Extensions.Logging)) - [NReco.Logging](https://github.com/nreco/logging/blob/master/README.md) ([GitHub repo](https://github.com/nreco/logging)) - [Sentry](https://sentry.io/welcome) ([GitHub repo](https://github.com/getsentry/sentry-dotnet)) diff --git a/docs/core/extensions/media/container-instance-running.png b/docs/core/extensions/media/container-instance-running.png new file mode 100644 index 0000000000000..3a4d1546f949b Binary files /dev/null and b/docs/core/extensions/media/container-instance-running.png differ diff --git a/docs/core/extensions/media/docker-file-options.png b/docs/core/extensions/media/docker-file-options.png new file mode 100644 index 0000000000000..7ef4b705d144c Binary files /dev/null and b/docs/core/extensions/media/docker-file-options.png differ diff --git a/docs/core/extensions/media/publish-dialog-azure-acr-registry.png b/docs/core/extensions/media/publish-dialog-azure-acr-registry.png new file mode 100644 index 0000000000000..2bf6bd553fb58 Binary files /dev/null and b/docs/core/extensions/media/publish-dialog-azure-acr-registry.png differ diff --git a/docs/core/extensions/media/publish-dialog-azure-acr.png b/docs/core/extensions/media/publish-dialog-azure-acr.png new file mode 100644 index 0000000000000..d836a2b92de91 Binary files /dev/null and b/docs/core/extensions/media/publish-dialog-azure-acr.png differ diff --git a/docs/core/extensions/media/publish-dialog-azure.png b/docs/core/extensions/media/publish-dialog-azure.png new file mode 100644 index 0000000000000..00e91da6fde8d Binary files /dev/null and b/docs/core/extensions/media/publish-dialog-azure.png differ diff --git a/docs/core/extensions/media/vs-code-connect-registry.png b/docs/core/extensions/media/vs-code-connect-registry.png new file mode 100644 index 0000000000000..aff34b4e5d1f9 Binary files /dev/null and b/docs/core/extensions/media/vs-code-connect-registry.png differ diff --git a/docs/core/extensions/media/vs-code-deploy-to-aci.png b/docs/core/extensions/media/vs-code-deploy-to-aci.png new file mode 100644 index 0000000000000..783ff59352331 Binary files /dev/null and b/docs/core/extensions/media/vs-code-deploy-to-aci.png differ diff --git a/docs/core/extensions/media/vs-code-push-image.png b/docs/core/extensions/media/vs-code-push-image.png new file mode 100644 index 0000000000000..b387c3320741f Binary files /dev/null and b/docs/core/extensions/media/vs-code-push-image.png differ diff --git a/docs/core/extensions/options.md b/docs/core/extensions/options.md index 4d3395b338d9d..e27a709268fa4 100644 --- a/docs/core/extensions/options.md +++ b/docs/core/extensions/options.md @@ -3,7 +3,7 @@ title: Options pattern in .NET author: IEvangelist description: Learn how to use the options pattern to represent groups of related settings in .NET apps. ms.author: dapine -ms.date: 05/04/2021 +ms.date: 06/21/2021 --- # Options pattern in .NET @@ -68,6 +68,18 @@ services.Configure( key: nameof(TransientFaultHandlingOptions))); ``` +To access both the `services` and the `configurationRoot` objects, you must use the method — the is available as the property. + +```csharp +Host.CreateDefaultBuilder(args) + .ConfigureServices((context, services) => + { + var configurationRoot = context.Configuration; + services.Configure( + configurationRoot.GetSection(nameof(TransientFaultHandlingOptions))); + }); +``` + > [!TIP] > The `key` parameter is the name of the configuration section to search for. It does *not* have to match the name of the type that represents it. For example, you could have a section named `"FaultHandling"` and it could be represented by the `TransientFaultHandlingOptions` class. In this instance, you'd pass `"FaultHandling"` to the function instead. The `nameof` operator is used as a convenience when the named section matches the type it corresponds to. diff --git a/docs/core/extensions/snippets/configuration/console-custom-logging/ColorConsoleLogger.cs b/docs/core/extensions/snippets/configuration/console-custom-logging/ColorConsoleLogger.cs index 4f9566b769681..74cbf4ccc895c 100644 --- a/docs/core/extensions/snippets/configuration/console-custom-logging/ColorConsoleLogger.cs +++ b/docs/core/extensions/snippets/configuration/console-custom-logging/ColorConsoleLogger.cs @@ -4,17 +4,17 @@ public class ColorConsoleLogger : ILogger { private readonly string _name; - private readonly ColorConsoleLoggerConfiguration _config; + private readonly Func _getCurrentConfig; public ColorConsoleLogger( string name, - ColorConsoleLoggerConfiguration config) => - (_name, _config) = (name, config); + Func getCurrentConfig) => + (_name, _getCurrentConfig) = (name, getCurrentConfig); public IDisposable BeginScope(TState state) => default; public bool IsEnabled(LogLevel logLevel) => - _config.LogLevels.ContainsKey(logLevel); + _getCurrentConfig().LogLevels.ContainsKey(logLevel); public void Log( LogLevel logLevel, @@ -28,11 +28,12 @@ public void Log( return; } - if (_config.EventId == 0 || _config.EventId == eventId.Id) + ColorConsoleLoggerConfiguration config = _getCurrentConfig(); + if (config.EventId == 0 || config.EventId == eventId.Id) { ConsoleColor originalColor = Console.ForegroundColor; - Console.ForegroundColor = _config.LogLevels[logLevel]; + Console.ForegroundColor = config.LogLevels[logLevel]; Console.WriteLine($"[{eventId.Id,2}: {logLevel,-12}]"); Console.ForegroundColor = originalColor; diff --git a/docs/core/extensions/snippets/configuration/console-custom-logging/ColorConsoleLoggerProvider.cs b/docs/core/extensions/snippets/configuration/console-custom-logging/ColorConsoleLoggerProvider.cs index 859aa89c98661..ab61e1f01df84 100644 --- a/docs/core/extensions/snippets/configuration/console-custom-logging/ColorConsoleLoggerProvider.cs +++ b/docs/core/extensions/snippets/configuration/console-custom-logging/ColorConsoleLoggerProvider.cs @@ -17,7 +17,9 @@ public ColorConsoleLoggerProvider( } public ILogger CreateLogger(string categoryName) => - _loggers.GetOrAdd(categoryName, name => new ColorConsoleLogger(name, _currentConfig)); + _loggers.GetOrAdd(categoryName, name => new ColorConsoleLogger(name, GetCurrentConfig)); + + private ColorConsoleLoggerConfiguration GetCurrentConfig() => _currentConfig; public void Dispose() { diff --git a/docs/core/extensions/snippets/logging/console-formatter-custom/CustomFormatter.cs b/docs/core/extensions/snippets/logging/console-formatter-custom/CustomFormatter.cs index f105838d4891d..0c1b4e0ec3b89 100644 --- a/docs/core/extensions/snippets/logging/console-formatter-custom/CustomFormatter.cs +++ b/docs/core/extensions/snippets/logging/console-formatter-custom/CustomFormatter.cs @@ -26,20 +26,15 @@ public override void Write( IExternalScopeProvider scopeProvider, TextWriter textWriter) { - if (logEntry.Exception is null) - { - return; - } - string message = logEntry.Formatter( logEntry.State, logEntry.Exception); - + if (message == null) { return; } - + CustomLogicGoesHere(textWriter); textWriter.WriteLine(message); } diff --git a/docs/core/extensions/snippets/workers/.dockerignore b/docs/core/extensions/snippets/workers/.dockerignore index 3729ff0cd1acc..0426a8a3195ca 100644 --- a/docs/core/extensions/snippets/workers/.dockerignore +++ b/docs/core/extensions/snippets/workers/.dockerignore @@ -15,11 +15,11 @@ **/bin **/charts **/docker-compose* +**/compose* **/Dockerfile* **/node_modules **/npm-debug.log **/obj **/secrets.dev.yaml **/values.dev.yaml -LICENSE -README.md \ No newline at end of file +README.md diff --git a/docs/core/extensions/snippets/workers/background-service/Dockerfile b/docs/core/extensions/snippets/workers/background-service/Dockerfile index 305bdd37f779f..ee164f43f5275 100644 --- a/docs/core/extensions/snippets/workers/background-service/Dockerfile +++ b/docs/core/extensions/snippets/workers/background-service/Dockerfile @@ -6,16 +6,16 @@ WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src -COPY ["background-service/App.BackgroundService.csproj", "background-service/"] -RUN dotnet restore "background-service/App.BackgroundService.csproj" +COPY ["background-service/App.WorkerService.csproj", "background-service/"] +RUN dotnet restore "background-service/App.WorkerService.csproj" COPY . . WORKDIR "/src/background-service" -RUN dotnet build "App.BackgroundService.csproj" -c Release -o /app/build +RUN dotnet build "App.WorkerService.csproj" -c Release -o /app/build FROM build AS publish -RUN dotnet publish "App.BackgroundService.csproj" -c Release -o /app/publish +RUN dotnet publish "App.WorkerService.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "App.BackgroundService.dll"] +ENTRYPOINT ["dotnet", "App.WorkerService.dll"] diff --git a/docs/core/extensions/snippets/workers/cloud-service/.dockerignore b/docs/core/extensions/snippets/workers/cloud-service/.dockerignore new file mode 100644 index 0000000000000..0426a8a3195ca --- /dev/null +++ b/docs/core/extensions/snippets/workers/cloud-service/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +README.md diff --git a/docs/core/extensions/snippets/workers/cloud-service/App.CloudService.csproj b/docs/core/extensions/snippets/workers/cloud-service/App.CloudService.csproj new file mode 100644 index 0000000000000..677640fc46f6c --- /dev/null +++ b/docs/core/extensions/snippets/workers/cloud-service/App.CloudService.csproj @@ -0,0 +1,12 @@ + + + net5.0 + App.CloudService + enable + Linux + + + + + + \ No newline at end of file diff --git a/docs/core/extensions/snippets/workers/cloud-service/Dockerfile b/docs/core/extensions/snippets/workers/cloud-service/Dockerfile new file mode 100644 index 0000000000000..e5c1327edd976 --- /dev/null +++ b/docs/core/extensions/snippets/workers/cloud-service/Dockerfile @@ -0,0 +1,23 @@ +FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base +WORKDIR /app + +# Creates a non-root user with an explicit UID and adds permission to access the /app folder +# For more info, please refer to https://aka.ms/vscode-docker-dotnet-configure-containers +RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app +USER appuser + +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build +WORKDIR /src +COPY ["App.CloudService.csproj", "./"] +RUN dotnet restore "App.CloudService.csproj" +COPY . . +WORKDIR "/src/." +RUN dotnet build "App.CloudService.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "App.CloudService.csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "App.CloudService.dll"] diff --git a/docs/core/extensions/snippets/workers/cloud-service/Program.cs b/docs/core/extensions/snippets/workers/cloud-service/Program.cs new file mode 100644 index 0000000000000..6db2a208f1f1e --- /dev/null +++ b/docs/core/extensions/snippets/workers/cloud-service/Program.cs @@ -0,0 +1,12 @@ +using App.CloudService; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +using IHost host = Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }) + .Build(); + +await host.RunAsync(); diff --git a/docs/core/extensions/snippets/workers/cloud-service/Properties/launchSettings.json b/docs/core/extensions/snippets/workers/cloud-service/Properties/launchSettings.json new file mode 100644 index 0000000000000..d1947de1b0a5c --- /dev/null +++ b/docs/core/extensions/snippets/workers/cloud-service/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "profiles": { + "App.CloudService": { + "commandName": "Project", + "environmentVariables": { + "DOTNET_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": "true" + }, + "Docker": { + "commandName": "Docker" + } + } +} \ No newline at end of file diff --git a/docs/core/extensions/snippets/workers/cloud-service/Worker.cs b/docs/core/extensions/snippets/workers/cloud-service/Worker.cs new file mode 100644 index 0000000000000..239d63f838b24 --- /dev/null +++ b/docs/core/extensions/snippets/workers/cloud-service/Worker.cs @@ -0,0 +1,34 @@ +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace App.CloudService +{ + public class Worker : BackgroundService + { + private readonly ILogger _logger; + + public Worker(ILogger logger) + { + _logger = logger; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + while (!stoppingToken.IsCancellationRequested) + { + _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); + try + { + await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); + } + catch (OperationCanceledException) + { + break; + } + } + } + } +} diff --git a/docs/core/extensions/snippets/workers/cloud-service/appsettings.Development.json b/docs/core/extensions/snippets/workers/cloud-service/appsettings.Development.json new file mode 100644 index 0000000000000..8983e0fc1c5e2 --- /dev/null +++ b/docs/core/extensions/snippets/workers/cloud-service/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/docs/core/extensions/snippets/workers/cloud-service/appsettings.json b/docs/core/extensions/snippets/workers/cloud-service/appsettings.json new file mode 100644 index 0000000000000..8983e0fc1c5e2 --- /dev/null +++ b/docs/core/extensions/snippets/workers/cloud-service/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/docs/core/extensions/snippets/workers/workers.sln b/docs/core/extensions/snippets/workers/workers.sln index 6111183018978..3bf19a22ba03f 100644 --- a/docs/core/extensions/snippets/workers/workers.sln +++ b/docs/core/extensions/snippets/workers/workers.sln @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.TimerHostedService", "t EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.WindowsService", "windows-service\App.WindowsService.csproj", "{0642A687-220B-4E1E-99B8-A31B5DC40A35}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "App.CloudService", "cloud-service\App.CloudService.csproj", "{D27DBD6D-3E1D-4A3F-9653-5EBFABA22123}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {0642A687-220B-4E1E-99B8-A31B5DC40A35}.Debug|Any CPU.Build.0 = Debug|Any CPU {0642A687-220B-4E1E-99B8-A31B5DC40A35}.Release|Any CPU.ActiveCfg = Release|Any CPU {0642A687-220B-4E1E-99B8-A31B5DC40A35}.Release|Any CPU.Build.0 = Release|Any CPU + {D27DBD6D-3E1D-4A3F-9653-5EBFABA22123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D27DBD6D-3E1D-4A3F-9653-5EBFABA22123}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D27DBD6D-3E1D-4A3F-9653-5EBFABA22123}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D27DBD6D-3E1D-4A3F-9653-5EBFABA22123}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/docs/core/extensions/workers.md b/docs/core/extensions/workers.md index 9c2cbdef02b8f..db7f8e3c326b6 100644 --- a/docs/core/extensions/workers.md +++ b/docs/core/extensions/workers.md @@ -31,7 +31,7 @@ There are many terms that are mistakenly used synonymously. In this section, the ## Worker Service template -The Worker Service template is available to the .NET CLI, and Visual Studio. For more information, see [.NET CLI, `dotnet new worker` - template](/dotnet/core/tools/dotnet-new-sdk-templates#web-others). The template consists of a `Program` and `Worker` class. +The Worker Service template is available to the .NET CLI, and Visual Studio. For more information, see [.NET CLI, `dotnet new worker` - template](../tools/dotnet-new-sdk-templates.md#web-others). The template consists of a `Program` and `Worker` class. :::code language="csharp" source="snippets/workers/background-service/Program.cs"::: @@ -108,7 +108,7 @@ When targeting Docker as a deployment strategy for your .NET Worker Service, the In the preceding project file, the `` element specifies `Linux` as its target. To target Windows containers, use `Windows` instead. The [`Microsoft.VisualStudio.Azure.Containers.Tools.Targets` NuGet package](https://www.nuget.org/packages/Microsoft.VisualStudio.Azure.Containers.Tools.Targets) is automatically added as a package reference when **Docker support** is selected from the template. -For more information on Docker with .NET, see [Tutorial: Containerize a .NET app](../docker/build-container.md). +For more information on Docker with .NET, see [Tutorial: Containerize a .NET app](../docker/build-container.md). For more information on deploying to Azure, see [Tutorial: Deploy a Worker Service to Azure](cloud-service.md). ## Hosted Service extensibility diff --git a/docs/core/install/includes/linux-install-package-manager-x64-vs-arm.md b/docs/core/install/includes/linux-install-package-manager-x64-vs-arm.md index dc0bfbf1f6402..77176af553f22 100644 --- a/docs/core/install/includes/linux-install-package-manager-x64-vs-arm.md +++ b/docs/core/install/includes/linux-install-package-manager-x64-vs-arm.md @@ -2,8 +2,8 @@ > [!IMPORTANT] > Package manager installs are only supported on the **x64** architecture. Other architectures, such as **ARM**, must install .NET by some other means such as with Snap, an installer script, or through a manual binary installation. -For more information on installing .NET without a package manager, see one of the following articles: +For more information on installing .NET **without a package manager**, see one of the following articles: -- [Install the .NET SDK or the .NET Runtime with Snap.](../linux-snap.md) -- [Install the .NET SDK or the .NET Runtime with a script.](../linux-scripted-manual.md#scripted-install) -- [Install the .NET SDK or the .NET Runtime manually.](../linux-scripted-manual.md#manual-install) +- [Alternatively install .NET with Snap.](../linux-snap.md) +- [Alternatively install .NET with `install-dotnet` script.](../linux-scripted-manual.md#scripted-install) +- [Manually install .NET](../linux-scripted-manual.md#manual-install) diff --git a/docs/core/porting/net-framework-tech-unavailable.md b/docs/core/porting/net-framework-tech-unavailable.md index 30c82a0d7a8d7..f50ef6aa7bc69 100644 --- a/docs/core/porting/net-framework-tech-unavailable.md +++ b/docs/core/porting/net-framework-tech-unavailable.md @@ -28,13 +28,13 @@ Across machines, use a network-based solution as an alternative. Preferably, use ## Code access security (CAS) -Sandboxing, which relies on the runtime or the framework to constrain which resources a managed application or library uses or runs, [isn't supported on .NET Framework](../../framework/misc/code-access-security.md) and therefore is also not supported on .NET Core and .NET 5+. There are too many cases in the .NET Framework and the runtime where an elevation of privileges occurs to continue treating CAS as a security boundary. Also, CAS makes the implementation more complicated and often has correctness-performance implications for applications that don't intend to use it. +Sandboxing, which relies on the runtime or the framework to constrain which resources a managed application or library uses or runs, [isn't supported on .NET Framework](/previous-versions/dotnet/framework/code-access-security/code-access-security) and therefore is also not supported on .NET Core and .NET 5+. There are too many cases in the .NET Framework and the runtime where an elevation of privileges occurs to continue treating CAS as a security boundary. Also, CAS makes the implementation more complicated and often has correctness-performance implications for applications that don't intend to use it. Use security boundaries provided by the operating system, such as virtualization, containers, or user accounts, for running processes with the minimum set of privileges. ## Security transparency -Similar to CAS, security transparency separates sandboxed code from security critical code in a declarative fashion but is [no longer supported as a security boundary](../../framework/misc/security-transparent-code.md). This feature is heavily used by Silverlight. +Similar to CAS, security transparency separates sandboxed code from security critical code in a declarative fashion but is [no longer supported as a security boundary](/previous-versions/dotnet/framework/code-access-security/security-transparent-code). This feature is heavily used by Silverlight. Use security boundaries provided by the operating system, such as virtualization, containers, or user accounts, for running processes with the least set of privileges. diff --git a/docs/core/porting/upgrade-assistant-aspnetmvc.md b/docs/core/porting/upgrade-assistant-aspnetmvc.md index dbd9d9f4a236b..f4b63b5c0529b 100644 --- a/docs/core/porting/upgrade-assistant-aspnetmvc.md +++ b/docs/core/porting/upgrade-assistant-aspnetmvc.md @@ -1,10 +1,10 @@ --- title: Upgrade ASP.NET MVC apps to .NET 5 -description: Use the .NET Upgrade Assistant to upgrade an existing .NET Framework ASP.NET MVC app to .NET 5. The .NET Upgrade Assistant is a CLI tool that assists in migrating an app from .NET Framework to .NET 5. -author: ardalis -ms.date: 03/08/2021 +description: Use the .NET Upgrade Assistant to upgrade an existing .NET Framework ASP.NET MVC app to .NET 5. The .NET Upgrade Assistant is a CLI tool that helps migrate an app from .NET Framework to .NET 5. +author: adegeo +ms.date: 06/01/2021 --- -# Upgrade an ASP.NET MVC App to .NET 5 with the .NET Upgrade Assistant +# Upgrade an ASP.NET MVC app to .NET 5 with the .NET Upgrade Assistant The [.NET Upgrade Assistant](upgrade-assistant-overview.md) is a command-line tool that can assist with upgrading .NET Framework ASP.NET MVC apps to .NET 5. This article provides: @@ -45,7 +45,7 @@ The tool runs and shows you a list of the steps it will do. :::image type="content" source="media/upgrade-assistant-aspnetmvc/initial-run.png" alt-text=".NET Upgrade Assistant initial screen"::: -As each step is completed, the tool provides a set of commands allowing the user to apply or skip the next step, see more details, configure logging, or exit the process. If the tool detects that a step will perform no actions, it automatically skips that step and continues to the next step until it reaches one that has actions to perform. Pressing Enter will perform the next step if no other selection is made. +As each step is completed, the tool provides a set of commands allowing the user to apply or skip the next step, see more details, configure logging, or exit the process. If the tool detects that a step will perform no actions, it automatically skips that step and continues to the next step until it reaches one that has actions to do. Pressing Enter will start the next step if no other selection is made. In this example, the apply step is chosen each time. The first step is to back up the project. @@ -63,7 +63,7 @@ Next, the tool updates the project's NuGet packages. Several packages need updat :::image type="content" source="media/upgrade-assistant-aspnetmvc/update-nuget-packages.png" alt-text=".NET Upgrade Assistant update NuGet packages"::: -Once the packages are updated, the next step is to add template files, if any. The tool notes there are four expected template items that must be added, and then adds them. These include the following files: +Once the packages are updated, the next step is to add template files, if any. The tool notes there are four expected template items that must be added, and then adds them. The following is a list of the template files: - `Program.cs` - `Startup.cs` @@ -115,26 +115,19 @@ By default, the project will be converted as a class library. Change the first l - FilterConfig.cs - RouteConfig.cs -These files - and the entire `App_Start` folder - can be deleted. Likewise, the `Global.asax` and `Global.asax.cs` files can be removed. +These files, and the entire `App_Start` folder, can be deleted. Likewise, the `Global.asax` and `Global.asax.cs` files can be removed. At this point the only errors that remain are related to bundling. There are [several ways to configure bundling and minification in ASP.NET Core](/aspnet/core/migration/mvc?view=aspnetcore-5.0&preserve-view=true#configure-bundling-and-minification). Choose whatever makes the most sense for your project. ## Troubleshooting tips -There are several known problems that can occur when using the .NET Upgrade Assistant. In some cases, these are problems with the [try-convert tool](https://github.com/dotnet/try-convert) that the .NET Upgrade Assistant uses internally. This tool is being frequently updated to address more scenarios, so make sure you're using a recent version. - -- The **try-convert** tool must be installed and updated to at least version _0.7.212201_. -- Earlier versions of the **try-convert** tool didn't support custom target or props files. If you can't upgrade to the latest version, you may need to manually address these issues. If the target project file includes references to custom targets or props files, these references may need to be manually deleted from the file before the .NET Upgrade Assistant is run against it. - -```xml - -``` +There are several known problems that can occur when using the .NET Upgrade Assistant. In some cases, these are problems with the [try-convert tool](https://github.com/dotnet/try-convert) that the .NET Upgrade Assistant uses internally. [The tool's GitHub repository](https://github.com/dotnet/upgrade-assistant#troubleshooting-common-issues) has more troubleshooting tips and known issues. ## See also -- [Upgrade a WPF App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-wpf-framework.md) -- [Upgrade a Windows Forms App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-winforms-framework.md) +- [Upgrade a WPF App to .NET 5](upgrade-assistant-wpf-framework.md) +- [Upgrade a Windows Forms App to .NET 5](upgrade-assistant-winforms-framework.md) - [Overview of the .NET Upgrade Assistant](upgrade-assistant-overview.md) - [.NET Upgrade Assistant GitHub Repository](https://github.com/dotnet/upgrade-assistant) diff --git a/docs/core/porting/upgrade-assistant-overview.md b/docs/core/porting/upgrade-assistant-overview.md index 22ba37280cb19..83f31eb2b5f02 100644 --- a/docs/core/porting/upgrade-assistant-overview.md +++ b/docs/core/porting/upgrade-assistant-overview.md @@ -1,8 +1,8 @@ --- title: Overview of the .NET Upgrade Assistant description: Introducing the .NET Upgrade Assistant tool that helps migrate from .NET Framework and upgrades your projects to .NET 5. -author: ardalis -ms.date: 03/08/2021 +author: adegeo +ms.date: 06/01/2021 --- # Overview of the .NET Upgrade Assistant @@ -23,7 +23,7 @@ Currently the tool supports the following .NET Framework app types: - .NET Framework console apps - .NET Framework class libraries -The .NET Upgrade Assistant is currently prerelease and is receiving frequent updates. If you discover problems using the tool, please report them in the tool's [GitHub repository](https://github.com/dotnet/upgrade-assistant). +The .NET Upgrade Assistant is currently prerelease and is receiving frequent updates. If you discover problems using the tool, report them in the tool's [GitHub repository](https://github.com/dotnet/upgrade-assistant). ## How to install the .NET Upgrade Assistant @@ -31,10 +31,7 @@ The [Get Started tutorial](https://aka.ms/dotnet-upgrade-assistant-install) walk ### Prerequisites -1. This tool uses MSBuild to work with project files. Make sure that a recent version of MSBuild is installed. An easy way to do this is to [install Visual Studio 2019](https://visualstudio.microsoft.com/downloads/). -1. This tool depends on [try-convert](https://github.com/dotnet/try-convert). In order for the tool to run correctly, you must install the try-convert tool for converting project files to the new SDK style. If you already have **try-convert** installed, you may need to update it instead (since **upgrade-assistant** depends on version _0.7.212201_ or later) - 1. To install try-convert: `dotnet tool install -g try-convert` - 1. To update try-convert: `dotnet tool update -g try-convert` +- This tool uses MSBuild to work with project files. Make sure that a recent version of MSBuild is installed. An easy way to satisfy this requirement is to [install Visual Studio 2019](https://visualstudio.microsoft.com/downloads/). ### Installation steps @@ -50,11 +47,11 @@ Similarly, because the .NET Upgrade Assistant is installed as a .NET CLI tool, i dotnet tool update -g upgrade-assistant ``` -For detailed installation instructions, please refer to the project's [README](https://github.com/dotnet/upgrade-assistant). +For detailed installation instructions, refer to the project's [README](https://github.com/dotnet/upgrade-assistant). ## See also -- [Upgrade a WPF App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-wpf-framework.md) -- [Upgrade a Windows Forms App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-winforms-framework.md) -- [Upgrade an ASP.NET MVC App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-aspnetmvc.md) +- [Upgrade an ASP.NET MVC App to .NET 5](upgrade-assistant-aspnetmvc.md) +- [Upgrade a WPF App to .NET 5](upgrade-assistant-wpf-framework.md) +- [Upgrade a Windows Forms App to .NET 5](upgrade-assistant-winforms-framework.md) - [.NET Upgrade Assistant GitHub Repository](https://github.com/dotnet/upgrade-assistant) diff --git a/docs/core/porting/upgrade-assistant-telemetry.md b/docs/core/porting/upgrade-assistant-telemetry.md new file mode 100644 index 0000000000000..93a8d042e562f --- /dev/null +++ b/docs/core/porting/upgrade-assistant-telemetry.md @@ -0,0 +1,119 @@ +--- +title: Upgrade Assistant Telemetry +description: Learn about telemetry collected by the Upgrade Assistant. +author: tasou +ms.date: 06/21/2021 +--- +# Upgrade Assistant telemetry + +The [Upgrade Assistant](./upgrade-assistant-overview.md) includes a telemetry feature that collects usage data. The telemetry data is used to help understand how to make improvements to the tool. + +## How to opt out + +The Upgrade Assistant telemetry feature is enabled by default. To opt out of the telemetry feature, set the `DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT` environment variable to `1` or `true`. + +### [Console](#tab/console) + +Create and assign persisted environment variable, given the value. + +```console +:: Assigns the env var to the value +setx DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT="1" +``` + +In a new instance of the **Command Prompt**, read the environment variable. + +```console +:: Prints the env var value +echo %DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT% +``` + +### [PowerShell](#tab/powershell) + +Create and assign persisted environment variable, given the value. + +```powershell +# Assigns the env var to the value +[System.Environment]::SetEnvironmentVariable('DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT', '1', 'User') +``` + +In a new instance of the **Windows PowerShell**, read the environment variable. + +```powershell +# Prints the env var value +[System.Environment]::GetEnvironmentVariable('DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT') +``` + +### [Bash](#tab/bash) + +Create and assign persisted environment variable, given the value. + +```Bash +# Assigns the env var to the value +echo export DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT="1" >> /etc/environment && source /etc/environment +``` + +In a new instance of the **Bash**, read the environment variable. + +```Bash +# Prints the env var value +echo "${DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT}" + +# Or use printenv: +# printenv DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT +``` + +--- + +## Disclosure + +The Upgrade Assistant displays text similar to the following when you first run the tool. Text may vary slightly depending on the version of the tool you're running. This "first run" experience is how Microsoft notifies you about data collection. + +```console +Telemetry +--------- +The .NET tools collect usage data in order to help us improve your experience. +It is collected by Microsoft and shared with the community. You can opt-out of +telemetry by setting the DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT environment +variable to '1' or 'true' using your favorite shell. +``` + +To suppress the "first run" experience text, set the `DOTNET_UPGRADEASSISTANT_SKIP_FIRST_TIME_EXPERIENCE` environment variable to `1` or `true`. + +## Data points + +The telemetry feature doesn't: + +* Collect samples of code + +The data is sent securely to Microsoft servers and held under restricted access. + +Protecting your privacy is important to us. If you suspect the telemetry feature is collecting sensitive data or the data is being insecurely or inappropriately handled, take one of the following actions: + +* File an issue in the [dotnet/upgrade-assistant](https://github.com/dotnet/upgrade-assistant/issues) repository. +* Send an email to [dotnet@microsoft.com](mailto:dotnet@microsoft.com) for investigation. + +The telemetry feature collects the following data. + +| Upgrade Assistant versions | Data | +| -------------------------- | ----------------------------------------------------------------------------------------------------------- | +| >=0.2.231802 | Timestamp of invocation. | +| >=0.2.231802 | Three-octet IP address used to determine the geographical location. | +| >=0.2.231802 | Operating system and version. | +| >=0.2.231802 | Runtime ID (RID) the tool is running on. | +| >=0.2.231802 | Whether the tool is running in a container. | +| >=0.2.231802 | Hashed Media Access Control (MAC) address: a cryptographically (SHA256) hashed and unique ID for a machine. | +| >=0.2.231802 | Kernel version. | +| >=0.2.231802 | Upgrade Assistant version. | +| >=0.2.231802 | The command and argument names invoked. Actual argument values aren't collected. | +| >=0.2.231802 | MSBuild version used. | +| >=0.2.231802 | Hashed solution id (or hashed path if no id is available). | +| >=0.2.231802 | Hashed project id (or hashed path if no id is available) for each project. | +| >=0.2.231802 | Hashed project id (or hashed path if no id is available) for each entrypoint. | +| >=0.2.231802 | For each step, the time to initialize and apply the step. | +| >=0.2.231802 | For each step, the decision selected (for example, `apply`). | + +## Additional resources + +* [.NET Core SDK telemetry](/dotnet/core/tools/telemetry) +* [.NET Core CLI telemetry data](https://dotnet.microsoft.com/platform/telemetry) diff --git a/docs/core/porting/upgrade-assistant-winforms-framework.md b/docs/core/porting/upgrade-assistant-winforms-framework.md index 7ecba14836c9b..2b594c64f612c 100644 --- a/docs/core/porting/upgrade-assistant-winforms-framework.md +++ b/docs/core/porting/upgrade-assistant-winforms-framework.md @@ -1,8 +1,8 @@ --- title: Upgrade Windows Forms apps to .NET 5 description: Use the .NET Upgrade Assistant to upgrade an existing .NET Framework Windows Forms app to .NET 5. The .NET Upgrade Assistant is a CLI tool that helps migrating an app from .NET Framework to .NET 5. -author: ardalis -ms.date: 03/08/2021 +author: adegeo +ms.date: 06/01/2021 --- # Upgrade a Windows Forms App to .NET 5 with the .NET Upgrade Assistant @@ -41,7 +41,7 @@ The tool runs and shows you a list of the steps it will do. :::image type="content" source="media/upgrade-assistant-winforms-framework/step1.png" alt-text=".NET Upgrade Assistant initial screen"::: -As each step is completed, the tool provides a set of commands allowing the user to apply or skip the next step, see more details, configure logging, or exit the process. If the tool detects that a step will perform no actions, it will automatically skip that step and continue to the next step until it reaches one that will have actions to perform. Pressing enter will perform the next step if no other selection is made. +As each step is completed, the tool provides a set of commands allowing the user to apply or skip the next step, see more details, configure logging, or exit the process. If the tool detects that a step will perform no actions, it automatically skips that step and continues to the next step until it reaches one that has actions to do. Pressing Enter will start the next step if no other selection is made. In this example, the apply step is chosen each time. The first step is to back up the project. @@ -91,16 +91,13 @@ Notice that the .NET Upgrade Assistant also adds analyzers to the project that a ## Troubleshooting tips -There are several known problems that can occur when using the .NET Upgrade Assistant. In some cases, these are problems with the [try-convert tool](https://github.com/dotnet/try-convert) that the .NET Upgrade Assistant uses internally. This tool is being frequently updated to address more scenarios, so make sure you're using a recent version. +There are several known problems that can occur when using the .NET Upgrade Assistant. In some cases, these are problems with the [try-convert tool](https://github.com/dotnet/try-convert) that the .NET Upgrade Assistant uses internally. -- The **try-convert** tool must be installed and updated to at least version _0.7.212201_. -- Earlier versions of the **try-convert** tool didn't support custom target or props files. If you can't upgrade to the latest version, you may need to manually address these issues. If the target project file includes references to custom targets or props files, these references may need to be manually deleted from the file before the .NET Upgrade Assistant is run against it. - -[The tool's GitHub repository](https://github.com/dotnet/upgrade-assistant#troubleshooting-common-issues) has additional troubleshooting tips and known issues. +[The tool's GitHub repository](https://github.com/dotnet/upgrade-assistant#troubleshooting-common-issues) has more troubleshooting tips and known issues. ## See also -- [Upgrade a WPF App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-wpf-framework.md) -- [Upgrade an ASP.NET MVC App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-aspnetmvc.md) +- [Upgrade a WPF App to .NET 5](upgrade-assistant-wpf-framework.md) +- [Upgrade an ASP.NET MVC App to .NET 5](upgrade-assistant-aspnetmvc.md) - [Overview of the .NET Upgrade Assistant](upgrade-assistant-overview.md) - [.NET Upgrade Assistant GitHub Repository](https://github.com/dotnet/upgrade-assistant) diff --git a/docs/core/porting/upgrade-assistant-wpf-framework.md b/docs/core/porting/upgrade-assistant-wpf-framework.md index 6de5eadddaca0..1d78883167343 100644 --- a/docs/core/porting/upgrade-assistant-wpf-framework.md +++ b/docs/core/porting/upgrade-assistant-wpf-framework.md @@ -1,8 +1,8 @@ --- title: Upgrade WPF apps to .NET 5 description: Use the .NET Upgrade Assistant to upgrade an existing .NET Framework WPF app to .NET 5. The .NET Upgrade Assistant is a CLI tool that helps migrating an app from .NET Framework to .NET 5. -author: ardalis -ms.date: 03/08/2021 +author: adegeo +ms.date: 06/01/2021 --- # Upgrade a WPF App to .NET 5 with the .NET Upgrade Assistant @@ -41,13 +41,13 @@ The tool runs and shows you a list of the steps it will do. :::image type="content" source="media/upgrade-assistant-wpf-framework/initial-run.png" alt-text=".NET Upgrade Assistant initial screen"::: -As each step is completed, the tool provides a set of commands allowing the user to apply or skip the next step, see more details, configure logging, or exit the process. If the tool detects that a step will perform no actions, it will automatically skip that step and continue to the next step until it reaches one that will have actions to perform. Pressing enter will perform the next step if no other selection is made. +As each step is completed, the tool provides a set of commands allowing the user to apply or skip the next step, see more details, configure logging, or exit the process. If the tool detects that a step will perform no actions, it automatically skips that step and continues to the next step until it reaches one that has actions to do. Pressing Enter will start the next step if no other selection is made. In this example, the apply step is chosen each time. The first step is to back up the project. :::image type="content" source="media/upgrade-assistant-wpf-framework/backup-project.png" alt-text=".NET Upgrade Assistant back up project"::: -The tool prompts for a custom path for the backup, or to use the default, which will place the project backup in the same folder with a `.backup` extension. The next step the tool performs is to convert the project file to SDK style. +The tool prompts for a custom path for the backup, or to use the default, which will place the project backup in the same folder with a `.backup` extension. The next step the tool does is to convert the project file to SDK style. :::image type="content" source="media/upgrade-assistant-wpf-framework/convert-project.png" alt-text=".NET Upgrade Assistant convert project to SDK style"::: @@ -91,16 +91,13 @@ Notice that the .NET Upgrade Assistant also adds analyzers to the project that a ## Troubleshooting tips -There are several known problems that can occur when using the .NET Upgrade Assistant. In some cases, these are problems with the [try-convert tool](https://github.com/dotnet/try-convert) that the .NET Upgrade Assistant uses internally. This tool is being frequently updated to address more scenarios, so make sure you're using a recent version. - -- The try-convert tool must be installed and updated to at least version _0.7.21201_. -- Earlier versions of the try-convert tool didn't support custom target or props files. If you can't upgrade to the latest version, you may need to manually address these issues. If the target project file includes references to custom targets or props files, these references may need to be manually deleted from the file before the .NET Upgrade Assistant is run against it. +There are several known problems that can occur when using the .NET Upgrade Assistant. In some cases, these are problems with the [try-convert tool](https://github.com/dotnet/try-convert) that the .NET Upgrade Assistant uses internally. [The tool's GitHub repository](https://github.com/dotnet/upgrade-assistant#troubleshooting-common-issues) has more troubleshooting tips and known issues. ## See also -- [Upgrade a Windows Forms App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-winforms-framework.md) -- [Upgrade an ASP.NET MVC App to .NET 5 with the .NET Upgrade Assistant](upgrade-assistant-aspnetmvc.md) +- [Upgrade a Windows Forms App to .NET 5](upgrade-assistant-winforms-framework.md) +- [Upgrade an ASP.NET MVC App to .NET 5](upgrade-assistant-aspnetmvc.md) - [Overview of the .NET Upgrade Assistant](upgrade-assistant-overview.md) - [.NET Upgrade Assistant GitHub Repository](https://github.com/dotnet/upgrade-assistant) diff --git a/docs/core/tools/dotnet-sln.md b/docs/core/tools/dotnet-sln.md index 48216080b55d5..4cd732f05ca4d 100644 --- a/docs/core/tools/dotnet-sln.md +++ b/docs/core/tools/dotnet-sln.md @@ -86,6 +86,16 @@ dotnet sln add [-h|--help] The path to the project or projects to add to the solution. Unix/Linux shell [globbing pattern](https://en.wikipedia.org/wiki/Glob_(programming)) expansions are processed correctly by the `dotnet sln` command. + If `PROJECT_PATH` includes folders that contain the project folder, that portion of the path is used to create [solution folders](/visualstudio/ide/solutions-and-projects-in-visual-studio#solution-folder). For example, the following commands create a solution with `myapp` in solution folder `folder1/folder2`: + + ```dotnetcli + dotnet new sln + dotnet new console --output folder1/folder2/myapp + dotnet sln add folder1/folder2/myapp + ``` + + You can override this default behavior by using the `--in-root` or the `-s|--solution-folder ` option. + #### Options - **`-h|--help`** @@ -94,11 +104,11 @@ dotnet sln add [-h|--help] - **`--in-root`** - Places the projects in the root of the solution, rather than creating a [solution folder](/visualstudio/ide/solutions-and-projects-in-visual-studio#solution-folder). Can't be used with `-s|--solution-folder`. If you omit this option and `-s|--solution-folder`, the result is the same as specifying this option. Available since .NET Core 3.0 SDK. + Places the projects in the root of the solution, rather than creating a [solution folder](/visualstudio/ide/solutions-and-projects-in-visual-studio#solution-folder). Can't be used with `-s|--solution-folder`. Available since .NET Core 3.0 SDK. - **`-s|--solution-folder `** - The destination [solution folder](/visualstudio/ide/solutions-and-projects-in-visual-studio#solution-folder) path to add the projects to. Can't be used with `--in-root`. If you omit this option and `--in-root`, the result is the same as specifying `--in-root`. Available since .NET Core 3.0 SDK. + The destination [solution folder](/visualstudio/ide/solutions-and-projects-in-visual-studio#solution-folder) path to add the projects to. Can't be used with `--in-root`. Available since .NET Core 3.0 SDK. ### `remove` diff --git a/docs/core/tutorials/testing-library-with-visual-studio.md b/docs/core/tutorials/testing-library-with-visual-studio.md index e2b89e42dd6f7..a548ae0fffb34 100644 --- a/docs/core/tutorials/testing-library-with-visual-studio.md +++ b/docs/core/tutorials/testing-library-with-visual-studio.md @@ -30,7 +30,7 @@ Unit tests provide automated software testing during your development and publis 1. On the **Add a new project** page, enter **mstest** in the search box. Choose **C#** or **Visual Basic** from the Language list, and then choose **All platforms** from the Platform list. - 1. Choose the **Unit Test Project** template, and then choose **Next**. + 1. Choose the **MSTest Test Project** template, and then choose **Next**. 1. On the **Configure your new project** page, enter **StringLibraryTest** in the **Project name** box. Then choose **Next**. diff --git a/docs/csharp/fundamentals/functional/snippets/patterns/Simulation.cs b/docs/csharp/fundamentals/functional/snippets/patterns/Simulation.cs index bfad185dd6190..7a369a253bbe9 100644 --- a/docs/csharp/fundamentals/functional/snippets/patterns/Simulation.cs +++ b/docs/csharp/fundamentals/functional/snippets/patterns/Simulation.cs @@ -31,7 +31,7 @@ public State PerformOperation(Operation command) => Operation.Start => StartSystem(), Operation.Stop => StopSystem(), Operation.Reset => ResetToReady(), - _ => throw new ArgumentException(nameof(command), "Invalid enum value for command"), + _ => throw new ArgumentException("Invalid enum value for command", nameof(command)), }; // @@ -43,7 +43,7 @@ public State PerformOperation(string command) => "Start" => StartSystem(), "Stop" => StopSystem(), "Reset" => ResetToReady(), - _ => throw new ArgumentException(nameof(command), "Invalid string value for command"), + _ => throw new ArgumentException("Invalid string value for command", nameof(command)), }; // diff --git a/docs/csharp/fundamentals/tutorials/classes.md b/docs/csharp/fundamentals/tutorials/classes.md index b5afaf1893b2d..787039321701f 100644 --- a/docs/csharp/fundamentals/tutorials/classes.md +++ b/docs/csharp/fundamentals/tutorials/classes.md @@ -209,7 +209,7 @@ Run your program to see the results. ## Next steps -If you got stuck, you can see the source for this tutorial [in our GitHub repo](https://github.com/dotnet/docs/tree/main/docs/csharp/tutorials/intro-to-csharp/snippets/introduction-to-classes). +If you got stuck, you can see the source for this tutorial [in our GitHub repo](https://github.com/dotnet/docs/tree/main/docs/csharp/fundamentals/tutorials/snippets/introduction-to-classes). You can continue with the [object oriented programming](oop.md) tutorial. diff --git a/docs/csharp/iterators.md b/docs/csharp/iterators.md index 1e906c3e78a7f..5690409300063 100644 --- a/docs/csharp/iterators.md +++ b/docs/csharp/iterators.md @@ -1,133 +1,67 @@ --- title: Iterators description: Learn how to use built-in C# iterators and how to create your own custom iterator methods. -ms.date: 06/20/2016 -ms.technology: csharp-advanced-concepts -ms.assetid: 5cf36f45-f91a-4fca-a0b7-87f233e108e9 +ms.date: 06/22/2021 --- # Iterators -Almost every program you write will have some need to iterate -over a collection. You'll write code that examines every item in -a collection. +Almost every program you write will have some need to iterate over a collection. You'll write code that examines every item in a collection. -You'll also create iterator methods which are methods that produces an -iterator (which is an object that traverses a container, particularly lists) for the elements of that class. These can be used for: +You'll also create iterator methods, which are methods that produce an *iterator* for the elements of that class. An *iterator* is an object that traverses a container, particularly lists. Iterators can be used for: -+ Performing an action on each item in a collection. -+ Enumerating a custom collection. -+ Extending [LINQ](linq/index.md) or other libraries. -+ Creating a data pipeline where data flows efficiently through iterator -methods. +- Performing an action on each item in a collection. +- Enumerating a custom collection. +- Extending [LINQ](linq/index.md) or other libraries. +- Creating a data pipeline where data flows efficiently through iterator methods. -The C# language provides -features for both these scenarios. This article provides an overview -of those features. - -This tutorial has multiple steps. After each step, you can run the application and see the progress. You can also [view or download the completed sample](https://github.com/dotnet/samples/blob/main/csharp/iterators) for this topic. For download instructions, see [Samples and Tutorials](../samples-and-tutorials/index.md#view-and-download-samples). +The C# language provides features for both generating and consuming sequences. These sequences can be produced and consumed synchronously or asynchronously. This article provides an overview of those features. ## Iterating with foreach -Enumerating a collection is simple: The `foreach` keyword enumerates -a collection, executing the embedded statement once for each element -in the collection: +Enumerating a collection is simple: The `foreach` keyword enumerates a collection, executing the embedded statement once for each element in the collection: -```csharp -foreach (var item in collection) -{ - Console.WriteLine(item.ToString()); -} -``` +:::code language="csharp" source="./snippets/iterators/Program.cs" ID="ForeachExample"::: + +That's all. To iterate over all the contents of a collection, the `foreach` statement is all you need. The `foreach` statement isn't magic, though. It relies on two generic interfaces defined in the .NET core library to generate the code necessary to iterate a collection: `IEnumerable` and `IEnumerator`. This mechanism is explained in more detail below. -That's all there is to it. To iterate over all the contents of a collection, -the `foreach` statement is all you need. The `foreach` statement isn't magic, -though. It relies on two generic interfaces defined in the .NET core library in order -to generate the code necessary to iterate a collection: `IEnumerable` and -`IEnumerator`. This mechanism is explained in more detail below. +Both of these interfaces also have non-generic counterparts: `IEnumerable` and `IEnumerator`. The [generic](fundamentals/types/generics.md) versions are preferred for modern code. -Both of these interfaces also have non-generic counterparts: `IEnumerable` and -`IEnumerator`. The [generic](fundamentals/types/generics.md) versions are preferred for modern code. +When a sequence is generated asynchronously, you can use the `await foreach` statement to asynchronously consume the sequence: + +:::code language="csharp" source="./snippets/iterators/Program.cs" ID="AwaitForeachExample"::: + +When a sequence is an , you use `foreach`. When a sequence is an , you use `await foreach`. In the latter case, the sequence is generated asynchronously. ## Enumeration sources with iterator methods -Another great feature of the C# language enables you to build methods that create -a source for an enumeration. These are referred to as *iterator methods*. An iterator -method defines how to generate the objects in a sequence when requested. You -use the `yield return` contextual keywords to define an iterator method. +Another great feature of the C# language enables you to build methods that create a source for an enumeration. These methods are referred to as *iterator methods*. An iterator method defines how to generate the objects in a sequence when requested. You use the `yield return` contextual keywords to define an iterator method. You could write this method to produce the sequence of integers from 0 through 9: -```csharp -public IEnumerable GetSingleDigitNumbers() -{ - yield return 0; - yield return 1; - yield return 2; - yield return 3; - yield return 4; - yield return 5; - yield return 6; - yield return 7; - yield return 8; - yield return 9; -} -``` +:::code language="csharp" source="./snippets/iterators/Generators.cs" ID="GetNumbers"::: -The code above shows distinct `yield return` statements to highlight the fact that -you can use multiple discrete `yield return` statements in an iterator method. -You can (and often do) use other language constructs to simplify the code of an -iterator method. The method definition below produces the exact same sequence -of numbers: +The code above shows distinct `yield return` statements to highlight the fact that you can use multiple discrete `yield return` statements in an iterator method. You can (and often do) use other language constructs to simplify the code of an iterator method. The method definition below produces the exact same sequence of numbers: -```csharp -public IEnumerable GetSingleDigitNumbers() -{ - int index = 0; - while (index < 10) - yield return index++; -} -``` +:::code language="csharp" source="./snippets/iterators/Generators.cs" ID="GetNumbersLoop"::: -You don't have to decide one or the other. You can have as many `yield return` -statements as necessary to meet the needs of your method: +You don't have to decide one or the other. You can have as many `yield return` statements as necessary to meet the needs of your method: -```csharp -public IEnumerable GetSingleDigitNumbers() -{ - int index = 0; - while (index < 10) - yield return index++; +:::code language="csharp" source="./snippets/iterators/Generators.cs" ID="GetMultipleLoops"::: - yield return 50; +All of these preceding examples would have an asynchronous counterpart. In each case, you'd replace the return type of `IEnumerable` with an `IAsyncEnumerable`. For example, the previous example would have the following asynchronous version: - index = 100; - while (index < 110) - yield return index++; -} -``` +:::code language="csharp" source="./snippets/iterators/Generators.cs" ID="GetMultipleAsyncLoops"::: -That's the basic syntax. Let's consider a real world example where you would -write an iterator method. Imagine you're on an IoT project and the device -sensors generate a very large stream of data. To get a feel for the data, you -might write a method that samples every Nth data element. This small iterator -method does the trick: +That's the syntax for both synchronous and asynchronous iterators. Let's consider a real world example. Imagine you're on an IoT project and the device sensors generate a very large stream of data. To get a feel for the data, you might write a method that samples every Nth data element. This small iterator method does the trick: -```csharp -public static IEnumerable Sample(this IEnumerable sourceSequence, int interval) -{ - int index = 0; - foreach (T item in sourceSequence) - { - if (index++ % interval == 0) - yield return item; - } -} -``` +:::code language="csharp" source="./snippets/iterators/Generators.cs" ID="SampleSequence"::: + +If reading from the IoT device produces an asynchronous sequence, you'd modify the method as the following method shows: + +:::code language="csharp" source="./snippets/iterators/Generators.cs" ID="SampleSequenceAsync"::: -There is one important restriction on iterator methods: you can't have both a -`return` statement and a `yield return` statement in the same method. The following -will not compile: +There's one important restriction on iterator methods: you can't have both a `return` statement and a `yield return` statement in the same method. The following code won't compile: ```csharp public IEnumerable GetSingleDigitNumbers() @@ -144,117 +78,67 @@ public IEnumerable GetSingleDigitNumbers() } ``` -This restriction normally isn't a problem. You have a choice of either using -`yield return` throughout the method, or separating the original method into -multiple methods, some using `return`, and some using `yield return`. +This restriction normally isn't a problem. You have a choice of either using `yield return` throughout the method, or separating the original method into multiple methods, some using `return`, and some using `yield return`. You can modify the last method slightly to use `yield return` everywhere: -```csharp -public IEnumerable GetSingleDigitNumbers() -{ - int index = 0; - while (index < 10) - yield return index++; - - yield return 50; +:::code language="csharp" source="./snippets/iterators/Generators.cs" ID="SequenceAndCollection"::: - var items = new int[] {100, 101, 102, 103, 104, 105, 106, 107, 108, 109 }; - foreach (var item in items) - yield return item; -} -``` +Sometimes, the right answer is to split an iterator method into two different methods. One that uses `return`, and a second that uses `yield return`. Consider a situation where you might want to return an empty collection, or the first five odd numbers, based on a boolean argument. You could write that as these two methods: -Sometimes, the right answer is to split an iterator method into two different -methods. One that uses `return`, and a second that uses `yield return`. Consider -a situation where you might want to return an empty collection, or the first 5 -odd numbers, based on a boolean argument. You could write that as these two -methods: +:::code language="csharp" source="./snippets/iterators/Generators.cs" ID="ReturnAndYieldReturn"::: -```csharp -public IEnumerable GetSingleDigitOddNumbers(bool getCollection) -{ - if (getCollection == false) - return new int[0]; - else - return IteratorMethod(); -} +Look at the methods above. The first uses the standard `return` statement to return either an empty collection, or the iterator created by the second method. The second method uses the `yield return` statement to create the requested sequence. -private IEnumerable IteratorMethod() -{ - int index = 0; - while (index < 10) - { - if (index % 2 == 1) - yield return index; - index++; - } -} -``` +## Deeper dive into `foreach` -Look at the methods above. The first uses the standard `return` statement to return -either an empty collection, or the iterator created by the second method. The second -method uses the `yield return` statement to create the requested sequence. +The `foreach` statement expands into a standard idiom that uses the `IEnumerable` and `IEnumerator` interfaces to iterate across all elements of a collection. It also minimizes errors developers make by not properly managing resources. -## Deeper Dive into `foreach` +The compiler translates the `foreach` loop shown in the first example into something similar to this construct: -The `foreach` statement expands into a standard idiom that uses the -`IEnumerable` and `IEnumerator` interfaces to iterate across all -elements of a collection. It also minimizes errors developers make -by not properly managing resources. +:::code language="csharp" source="./snippets/iterators/Program.cs" ID="InsideForeach"::: -The compiler translates the `foreach` loop shown in the first -example into something similar to this construct: +The exact code generated by the compiler is more complicated, and handles situations where the object returned by `GetEnumerator()` implements the `IDisposable` interface. The full expansion generates code more like this: ```csharp -IEnumerator enumerator = collection.GetEnumerator(); -while (enumerator.MoveNext()) { - var item = enumerator.Current; - Console.WriteLine(item.ToString()); -} -``` - -The construct above represents the code generated by the C# compiler as of -version 5 and above. Prior to version 5, the `item` variable had a different scope: - -```csharp -// C# versions 1 through 4: -IEnumerator enumerator = collection.GetEnumerator(); -int item = default(int); -while (enumerator.MoveNext()) -{ - item = enumerator.Current; - Console.WriteLine(item.ToString()); + var enumerator = collection.GetEnumerator(); + try + { + while (enumerator.MoveNext()) + { + var item = enumerator.Current; + Console.WriteLine(item.ToString()); + } + } + finally + { + // dispose of enumerator. + } } ``` -This was changed because the earlier behavior could lead to subtle and hard -to diagnose bugs involving lambda expressions. For more information about lambda expressions, see [Lambda expressions](language-reference/operators/lambda-expressions.md). - -The exact code generated by the compiler is somewhat more complicated, and -handles situations where the object returned by `GetEnumerator()` implements -the `IDisposable` interface. The full expansion generates code more like this: +The compiler translates the first asynchronous sample into something similar to this construct: ```csharp { var enumerator = collection.GetEnumerator(); try { - while (enumerator.MoveNext()) + while (await enumerator.MoveNext()) { var item = enumerator.Current; Console.WriteLine(item.ToString()); } - } finally + } + finally { - // dispose of enumerator. + // dispose of async enumerator. } } ``` -The manner in which the enumerator is disposed of depends on the characteristics of -the type of `enumerator`. In the general case, the `finally` clause expands to: +The manner in which the enumerator is disposed of depends on the characteristics of the type of `enumerator`. In the general synchronous case, the `finally` clause expands to: ```csharp finally @@ -263,9 +147,17 @@ finally } ``` -However, if the type of `enumerator` is a sealed type and there is no implicit -conversion from the type of `enumerator` to `IDisposable`, the `finally` clause -expands to an empty block: +The general asynchronous case expands to: + +```csharp +finally +{ + if (enumerator is IAsyncDisposable asyncDisposable) + await asyncDisposable.DisposeAsync(); +} +``` + +However, if the type of `enumerator` is a sealed type and there's no implicit conversion from the type of `enumerator` to `IDisposable` or `IAsyncDisposable`, the `finally` clause expands to an empty block: ```csharp finally @@ -273,8 +165,7 @@ finally } ``` -If there is an implicit conversion from the type of `enumerator` to `IDisposable`, -and `enumerator` is a non-nullable value type, the `finally` clause expands to: +If there's an implicit conversion from the type of `enumerator` to `IDisposable`, and `enumerator` is a non-nullable value type, the `finally` clause expands to: ```csharp finally @@ -283,6 +174,4 @@ finally } ``` -Thankfully, you don't need to remember all these details. The `foreach` statement -handles all those nuances for you. The compiler will generate the correct code for -any of these constructs. +Thankfully, you don't need to remember all these details. The `foreach` statement handles all those nuances for you. The compiler will generate the correct code for any of these constructs. diff --git a/docs/csharp/language-reference/attributes/nullable-analysis.md b/docs/csharp/language-reference/attributes/nullable-analysis.md index 197aed91d5e8b..ad3919fdd8072 100644 --- a/docs/csharp/language-reference/attributes/nullable-analysis.md +++ b/docs/csharp/language-reference/attributes/nullable-analysis.md @@ -1,18 +1,20 @@ --- title: "C# Reserved attributes: Nullable static analysis" ms.date: 04/09/2021 -description: These attributes are interpreted by the compiler to provide better static analysis for nullable and non-nullable reference types. +description: Learn about attributes that are interpreted by the compiler to provide better static analysis for nullable and non-nullable reference types. --- -# Reserved attributes contribute to the compiler's null state static analysis +# Attributes for null-state static analysis In a nullable context, the compiler performs static analysis of code to determine the null state of all reference type variables: - *not null*: Static analysis determines that a variable is assigned a non-null value. - *maybe null*: Static analysis can't determine that a variable is assigned a non-null value. -You can apply attributes that provide information to the compiler about the semantics of your APIs. That information helps the compiler perform static analysis and determine when a variable isn't null. This article provides a brief description of each of those attributes and how to use them. All the examples assume C# 8.0 or newer, and the code is in a nullable context. +You can apply attributes that provide information to the compiler about the semantics of your APIs. These attributes help to define the *nullability contract* for your API. The contract helps the compiler perform static analysis of any code that calls your API. For example, if the compiler determines that a variable may be null, and your code doesn't check that before dereferencing the variable, it issues a warning. -Let's start with a familiar example. Imagine your library has the following API to retrieve a resource string: +This article provides a brief description of each of the nullable reference type attributes and how to use them. All the examples assume C# 8.0 or newer and that the code is in a nullable context. + +Let's start with an example. Imagine your library has the following API to retrieve a resource string: :::code language="csharp" source="snippets/NullableAttributes.cs" ID="TryGetExample" ::: @@ -22,29 +24,32 @@ The preceding example follows the familiar `Try*` pattern in .NET. There are two - Callers can pass a variable whose value is `null` as the argument for `message`. - If the `TryGetMessage` method returns `true`, the value of `message` isn't null. If the return value is `false,` the value of `message` (and its null state) is null. -The rule for `key` can be expressed by the variable type: `key` should be a non-nullable reference type. The `message` parameter is more complex. It allows `null` as the argument, but guarantees that, on success, that `out` argument isn't null. For these scenarios, you need a richer vocabulary to describe the expectations. +The rule for `key` can be expressed by the variable type: `key` should be a non-nullable reference type. The `message` parameter is more complex. It allows `null` as the argument, but guarantees, on success, that `out` argument isn't null. For these scenarios, you need a richer vocabulary to describe the expectations. -Several attributes have been added to express additional information about the null state of variables. All code you wrote before C# 8 introduced nullable reference types was *null oblivious*. That means any reference type variable may be null, but null checks aren't required. Once your code is *nullable aware*, those rules change. Reference types should never be the `null` value, and nullable reference types must be checked against `null` before being dereferenced. +C# 8 introduced several attributes to express additional information about the null state of variables. Any code you wrote before C# 8 introduced nullable reference types was *null oblivious*. That means any reference type variable may be null, but null checks aren't required. Once your code is *nullable aware*, those rules change. Reference types should never be the `null` value, and nullable reference types must be checked against `null` before being dereferenced. -The rules for your APIs are likely more complicated, as you saw with the `TryGetValue` API scenario. Many of your APIs have more complex rules for when variables can or can't be `null`. In these cases, you'll use one of the following attributes to express those rules: +The rules for your APIs are likely more complicated, as you saw with the `TryGetValue` API scenario. Many of your APIs have more complex rules for when variables can or can't be `null`. In these cases, you'll use one of the attributes in the following table to express those rules. -- [AllowNull](xref:System.Diagnostics.CodeAnalysis.AllowNullAttribute): A non-nullable argument may be null. -- [DisallowNull](xref:System.Diagnostics.CodeAnalysis.DisallowNullAttribute): A nullable argument should never be null. -- [MaybeNull](xref:System.Diagnostics.CodeAnalysis.MaybeNullAttribute): A non-nullable return value may be null. -- [NotNull](xref:System.Diagnostics.CodeAnalysis.NotNullAttribute): A nullable return value will never be null. -- [MaybeNullWhen](xref:System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute): A non-nullable argument may be null when the method returns the specified `bool` value. -- [NotNullWhen](xref:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute): A nullable argument won't be null when the method returns the specified `bool` value. -- [NotNullIfNotNull](xref:System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute): A return value isn't null if the argument for the specified parameter isn't null. -- [DoesNotReturn](xref:System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute): A method never returns. In other words, it always throws an exception. -- [DoesNotReturnIf](xref:System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute): This method never returns if the associated `bool` parameter has the specified value. -- [MemberNotNull](xref:System.Diagnostics.CodeAnalysis.MemberNotNullAttribute): The listed member won't be null when the method returns. -- [MemberNotNullWhen](xref:System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute): The listed member won't be null when the method returns the specified `bool` value. +> [!NOTE] +> Adding these attributes gives the compiler more information about the rules for your API. When calling code is compiled in a nullable enabled context, the compiler will warn callers when they violate those rules. These attributes don't enable more checks on your implementation. -The preceding descriptions are a quick reference to what each attribute does. Each following section describes the behavior and meaning more thoroughly. +| Attribute | Category | Meaning | +| - | - | - | +| [AllowNull](xref:System.Diagnostics.CodeAnalysis.AllowNullAttribute) | [Precondition](#preconditions-allownull-and-disallownull) | A non-nullable argument may be null. | +| [DisallowNull](xref:System.Diagnostics.CodeAnalysis.DisallowNullAttribute) | [Precondition](#preconditions-allownull-and-disallownull) | A nullable argument should never be null. | +| [MaybeNull](xref:System.Diagnostics.CodeAnalysis.MaybeNullAttribute) | [Postcondition](#postconditions-maybenull-and-notnull) | A non-nullable return value may be null. | +| [NotNull](xref:System.Diagnostics.CodeAnalysis.NotNullAttribute) | [Postcondition](#postconditions-maybenull-and-notnull) | A nullable return value will never be null. | +| [MaybeNullWhen](xref:System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute) | [Conditional postcondition](#conditional-post-conditions-notnullwhen-maybenullwhen-and-notnullifnotnull) | A non-nullable argument may be null when the method returns the specified `bool` value. | +| [NotNullWhen](xref:System.Diagnostics.CodeAnalysis.NotNullWhenAttribute) | [Conditional postcondition](#conditional-post-conditions-notnullwhen-maybenullwhen-and-notnullifnotnull) | A nullable argument won't be null when the method returns the specified `bool` value. | +| [NotNullIfNotNull](xref:System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute) | [Conditional postcondition](#conditional-post-conditions-notnullwhen-maybenullwhen-and-notnullifnotnull) | A return value isn't null if the argument for the specified parameter isn't null. | +| [MemberNotNull](xref:System.Diagnostics.CodeAnalysis.MemberNotNullAttribute) | [Constructor helper methods](#constructor-helper-methods-membernotnull-and-membernotnullwhen) | The listed member won't be null when the method returns. | +| [MemberNotNullWhen](xref:System.Diagnostics.CodeAnalysis.MemberNotNullWhenAttribute) | [Constructor helper methods](#constructor-helper-methods-membernotnull-and-membernotnullwhen) | The listed member won't be null when the method returns the specified `bool` value. | +| [DoesNotReturn](xref:System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute) | [Unreachable code](#verify-unreachable-code) | A method never returns. In other words, it always throws an exception. | +| [DoesNotReturnIf](xref:System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute) | [Unreachable code](#verify-unreachable-code) | This method never returns if the associated `bool` parameter has the specified value. | -Adding these attributes gives the compiler more information about the rules for your API. When calling code is compiled in a nullable enabled context, the compiler will warn callers when they violate those rules. These attributes don't enable more checks on your implementation. +The preceding descriptions are a quick reference to what each attribute does. The following sections describe the behavior and meaning of these attributes more thoroughly. -## Specify preconditions: `AllowNull` and `DisallowNull` +## Preconditions: `AllowNull` and `DisallowNull` Consider a read/write property that never returns `null` because it has a reasonable default value. Callers pass `null` to the set accessor when setting it to that default value. For example, consider a messaging system that asks for a screen name in a chat room. If none is provided, the system generates a random name: @@ -83,7 +88,7 @@ The `AllowNull` and `DisallowNull` attributes enable you to specify that precond - [AllowNull](xref:System.Diagnostics.CodeAnalysis.AllowNullAttribute): A non-nullable argument may be null. - [DisallowNull](xref:System.Diagnostics.CodeAnalysis.DisallowNullAttribute): A nullable argument should never be null. -## Specify post-conditions: `MaybeNull` and `NotNull` +## Postconditions: `MaybeNull` and `NotNull` Suppose you have a method with the following signature: @@ -122,7 +127,7 @@ You specify unconditional postconditions using the following attributes: - [MaybeNull](xref:System.Diagnostics.CodeAnalysis.MaybeNullAttribute): A non-nullable return value may be null. - [NotNull](xref:System.Diagnostics.CodeAnalysis.NotNullAttribute): A nullable return value will never be null. -## Specify conditional post-conditions: `NotNullWhen`, `MaybeNullWhen`, and `NotNullIfNotNull` +## Conditional post-conditions: `NotNullWhen`, `MaybeNullWhen`, and `NotNullIfNotNull` You're likely familiar with the `string` method . This method returns `true` when the argument is null or an empty string. It's a form of null-check: Callers don't need to null-check the argument if the method returns `false`. To make a method like this nullable aware, you'd set the argument to a nullable reference type, and add the `NotNullWhen` attribute: diff --git a/docs/csharp/language-reference/builtin-types/reference-types.md b/docs/csharp/language-reference/builtin-types/reference-types.md index bcfe34a75ad76..3389a3672f333 100644 --- a/docs/csharp/language-reference/builtin-types/reference-types.md +++ b/docs/csharp/language-reference/builtin-types/reference-types.md @@ -132,6 +132,31 @@ A `delegate` is a reference type that can be used to encapsulate a named or an a The delegate must be instantiated with a method or lambda expression that has a compatible return type and input parameters. For more information on the degree of variance that is allowed in the method signature, see [Variance in Delegates](../../programming-guide/concepts/covariance-contravariance/using-variance-in-delegates.md). For use with anonymous methods, the delegate and the code to be associated with it are declared together. +Delegate combination and removal fails with a runtime exception when the delegate types involved at runtime are different due to variant conversion. The following example demonstrates a situation which fails: + +```csharp +Action stringAction = str => {}; +Action objectAction = obj => {}; + +// Valid due to implicit reference conversion of +// objectAction to Action, but may fail +// at runtime. +Action combination = stringAction + objectAction; +``` + +You can create a delegate with the correct runtime type by creating a new delegate object. The following example demonstrates how this workaround may be applied to the preceding example. + +```csharp +Action stringAction = str => {}; +Action objectAction = obj => {}; + +// Creates a new delegate instance with a runtime type of Action. +Action wrappedObjectAction = new Action(objectAction); + +// The two Action delegate instances can now be combined. +Action combination = stringAction + wrappedObjectAction; +``` + Beginning with C# 9, you can declare [*function pointers*](../unsafe-code.md#function-pointers), which use similar syntax. A function pointer uses the `calli` instruction instead of instantiating a delegate type and calling the virtual `Invoke` method. ## The dynamic type diff --git a/docs/csharp/language-reference/keywords/yield.md b/docs/csharp/language-reference/keywords/yield.md index 13c9e7571fac4..c9edae724de54 100644 --- a/docs/csharp/language-reference/keywords/yield.md +++ b/docs/csharp/language-reference/keywords/yield.md @@ -26,6 +26,8 @@ You use a `yield return` statement to return each element one at a time. The sequence returned from an iterator method can be consumed by using a [foreach](../statements/iteration-statements.md#the-foreach-statement) statement or LINQ query. Each iteration of the `foreach` loop calls the iterator method. When a `yield return` statement is reached in the iterator method, `expression` is returned, and the current location in code is retained. Execution is restarted from that location the next time that the iterator function is called. +When the iterator returns an , that sequence can be consumed asynchronously using an [await foreach](../statements/iteration-statements.md#await-foreach) statement. The iteration of the loop is analogous to the `foreach` statement. The difference is that each iteration may be suspended for an asynchronous operation before returning the expression for the next element. + You can use a `yield break` statement to end the iteration. For more information about iterators, see [Iterators](../../iterators.md). @@ -34,16 +36,19 @@ For more information about iterators, see [Iterators](../../iterators.md). The declaration of an iterator must meet the following requirements: -- The return type must be , , , or . - +- The return type must be one of the following types: + - + - + - + - + - - The declaration can't have any [in](in-parameter-modifier.md), [ref](ref.md), or [out](out-parameter-modifier.md) parameters. -The `yield` type of an iterator that returns or is `object`. If the iterator returns or , there must be an implicit conversion from the type of the expression in the `yield return` statement to the generic type parameter . +The `yield` type of an iterator that returns or is `object`. If the iterator returns or , there must be an implicit conversion from the type of the expression in the `yield return` statement to the generic type parameter. You can't include a `yield return` or `yield break` statement in: - [Lambda expressions](../operators/lambda-expressions.md) and [anonymous methods](../operators/delegate-operator.md). - - Methods that contain unsafe blocks. For more information, see [unsafe](unsafe.md). ## Exception handling @@ -52,7 +57,7 @@ A `yield return` statement can't be located in a try-catch block. A `yield retur A `yield break` statement can be located in a try block or a catch block but not a finally block. -If the `foreach` body (outside of the iterator method) throws an exception, a `finally` block in the iterator method is executed. +If the `foreach` or `await foreach` body (outside of the iterator method) throws an exception, a `finally` block in the iterator method is executed. ## Technical implementation @@ -72,7 +77,21 @@ On an iteration of the `foreach` loop, the ` from an iterator method and then iterates through its elements. + +```csharp +IAsyncEnumerable elements = MyAsyncIteratorMethod(); +await foreach (string element in elements) +{ + // ... +} +``` + +On an iteration of the `await foreach` loop, the method is called for `elements`. The return by `MoveNext` completes when the next `yield return` is reached. + +On each subsequent iteration of the `await foreach` loop, the execution of the iterator body continues from where it left off, again stopping when it reaches a `yield return` statement. The `await foreach` loop completes when the end of the iterator method or a `yield break` statement is reached. + +## Examples The following example has a `yield return` statement that's inside a `for` loop. Each iteration of the `foreach` statement body in the `Main` method creates a call to the `Power` iterator function. Each call to the iterator function proceeds to the next execution of the `yield return` statement, which occurs during the next iteration of the `for` loop. @@ -80,8 +99,6 @@ The return type of the iterator method is , [!code-csharp[csrefKeywordsContextual#5](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsContextual/CS/csrefKeywordsContextual.cs#5)] -## Example 2 - The following example demonstrates a `get` accessor that is an iterator. In the example, each `yield return` statement returns an instance of a user-defined class. [!code-csharp[csrefKeywordsContextual#21](~/samples/snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsContextual/CS/csrefKeywordsContextual.cs#21)] diff --git a/docs/csharp/misc/cs0688.md b/docs/csharp/misc/cs0688.md index 75101090c966d..c2673f4b777cd 100644 --- a/docs/csharp/misc/cs0688.md +++ b/docs/csharp/misc/cs0688.md @@ -12,7 +12,7 @@ ms.assetid: 8ce5af36-663e-46e8-87e9-bb32555796ae 'method1' has a link demand, but overrides or implements 'method2' which does not have a link demand. A security hole may exist. - The link demand set up on the derived class method can easily be circumvented by calling the base class method. To close the security hole, the base class method needs to also use the link demand. For more information, see [Demand vs. LinkDemand](../../framework/misc/securing-wrapper-code.md#demand-vs-linkdemand). + The link demand set up on the derived class method can easily be circumvented by calling the base class method. To close the security hole, the base class method needs to also use the link demand. For more information, see [Demand vs. LinkDemand](/previous-versions/dotnet/framework/code-access-security/securing-wrapper-code#demand-vs-linkdemand). ## Example diff --git a/docs/csharp/programming-guide/classes-and-structs/destructors.md b/docs/csharp/programming-guide/classes-and-structs/destructors.md index 5db9c087ceeed..4ee3d36b84597 100644 --- a/docs/csharp/programming-guide/classes-and-structs/destructors.md +++ b/docs/csharp/programming-guide/classes-and-structs/destructors.md @@ -69,7 +69,7 @@ For more information about cleaning up resources, see the following articles: - [Cleaning Up Unmanaged Resources](../../../standard/garbage-collection/unmanaged.md) - [Implementing a Dispose Method](../../../standard/garbage-collection/implementing-dispose.md) -- [Implementing a Dispose Method](../../../standard/garbage-collection/implementing-disposeasync.md) +- [Implementing a DisposeAsync Method](../../../standard/garbage-collection/implementing-disposeasync.md) - [using Statement](../../language-reference/keywords/using-statement.md) ## Example diff --git a/docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md b/docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md index 6accaf99a949b..64c8b8d6bd941 100644 --- a/docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md +++ b/docs/csharp/programming-guide/classes-and-structs/object-and-collection-initializers.md @@ -103,6 +103,34 @@ The preceding sample generates code that calls the to add the three items into the dictionary. These two different ways to initialize associative collections have slightly different behavior because of the method calls the compiler generates. Both variants work with the `Dictionary` class. Other types may only support one or the other based on their public API. +## Object Initializers with collection read-only property initialization + +Some classes may have collection properties where the property is read-only, like the `Cats` property of `CatOwner` in the following case: + +[!code-csharp[ObjectInitializer1](../../../../samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/BasicObjectInitializers.cs#CatOwnerDeclaration)] + +You will not be able to use collection initializer syntax discussed so far since the property cannot be assigned a new list: + +```csharp +CatOwner owner = new CatOwner +{ + Cats = new List + { + new Cat{ Name = "Sylvester", Age=8 }, + new Cat{ Name = "Whiskers", Age=2 }, + new Cat{ Name = "Sasha", Age=14 } + } +}; +``` + +However, new entries can be added to `Cats` nonetheless using the initialization syntax by omitting the list creation (`new List`), as shown next: + +[!code-csharp[ListInitializer](../../../../samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/BasicObjectInitializers.cs#ReadOnlyPropertyCollectionInitializer)] + +The set of entries to be added simply appear surrounded by braces. The above is identical to writing: + +[!code-csharp[ListInitializer](../../../../samples/snippets/csharp/programming-guide/classes-and-structs/object-collection-initializers/BasicObjectInitializers.cs#ReadOnlyPropertyCollectionInitializerTranslation)] + ## Examples The following example combines the concepts of object and collection initializers. diff --git a/docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md b/docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md index 33e01fc32f073..c5d5d4d802747 100644 --- a/docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md +++ b/docs/csharp/programming-guide/classes-and-structs/partial-classes-and-methods.md @@ -1,7 +1,7 @@ --- title: "Partial Classes and Methods - C# Programming Guide" description: Partial classes and methods in C# split the definition of a class, a struct, an interface, or a method over two or more source files. -ms.date: 03/23/2021 +ms.date: 06/21/2021 helpviewer_keywords: - "partial methods [C#]" - "partial classes [C#]" @@ -17,10 +17,10 @@ It is possible to split the definition of a [class](../../language-reference/key There are several situations when splitting a class definition is desirable: - When working on large projects, spreading a class over separate files enables multiple programmers to work on it at the same time. - - When working with automatically generated source, code can be added to the class without having to recreate the source file. Visual Studio uses this approach when it creates Windows Forms, Web service wrapper code, and so on. You can create code that uses these classes without having to modify the file created by Visual Studio. +- When using [source generators](../../roslyn-sdk/source-generators-overview.md) to generate additional functionality in a class. -- To split a class definition, use the [partial](../../language-reference/keywords/partial-type.md) keyword modifier, as shown here: +To split a class definition, use the [partial](../../language-reference/keywords/partial-type.md) keyword modifier, as shown here: [!code-csharp[EmployeeExample#1](snippets/partial-classes-and-methods/Program.cs#1)] @@ -48,13 +48,9 @@ They are equivalent to the following declarations: The following are merged from all the partial-type definitions: - XML comments - - interfaces - - generic-type parameter attributes - - class attributes - - members For example, consider the following declarations: @@ -70,70 +66,50 @@ They are equivalent to the following declarations: There are several rules to follow when you are working with partial class definitions: - All partial-type definitions meant to be parts of the same type must be modified with `partial`. For example, the following class declarations generate an error: - [!code-csharp[AllDefinitionsMustBePartials#7](snippets/partial-classes-and-methods/Program.cs#7)] - - The `partial` modifier can only appear immediately before the keywords `class`, `struct`, or `interface`. - - Nested partial types are allowed in partial-type definitions as illustrated in the following example: - [!code-csharp[NestedPartialTypes#8](snippets/partial-classes-and-methods/Program.cs#8)] - - All partial-type definitions meant to be parts of the same type must be defined in the same assembly and the same module (.exe or .dll file). Partial definitions cannot span multiple modules. - - The class name and generic-type parameters must match on all partial-type definitions. Generic types can be partial. Each partial declaration must use the same parameter names in the same order. - - The following keywords on a partial-type definition are optional, but if present on one partial-type definition, cannot conflict with the keywords specified on another partial definition for the same type: - - [public](../../language-reference/keywords/public.md) - - [private](../../language-reference/keywords/private.md) - - [protected](../../language-reference/keywords/protected.md) - - [internal](../../language-reference/keywords/internal.md) - - [abstract](../../language-reference/keywords/abstract.md) - - [sealed](../../language-reference/keywords/sealed.md) - - base class - - [new](../../language-reference/keywords/new-modifier.md) modifier (nested parts) - - generic constraints For more information, see [Constraints on Type Parameters](../generics/constraints-on-type-parameters.md). -## Example 1 - -### Description +## Examples In the following example, the fields and the constructor of the class, `Coords`, are declared in one partial class definition, and the member, `PrintCoords`, is declared in another partial class definition. -### Code - [!code-csharp[CoordsExample#9](snippets/partial-classes-and-methods/Program.cs#9)] -## Example 2 - -### Description - The following example shows that you can also develop partial structs and interfaces. -### Code - [!code-csharp[PartialStructsAndInterfaces#10](snippets/partial-classes-and-methods/Program.cs#10)] ## Partial Methods -A partial class or struct may contain a partial method. One part of the class contains the signature of the method. An implementation can be defined in the same part or another part. If the implementation is not supplied, then the method and all calls to the method are removed at compile time. Implementation may be required depending on method signature. +A partial class or struct may contain a partial method. One part of the class contains the signature of the method. An implementation can be defined in the same part or another part. If the implementation is not supplied, then the method and all calls to the method are removed at compile time. Implementation may be required depending on method signature. A partial method isn't required to have an implementation in the following cases: -Partial methods enable the implementer of one part of a class to define a method, similar to an event. The implementer of the other part of the class can decide whether to implement the method or not. If the method is not implemented, then the compiler removes the method signature and all calls to the method. The calls to the method, including any results that would occur from evaluation of arguments in the calls, have no effect at run time. Therefore, any code in the partial class can freely use a partial method, even if the implementation is not supplied. No compile-time or run-time errors will result if the method is called but not implemented. +- It doesn't have any accessibility modifiers (including the default [private](../../language-reference/keywords/private.md)). +- It returns [void](../../language-reference/builtin-types/void.md). +- It doesn't have any [out](../../language-reference/keywords/out-parameter-modifier.md) parameters. +- It doesn't have any of the following modifiers [virtual](../../language-reference/keywords/virtual.md), [override](../../language-reference/keywords/override.md), [sealed](../../language-reference/keywords/sealed.md), [new](../../language-reference/keywords/new-modifier.md), or [extern](../../language-reference/keywords/extern.md). + +Any method that doesn't conform to all those restrictions (for example, `public virtual partial void` method), must provide an implementation. That implementation may be supplied by a *source generator*. -Partial methods are especially useful as a way to customize generated code. They allow for a method name and signature to be reserved, so that generated code can call the method but the developer can decide whether to implement the method. Much like partial classes, partial methods enable code created by a code generator and code created by a human developer to work together without run-time costs. +Partial methods enable the implementer of one part of a class to declare a method. The implementer of another part of the class can define that method. There are two scenarios where this is useful: templates that generate boilerplate code, and source generators. -A partial method declaration consists of two parts: the definition, and the implementation. These may be in separate parts of a partial class, or in the same part. If there is no implementation declaration, then the compiler optimizes away both the defining declaration and all calls to the method. +- **Template code**: The template reserves a method name and signature so that generated code can call the method. These methods follows the restrictions that enable a developer to decide whether to implement the method. If the method is not implemented, then the compiler removes the method signature and all calls to the method. The calls to the method, including any results that would occur from evaluation of arguments in the calls, have no effect at run time. Therefore, any code in the partial class can freely use a partial method, even if the implementation is not supplied. No compile-time or run-time errors will result if the method is called but not implemented. +- **Source generators**: Source generators provide an implementation for methods. The human developer can add the method declaration (often with attributes read by the source generator). The developer can write code that calls these methods. The source generator runs during compilation and provides the implementation. In this scenario, the restrictions for partial methods that may not be implemented often aren't followed. ```csharp // Definition in file1.cs @@ -147,27 +123,11 @@ partial void OnNameChanged() ``` - Partial method declarations must begin with the contextual keyword [partial](../../language-reference/keywords/partial-type.md). - - Partial method signatures in both parts of the partial type must match. - - Partial methods can have [static](../../language-reference/keywords/static.md) and [unsafe](../../language-reference/keywords/unsafe.md) modifiers. - - Partial methods can be generic. Constraints are put on the defining partial method declaration, and may optionally be repeated on the implementing one. Parameter and type parameter names do not have to be the same in the implementing declaration as in the defining one. - - You can make a [delegate](../../language-reference/builtin-types/reference-types.md) to a partial method that has been defined and implemented, but not to a partial method that has only been defined. -A partial method isn't required to have an implementation in the following cases: - -- It doesn't have any accessibility modifiers (including the default [private](../../language-reference/keywords/private.md)). - -- It returns [void](../../language-reference/builtin-types/void.md). - -- It doesn't have any [out](../../language-reference/keywords/out-parameter-modifier.md) parameters. - -- It doesn't have any of the following modifiers [virtual](../../language-reference/keywords/virtual.md), [override](../../language-reference/keywords/override.md), [sealed](../../language-reference/keywords/sealed.md), [new](../../language-reference/keywords/new-modifier.md), or [extern](../../language-reference/keywords/extern.md). - -Any method that doesn't conform to all those restrictions (for example, `public virtual partial void` method), must provide an implementation. - ## C# Language Specification For more information, see [Partial types](~/_csharplang/spec/classes.md#partial-types) in the [C# Language Specification](/dotnet/csharp/language-reference/language-specification/introduction). The language specification is the definitive source for C# syntax and usage. diff --git a/docs/csharp/roslyn-sdk/media/source-generators/source-generator-visualization.png b/docs/csharp/roslyn-sdk/media/source-generators/source-generator-visualization.png new file mode 100644 index 0000000000000..8e658d8e373f5 Binary files /dev/null and b/docs/csharp/roslyn-sdk/media/source-generators/source-generator-visualization.png differ diff --git a/docs/csharp/roslyn-sdk/source-generators-overview.md b/docs/csharp/roslyn-sdk/source-generators-overview.md new file mode 100644 index 0000000000000..5eaf9ad4958af --- /dev/null +++ b/docs/csharp/roslyn-sdk/source-generators-overview.md @@ -0,0 +1,158 @@ +--- +title: Source Generators +description: Source Generators is a C# compiler feature that lets C# developers inspect user code as it is being compiled and generates new C# source files on the fly that are added to the user's compilation. +ms.date: 06/11/2021 +ms.topic: tutorial +ms.custom: mvc, vs-dotnet, source-generators +--- +# Source Generators + +This article provides an overview of Source Generators that ships as part of the .NET Compiler Platform ("Roslyn") SDK. Source Generators is a C# compiler feature that lets C# developers inspect user code as it is being compiled and generates new C# source files on the fly that are added to the user's compilation. + +A Source Generator is a piece of code that runs during compilation and can inspect your program to produce additional source files that are compiled together with the rest of your code. + +A Source Generator is a new kind of component that C# developers can write that lets you do two major things: + +1. Retrieve a *compilation object* that represents all user code that is being compiled. This object can be inspected, and you can write code that works with the syntax and semantic models for the code being compiled, just like with analyzers today. + +2. Generate C# source files that can be added to a compilation object during the course of compilation. In other words, you can provide additional source code as input to a compilation while the code is being compiled. + +When combined, these two things are what make Source Generators so useful. You can inspect user code with all of the rich metadata that the compiler builds up during compilation, then emit C# code back into the same compilation that is based on the data you've analyzed! If you're familiar with Roslyn Analyzers, you can think of Source Generators as analyzers that can emit C# source code. + +Source generators run as a phase of compilation visualized below: + +:::image type="content" source="media/source-generators/source-generator-visualization.png" alt-text="Graphic describing the different parts of source generation"::: + +A Source Generator is a .NET Standard 2.0 assembly that is loaded by the compiler along with any analyzers. It is usable in environments where .NET Standard components can be loaded and run. + +## Common scenarios + +Today, there are three general approaches to inspecting user code and generating information or code based on that analysis used by technologies today: runtime reflection, IL weaving, and juggling MSBuild tasks. Source Generators can be an improvement over each approach. +Runtime reflection is a powerful technology that was added to .NET a long time ago. There are countless scenarios for using it. A very common scenario is to perform some analysis of user code when an app starts up and use that data to generate things. + +For example, ASP.NET Core uses reflection when your web service first runs to discover constructs you’ve defined so that it can “wire up” things like controllers and razor pages. Although this enables you to write straightforward code with powerful abstractions, it comes with a performance penalty at runtime: when your web service or app first starts up, it cannot accept any requests until all the runtime reflection code that discovers information about your code is finished running! Although this performance penalty is not enormous, it is somewhat of a fixed cost that you cannot improve yourself in your own app. + +With a Source Generator, the controller discovery phase of startup could instead happen at compile time by analyzing your source code and emitting the code it needs to "wire up" your app. This could result in some faster startup times, since an action happening at runtime today could get pushed into compile time. +Source Generators can improve performance in ways that aren’t limited to reflection at runtime to discover types as well. Some scenarios involve calling the MSBuild C# task (called CSC) multiple times so they can inspect data from a compilation. As you might imagine, calling the compiler more than once affects the total time it takes to build your app! We’re investigating how Source Generators can be used to obviate the need for juggling MSBuild tasks like this, since Source generators don’t just offer some performance benefits, but also allows tools to operate at the right level of abstraction. + +Another capability Source Generators can offer is obviating the use of some “stringly-typed” APIs, such as how ASP.NET Core routing between controllers and razor pages work. With a Source Generator, routing can be strongly typed with the necessary strings being generated as a compile-time detail. This would reduce the amount of times a mistyped string literal leads to a request not hitting the correct controller. + +## Get started with source generators + +In this guide, you'll explore the creation of a source generator using the API. + +1. Create a .NET console application. + +2. Replace the Program class with the following: + + ```csharp + partial class Program + { + static void Main(string[] args) + { + HelloFrom("Generated Code"); + } + + static partial void HelloFrom(string name); + } + ``` + + > [!NOTE] + > You can run this sample as-is, but nothing will happen yet. + +3. Next, we'll create a source generator that will fill in the contents of the `HelloFrom` method. + +4. Create a .NET standard library project that looks like this: + + ```xml + + + + netstandard2.0 + + + + + + + + + ``` + +5. Modify or create a C# file that specifies your own Source Generator like so: + + ```csharp + using Microsoft.CodeAnalysis; + + namespace MyGenerator + { + [Generator] + public class MySourceGenerator : ISourceGenerator + { + public void Execute(GeneratorExecutionContext context) + { + // Code generation goes here + } + + public void Initialize(GeneratorInitializationContext context) + { + // No initialization required for this one + } + } + } + ``` + +6. Replace the contents of the `Execute` method, so that it looks like the following: + + ```csharp + public void Execute(GeneratorExecutionContext context) + { + // find the main method + var mainMethod = context.Compilation.GetEntryPoint(context.CancellationToken); + + // build up the source code + string source = $@" + using System; + + namespace {mainMethod.ContainingNamespace.Name} + {{ + public static partial class {mainMethod.ContainingType.Name} + {{ + static partial void HelloFrom(string name) + {{ + Console.WriteLine($""Generator says: Hi from '{{name}}'""); + }} + }} + }} + "; + // add the source code to the compilation + context.AddSource("generatedSource", source); + } + ``` + +7. We now have a functioning generator, but need to connect it to our console application. Edit the original console application project and add the following, replacing the project path with the one from the .NET Standard project you created above: + + ```xml + + + + + + ``` + +8. Now, when you run the console application, you should see that the generated code gets run and prints to the screen. + + > [!NOTE] + > You will currently need to restart Visual Studio to see IntelliSense and get rid of errors with the early tooling experience. + +## Next steps + +The [Source Generators Cookbook](https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.cookbook.md) goes over some of these examples with some recommended approaches to solving them. Additionally, we have a [set of samples available on GitHub](https://github.com/dotnet/roslyn-sdk/tree/main/samples/CSharp/SourceGenerators) that you can try on your own. + +You can learn more about Source Generators in these topics: + +- [Source Generators design document](https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.md) +- [Source Generators cookbook](https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.cookbook.md) diff --git a/docs/csharp/snippets/iterators/Generators.cs b/docs/csharp/snippets/iterators/Generators.cs new file mode 100644 index 0000000000000..061e23ac3e040 --- /dev/null +++ b/docs/csharp/snippets/iterators/Generators.cs @@ -0,0 +1,131 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace iterators +{ + + public class Generators + { + // + public IEnumerable GetSingleDigitNumbers() + { + yield return 0; + yield return 1; + yield return 2; + yield return 3; + yield return 4; + yield return 5; + yield return 6; + yield return 7; + yield return 8; + yield return 9; + } + // + + // + public IEnumerable GetSingleDigitNumbersLoop() + { + int index = 0; + while (index < 10) + yield return index++; + } + // + + // + public IEnumerable GetSetsOfNumbers() + { + int index = 0; + while (index < 10) + yield return index++; + + yield return 50; + + index = 100; + while (index < 110) + yield return index++; + } + // + + // + public async IAsyncEnumerable GetSetsOfNumbersAsync() + { + int index = 0; + while (index < 10) + yield return index++; + + await Task.Delay(500); + + yield return 50; + + await Task.Delay(500); + + index = 100; + while (index < 110) + yield return index++; + } + // + + // + public IEnumerable GetFirstDecile() + { + int index = 0; + while (index < 10) + yield return index++; + + yield return 50; + + var items = new int[] {100, 101, 102, 103, 104, 105, 106, 107, 108, 109 }; + foreach (var item in items) + yield return item; + } + // + + // + public IEnumerable GetSingleDigitOddNumbers(bool getCollection) + { + if (getCollection == false) + return new int[0]; + else + return IteratorMethod(); + } + + private IEnumerable IteratorMethod() + { + int index = 0; + while (index < 10) + { + if (index % 2 == 1) + yield return index; + index++; + } + } + // + } + + public static class Extensions + { + // + public static IEnumerable Sample(this IEnumerable sourceSequence, int interval) + { + int index = 0; + foreach (T item in sourceSequence) + { + if (index++ % interval == 0) + yield return item; + } + } + // + + // + public static async IAsyncEnumerable Sample(this IAsyncEnumerable sourceSequence, int interval) + { + int index = 0; + await foreach (T item in sourceSequence) + { + if (index++ % interval == 0) + yield return item; + } + } + // + } +} \ No newline at end of file diff --git a/docs/csharp/snippets/iterators/Program.cs b/docs/csharp/snippets/iterators/Program.cs new file mode 100644 index 0000000000000..b4d1a03c8f5bd --- /dev/null +++ b/docs/csharp/snippets/iterators/Program.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace iterators +{ + class Program + { + static async Task Main(string[] args) + { + firstExample(new int[] {1,2,3,4,5}); + await firstAsyncExample(asyncCollection()); + + var gen = new Generators(); + foreach(var item in gen.GetSetsOfNumbers()) + Console.WriteLine(item); + + await foreach(var item in gen.GetSetsOfNumbersAsync()) + Console.WriteLine(item); + + + async IAsyncEnumerable asyncCollection() + { + yield return 1; + yield return 2; + await Task.Delay(1000); + yield return 3; + yield return 4; + yield return 5; + } + } + + public static void firstExample(IEnumerable collection) + { + // + foreach (var item in collection) + { + Console.WriteLine(item.ToString()); + } + // + } + + public static async Task firstAsyncExample(IAsyncEnumerable asyncSequence) + { + // + await foreach (var item in asyncSequence) + { + Console.WriteLine(item.ToString()); + } + // + } + + public static void InsideForeach(IEnumerable collection) + { + // + IEnumerator enumerator = collection.GetEnumerator(); + while (enumerator.MoveNext()) + { + var item = enumerator.Current; + Console.WriteLine(item.ToString()); + } + // + } + } +} diff --git a/docs/csharp/snippets/iterators/iterators.csproj b/docs/csharp/snippets/iterators/iterators.csproj new file mode 100644 index 0000000000000..41f1d5ad4b264 --- /dev/null +++ b/docs/csharp/snippets/iterators/iterators.csproj @@ -0,0 +1,8 @@ + + + + Exe + net6.0 + + + diff --git a/docs/csharp/toc.yml b/docs/csharp/toc.yml index c5f3ae094238c..15b703881c856 100644 --- a/docs/csharp/toc.yml +++ b/docs/csharp/toc.yml @@ -329,6 +329,8 @@ items: href: roslyn-sdk/work-with-workspace.md - name: Explore code with the syntax visualizer href: roslyn-sdk/syntax-visualizer.md + - name: Source Generators + href: roslyn-sdk/source-generators-overview.md - name: Quick starts items: - name: Syntax analysis diff --git a/docs/csharp/whats-new/csharp-version-history.md b/docs/csharp/whats-new/csharp-version-history.md index acee58effae54..4a177e3d29a23 100644 --- a/docs/csharp/whats-new/csharp-version-history.md +++ b/docs/csharp/whats-new/csharp-version-history.md @@ -2,7 +2,8 @@ title: The history of C# - C# Guide description: What did the language look like in its earliest versions, and how has it evolved since? author: erikdietrich -ms.date: 04/08/2020 +ms.date: 06/18/2021 +ms.custom: updateeachrelease --- # The history of C\# @@ -12,15 +13,6 @@ This article provides a history of each major release of the C# language. The C# > [!IMPORTANT] > The C# language relies on types and methods in what the C# specification defines as a *standard library* for some of the features. The .NET platform delivers those types and methods in a number of packages. One example is exception processing. Every `throw` statement or expression is checked to ensure the object being thrown is derived from . Similarly, every `catch` is checked to ensure that the type being caught is derived from . Each version may add new requirements. To use the latest language features in older environments, you may need to install specific libraries. These dependencies are documented in the page for each specific version. You can learn more about the [relationships between language and library](relationships-between-language-and-library.md) for background on this dependency. -The C# build tools consider the latest major language release the default language version. There may be point releases between major releases, detailed in other articles in this section. To use the latest features in a point release, you need to [configure the compiler language version](../language-reference/configure-language-version.md) and select the version. There have been three-point releases since C# 7.0: - -- C# 7.3: - - C# 7.3 is available starting with [Visual Studio 2017 version 15.7](https://visualstudio.microsoft.com/vs/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=inline+link) and [.NET Core 2.1 SDK](../../core/whats-new/dotnet-core-2-1.md). -- C# 7.2: - - C# 7.2 is available starting with [Visual Studio 2017 version 15.5](https://visualstudio.microsoft.com/vs/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=inline+link) and [.NET Core 2.0 SDK](../../core/whats-new/dotnet-core-2-0.md). -- C# 7.1: - - C# 7.1 is available starting with [Visual Studio 2017 version 15.3](https://visualstudio.microsoft.com/vs/?utm_medium=microsoft&utm_source=docs.microsoft.com&utm_campaign=inline+link) and [.NET Core 2.0 SDK](../../core/whats-new/dotnet-core-2-0.md). - ## C# version 1.0 When you go back and look, C# version 1.0, released with Visual Studio .NET 2002, looked a lot like Java. As [part of its stated design goals for ECMA](https://feeldotneteasy.blogspot.com/2011/01/c-design-goals.html), it sought to be a "simple, modern, general-purpose object-oriented language." At the time, looking like Java meant it achieved those early design goals. @@ -65,7 +57,7 @@ Other C# 2.0 features added capabilities to existing features: While C# may have started as a generic Object-Oriented (OO) language, C# version 2.0 changed that in a hurry. Once they had their feet under them, they went after some serious developer pain points. And they went after them in a significant way. -With generics, types and methods can operate on an arbitrary type while still retaining type safety. For instance, having a lets you have `List` or `List` and perform type-safe operations on those strings or integers while you iterate through them. Using generics is better than creating a `ListInt` type which derives from `ArrayList` or casting from `Object` for every operation. +With generics, types and methods can operate on an arbitrary type while still retaining type safety. For instance, having a lets you have `List` or `List` and perform type-safe operations on those strings or integers while you iterate through them. Using generics is better than creating a `ListInt` type that derives from `ArrayList` or casting from `Object` for every operation. C# version 2.0 brought iterators. To put it succinctly, iterators let you examine all the items in a `List` (or other Enumerable types) with a `foreach` loop. Having iterators as a first-class part of the language dramatically enhanced readability of the language and people's ability to reason about the code. @@ -104,7 +96,7 @@ The next version did introduce some interesting new features: - [Generic covariant and contravariant](../../standard/generics/covariance-and-contravariance.md) - [Embedded interop types](../../framework/interop/type-equivalence-and-embedded-interop-types.md) -Embedded interop types alleviated a deployment pain. Generic covariance and contravariance give you more power to use generics, but they're a bit academic and probably most appreciated by framework and library authors. Named and optional parameters let you eliminate many method overloads and provide convenience. But none of those features are exactly paradigm altering. +Embedded interop types eased the deployment pain of creating COM interop assemblies for your application. Generic covariance and contravariance give you more power to use generics, but they're a bit academic and probably most appreciated by framework and library authors. Named and optional parameters let you eliminate many method overloads and provide convenience. But none of those features are exactly paradigm altering. The major feature was the introduction of the `dynamic` keyword. The `dynamic` keyword introduced into C# version 4.0 the ability to override the compiler on compile-time typing. By using the dynamic keyword, you can create constructs similar to dynamically typed languages like JavaScript. You can create a `dynamic x = "a string"` and then add six to it, leaving it up to the runtime to sort out what should happen next. @@ -112,7 +104,7 @@ Dynamic binding gives you the potential for errors but also great power within t ## C# version 5.0 -C# version 5.0, released with Visual Studio 2012, was a focused version of the language. Nearly all of the effort for that version went into another groundbreaking language concept: the `async` and `await` model for asynchronous programming. Here is the major features list: +C# version 5.0, released with Visual Studio 2012, was a focused version of the language. Nearly all of the effort for that version went into another groundbreaking language concept: the `async` and `await` model for asynchronous programming. Here's the major features list: - [Asynchronous members](../async.md) - [Caller info attributes](../language-reference/attributes/caller-information.md) @@ -211,7 +203,7 @@ The following new features support the theme of better performance for safe code - [You can reassign `ref` local variables.](csharp-7.md#enabling-more-efficient-safe-code) - [You can use initializers on `stackalloc` arrays.](csharp-7.md#stackalloc-arrays-support-initializers) - [You can use `fixed` statements with any type that supports a pattern.](csharp-7.md#more-types-support-the-fixed-statement) -- [You can use additional generic constraints.](csharp-7.md#enhanced-generic-constraints) +- [You can use more generic constraints.](csharp-7.md#enhanced-generic-constraints) The following enhancements were made to existing features: @@ -250,4 +242,60 @@ C# 8.0 is the first major C# release that specifically targets .NET Core. Some f Default interface members require enhancements in the CLR. Those features were added in the CLR for .NET Core 3.0. Ranges and indexes, and asynchronous streams require new types in the .NET Core 3.0 libraries. Nullable reference types, while implemented in the compiler, is much more useful when libraries are annotated to provide semantic information regarding the null state of arguments and return values. Those annotations are being added in the .NET Core libraries. +## C# version 9.0 + +C# 9.0 was released with .NET 5. It's the default language version for any assembly that targets the .NET 5 release. It contains the following new and enhanced features: + +C# 9.0 adds the following features and enhancements to the C# language: + +- [Records](./csharp-9.md#record-types) +- [Init only setters](./csharp-9.md#init-only-setters) +- [Top-level statements](./csharp-9.md#top-level-statements) +- [Pattern matching enhancements](./csharp-9.md#pattern-matching-enhancements) +- [Performance and interop](./csharp-9.md#performance-and-interop) + - [Native sized integers](~/_csharplang/proposals/csharp-9.0/native-integers.md) + - [Function pointers](~/_csharplang/proposals/csharp-9.0/function-pointers.md) + - [Suppress emitting localsinit flag](~/_csharplang/proposals/csharp-9.0/skip-localsinit.md) +- [Fit and finish features](./csharp-9.md#fit-and-finish-features) + - [Target-typed `new` expressions](~/_csharplang/proposals/csharp-9.0/target-typed-new.md) + - [`static` anonymous functions](~/_csharplang/proposals/csharp-9.0/static-anonymous-functions.md) + - [Target-typed conditional expressions](~/_csharplang/proposals/csharp-9.0/target-typed-conditional-expression.md) + - [Covariant return types](~/_csharplang/proposals/csharp-9.0/covariant-returns.md) + - [Extension `GetEnumerator` support for `foreach` loops](~/_csharplang/proposals/csharp-9.0/extension-getenumerator.md) + - [Lambda discard parameters](~/_csharplang/proposals/csharp-9.0/lambda-discard-parameters.md) + - [Attributes on local functions](~/_csharplang/proposals/csharp-9.0/local-function-attributes.md) +- [Support for code generators](./csharp-9.md#support-for-code-generators) + - [Module initializers](~/_csharplang/proposals/csharp-9.0/module-initializers.md) + - [New features for partial methods](~/_csharplang/proposals/csharp-9.0/extending-partial-methods.md) + +C# 9.0 continues three of the themes from previous releases: removing ceremony, separating data from algorithms, and providing more patterns in more places. + +[Top level statements](../fundamentals/program-structure/top-level-statements.md) means your main program is simpler to read. There's less need for ceremony: a namespace, a `Program` class, and `static void Main()` are all unnecessary. + +The introduction of [`records`](../language-reference/builtin-types/record.md) provide a concise syntax for reference types that follow value semantics for equality. You'll use these types to define data containers that typically define minimal behavior. [Init-only setters](./csharp-9.md#init-only-setters) provide the capability for non-destructive mutation (`with` expressions) in records. C# 9.0 also adds [covariant return types](~/_csharplang/proposals/csharp-9.0/covariant-returns.md) so that derived records can override virtual methods and return a type derived from the base method's return type. + +The [pattern matching](../fundamentals/functional/pattern-matching.md) capabilities have been expanded in several ways. Numeric types now support *range patterns*. Patterns can be combined using `and`, `or`, and `not` patterns. Parentheses can be added to clarify more complex patterns. + +Another set of features supports high-performance computing in C#: + +- The `nint` and `nuint` types model the native-size integer types on the target CPU. +- [Function pointers](../language-reference/unsafe-code.md#function-pointers) provide delegate-like functionality while avoiding the allocations necessary to create a delegate object. +- The `localsinit` instruction can be omitted to save instructions. + +Another set of improvements supports scenarios where *code generators* add functionality: + +- [Module initializers](../language-reference/attributes/general.md#moduleinitializer-attribute) are methods that the runtime calls when an assembly loads. +- [Partial methods](../language-reference/keywords/partial-method.md) support new accessibly modifiers and non-void return types. In those cases, an implementation must be provided. + +C# 9.0 adds many other small features that improve developer productivity, both writing and reading code: + +- Target-type `new` expressions +- `static` anonymous functions +- Target-type conditional expressions +- Extension `GetEnumerator()` support for `foreach` loops +- Lambda expressions can declare discard parameters +- Attributes can be applied to local functions + +The C# 9.0 release continues the work to keep C# a modern, general-purpose programming language. Features continue to support modern workloads and application types. + _Article_ [_originally published on the NDepend blog_](https://blog.ndepend.com/c-versions-look-language-history/)_, courtesy of Erik Dietrich and Patrick Smacchia._ diff --git a/docs/csharp/whats-new/tutorials/snippets/record-types/InterimSteps.cs b/docs/csharp/whats-new/tutorials/snippets/record-types/InterimSteps.cs index c268a3ec43c39..05939c8f40ae8 100644 --- a/docs/csharp/whats-new/tutorials/snippets/record-types/InterimSteps.cs +++ b/docs/csharp/whats-new/tutorials/snippets/record-types/InterimSteps.cs @@ -19,7 +19,7 @@ public record DailyTemperature(double HighTemp, double LowTemp) // public abstract record DegreeDays(double BaseTemperature, IEnumerable TempRecords); - public record HeatingDegreeDays(double BaseTemperature, IEnumerable TempRecords) + public sealed record HeatingDegreeDays(double BaseTemperature, IEnumerable TempRecords) : DegreeDays(BaseTemperature, TempRecords) { public double DegreeDays => TempRecords.Where(s => s.Mean < BaseTemperature).Sum(s => BaseTemperature - s.Mean); diff --git a/docs/framework/configure-apps/file-schema/index.md b/docs/framework/configure-apps/file-schema/index.md index 2aebdde137a10..5f4084041455a 100644 --- a/docs/framework/configure-apps/file-schema/index.md +++ b/docs/framework/configure-apps/file-schema/index.md @@ -2,7 +2,7 @@ description: "Learn more about: Configuration file schema for the .NET Framework" title: "Configuration file schema for the .NET Framework" ms.date: "05/01/2017" -helpviewer_keywords: +helpviewer_keywords: - ".NET Framework application configuration, configuration schema" - "machine configuration files" - "application configuration files, schema" @@ -82,9 +82,6 @@ All elements that enable you to configure WCF service and client applications. [WCF Directive Syntax](./wcf-directive/index.md)\ Describes the `@ServiceHost` directive, which defines page-specific attributes used by the .svc compiler. -[WIF Configuration Schema](windows-identity-foundation/index.md)\ -All elements of the Windows Identity Foundation (WIF) configuration schema. - ## Related sections [Remoting Settings Schema](/previous-versions/dotnet/netframework-4.0/z415cf9a(v=vs.100))\ diff --git a/docs/framework/configure-apps/file-schema/runtime/loadfromremotesources-element.md b/docs/framework/configure-apps/file-schema/runtime/loadfromremotesources-element.md index 03a6a503891a4..2ea4549acdc6f 100644 --- a/docs/framework/configure-apps/file-schema/runtime/loadfromremotesources-element.md +++ b/docs/framework/configure-apps/file-schema/runtime/loadfromremotesources-element.md @@ -70,7 +70,7 @@ so this load may be dangerous. If this load is not intended to sandbox the assem To load the assembly and execute its code, you must either: -- Explicitly create a sandbox for the assembly (see [How to: Run Partially Trusted Code in a Sandbox](../../../misc/how-to-run-partially-trusted-code-in-a-sandbox.md)). +- Explicitly create a sandbox for the assembly (see [How to: Run Partially Trusted Code in a Sandbox](/previous-versions/dotnet/framework/code-access-security/how-to-run-partially-trusted-code-in-a-sandbox)). - Run the assembly's code in full trust. You do this by configuring the `` element. It lets you specify that the assemblies that run in partial trust in earlier versions of the .NET Framework now run in full trust in the .NET Framework 4 and later versions. @@ -114,7 +114,7 @@ The following example shows how to grant full trust to assemblies loaded from re ## See also - [More Implicit Uses of CAS Policy: loadFromRemoteSources](/archive/blogs/shawnfa/more-implicit-uses-of-cas-policy-loadfromremotesources) -- [How to: Run Partially Trusted Code in a Sandbox](../../../misc/how-to-run-partially-trusted-code-in-a-sandbox.md) +- [How to: Run Partially Trusted Code in a Sandbox](/previous-versions/dotnet/framework/code-access-security/how-to-run-partially-trusted-code-in-a-sandbox) - [Runtime Settings Schema](index.md) - [Configuration File Schema](../index.md) - diff --git a/docs/framework/configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md b/docs/framework/configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md index e7c68a8678dce..64e45a3741667 100644 --- a/docs/framework/configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md +++ b/docs/framework/configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md @@ -56,7 +56,7 @@ In the .NET Framework version 3.5 and earlier versions, CAS policy is always in CAS policy is version-specific. Custom CAS policies that exist in earlier versions of the .NET Framework must be respecified in the .NET Framework 4. -Applying the `` element to a .NET Framework 4 assembly does not affect [security-transparent code](../../../misc/security-transparent-code.md); the transparency rules still apply. +Applying the `` element to a .NET Framework 4 assembly does not affect [security-transparent code](/previous-versions/dotnet/framework/code-access-security/security-transparent-code); the transparency rules still apply. > [!IMPORTANT] > Applying the `` element can result in significant performance penalties for native image assemblies created by the [Native Image Generator (Ngen.exe)](../../../tools/ngen-exe-native-image-generator.md) that are not installed in the [global assembly cache](../../../app-domains/gac.md). The performance degradation is caused by the inability of the runtime to load the assemblies as native images when the attribute is applied, resulting in their being loaded as just-in-time assemblies. diff --git a/docs/framework/configure-apps/file-schema/startup/supportedruntime-element.md b/docs/framework/configure-apps/file-schema/startup/supportedruntime-element.md index dae459675b313..3d29bf090b1ab 100644 --- a/docs/framework/configure-apps/file-schema/startup/supportedruntime-element.md +++ b/docs/framework/configure-apps/file-schema/startup/supportedruntime-element.md @@ -66,7 +66,7 @@ The `runtime` attribute specifies the Common Language Runtime (CLR) version that ## "sku id" values -The `sku` attribute uses a target framework moniker (TFM) to indicate the version of the .NET Framework that the app targets and requires to run. The following table lists valid values that are supported by the `sku` attribute, starting with the .NET Framework 4. +The `sku` attribute uses a target framework moniker (TFM) to indicate the version of .NET Framework that the app targets and requires to run. The following table lists valid values that are supported by the `sku` attribute, starting with .NET Framework 4. |.NET Framework version|`sku` attribute| |----------------------------|---------------------| @@ -91,7 +91,7 @@ The `sku` attribute uses a target framework moniker (TFM) to indicate the versio ## Example -The following example shows how to specify the supported runtime version in a configuration file. The configuration file indicates that the app targets the .NET Framework 4.7. +The following example shows how to specify the supported runtime version in a configuration file. The configuration file indicates that the app targets .NET Framework 4.7. ```xml diff --git a/docs/framework/configure-apps/file-schema/toc.yml b/docs/framework/configure-apps/file-schema/toc.yml index 47f0b13d3db76..8aa59106dd2cf 100644 --- a/docs/framework/configure-apps/file-schema/toc.yml +++ b/docs/framework/configure-apps/file-schema/toc.yml @@ -47,8 +47,6 @@ href: wcf/index.md - name: WCF Directive Syntax href: wcf-directive/index.md - - name: WIF Configuration Schema - href: windows-identity-foundation/index.md - name: Windows Forms Configuration Section href: winforms/index.md - name: Windows Workflow Foundation Configuration Schema diff --git a/docs/framework/configure-apps/file-schema/wcf-directive/servicehost.md b/docs/framework/configure-apps/file-schema/wcf-directive/servicehost.md index b77df5c9ef90c..83f88d877c496 100644 --- a/docs/framework/configure-apps/file-schema/wcf-directive/servicehost.md +++ b/docs/framework/configure-apps/file-schema/wcf-directive/servicehost.md @@ -69,4 +69,4 @@ Factory="WebScriptServiceHostFactory" ## See also -- [Custom Service Host](../../../wcf/samples/custom-service-host.md) +- [Custom Service Host](/previous-versions/dotnet/framework/wcf/samples/custom-service-host) diff --git a/docs/framework/configure-apps/file-schema/wcf/add-of-authorizationpolicies.md b/docs/framework/configure-apps/file-schema/wcf/add-of-authorizationpolicies.md index 5c7786c0b2d0e..8e832efa843e7 100644 --- a/docs/framework/configure-apps/file-schema/wcf/add-of-authorizationpolicies.md +++ b/docs/framework/configure-apps/file-schema/wcf/add-of-authorizationpolicies.md @@ -51,7 +51,7 @@ Specifies an authorization policy for claim transformation. ## Remarks - Each authorization policy contains a single required `policyType` attribute that is a string. The attribute specifies an authorization policy, which enables transformation of one set of input claims into another set of claims. Access control can be granted or denied based on that. For more information on how an authorization policy works, see and [Authorization Policy](../../../wcf/samples/authorization-policy.md). + Each authorization policy contains a single required `policyType` attribute that is a string. The attribute specifies an authorization policy, which enables transformation of one set of input claims into another set of claims. Access control can be granted or denied based on that. For more information on how an authorization policy works, see and [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy). ## See also @@ -62,7 +62,7 @@ Specifies an authorization policy for claim transformation. - - - -- [Authorizing Access to Service Operations](../../../wcf/samples/authorizing-access-to-service-operations.md) +- [Authorizing Access to Service Operations](/previous-versions/dotnet/framework/wcf/samples/authorizing-access-to-service-operations) - [How to: Create a Custom Authorization Manager for a Service](../../../wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service.md) - [\](add-of-authorizationpolicies.md) -- [Authorization Policy](../../../wcf/samples/authorization-policy.md) +- [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy) diff --git a/docs/framework/configure-apps/file-schema/wcf/add-of-claimtyperequirements.md b/docs/framework/configure-apps/file-schema/wcf/add-of-claimtyperequirements.md index 8d16e62f57769..14e84fa2230d1 100644 --- a/docs/framework/configure-apps/file-schema/wcf/add-of-claimtyperequirements.md +++ b/docs/framework/configure-apps/file-schema/wcf/add-of-claimtyperequirements.md @@ -88,4 +88,4 @@ Specifies the types of required and optional claims expected to appear in the fe - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/additionalrequestparameters-element.md b/docs/framework/configure-apps/file-schema/wcf/additionalrequestparameters-element.md index 4ea907cd8b5af..f3f48b6181e59 100644 --- a/docs/framework/configure-apps/file-schema/wcf/additionalrequestparameters-element.md +++ b/docs/framework/configure-apps/file-schema/wcf/additionalrequestparameters-element.md @@ -22,4 +22,4 @@ This contains a collection of configuration elements that specify additional req - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/authorizationpolicies.md b/docs/framework/configure-apps/file-schema/wcf/authorizationpolicies.md index 2ec9e5b96e294..4be390fb88520 100644 --- a/docs/framework/configure-apps/file-schema/wcf/authorizationpolicies.md +++ b/docs/framework/configure-apps/file-schema/wcf/authorizationpolicies.md @@ -6,7 +6,7 @@ ms.assetid: 5b367489-54d7-408b-8f56-cb157dd68eaf --- # \ -This configuration section contains a collection of authorization policy types, which can be added using the `add` keyword. Each authorization policy contains a single required `policyType` attribute that is a string. The attribute specifies an authorization policy, which enables transformation of one set of input claims into another set of claims. Access control can be granted or denied based on that. For more information on how an authorization policy works, see and [Authorization Policy](../../../wcf/samples/authorization-policy.md). +This configuration section contains a collection of authorization policy types, which can be added using the `add` keyword. Each authorization policy contains a single required `policyType` attribute that is a string. The attribute specifies an authorization policy, which enables transformation of one set of input claims into another set of claims. Access control can be granted or denied based on that. For more information on how an authorization policy works, see and [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy). ## See also @@ -17,7 +17,7 @@ This configuration section contains a collection of authorization policy types, - - - -- [Authorizing Access to Service Operations](../../../wcf/samples/authorizing-access-to-service-operations.md) +- [Authorizing Access to Service Operations](/previous-versions/dotnet/framework/wcf/samples/authorizing-access-to-service-operations) - [How to: Create a Custom Authorization Manager for a Service](../../../wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service.md) - [\](add-of-authorizationpolicies.md) -- [Authorization Policy](../../../wcf/samples/authorization-policy.md) +- [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy) diff --git a/docs/framework/configure-apps/file-schema/wcf/basichttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/basichttpbinding.md index 88c3efb3bcde6..996c26ec00686 100644 --- a/docs/framework/configure-apps/file-schema/wcf/basichttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/basichttpbinding.md @@ -2,22 +2,22 @@ title: "" description: Defines a binding that a WCF service can use to configure and expose endpoints to communicate with services conforming to the WS-I Basic Profile 1.1. ms.date: "03/30/2017" -helpviewer_keywords: +helpviewer_keywords: - "basicHttpBinding Element" ms.assetid: 85cf1a4f-26c2-48c7-bda6-6c960d5d3fb3 --- # \ -Represents a binding that a Windows Communication Foundation (WCF) service can use to configure and expose endpoints that are able to communicate with ASMX-based Web services and clients and other services that conform to the WS-I Basic Profile 1.1. - +Represents a binding that a Windows Communication Foundation (WCF) service can use to configure and expose endpoints that are able to communicate with ASMX-based Web services and clients and other services that conform to the WS-I Basic Profile 1.1. + [**\**](../configuration-element.md)\   [**\**](system-servicemodel.md)\     [**\**](bindings.md)\ -      **\** - -## Syntax - -```xml +      **\** + +## Syntax + +```xml -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|`allowCookies`|A Boolean value that indicates whether the client accepts cookies and propagates them on future requests. The default is `false`.

You can use this property when you interact with ASMX Web services that use cookies. In this way, you can be sure that the cookies returned from the server are automatically copied to all future client requests for that service.| -|`bypassProxyOnLocal`|A Boolean value that indicates whether to bypass the proxy server for local addresses. The default is `false`.

An Internet resource is local if it has a local address. A local address is one that is on same computer, the local LAN or intranet and is identified, syntactically, by the lack of a period (.) as in the URIs `http://webserver/` and `http://localhost/`.

Setting this attribute determines whether endpoints configured with the BasicHttpBinding use the proxy server when accessing local resources. If this attribute is `true`, requests to local Internet resources do not use the proxy server. Use the host name (rather than localhost) if you want clients to go through a proxy when talking to services on the same machine when this attribute is set to `true`.

When this attribute is `false`, all Internet requests are made through the proxy server.| -|`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`hostNameComparisonMode`|Specifies the HTTP hostname comparison mode used to parse URIs. This attribute is of type , which indicates whether the hostname is used to reach the service when matching on the URI. The default value is , which ignores the hostname in the match.| -|`maxBufferPoolSize`|An integer value that specifies the maximum amount of memory that is allocated for use by the manager of the message buffers that receive messages from the channel. The default value is 524288 (0x80000) bytes.

The Buffer Manager minimizes the cost of using buffers by using a buffer pool. Buffers are required to process messages by the service when they come out of the channel. If there is not sufficient memory in the buffer pool to process the message load, the Buffer Manager must allocate additional memory from the CLR heap, which increases the garbage collection overhead. Extensive allocation from the CLR garbage heap is an indication that the buffer pool size is too small and that performance can be improved with a larger allocation by increasing the limit specified by this attribute.| -|`maxBufferSize`|An integer value that specifies the maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 65,536 bytes.| -|`maxReceivedMessageSize`|A positive integer that defines the maximum message size, in bytes, including headers, for a message that can be received on a channel configured with this binding. The sender receives a SOAP fault if the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65,536 bytes.| -|`messageEncoding`|Defines the encoder used to encode the SOAP message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text. This attribute is of type .| -|`name`|A string that contains the configuration name of the binding. This value should be unique among bindings of the same type. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| -|`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`proxyAddress`|A URI that contains the address of the HTTP proxy. If `useSystemWebProxy` is set to `true`, this setting must be `null`. The default is `null`.| -|`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| -|`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`textEncoding`|Sets the character set encoding to be used for emitting messages on the binding. Valid values include the following:

- BigEndianUnicode: Unicode BigEndian encoding.
- Unicode: 16-bit encoding.
- UTF8: 8-bit encoding

The default is UTF8. This attribute is of type .| -|`transferMode`|A valid value that specifies whether messages are buffered or streamed on a request or response.| -|`useDefaultWebProxy`|A Boolean value that specifies whether the auto-configured HTTP proxy of the system should be used, if available. The default is `true`.| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](security-of-basichttpbinding.md)|Defines the security settings for the binding. This element is of type .| -|[\](/previous-versions/dotnet/netframework-4.0/ms731325(v=vs.100))|Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type .| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](bindings.md)|This element holds a collection of standard and custom bindings.| - -## Remarks - - The BasicHttpBinding uses HTTP as the transport for sending SOAP 1.1 messages. A service can use this binding to expose endpoints that conform to WS-I BP 1.1, such as those that ASMX clients consume. Similarly, a client can use the BasicHttpBinding to communicate with services exposing endpoints that conform to WS-I BP 1.1, such as ASMX Web services or services configured with the BasicHttpBinding. - - Security is turned off by default, but can be added setting the mode attribute of the [\](security-of-basichttpbinding.md) child element to a value other than `None`. It uses a "Text" message encoding and UTF-8 text encoding by default. - -## Example - - The following example demonstrates the use of that provides HTTP communication and maximum interoperability with first- and second-generation Web services. The binding is specified in the configuration files for the client and service. The binding type is specified using the `binding` attribute of the `` element. If you want to configure the basic binding and change some of its settings, it is necessary to define a binding configuration. The endpoint must reference the binding configuration by name by using the `bindingConfiguration` attribute of the `` element, as shown in the following configuration code for the service. - -```xml +``` + +## Attributes and Elements + + The following sections describe attributes, child elements, and parent elements. + +### Attributes + +|Attribute|Description| +|---------------|-----------------| +|`allowCookies`|A Boolean value that indicates whether the client accepts cookies and propagates them on future requests. The default is `false`.

You can use this property when you interact with ASMX Web services that use cookies. In this way, you can be sure that the cookies returned from the server are automatically copied to all future client requests for that service.| +|`bypassProxyOnLocal`|A Boolean value that indicates whether to bypass the proxy server for local addresses. The default is `false`.

An Internet resource is local if it has a local address. A local address is one that is on same computer, the local LAN or intranet and is identified, syntactically, by the lack of a period (.) as in the URIs `http://webserver/` and `http://localhost/`.

Setting this attribute determines whether endpoints configured with the BasicHttpBinding use the proxy server when accessing local resources. If this attribute is `true`, requests to local Internet resources do not use the proxy server. Use the host name (rather than localhost) if you want clients to go through a proxy when talking to services on the same machine when this attribute is set to `true`.

When this attribute is `false`, all Internet requests are made through the proxy server.| +|`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`hostNameComparisonMode`|Specifies the HTTP hostname comparison mode used to parse URIs. This attribute is of type , which indicates whether the hostname is used to reach the service when matching on the URI. The default value is , which ignores the hostname in the match.| +|`maxBufferPoolSize`|An integer value that specifies the maximum amount of memory that is allocated for use by the manager of the message buffers that receive messages from the channel. The default value is 524288 (0x80000) bytes.

The Buffer Manager minimizes the cost of using buffers by using a buffer pool. Buffers are required to process messages by the service when they come out of the channel. If there is not sufficient memory in the buffer pool to process the message load, the Buffer Manager must allocate additional memory from the CLR heap, which increases the garbage collection overhead. Extensive allocation from the CLR garbage heap is an indication that the buffer pool size is too small and that performance can be improved with a larger allocation by increasing the limit specified by this attribute.| +|`maxBufferSize`|An integer value that specifies the maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 65,536 bytes.| +|`maxReceivedMessageSize`|A positive integer that defines the maximum message size, in bytes, including headers, for a message that can be received on a channel configured with this binding. The sender receives a SOAP fault if the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65,536 bytes.| +|`messageEncoding`|Defines the encoder used to encode the SOAP message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text. This attribute is of type .| +|`name`|A string that contains the configuration name of the binding. This value should be unique among bindings of the same type. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| +|`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`proxyAddress`|A URI that contains the address of the HTTP proxy. If `useSystemWebProxy` is set to `true`, this setting must be `null`. The default is `null`.| +|`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| +|`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`textEncoding`|Sets the character set encoding to be used for emitting messages on the binding. Valid values include the following:

- BigEndianUnicode: Unicode BigEndian encoding.
- Unicode: 16-bit encoding.
- UTF8: 8-bit encoding

The default is UTF8. This attribute is of type .| +|`transferMode`|A valid value that specifies whether messages are buffered or streamed on a request or response.| +|`useDefaultWebProxy`|A Boolean value that specifies whether the auto-configured HTTP proxy of the system should be used, if available. The default is `true`.| + +### Child Elements + +|Element|Description| +|-------------|-----------------| +|[\](security-of-basichttpbinding.md)|Defines the security settings for the binding. This element is of type .| +|[\](/previous-versions/dotnet/netframework-4.0/ms731325(v=vs.100))|Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type .| + +### Parent Elements + +|Element|Description| +|-------------|-----------------| +|[\](bindings.md)|This element holds a collection of standard and custom bindings.| + +## Remarks + + The BasicHttpBinding uses HTTP as the transport for sending SOAP 1.1 messages. A service can use this binding to expose endpoints that conform to WS-I BP 1.1, such as those that ASMX clients consume. Similarly, a client can use the BasicHttpBinding to communicate with services exposing endpoints that conform to WS-I BP 1.1, such as ASMX Web services or services configured with the BasicHttpBinding. + + Security is turned off by default, but can be added setting the mode attribute of the [\](security-of-basichttpbinding.md) child element to a value other than `None`. It uses a "Text" message encoding and UTF-8 text encoding by default. + +## Example 1 + + The following example demonstrates the use of that provides HTTP communication and maximum interoperability with first- and second-generation Web services. The binding is specified in the configuration files for the client and service. The binding type is specified using the `binding` attribute of the `` element. If you want to configure the basic binding and change some of its settings, it is necessary to define a binding configuration. The endpoint must reference the binding configuration by name by using the `bindingConfiguration` attribute of the `` element, as shown in the following configuration code for the service. + +```xml
-``` - -## Example +``` + +## Example 2 + + Starting with .NET Framework 4, bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name from the binding. - Starting with .NET Framework 4, bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name from the binding. - -```xml +```xml -``` - - For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md). - +``` + + For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). + ## See also - diff --git a/docs/framework/configure-apps/file-schema/wcf/basichttpcontextbinding.md b/docs/framework/configure-apps/file-schema/wcf/basichttpcontextbinding.md index ad96badd854e4..30f25fe457ecc 100644 --- a/docs/framework/configure-apps/file-schema/wcf/basichttpcontextbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/basichttpcontextbinding.md @@ -66,7 +66,7 @@ Specifying a binding that provides context for the
- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text. This attribute is of type .| |`messageVersion`|Specifies the message version used by clients and services configured with the binding. This attribute is of type .| -|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`proxyAddress`|A URI that contains the address of the HTTP proxy. If `useSystemWebProxy` is set to `true`, this setting must be `null`. The default is `null`.| |`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/behavior-of-endpointbehaviors.md b/docs/framework/configure-apps/file-schema/wcf/behavior-of-endpointbehaviors.md index 0ff36d1c698b3..1a2002a2de268 100644 --- a/docs/framework/configure-apps/file-schema/wcf/behavior-of-endpointbehaviors.md +++ b/docs/framework/configure-apps/file-schema/wcf/behavior-of-endpointbehaviors.md @@ -6,7 +6,7 @@ ms.assetid: b90ca3bc-3c22-4174-b903-e3a39898bd27 --- # \ of \ -The `behavior` element contains a collection of settings for the behavior of an endpoint. Each behavior is indexed by its `name`. Endpoints can link to each behavior through this name. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md). +The `behavior` element contains a collection of settings for the behavior of an endpoint. Each behavior is indexed by its `name`. Endpoints can link to each behavior through this name. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). [**\**](../configuration-element.md)\   [**\**](system-servicemodel.md)\ @@ -34,7 +34,7 @@ The `behavior` element contains a collection of settings for the behavior of an |Attribute|Description| |---------------|-----------------| -|name|A unique string that contains the configuration name of the behavior. This value is a user-defined string that must be unique, since it acts as the identification string for the element. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A unique string that contains the configuration name of the behavior. This value is a user-defined string that must be unique, since it acts as the identification string for the element. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| ### Child Elements diff --git a/docs/framework/configure-apps/file-schema/wcf/behavior-of-servicebehaviors.md b/docs/framework/configure-apps/file-schema/wcf/behavior-of-servicebehaviors.md index 7145982c704f5..e799a19bc5597 100644 --- a/docs/framework/configure-apps/file-schema/wcf/behavior-of-servicebehaviors.md +++ b/docs/framework/configure-apps/file-schema/wcf/behavior-of-servicebehaviors.md @@ -6,7 +6,7 @@ ms.assetid: 78fc0a08-55de-416a-ac12-a5e6ffc9a987 --- # \ of \ -The `behavior` element contains a collection of settings for the behavior of a service. Each behavior is indexed by its `name`. Services can link to each behavior through this name using the `behaviorConfiguration` attribute of the [\](endpoint-element.md) element. This allows endpoints to share common behavior configurations without redefining the settings. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md). +The `behavior` element contains a collection of settings for the behavior of a service. Each behavior is indexed by its `name`. Services can link to each behavior through this name using the `behaviorConfiguration` attribute of the [\](endpoint-element.md) element. This allows endpoints to share common behavior configurations without redefining the settings. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). > [!NOTE] > Behavior elements specific to Windows Workflow activities, such as the [\](../windows-workflow-foundation/sendmessagechannelcache.md) element, are documented in the [\ of \](../windows-workflow-foundation/behavior-of-servicebehaviors-of-workflow.md) page. @@ -37,7 +37,7 @@ The `behavior` element contains a collection of settings for the behavior of a s |Attribute|Description| |---------------|-----------------| -|name|A unique string that contains the configuration name of the behavior. This value is a user-defined string that must be unique, since it acts as the identification string for the element. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A unique string that contains the configuration name of the behavior. This value is a user-defined string that must be unique, since it acts as the identification string for the element. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| ### Child Elements diff --git a/docs/framework/configure-apps/file-schema/wcf/behaviors.md b/docs/framework/configure-apps/file-schema/wcf/behaviors.md index a3963b5a5275f..7a27655d235c2 100644 --- a/docs/framework/configure-apps/file-schema/wcf/behaviors.md +++ b/docs/framework/configure-apps/file-schema/wcf/behaviors.md @@ -6,7 +6,7 @@ ms.assetid: 0e5da4e6-1aa5-466c-924e-f10efee57f0b --- # \ -This element defines two child collections named `endpointBehaviors` and `serviceBehaviors`. Each collection defines behavior elements consumed by endpoints and services respectively. Each behavior element is identified by its unique `name` attribute. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md). +This element defines two child collections named `endpointBehaviors` and `serviceBehaviors`. Each collection defines behavior elements consumed by endpoints and services respectively. Each behavior element is identified by its unique `name` attribute. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). [**\**](../configuration-element.md)\   [**\**](system-servicemodel.md)\ diff --git a/docs/framework/configure-apps/file-schema/wcf/bindings.md b/docs/framework/configure-apps/file-schema/wcf/bindings.md index be2ecbc89d585..6c960930daa4d 100644 --- a/docs/framework/configure-apps/file-schema/wcf/bindings.md +++ b/docs/framework/configure-apps/file-schema/wcf/bindings.md @@ -6,7 +6,7 @@ ms.assetid: b62cd369-5409-4030-8490-9759a462dd3a --- # \ -You can use the `bindings` element to configure a collection of standard and custom bindings for Windows Communication Foundation (WCF). Each entry is a `binding` element that can be identified by its unique `name`. Services use bindings by linking them using the `name`. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md). +You can use the `bindings` element to configure a collection of standard and custom bindings for Windows Communication Foundation (WCF). Each entry is a `binding` element that can be identified by its unique `name`. Services use bindings by linking them using the `name`. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). ## System-provided bindings diff --git a/docs/framework/configure-apps/file-schema/wcf/claimtyperequirements-element.md b/docs/framework/configure-apps/file-schema/wcf/claimtyperequirements-element.md index ceabf30ecae37..ec937516eb45d 100644 --- a/docs/framework/configure-apps/file-schema/wcf/claimtyperequirements-element.md +++ b/docs/framework/configure-apps/file-schema/wcf/claimtyperequirements-element.md @@ -30,4 +30,4 @@ Specifies a collection of required claim types. - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/custombinding.md b/docs/framework/configure-apps/file-schema/wcf/custombinding.md index c0e3ad9cb476f..6f2d10fb9a508 100644 --- a/docs/framework/configure-apps/file-schema/wcf/custombinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/custombinding.md @@ -178,7 +178,7 @@ The following sections describe attributes, child elements, and parent elements |Attribute|Description| |---------------|-----------------| |closeTimeout|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|name|A string that contains the configuration name of the binding. This value is a user-defined string that acts as the identification string for the custom binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value is a user-defined string that acts as the identification string for the custom binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |receiveTimeout|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |sendTimeout|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/issuedtokenparameters.md b/docs/framework/configure-apps/file-schema/wcf/issuedtokenparameters.md index 41545591f4041..cddf34a1657c9 100644 --- a/docs/framework/configure-apps/file-schema/wcf/issuedtokenparameters.md +++ b/docs/framework/configure-apps/file-schema/wcf/issuedtokenparameters.md @@ -80,7 +80,7 @@ Specifies the parameters for a security token issued in a Federated security sce - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) - [Service Identity and Authentication](../../../wcf/feature-details/service-identity-and-authentication.md) - [Federation and Issued Tokens](../../../wcf/feature-details/federation-and-issued-tokens.md) - [Security Capabilities with Custom Bindings](../../../wcf/feature-details/security-capabilities-with-custom-bindings.md) diff --git a/docs/framework/configure-apps/file-schema/wcf/issuer-of-issuedtokenparameters.md b/docs/framework/configure-apps/file-schema/wcf/issuer-of-issuedtokenparameters.md index 10cf7af2ee358..c3221c2deff0c 100644 --- a/docs/framework/configure-apps/file-schema/wcf/issuer-of-issuedtokenparameters.md +++ b/docs/framework/configure-apps/file-schema/wcf/issuer-of-issuedtokenparameters.md @@ -60,4 +60,4 @@ Specifies the Security Token Service (STS) that issues security tokens. - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/issuermetadata-of-issuedtokenparameters.md b/docs/framework/configure-apps/file-schema/wcf/issuermetadata-of-issuedtokenparameters.md index 888cc27ab1672..192366754fd63 100644 --- a/docs/framework/configure-apps/file-schema/wcf/issuermetadata-of-issuedtokenparameters.md +++ b/docs/framework/configure-apps/file-schema/wcf/issuermetadata-of-issuedtokenparameters.md @@ -58,4 +58,4 @@ ms.assetid: 1a85ca37-496d-4fa3-8d44-d6c9383d735c - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/localclientsettings-element.md b/docs/framework/configure-apps/file-schema/wcf/localclientsettings-element.md index 537cdf12b69ac..2d61c031a77a6 100644 --- a/docs/framework/configure-apps/file-schema/wcf/localclientsettings-element.md +++ b/docs/framework/configure-apps/file-schema/wcf/localclientsettings-element.md @@ -81,4 +81,4 @@ Specifies the security settings of a local client for this binding. - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/localservicesettings-element.md b/docs/framework/configure-apps/file-schema/wcf/localservicesettings-element.md index 24f5806dbce0b..ff10f5fc9dc9b 100644 --- a/docs/framework/configure-apps/file-schema/wcf/localservicesettings-element.md +++ b/docs/framework/configure-apps/file-schema/wcf/localservicesettings-element.md @@ -99,4 +99,4 @@ Specifies the security settings of a local service for this binding. - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/mexhttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/mexhttpbinding.md index 9c2802eb4304a..902d4bf4f8eef 100644 --- a/docs/framework/configure-apps/file-schema/wcf/mexhttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/mexhttpbinding.md @@ -35,7 +35,7 @@ Specifies the settings for a binding used for the WS-MetadataExchange (WS-MEX) m |Attribute|Description| |---------------|-----------------| |`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| |`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/mexhttpsbinding.md b/docs/framework/configure-apps/file-schema/wcf/mexhttpsbinding.md index b7a8d40b2b3bf..3137eb066c4c8 100644 --- a/docs/framework/configure-apps/file-schema/wcf/mexhttpsbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/mexhttpsbinding.md @@ -35,7 +35,7 @@ Specifies the settings for a binding used for the WS-MetadataExchange (WS-MEX) m |Attribute|Description| |---------------|-----------------| |`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| |`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| @@ -52,7 +52,7 @@ Specifies the settings for a binding used for the WS-MetadataExchange (WS-MEX) m ## Remarks - This binding is essentially a `WSHttpBinding` binding that supports transport-level security using certificates. For more information about configuring and using such a metadata endpoint, see [How to: Configure a Custom WS-Metadata Exchange Binding](../../../wcf/extending/how-to-configure-a-custom-ws-metadata-exchange-binding.md), [How to: Retrieve Metadata Over a non-MEX Binding](../../../wcf/extending/how-to-retrieve-metadata-over-a-non-mex-binding.md), and the sample [Custom Secure Metadata Endpoint](../../../wcf/samples/custom-secure-metadata-endpoint.md). + This binding is essentially a `WSHttpBinding` binding that supports transport-level security using certificates. For more information about configuring and using such a metadata endpoint, see [How to: Configure a Custom WS-Metadata Exchange Binding](../../../wcf/extending/how-to-configure-a-custom-ws-metadata-exchange-binding.md), [How to: Retrieve Metadata Over a non-MEX Binding](../../../wcf/extending/how-to-retrieve-metadata-over-a-non-mex-binding.md), and the sample [Custom Secure Metadata Endpoint](/previous-versions/dotnet/framework/wcf/samples/custom-secure-metadata-endpoint). ## See also @@ -62,7 +62,7 @@ Specifies the settings for a binding used for the WS-MetadataExchange (WS-MEX) m - [Publishing and Retrieving Metadata Over a Custom Binding](../../../wcf/extending/publishing-and-retrieving-metadata-over-a-custom-binding.md) - [How to: Configure a Custom WS-Metadata Exchange Binding](../../../wcf/extending/how-to-configure-a-custom-ws-metadata-exchange-binding.md) - [How to: Retrieve Metadata Over a non-MEX Binding](../../../wcf/extending/how-to-retrieve-metadata-over-a-non-mex-binding.md) -- [Custom Secure Metadata Endpoint](../../../wcf/samples/custom-secure-metadata-endpoint.md) +- [Custom Secure Metadata Endpoint](/previous-versions/dotnet/framework/wcf/samples/custom-secure-metadata-endpoint) - [Metadata](../../../wcf/feature-details/metadata.md) - [Bindings](../../../wcf/bindings.md) - [Configuring System-Provided Bindings](../../../wcf/feature-details/configuring-system-provided-bindings.md) diff --git a/docs/framework/configure-apps/file-schema/wcf/mexnamedpipebinding.md b/docs/framework/configure-apps/file-schema/wcf/mexnamedpipebinding.md index 441b556d64bb4..37d7c5ad66e8e 100644 --- a/docs/framework/configure-apps/file-schema/wcf/mexnamedpipebinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/mexnamedpipebinding.md @@ -35,7 +35,7 @@ Specifies the settings for a binding used for the WS-MetadataExchange (WS-MEX) m |Attribute|Description| |---------------|-----------------| |`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| |`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/mextcpbinding.md b/docs/framework/configure-apps/file-schema/wcf/mextcpbinding.md index e598751f1c530..23b41d61600ea 100644 --- a/docs/framework/configure-apps/file-schema/wcf/mextcpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/mextcpbinding.md @@ -35,7 +35,7 @@ Specifies the settings for a binding used for the WS-MetadataExchange (WS-MEX) m |Attribute|Description| |---------------|-----------------| |`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| |`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/msmqintegrationbinding.md b/docs/framework/configure-apps/file-schema/wcf/msmqintegrationbinding.md index 3bdeee56edf03..9e881241cbd92 100644 --- a/docs/framework/configure-apps/file-schema/wcf/msmqintegrationbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/msmqintegrationbinding.md @@ -59,7 +59,7 @@ Defines a binding that provides queuing support by routing messages through MSMQ |exactlyOnce|A Boolean value that indicates whether each message is delivered only once. The sender will then be notified of delivery failures. When `durable` is `false`, this attribute is ignored and messages are transferred without delivery assurance. The default is `true`. For more information, see .| |maxReceivedMessageSize|A positive integer that defines the maximum message size, in bytes, including headers, that is processed by this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536. This bound on message size is intended to limit exposure to Denial of Service (DoS) attacks.| |maxRetryCycles|An integer that indicates the number of retry cycles used by the poison-message detection feature. A message becomes a poison message when it fails all delivery attempts of all cycles. The default is 2. For more information, see .| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |receiveErrorHandling|A value that specifies how poison and nondispatchable messages are handled.| |receiveRetryCount|An integer that specifies the maximum number of immediate retries the queue manager should attempt if transmission of a message from the application queue to the application fails.

If the maximum number of delivery attempts is reached and the message is not accessed by the application, then the message is sent to a retry queue for redelivery at a later time. The amount of time before the message is transferred back to the sending queue is controlled by `retryCycleDelay`. If retry cycles reach the `maxRetryCycles` value, then the message is either sent to the poison-message queue, or a negative acknowledgement is sent back to the sender.| diff --git a/docs/framework/configure-apps/file-schema/wcf/nethttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/nethttpbinding.md index 248e7b6ce5bd8..0d697c82717c7 100644 --- a/docs/framework/configure-apps/file-schema/wcf/nethttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/nethttpbinding.md @@ -6,16 +6,16 @@ ms.assetid: b0d81ca0-87c5-4090-8baa-e390fd3656d2 --- # \ -Represents a binding that a Windows Communication Foundation (WCF) service can use to configure and expose endpoints that are able to communicate over HTTP. When used with a duplex contract, Web Sockets will be used, otherwise HTTP will be used. - +Represents a binding that a Windows Communication Foundation (WCF) service can use to configure and expose endpoints that are able to communicate over HTTP. When used with a duplex contract, Web Sockets will be used, otherwise HTTP will be used. + [**\**](../configuration-element.md)\   [**\**](system-servicemodel.md)\     [**\**](bindings.md)\ -      **\** - -## Syntax - -```xml +      **\** + +## Syntax + +```xml -``` - -## Type - - `Type` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|`allowCookies`|A Boolean value that indicates whether the client accepts cookies and propagates them on future requests. The default is `false`.

You can use this property when you interact with ASMX Web services that use cookies. In this way, you can be sure that the cookies returned from the server are automatically copied to all future client requests for that service.| -|`bypassProxyOnLocal`|A Boolean value that indicates whether to bypass the proxy server for local addresses. The default is `false`.

An Internet resource is local if it has a local address. A local address is one that is on same computer, the local LAN or intranet and is identified, syntactically, by the lack of a period (.) as in the URIs `http://webserver/` and `http://localhost/`.

Setting this attribute determines whether endpoints configured with the BasicHttpBinding use the proxy server when accessing local resources. If this attribute is `true`, requests to local Internet resources do not use the proxy server. Use the host name (rather than localhost) if you want clients to go through a proxy when talking to services on the same machine when this attribute is set to `true`.

When this attribute is `false`, all Internet requests are made through the proxy server.| -|`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`hostNameComparisonMode`|Specifies the HTTP hostname comparison mode used to parse URIs. This attribute is of type , which indicates whether the hostname is used to reach the service when matching on the URI. The default value is , which ignores the hostname in the match.| -|`maxBufferPoolSize`|An integer value that specifies the maximum amount of memory that is allocated for use by the manager of the message buffers that receive messages from the channel. The default value is 524288 (0x80000) bytes.

The Buffer Manager minimizes the cost of using buffers by using a buffer pool. Buffers are required to process messages by the service when they come out of the channel. If there is not sufficient memory in the buffer pool to process the message load, the Buffer Manager must allocate additional memory from the CLR heap, which increases the garbage collection overhead. Extensive allocation from the CLR garbage heap is an indication that the buffer pool size is too small and that performance can be improved with a larger allocation by increasing the limit specified by this attribute.| -|`maxBufferSize`|An integer value that specifies the maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 65,536 bytes.| -|`maxReceivedMessageSize`|A positive integer that defines the maximum message size, in bytes, including headers, for a message that can be received on a channel configured with this binding. The sender receives a SOAP fault if the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65,536 bytes.| -|`messageEncoding`|Defines the encoder used to encode the SOAP message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text. This attribute is of type .| -|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| -|`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`proxyAddress`|A URI that contains the address of the HTTP proxy. If `useSystemWebProxy` is set to `true`, this setting must be `null`. The default is `null`.| -|`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| -|`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`textEncoding`|Sets the character set encoding to be used for emitting messages on the binding. Valid values include the following:

- BigEndianUnicode: Unicode BigEndian encoding.
- Unicode: 16-bit encoding.
- UTF8: 8-bit encoding

The default is UTF8. This attribute is of type .| -|`transferMode`|A valid value that specifies whether messages are buffered or streamed on a request or response.| -|`useDefaultWebProxy`|A Boolean value that specifies whether the auto-configured HTTP proxy of the system should be used, if available. The default is `true`.| -||| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](security-of-basichttpbinding.md)|Defines the security settings for the binding. This element is of type .| -|[\](/previous-versions/dotnet/netframework-4.0/ms731325(v=vs.100))|Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type .| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](bindings.md)|This element holds a collection of standard and custom bindings.| - -## Remarks - - The NetHttpBinding uses HTTP as the transport for sending messages. When used with a duplex contract, Web Sockets will be used. When used with a request-reply contract NetHttpBinding will behave like a BasicHttpBinding with a binary encoder. - - Security is turned off by default, but can be added setting the mode attribute of the [\](security-of-basichttpbinding.md) child element to a value other than `None`. It uses a "Text" message encoding and UTF-8 text encoding by default. - -## Example - - The following example demonstrates the use of that provides HTTP communication and maximum interoperability with first- and second-generation Web services. The binding is specified in the configuration files for the client and service. The binding type is specified using the `binding` attribute of the `` element. If you want to configure the basic binding and change some of its settings, it is necessary to define a binding configuration. The endpoint must reference the binding configuration by name by using the `bindingConfiguration` attribute of the `` element, as shown in the following configuration code for the service. - -```xml +``` + +## Type + + `Type` + +## Attributes and Elements + + The following sections describe attributes, child elements, and parent elements. + +### Attributes + +|Attribute|Description| +|---------------|-----------------| +|`allowCookies`|A Boolean value that indicates whether the client accepts cookies and propagates them on future requests. The default is `false`.

You can use this property when you interact with ASMX Web services that use cookies. In this way, you can be sure that the cookies returned from the server are automatically copied to all future client requests for that service.| +|`bypassProxyOnLocal`|A Boolean value that indicates whether to bypass the proxy server for local addresses. The default is `false`.

An Internet resource is local if it has a local address. A local address is one that is on same computer, the local LAN or intranet and is identified, syntactically, by the lack of a period (.) as in the URIs `http://webserver/` and `http://localhost/`.

Setting this attribute determines whether endpoints configured with the BasicHttpBinding use the proxy server when accessing local resources. If this attribute is `true`, requests to local Internet resources do not use the proxy server. Use the host name (rather than localhost) if you want clients to go through a proxy when talking to services on the same machine when this attribute is set to `true`.

When this attribute is `false`, all Internet requests are made through the proxy server.| +|`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`hostNameComparisonMode`|Specifies the HTTP hostname comparison mode used to parse URIs. This attribute is of type , which indicates whether the hostname is used to reach the service when matching on the URI. The default value is , which ignores the hostname in the match.| +|`maxBufferPoolSize`|An integer value that specifies the maximum amount of memory that is allocated for use by the manager of the message buffers that receive messages from the channel. The default value is 524288 (0x80000) bytes.

The Buffer Manager minimizes the cost of using buffers by using a buffer pool. Buffers are required to process messages by the service when they come out of the channel. If there is not sufficient memory in the buffer pool to process the message load, the Buffer Manager must allocate additional memory from the CLR heap, which increases the garbage collection overhead. Extensive allocation from the CLR garbage heap is an indication that the buffer pool size is too small and that performance can be improved with a larger allocation by increasing the limit specified by this attribute.| +|`maxBufferSize`|An integer value that specifies the maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 65,536 bytes.| +|`maxReceivedMessageSize`|A positive integer that defines the maximum message size, in bytes, including headers, for a message that can be received on a channel configured with this binding. The sender receives a SOAP fault if the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65,536 bytes.| +|`messageEncoding`|Defines the encoder used to encode the SOAP message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text. This attribute is of type .| +|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| +|`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`proxyAddress`|A URI that contains the address of the HTTP proxy. If `useSystemWebProxy` is set to `true`, this setting must be `null`. The default is `null`.| +|`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| +|`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`textEncoding`|Sets the character set encoding to be used for emitting messages on the binding. Valid values include the following:

- BigEndianUnicode: Unicode BigEndian encoding.
- Unicode: 16-bit encoding.
- UTF8: 8-bit encoding

The default is UTF8. This attribute is of type .| +|`transferMode`|A valid value that specifies whether messages are buffered or streamed on a request or response.| +|`useDefaultWebProxy`|A Boolean value that specifies whether the auto-configured HTTP proxy of the system should be used, if available. The default is `true`.| +||| + +### Child Elements + +|Element|Description| +|-------------|-----------------| +|[\](security-of-basichttpbinding.md)|Defines the security settings for the binding. This element is of type .| +|[\](/previous-versions/dotnet/netframework-4.0/ms731325(v=vs.100))|Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type .| + +### Parent Elements + +|Element|Description| +|-------------|-----------------| +|[\](bindings.md)|This element holds a collection of standard and custom bindings.| + +## Remarks + + The NetHttpBinding uses HTTP as the transport for sending messages. When used with a duplex contract, Web Sockets will be used. When used with a request-reply contract NetHttpBinding will behave like a BasicHttpBinding with a binary encoder. + + Security is turned off by default, but can be added setting the mode attribute of the [\](security-of-basichttpbinding.md) child element to a value other than `None`. It uses a "Text" message encoding and UTF-8 text encoding by default. + +## Example 1 + + The following example demonstrates the use of that provides HTTP communication and maximum interoperability with first- and second-generation Web services. The binding is specified in the configuration files for the client and service. The binding type is specified using the `binding` attribute of the `` element. If you want to configure the basic binding and change some of its settings, it is necessary to define a binding configuration. The endpoint must reference the binding configuration by name by using the `bindingConfiguration` attribute of the `` element, as shown in the following configuration code for the service. + +```xml
-``` - -## Example +``` + +## Example 2 + + Starting with .NET Framework 4, bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name from the binding. - Starting with .NET Framework 4, bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name from the binding. - -```xml +```xml
-``` - - For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md). - +``` + + For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). + ## See also - diff --git a/docs/framework/configure-apps/file-schema/wcf/nethttpsbinding.md b/docs/framework/configure-apps/file-schema/wcf/nethttpsbinding.md index f9852926db8af..8c9d756f9352c 100644 --- a/docs/framework/configure-apps/file-schema/wcf/nethttpsbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/nethttpsbinding.md @@ -6,16 +6,16 @@ ms.assetid: ff122116-6042-4792-9f21-275b4f97a105 --- # \ -Represents a binding that a Windows Communication Foundation (WCF) service can use to configure and expose endpoints that are able to communicate over HTTPS. When used with a duplex contract, Web Sockets will be used, otherwise HTTPS will be used. - +Represents a binding that a Windows Communication Foundation (WCF) service can use to configure and expose endpoints that are able to communicate over HTTPS. When used with a duplex contract, Web Sockets will be used, otherwise HTTPS will be used. + [**\**](../configuration-element.md)\   [**\**](system-servicemodel.md)\     [**\**](bindings.md)\ -      **\** +      **\** + +## Syntax -## Syntax - -```xml +```xml -``` - -## Type - - `Type` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|`allowCookies`|A Boolean value that indicates whether the client accepts cookies and propagates them on future requests. The default is `false`.

You can use this property when you interact with ASMX Web services that use cookies. In this way, you can be sure that the cookies returned from the server are automatically copied to all future client requests for that service.| -|`bypassProxyOnLocal`|A Boolean value that indicates whether to bypass the proxy server for local addresses. The default is `false`.

An Internet resource is local if it has a local address. A local address is one that is on same computer, the local LAN or intranet and is identified, syntactically, by the lack of a period (.) as in the URIs `http://webserver/` and `http://localhost/`.

Setting this attribute determines whether endpoints configured with the BasicHttpBinding use the proxy server when accessing local resources. If this attribute is `true`, requests to local Internet resources do not use the proxy server. Use the host name (rather than localhost) if you want clients to go through a proxy when talking to services on the same machine when this attribute is set to `true`.

When this attribute is `false`, all Internet requests are made through the proxy server.| -|`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`hostNameComparisonMode`|Specifies the HTTP hostname comparison mode used to parse URIs. This attribute is of type , which indicates whether the hostname is used to reach the service when matching on the URI. The default value is , which ignores the hostname in the match.| -|`maxBufferPoolSize`|An integer value that specifies the maximum amount of memory that is allocated for use by the manager of the message buffers that receive messages from the channel. The default value is 524288 (0x80000) bytes.

The Buffer Manager minimizes the cost of using buffers by using a buffer pool. Buffers are required to process messages by the service when they come out of the channel. If there is not sufficient memory in the buffer pool to process the message load, the Buffer Manager must allocate additional memory from the CLR heap, which increases the garbage collection overhead. Extensive allocation from the CLR garbage heap is an indication that the buffer pool size is too small and that performance can be improved with a larger allocation by increasing the limit specified by this attribute.| -|`maxBufferSize`|An integer value that specifies the maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 65,536 bytes.| -|`maxReceivedMessageSize`|A positive integer that defines the maximum message size, in bytes, including headers, for a message that can be received on a channel configured with this binding. The sender receives a SOAP fault if the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65,536 bytes.| -|`messageEncoding`|Defines the encoder used to encode the SOAP message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text. This attribute is of type .| -|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| -|`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`proxyAddress`|A URI that contains the address of the HTTP proxy. If `useSystemWebProxy` is set to `true`, this setting must be `null`. The default is `null`.| -|`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| -|`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| -|`textEncoding`|Sets the character set encoding to be used for emitting messages on the binding. Valid values include the following:

- BigEndianUnicode: Unicode BigEndian encoding.
- Unicode: 16-bit encoding.
- UTF8: 8-bit encoding

The default is UTF8. This attribute is of type .| -|`transferMode`|A valid value that specifies whether messages are buffered or streamed on a request or response.| -|`useDefaultWebProxy`|A Boolean value that specifies whether the auto-configured HTTP proxy of the system should be used, if available. The default is `true`.| -||| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](security-of-nethttpbinding.md)|Defines the security settings for the binding. This element is of type . | -|[\](/previous-versions/dotnet/netframework-4.0/ms731325(v=vs.100))|Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type .| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](bindings.md)|This element holds a collection of standard and custom bindings.| - -## Remarks - - The NetHttpsBinding uses HTTPS as the transport for sending messages. When used with a duplex contract, Web Sockets will be used. When used with a request-reply contract NetHttpsBinding will behave like a BasicHttpsBinding with a binary encoder. - - Security is turned off by default, but can be added setting the mode attribute of the [\](security-of-basichttpbinding.md) child element to a value other than `None`. It uses a "Text" message encoding and UTF-8 text encoding by default. - -## Example - - The following example demonstrates the use of that provides HTTPS communication and maximum interoperability with first- and second-generation Web services. The binding is specified in the configuration files for the client and service. The binding type is specified using the `binding` attribute of the `` element. If you want to configure the basic binding and change some of its settings, it is necessary to define a binding configuration. The endpoint must reference the binding configuration by name by using the `bindingConfiguration` attribute of the `` element, as shown in the following configuration code for the service. - -```xml +``` + +## Type + + `Type` + +## Attributes and Elements + + The following sections describe attributes, child elements, and parent elements. + +### Attributes + +|Attribute|Description| +|---------------|-----------------| +|`allowCookies`|A Boolean value that indicates whether the client accepts cookies and propagates them on future requests. The default is `false`.

You can use this property when you interact with ASMX Web services that use cookies. In this way, you can be sure that the cookies returned from the server are automatically copied to all future client requests for that service.| +|`bypassProxyOnLocal`|A Boolean value that indicates whether to bypass the proxy server for local addresses. The default is `false`.

An Internet resource is local if it has a local address. A local address is one that is on same computer, the local LAN or intranet and is identified, syntactically, by the lack of a period (.) as in the URIs `http://webserver/` and `http://localhost/`.

Setting this attribute determines whether endpoints configured with the BasicHttpBinding use the proxy server when accessing local resources. If this attribute is `true`, requests to local Internet resources do not use the proxy server. Use the host name (rather than localhost) if you want clients to go through a proxy when talking to services on the same machine when this attribute is set to `true`.

When this attribute is `false`, all Internet requests are made through the proxy server.| +|`closeTimeout`|A value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`hostNameComparisonMode`|Specifies the HTTP hostname comparison mode used to parse URIs. This attribute is of type , which indicates whether the hostname is used to reach the service when matching on the URI. The default value is , which ignores the hostname in the match.| +|`maxBufferPoolSize`|An integer value that specifies the maximum amount of memory that is allocated for use by the manager of the message buffers that receive messages from the channel. The default value is 524288 (0x80000) bytes.

The Buffer Manager minimizes the cost of using buffers by using a buffer pool. Buffers are required to process messages by the service when they come out of the channel. If there is not sufficient memory in the buffer pool to process the message load, the Buffer Manager must allocate additional memory from the CLR heap, which increases the garbage collection overhead. Extensive allocation from the CLR garbage heap is an indication that the buffer pool size is too small and that performance can be improved with a larger allocation by increasing the limit specified by this attribute.| +|`maxBufferSize`|An integer value that specifies the maximum size, in bytes, of a buffer that stores messages while they are processed for an endpoint configured with this binding. The default value is 65,536 bytes.| +|`maxReceivedMessageSize`|A positive integer that defines the maximum message size, in bytes, including headers, for a message that can be received on a channel configured with this binding. The sender receives a SOAP fault if the message is too large for the receiver. The receiver drops the message and creates an entry of the event in the trace log. The default is 65,536 bytes.| +|`messageEncoding`|Defines the encoder used to encode the SOAP message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text. This attribute is of type .| +|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| +|`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`proxyAddress`|A URI that contains the address of the HTTP proxy. If `useSystemWebProxy` is set to `true`, this setting must be `null`. The default is `null`.| +|`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| +|`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| +|`textEncoding`|Sets the character set encoding to be used for emitting messages on the binding. Valid values include the following:

- BigEndianUnicode: Unicode BigEndian encoding.
- Unicode: 16-bit encoding.
- UTF8: 8-bit encoding

The default is UTF8. This attribute is of type .| +|`transferMode`|A valid value that specifies whether messages are buffered or streamed on a request or response.| +|`useDefaultWebProxy`|A Boolean value that specifies whether the auto-configured HTTP proxy of the system should be used, if available. The default is `true`.| +||| + +### Child Elements + +|Element|Description| +|-------------|-----------------| +|[\](security-of-nethttpbinding.md)|Defines the security settings for the binding. This element is of type . | +|[\](/previous-versions/dotnet/netframework-4.0/ms731325(v=vs.100))|Defines the constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. This element is of type .| + +### Parent Elements + +|Element|Description| +|-------------|-----------------| +|[\](bindings.md)|This element holds a collection of standard and custom bindings.| + +## Remarks + + The NetHttpsBinding uses HTTPS as the transport for sending messages. When used with a duplex contract, Web Sockets will be used. When used with a request-reply contract NetHttpsBinding will behave like a BasicHttpsBinding with a binary encoder. + + Security is turned off by default, but can be added setting the mode attribute of the [\](security-of-basichttpbinding.md) child element to a value other than `None`. It uses a "Text" message encoding and UTF-8 text encoding by default. + +## Example 1 + + The following example demonstrates the use of that provides HTTPS communication and maximum interoperability with first- and second-generation Web services. The binding is specified in the configuration files for the client and service. The binding type is specified using the `binding` attribute of the `` element. If you want to configure the basic binding and change some of its settings, it is necessary to define a binding configuration. The endpoint must reference the binding configuration by name by using the `bindingConfiguration` attribute of the `` element, as shown in the following configuration code for the service. + +```xml
-``` - -## Example +``` + +## Example 2 + + Starting with .NET Framework 4, bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name from the binding. - Starting with .NET Framework 4, bindings and behaviors are not required to have a name. The functionality from the previous example can be accomplished by removing the bindingConfiguration from the endpoint address and the name from the binding. - -```xml +```xml -``` - - For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md). - +``` + + For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). + ## See also - diff --git a/docs/framework/configure-apps/file-schema/wcf/netmsmqbinding.md b/docs/framework/configure-apps/file-schema/wcf/netmsmqbinding.md index 7b66d3b8d8f07..0dab67eb17475 100644 --- a/docs/framework/configure-apps/file-schema/wcf/netmsmqbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/netmsmqbinding.md @@ -72,7 +72,7 @@ Defines a queued binding suitable for cross-machine communication. |`maxBufferPoolSize`|An integer that specifies the maximum buffer pool size for this binding. The default is 8.| |`maxReceivedMessageSize`|A positive integer that defines the maximum message size, in bytes, including headers, that is processed by this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536. This bound on message size is intended to limit exposure to Denial of Service (DoS) attacks.| |`maxRetryCycles`|An integer that indicates the number of retry cycles used by the poison-message detection feature. A message becomes a poison message when it fails all delivery attempts of all cycles. The default is 3. For more information, see .| -|`name`|Required attribute. A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|Required attribute. A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`QueueTransferProtocol`|A valid value that specifies the queued communication channel transport that this binding uses. MSMQ does not support Active Directory addressing when using SOAP Reliable Messaging Protocol. Therefore, you should not set this attribute to `Srmp` or `Srmps` when the `useActiveDirectory` attribute is set to `true`.| |`receiveErrorHandling`|A value that specifies how poison and nondispatchable messages are handled.| diff --git a/docs/framework/configure-apps/file-schema/wcf/netnamedpipebinding.md b/docs/framework/configure-apps/file-schema/wcf/netnamedpipebinding.md index 357bcb14df4a6..081a2c0274ae5 100644 --- a/docs/framework/configure-apps/file-schema/wcf/netnamedpipebinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/netnamedpipebinding.md @@ -56,7 +56,7 @@ Defines a binding that is secure, reliable, optimized for on-machine cross proce |maxBufferSize|A positive integer that specifies the maximum size, in bytes, of the buffer used to store messages in memory. If the buffer is full, excess data remains in the underlying socket until the buffer has room again. This value cannot be less than `maxReceivedMessageSize` attribute. The default is 65536. For more information, see .| |maxConnections|An integer that specifies the maximum number of outbound and inbound connections the service will create/accept. Incoming and outgoing connections are counted against a separate limit specified by this attribute.

Inbound connections in excess of the limit are queued until a space below the limit becomes available.

Outbound connections in excess of the limit are queued until a space below the limit becomes available.

The default is 10.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |receiveTimeout|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| |sendTimeout|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/netpeertcpbinding.md b/docs/framework/configure-apps/file-schema/wcf/netpeertcpbinding.md index 7e0d994d3438d..fd8c719feb84f 100644 --- a/docs/framework/configure-apps/file-schema/wcf/netpeertcpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/netpeertcpbinding.md @@ -47,7 +47,7 @@ Defines a binding for peer channel specific TCP messaging. |listenIPAddress|A string that specifies an IP address on which the peer node will listen for TCP messages. The default is `null`.| |maxBufferPoolSize|An integer that specifies the maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |port|An integer that specifies the network interface port on which this binding will process peer channel TCP messages. This value must be between and . The default is 0.| |receiveTimeout|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/nettcpbinding.md b/docs/framework/configure-apps/file-schema/wcf/nettcpbinding.md index 865352275d690..27a28f49926b9 100644 --- a/docs/framework/configure-apps/file-schema/wcf/nettcpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/nettcpbinding.md @@ -67,7 +67,7 @@ The following sections describe attributes, child elements, and parent elements. |`maxBufferSize`|A positive integer that specifies the maximum size, in bytes, of the buffer used to store messages in memory.

If the `transferMode` attribute equals to `Buffered`, this attribute should be equal to the `maxReceivedMessageSize` attribute value.

If the `transferMode` attribute equals to `Streamed`, this attribute cannot be more than the `maxReceivedMessageSize` attribute value, and should be at least the size of the headers.

The default is 65536. For more information, see .| |`maxConnections`|An integer that specifies the maximum number of outbound and inbound connections the service will create/accept. Incoming and outgoing connections are counted against a separate limit specified by this attribute.

Inbound connections in excess of the limit are queued until a space below the limit becomes available.

Outbound connections in excess of the limit are queued until a space below the limit becomes available.

The default is 10.| |`maxReceivedMessageSize`|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| -|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`portSharingEnabled`|A Boolean value that specifies whether TCP port sharing is enabled for this connection. If this is `false`, each binding uses its own exclusive port. This setting is relevant only to services, because clients are not affected.| |`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/nettcpcontextbinding.md b/docs/framework/configure-apps/file-schema/wcf/nettcpcontextbinding.md index 44ac4eda0818f..a933f93bc5055 100644 --- a/docs/framework/configure-apps/file-schema/wcf/nettcpcontextbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/nettcpcontextbinding.md @@ -73,7 +73,7 @@ Specifies a context for the that requir |maxBufferSize|A positive integer that specifies the maximum size, in bytes, of the buffer used to store messages in memory. If the buffer is full, excess data remains in the underlying socket until the buffer has room again. This value cannot be less than `maxReceivedMessageSize` attribute. The default is 65536. For more information, see .| |maxConnections|An integer that specifies the maximum number of outbound and inbound connections the service will create/accept. Incoming and outgoing connections are counted against a separate limit specified by this attribute.

Inbound connections in excess of the limit are queued until a space below the limit becomes available.

Outbound connections in excess of the limit are queued until a space below the limit becomes available.

The default is 10.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |portSharingEnabled|A Boolean value that specifies whether TCP port sharing is enabled for this connection. If this is `false`, each binding uses its own exclusive port. This setting is relevant only to services, because clients are not affected.| |receiveTimeout|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/secureconversationbootstrap.md b/docs/framework/configure-apps/file-schema/wcf/secureconversationbootstrap.md index 3bebf31f4eef1..caba6103fdd73 100644 --- a/docs/framework/configure-apps/file-schema/wcf/secureconversationbootstrap.md +++ b/docs/framework/configure-apps/file-schema/wcf/secureconversationbootstrap.md @@ -83,4 +83,4 @@ Specifies the default values used for initiating a secure conversation service. - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md b/docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md index 5b7e479eacfdc..30106e56d1831 100644 --- a/docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/security-of-custombinding.md @@ -109,7 +109,7 @@ Specifies the security options for a custom binding. The service configuration defines a custom binding that supports TCP communication protected using TLS/SSL protocol, and Windows message security. The custom binding uses a service certificate to authenticate the service on the transport level and to protect the messages during the transmission between client and service. This is accomplished by the [\](sslstreamsecurity.md) binding element. The service's certificate is configured using a service behavior. - Additionally, the custom binding uses message security with Windows credential type - this is the default credential type. This is accomplished by the [security](security-of-custombinding.md) binding element. Both client and service are authenticated using message-level security if Kerberos authentication mechanism is available. If the Kerberos authentication mechanism is not available, NTLM authentication is used. NTLM authenticates the client to the service but does not authenticate service to the client. The [security](security-of-custombinding.md) binding element is configured to use `SecureConversation` authenticationType, which results in the creation of a security session on both the client and the service. This is required to enable the service's duplex contract to work. For more information on running this example, see [Custom Binding Security](../../../wcf/samples/custom-binding-security.md). + Additionally, the custom binding uses message security with Windows credential type - this is the default credential type. This is accomplished by the [security](security-of-custombinding.md) binding element. Both client and service are authenticated using message-level security if Kerberos authentication mechanism is available. If the Kerberos authentication mechanism is not available, NTLM authentication is used. NTLM authenticates the client to the service but does not authenticate service to the client. The [security](security-of-custombinding.md) binding element is configured to use `SecureConversation` authenticationType, which results in the creation of a security session on both the client and the service. This is required to enable the service's duplex contract to work. For more information on running this example, see [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security). ```xml @@ -176,4 +176,4 @@ Specifies the security options for a custom binding. - [Custom Bindings](../../../wcf/extending/custom-bindings.md) - [\](custombinding.md) - [How to: Create a Custom Binding Using the SecurityBindingElement](../../../wcf/feature-details/how-to-create-a-custom-binding-using-the-securitybindingelement.md) -- [Custom Binding Security](../../../wcf/samples/custom-binding-security.md) +- [Custom Binding Security](/previous-versions/dotnet/framework/wcf/samples/custom-binding-security) diff --git a/docs/framework/configure-apps/file-schema/wcf/serviceauthorization-element.md b/docs/framework/configure-apps/file-schema/wcf/serviceauthorization-element.md index 4f0200725a67d..b3a131c25ef3a 100644 --- a/docs/framework/configure-apps/file-schema/wcf/serviceauthorization-element.md +++ b/docs/framework/configure-apps/file-schema/wcf/serviceauthorization-element.md @@ -92,14 +92,14 @@ The following code shows the `roleProviderName` used with the `principalPermissi
``` -For a detailed example of using this configuration element, see [Authorizing Access to Service Operations](../../../wcf/samples/authorizing-access-to-service-operations.md) and [Authorization Policy](../../../wcf/samples/authorization-policy.md). +For a detailed example of using this configuration element, see [Authorizing Access to Service Operations](/previous-versions/dotnet/framework/wcf/samples/authorizing-access-to-service-operations) and [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy). ## See also - - - [Security Behaviors](../../../wcf/feature-details/security-behaviors-in-wcf.md) -- [Authorizing Access to Service Operations](../../../wcf/samples/authorizing-access-to-service-operations.md) +- [Authorizing Access to Service Operations](/previous-versions/dotnet/framework/wcf/samples/authorizing-access-to-service-operations) - [How to: Create a Custom Authorization Manager for a Service](../../../wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service.md) - [How to: Restrict Access with the PrincipalPermissionAttribute Class](../../../wcf/how-to-restrict-access-with-the-principalpermissionattribute-class.md) -- [Authorization Policy](../../../wcf/samples/authorization-policy.md) +- [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy) diff --git a/docs/framework/configure-apps/file-schema/wcf/servicedebug.md b/docs/framework/configure-apps/file-schema/wcf/servicedebug.md index 378510c048890..53ff34ca5e834 100644 --- a/docs/framework/configure-apps/file-schema/wcf/servicedebug.md +++ b/docs/framework/configure-apps/file-schema/wcf/servicedebug.md @@ -64,7 +64,7 @@ Specifies debugging and help information features for a Windows Communication Fo > [!CAUTION] > Returning managed exception information to clients can be a security risk because exception details expose information about the internal service implementation that could be used by unauthorized clients. Because of the security issues involved, it is strongly recommended that you only do so in controlled debugging scenarios. You should set `includeExceptionDetailInFaults` to `false` when deploying your application. - For details about the security issues related to managed exception, see [Specifying and Handling Faults in Contracts and Services](../../../wcf/specifying-and-handling-faults-in-contracts-and-services.md). For a code sample, see [Service Debug Behavior](../../../wcf/samples/service-debug-behavior.md). + For details about the security issues related to managed exception, see [Specifying and Handling Faults in Contracts and Services](../../../wcf/specifying-and-handling-faults-in-contracts-and-services.md). For a code sample, see [Service Debug Behavior](/previous-versions/dotnet/framework/wcf/samples/service-debug-behavior). You can also set `httpsHelpPageEnabled` and `httpsHelpPageUrl` to enable or disable the help page. Each service can optionally expose a help page that contains information about the service including the endpoint to get WSDL for the service. This can be enabled by setting `httpHelpPageEnabled` to `true`. This enables the help page to be returned to a GET request to the base address of the service. You can change this address by setting the `httpHelpPageUrl` attribute. In addition, you can make this secure by using HTTPS instead of HTTP. @@ -76,4 +76,4 @@ Specifies debugging and help information features for a Windows Communication Fo - - [Specifying and Handling Faults in Contracts and Services](../../../wcf/specifying-and-handling-faults-in-contracts-and-services.md) - [Handling Exceptions and Faults](../../../wcf/extending/handling-exceptions-and-faults.md) -- [Service Debug Behavior](../../../wcf/samples/service-debug-behavior.md) +- [Service Debug Behavior](/previous-versions/dotnet/framework/wcf/samples/service-debug-behavior) diff --git a/docs/framework/configure-apps/file-schema/wcf/servicemetadata.md b/docs/framework/configure-apps/file-schema/wcf/servicemetadata.md index cc7e104cea0b5..ee02b25fad712 100644 --- a/docs/framework/configure-apps/file-schema/wcf/servicemetadata.md +++ b/docs/framework/configure-apps/file-schema/wcf/servicemetadata.md @@ -63,7 +63,7 @@ Specifies the publication of service metadata and associated information. This configuration element allows you to control the metadata publishing features of a service. To prevent unintentional disclosure of potentially sensitive service metadata, the default configuration for Windows Communication Foundation (WCF) services disables metadata publishing. This behavior is secure by default, but also means that you cannot use a metadata import tool (such as Svcutil.exe) to generate the client code required to call the service unless the service’s metadata publishing behavior is explicitly enabled in configuration. Using this configuration element, you can enable this publishing behavior for your service. - For a detailed example of configuring this behavior, see [Metadata Publishing Behavior](../../../wcf/samples/metadata-publishing-behavior.md). + For a detailed example of configuring this behavior, see [Metadata Publishing Behavior](/previous-versions/dotnet/framework/wcf/samples/metadata-publishing-behavior). The optional `httpGetBinding` and `httpsGetBinding` attributes allow you to configure the bindings used for metadata retrieval via HTTP GET (or HTTPS GET). If they are not specified, the default bindings (`HttpTransportBindingElement`, in the case of HTTP and `HttpsTransportBindingElement`, in the case of HTTPS) are used for metadata retrieval as appropriate. Notice that you cannot use these attributes with the built-in WCF bindings. Only bindings with inner binding elements that support will be supported. Additionally, the property of the binding must be . @@ -122,4 +122,4 @@ Specifies the publication of service metadata and associated information. - - - [Security Behaviors](../../../wcf/feature-details/security-behaviors-in-wcf.md) -- [Metadata Publishing Behavior](../../../wcf/samples/metadata-publishing-behavior.md) +- [Metadata Publishing Behavior](/previous-versions/dotnet/framework/wcf/samples/metadata-publishing-behavior) diff --git a/docs/framework/configure-apps/file-schema/wcf/servicesecurityaudit.md b/docs/framework/configure-apps/file-schema/wcf/servicesecurityaudit.md index cdf64e441823f..de1994dad2a7a 100644 --- a/docs/framework/configure-apps/file-schema/wcf/servicesecurityaudit.md +++ b/docs/framework/configure-apps/file-schema/wcf/servicesecurityaudit.md @@ -51,7 +51,7 @@ Specifies settings that enable auditing of security events during service operat This configuration element is used to audit Windows Communication Foundation (WCF) authentication events. When auditing is enabled, either successful or failed authentication attempts (or both) can be audited. The events are written to one of three event logs: application, security, or the default log for the operating system version. The event logs can all be viewed using the Windows Event viewer. - For a detailed example of using this configuration element, see [Service Auditing Behavior](../../../wcf/samples/service-auditing-behavior.md). + For a detailed example of using this configuration element, see [Service Auditing Behavior](/previous-versions/dotnet/framework/wcf/samples/service-auditing-behavior). By default, on Windows XP the audit events can be seen in the Application Log; while on Windows Server 2003 and Windows Vista, the audit events can be seen in the Security Log. The location of audit events can be specified by setting the `auditLogLocation` attribute to 'Application' or 'Security'. For more information, see [How to: Audit Security Events](../../../wcf/feature-details/how-to-audit-wcf-security-events.md). If the events are written in the Security Log, the LocalSecurityPolicy-> Enable Object Access should be set for "Success" and "Failure". @@ -85,4 +85,4 @@ Specifies settings that enable auditing of security events during service operat - [Security Behaviors](../../../wcf/feature-details/security-behaviors-in-wcf.md) - [Auditing](../../../wcf/feature-details/auditing-security-events.md) - [How to: Audit Security Events](../../../wcf/feature-details/how-to-audit-wcf-security-events.md) -- [Service Auditing Behavior](../../../wcf/samples/service-auditing-behavior.md) +- [Service Auditing Behavior](/previous-versions/dotnet/framework/wcf/samples/service-auditing-behavior) diff --git a/docs/framework/configure-apps/file-schema/wcf/servicethrottling.md b/docs/framework/configure-apps/file-schema/wcf/servicethrottling.md index bace8539435e8..ddfd5cee5155f 100644 --- a/docs/framework/configure-apps/file-schema/wcf/servicethrottling.md +++ b/docs/framework/configure-apps/file-schema/wcf/servicethrottling.md @@ -53,7 +53,7 @@ Specifies the throttling mechanism of a Windows Communication Foundation (WCF) s ## Example - The following configuration example specifies that the service limits the maximum concurrent calls to 2, and the maximum number of concurrent instances to 10. For a detailed example of running this example, see [Throttling](../../../wcf/samples/throttling.md). + The following configuration example specifies that the service limits the maximum concurrent calls to 2, and the maximum number of concurrent instances to 10. For a detailed example of running this example, see [Throttling](/previous-versions/dotnet/framework/wcf/samples/throttling). ```xml diff --git a/docs/framework/configure-apps/file-schema/wcf/udpbinding.md b/docs/framework/configure-apps/file-schema/wcf/udpbinding.md index a4ecd0a3232da..59a0928cae6db 100644 --- a/docs/framework/configure-apps/file-schema/wcf/udpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/udpbinding.md @@ -56,7 +56,7 @@ A configuration element used to configure the value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:10:00.| |`sendTimeout`|A value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/webhttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/webhttpbinding.md index e8295d5f79a47..9f8164db3b1fa 100644 --- a/docs/framework/configure-apps/file-schema/wcf/webhttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/webhttpbinding.md @@ -61,7 +61,7 @@ Defines a binding element that is used to configure endpoints for Windows Commun |maxBufferPoolSize|An integer that specifies the maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| |maxBufferSize|An integer that specifies the maximum amount of memory that is allocated for use by the manager of the message buffers that receive messages from the channel. The default value is 524,288 (0x80000) bytes.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536. **Note:** Increasing this value alone is not sufficient in ASP.NET compatible mode. You should also increase the value of `httpRuntime` (see [httpRuntime Element (ASP.NET Settings Schema)](/previous-versions/dotnet/netframework-4.0/e1f13641(v=vs.100))).| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |proxyAddress|A URI that specifies the address of the HTTP proxy. If `useSystemWebProxy` is `true`, this setting must be `null`. The default is `null`.| |receiveTimeout|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/ws2007federationhttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/ws2007federationhttpbinding.md index b014ad0ced62c..4d3a7f9a7e441 100644 --- a/docs/framework/configure-apps/file-schema/wcf/ws2007federationhttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/ws2007federationhttpbinding.md @@ -67,7 +67,7 @@ The following sections describe attributes, child elements, and parent elements. |`maxBufferPoolSize`|The maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| |`maxReceivedMessageSize`|The maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message that exceeds this limit receives a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| |`messageEncoding`|Defines the encoder used to encode the message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text.

This attribute is of type .| -|`name`|The configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|The configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`privacyNoticeAt`|A URI at which the privacy notice is located.| |`privacyNoticeVersion`|The version of the current privacy notice.| diff --git a/docs/framework/configure-apps/file-schema/wcf/ws2007httpbinding.md b/docs/framework/configure-apps/file-schema/wcf/ws2007httpbinding.md index bdb30e43cc59d..0d0f5e590418f 100644 --- a/docs/framework/configure-apps/file-schema/wcf/ws2007httpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/ws2007httpbinding.md @@ -69,7 +69,7 @@ Defines an interoperable binding that provides support for the correct versions |`maxBufferPoolSize`|The maximum buffer pool size for this binding. The default is 524,288 bytes (512 × 1,024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, as is garbage collection for buffers. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool when you are done. This avoids the overhead in creating and destroying buffers.| |`maxReceivedMessageSize`|The maximum message size, in bytes, including headers, which a channel configured with this binding, can receive. The sender of a message exceeding this limit receives a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| |`messageEncoding`|Defines the encoder used to encode the message. Valid values include the following:

- `Text`: Use a text message encoder.
- `Mtom`: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is `Text`.

This attribute is of type .| -|`name`|The configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|`name`|The configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |`openTimeout`|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |`proxyAddress`|A URI that specifies the address of the HTTP proxy. If `useSystemWebProxy` is `true`, this setting must be `null`. The default is `null`.| |`receiveTimeout`|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/wsdualhttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/wsdualhttpbinding.md index 33df4e7e2ad48..87fb7bcd67c0d 100644 --- a/docs/framework/configure-apps/file-schema/wcf/wsdualhttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/wsdualhttpbinding.md @@ -65,7 +65,7 @@ Defines a secure, reliable and interoperable binding that is suitable for duplex |maxBufferPoolSize|An integer that specifies the maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| |messageEncoding|Defines the encoder used to encode the message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.
- The default is Text.

This attribute is of type .| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |proxyAddress|A URI that specifies the address of the HTTP proxy. If `useDefaultWebProxy` is `true`, this setting must be `null`. The default is `null`.| |receiveTimeout|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/wsfederationhttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/wsfederationhttpbinding.md index 7bac06e35e5d2..78c5401077a4e 100644 --- a/docs/framework/configure-apps/file-schema/wcf/wsfederationhttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/wsfederationhttpbinding.md @@ -113,7 +113,7 @@ The following sections describe attributes, child elements, and parent elements. |maxBufferPoolSize|An integer that specifies the maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| |messageEncoding|Defines the encoder used to encode the message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.

The default is Text.

This attribute is of type .| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |privacyNoticeAt|A String that specifies a URI at which the privacy notice is located.| |privacyNoticeVersion|An integer that specifies the version of the current privacy notice.| diff --git a/docs/framework/configure-apps/file-schema/wcf/wshttpbinding.md b/docs/framework/configure-apps/file-schema/wcf/wshttpbinding.md index 85c9095d79c14..bb1b28a03e612 100644 --- a/docs/framework/configure-apps/file-schema/wcf/wshttpbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/wshttpbinding.md @@ -70,7 +70,7 @@ Defines a secure, reliable, interoperable binding suitable for non-duplex servic |maxBufferPoolSize|An integer that specifies the maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| |messageEncoding|Defines the encoder used to encode the message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.
- The default is Text.

This attribute is of type .| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |proxyAddress|A URI that specifies the address of the HTTP proxy. If `useSystemWebProxy` is `true`, this setting must be `null`. The default is `null`.| |receiveTimeout|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/wcf/wshttpcontextbinding.md b/docs/framework/configure-apps/file-schema/wcf/wshttpcontextbinding.md index f637d75937b91..7b1192fc88f5f 100644 --- a/docs/framework/configure-apps/file-schema/wcf/wshttpcontextbinding.md +++ b/docs/framework/configure-apps/file-schema/wcf/wshttpcontextbinding.md @@ -73,7 +73,7 @@ Provides a context for the that require |maxBufferPoolSize|An integer that specifies the maximum buffer pool size for this binding. The default is 524,288 bytes (512 * 1024). Many parts of Windows Communication Foundation (WCF) use buffers. Creating and destroying buffers each time they are used is expensive, and garbage collection for buffers is also expensive. With buffer pools, you can take a buffer from the pool, use it, and return it to the pool once you are done. Thus the overhead in creating and destroying buffers is avoided.| |maxReceivedMessageSize|A positive integer that specifies the maximum message size, in bytes, including headers, that can be received on a channel configured with this binding. The sender of a message exceeding this limit will receive a SOAP fault. The receiver drops the message and creates an entry of the event in the trace log. The default is 65536.| |messageEncoding|Defines the encoder used to encode the message. Valid values include the following:

- Text: Use a text message encoder.
- Mtom: Use a Message Transmission Organization Mechanism 1.0 (MTOM) encoder.
- The default is Text.

This attribute is of type .| -|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](../../../wcf/samples/simplified-configuration-for-wcf-services.md).| +|name|A string that contains the configuration name of the binding. This value should be unique because it is used as an identification for the binding. Starting with .NET Framework 4, bindings and behaviors are not required to have a name. For more information about default configuration and nameless bindings and behaviors, see [Simplified Configuration](../../../wcf/simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services).| |openTimeout|A value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to . The default is 00:01:00.| |proxyAddress|A URI that specifies the address of the HTTP proxy. If `useSystemWebProxy` is `true`, this setting must be `null`. The default is `null`.| |receiveTimeout|A value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to . The default is 00:01:00.| diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/add.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/add.md deleted file mode 100644 index bb1cf780401dc..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/add.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 4712a888-f154-4395-8887-ef14a88a6497 -author: "BrucePerlerMS" ---- -# \ - -Adds the specified security token handler to the token handler collection. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|The CLR type name of the token handler to be added. For more information about how to specify the `type` attribute, see [Custom Type References](/previous-versions/windows-identity-foundation/gg638728(v=msdn.10)#custom-type-references).| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](samlsecuritytokenrequirement.md)|Provides configuration for the class, the class, or a derived class of either of these classes.| -|[\](sessiontokenrequirement.md)|Provides configuration for the class or derived classes.| -|[\](usernamesecuritytokenhandlerrequirement.md)|Provides configuration for the class or derived classes.| -|[\](x509securitytokenhandlerrequirement.md)|Provides optional configuration for the class or derived classes.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](securitytokenhandlers.md)|Specifies a collection of security token handlers that are registered with the endpoint.| - -## Remarks - - The `` element can take a single child element that specifies the configuration for the token handler. This is dependent on whether the handler class referenced through the `type` attribute of the `` element provides support for this feature. Token handler classes that provide this feature must expose a constructor that takes an object. - -```csharp -public class CustomTokenHandler : Microsoft.IdentityModel.Tokens.SecurityTokenHandler -{ - public CustomTokenHandler( XmlElement customConfig ) - { - } -} -``` - - Several of the built-in security token handler classes do provide this functionality. These classes are , , , , and . - -> [!IMPORTANT] -> The token handler collection can only contain a single handler of any given type. This means, for example, that if you want to add a handler that is derived from the class to the collection, you must first remove the , which is present by default, from the collection. You can use the [\](remove.md) element to remove a single handler from the collection or use the [\](clear.md) element to remove all handlers from the collection. - - Settings specified on a handler override equivalent settings specified on the token handler collection under the [\](securitytokenhandlerconfiguration.md) element and those specified at the service-level under the [\](identityconfiguration.md) element. - -## Example - - The following XML shows the use of the `` and `` elements to replace the default session token handler with a custom session token handler. The XML is taken from the `ClaimsAwareWebFarm` sample. - -```xml - - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/audienceuris.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/audienceuris.md deleted file mode 100644 index 29419a64819eb..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/audienceuris.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 7a3d8515-d756-4afe-a22d-07cbe2217ee3 -author: "BrucePerlerMS" ---- -# \ - -Specifies the set of URIs that are acceptable identifiers of the relying party (RP). Tokens will not be accepted unless they are scoped for one of the allowed audience URIs. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](securitytokenhandlerconfiguration.md)\ -          **\** - -## Syntax - -```xml - - - - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|mode|An value that specifies whether the audience restriction should be applied to an incoming token. The possible values are "Always", "Never", and "BearerKeyOnly". The default is "Always". Optional.| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|``|Adds the URI specified by the `value` attribute to the audienceUris collection. The `value` attribute is required. The URI is case-sensitive.| -|``|Clears the audienceUris collection. All identifiers are removed from the collection.| -|``|Removes the URI specified by the `value` attribute from the audienceUris collection. The `value` attribute is required. The URI is case-sensitive.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](securitytokenhandlerconfiguration.md)|Provides configuration for a collection of security token handlers.| - -## Remarks - - By default, the collection is empty; use ``, ``, and `` elements to modify the collection. and objects use the values in the audience URI collection to configure any allowed audience URI restrictions in objects. - - The `` element is represented by the class. An individual URI added to the collection is represented by the class. - -> [!NOTE] -> The use of the `` element as a child element of the [\](identityconfiguration.md) element has been deprecated, but is still supported for backward compatibility. Settings on the `` element override those on the `` element. - -## Example - - The following XML shows how to configure the acceptable audience URIs for an application. This example configures a single URI. Tokens scoped for this URI will be accepted, all others will be rejected. - -```xml - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/caches.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/caches.md deleted file mode 100644 index 51329d85caec3..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/caches.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 4651091b-3a20-40d8-b293-4408c0710143 -author: "BrucePerlerMS" ---- -# \ - -Registers the caches used for session tokens and token replay detection. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - - None - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](sessionsecuritytokencache.md)|Registers a cache for session tokens with a service or a security token handler collection.| -|[\](tokenreplaycache.md)|Registers a token replay cache with a service or a security token handler collection.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](identityconfiguration.md)|Specifies service-level identity settings.| -|[\](securitytokenhandlerconfiguration.md)|Provides configuration for a collection of security token handlers.| - -## Remarks - - A `` element can be specified at the service level under the `` element or on the security token handler collection level under the `` element. Settings on a token handler collection override those specified on the service. - - The `` element is represented by the class. The configured caches are represented by the class. - -## Example - - The following XML shows the configuration of a custom cache for holding session security tokens (). The configuration is taken from the `ClaimsAwareWebFarm` sample. - -```xml - - - - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatereference.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatereference.md deleted file mode 100644 index efe31e9f256a0..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatereference.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 2ac8bc14-e9f1-48fb-b662-f5991558fbe4 -author: "BrucePerlerMS" ---- -# \ - -Specifies settings that are used to find and validate an X.509 certificate in a certificate store. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel-services.md)\ -    [**\**](federationconfiguration.md)\ -      [**\**](servicecertificate.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|storeName|The name of the X.509 certificate store. The default is "My". Optional.| -|storeLocation|A value that specifies the location of the X.509 certificate store. The default value is "LocalMachine". Optional.| -|x509FindType|An value that specifies the type of search that is to be executed. The default is "FindBySubjectDistinguishedName". Optional.| -|findValue|The value to search for in the X.509 certificate store. Optional.| -|isChainIncluded|Specifies whether validation should be performed by using the certificate chain. The default is "true"; validation is performed by using the certificate chain. Optional.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](servicecertificate.md)|Configures the certificate that is used to encrypt and decrypt tokens.| - -## Remarks - - The `` element specifies settings that are used to find and validate an X.509 certificate in a certificate store. When it is specified as the child element of the `` element, it specifies the location and verification settings of the X.509 certificate that is used to encrypt and decrypt tokens. The `` element is represented by the class. diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatevalidation.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatevalidation.md deleted file mode 100644 index 514bd5a9b964e..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatevalidation.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 6c54c704-b55e-4631-88ff-4d4a5621554c -author: "BrucePerlerMS" ---- -# \ - -Controls the settings that token handlers use to validate certificates. These settings are overridden if a specific handler is configured with its own validator. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|certificateValidationMode|An value that specifies the validation mode to use for the X.509 certificate. The default value is "PeerOrChainTrust". To specify a custom validator, set this attribute to "Custom" and specify the validator using the [\](certificatevalidator.md) element. Optional.| -|revocationMode|An value that specifies the revocation mode to use for the X.509 certificate. The default value is "Online". Optional.| -|trustedStoreLocation|A value that specifies the X.509 certificate store. The default value is "LocalMachine". Optional.| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](certificatevalidator.md)|Specifies a custom type for certificate validation. This type is used only if the `certificateValidationMode` attribute of the [\](certificatevalidation.md) element is set to "Custom".| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](identityconfiguration.md)|Specifies service-level identity settings.| -|[\](securitytokenhandlerconfiguration.md)|Provides configuration for a collection of security token handlers.| - -## Remarks - - A `` element can be specified at the service level under the `` element or on the security token handler collection level under the `` element. Settings on a token handler collection override those specified on the service. Some token handlers allow you to specify certificate validation settings in configuration. Settings on individual token handlers override those specified both at the service level and on the security token handler collection. - -## Example - -```xml - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatevalidator.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatevalidator.md deleted file mode 100644 index c90eea3718645..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/certificatevalidator.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 86161897-c20f-4ad8-9d7f-050c247251bf -author: "BrucePerlerMS" ---- -# \ - -Specifies a custom type for certificate validation. This type is used only if the `certificateValidationMode` attribute of the [\](certificatevalidation.md) element is set to "Custom". - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](certificatevalidation.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|Specifies a custom type that derives from the class. Set the `certificateValidationMode` attribute of the [\](certificatevalidation.md) element to "Custom" to use this type. For more information about how to specify the `type` attribute, see [Custom Type References](../windows-workflow-foundation/index.md). Optional.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](certificatevalidation.md)|Controls the settings that token handlers use to validate certificates.| - -## Example - -```xml - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/chunkedcookiehandler.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/chunkedcookiehandler.md deleted file mode 100644 index 49edf3c33d005..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/chunkedcookiehandler.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 7220de45-1d14-4aec-a29e-4a2ea8ac861f -author: "BrucePerlerMS" ---- -# \ - -Configures the . This element may only be present if the `mode` attribute of the `` element is "Default" or "Chunked". - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel-services.md)\ -    [**\**](federationconfiguration.md)\ -      [**\**](cookiehandler.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|chunkSize|The maximum size, in characters, of the HTTP cookie data for any one HTTP cookie. You must be careful when adjusting the chunk size. Web browsers have different limits on the size of cookies and number allowed per domain. For example, the original Netscape specification stipulated these limits: 300 cookies total, 4096 bytes per cookie header (including metadata, not just the cookie value), and 20 cookies per domain. The default is 2000. Required.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](cookiehandler.md)|Configures the that the (SAM) uses to read and write cookies.| - -## Remarks - - When you specify a by setting the `mode` attribute of the `` element to "Default" or "Chunked", you can specify the chunk size that the cookie handler uses to read and write cookies by including a `` child element and setting its `chunkSize` attribute. If the `` element is not present, the default chunk size of 2000 bytes is used. This element cannot be specified when the `mode` attribute is set to "Custom". - - The `` element is represented by the class. - -## Example - - The following example configures a chunked cookie handler that writes cookies in chunks of 3000 bytes. - -```xml - - - -``` - -## See also - -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthenticationmanager.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthenticationmanager.md deleted file mode 100644 index ec97bdc13d67c..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthenticationmanager.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 6d30a450-6d13-4671-81a8-77e0204500c5 -author: "BrucePerlerMS" ---- -# \ - -Registers a claims authentication manager for the incoming claims. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|Specifies a custom type that derives from the class. For more information about how to specify the `type` attribute, see [Custom Type References].| - -### Child Elements - - If there is no `type` attribute, or if the `type` attribute references the class, the `` element does not take child elements; however, classes derived from can define child configuration elements. - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](identityconfiguration.md)|Specifies service-level identity settings.| - -## Remarks - - The default behavior provided through the class echoes the incoming claims. If no `type` attribute is specified or if the `type` attribute specifies the class, the `` element does not take child elements. You can specify the `type` attribute to register a type derived from the class to implement custom behavior. Derived classes can support configuration through child elements of the `` element by overriding the method to handle these elements. The schema defined for the child elements is up to the designer of the class. - - The `` element sets the property. - -## Example - -```xml - - - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthorizationmanager.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthorizationmanager.md deleted file mode 100644 index 352be81f5db59..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimsauthorizationmanager.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 9354eee3-f692-4ad6-8427-3169686b8bcc -author: "BrucePerlerMS" ---- -# \ - -Registers a claims authorization manager for the incoming claims. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|A custom type that derives from the class. For more information about how to specify the `type` attribute, see [Custom Type References](../windows-workflow-foundation/index.md).| - -### Child Elements - - If there is no `type` attribute, or if the `type` attribute references the class, the `` element does not take child elements; however, classes derived from can define child configuration elements. - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](identityconfiguration.md)|Specifies service-level identity settings.| - -## Remarks - - The default behavior provided through the class always authorizes the incoming claims. If no `type` attribute is specified or if the `type` attribute specifies the class, the `` element does not take child elements. You can specify the `type` attribute to register a type derived from the class to implement custom behavior. Derived classes can support configuration through child elements of the `` element by overriding the method to handle these elements. The schema defined for the child elements is up to the designer of the class. - -> [!IMPORTANT] -> When using the or the class to provide claims-based access control in your code, the identity configuration that is referenced by the `` element configures the claims authorization manager and policy that is used to make authorization decisions. This is true, even in scenarios that are not passive Web scenarios, for example Windows Communication Foundation (WCF) applications or an application that is not Web-based. If the application is not a passive Web application, the `` element (and its child policy elements, if present) of the referenced identity configuration are the only settings applied. All other settings are ignored. For more information, see the [\](federationconfiguration.md) element. - - This element sets the property. - -## Example - - The following XML shows the configuration for a claims authorization manager that implements policy composed of resource-action pairs each of which specifies boolean combinations of the claims that a requestor must possess to perform the action on the resource. The code that implements the claims authorization manager capable of using this policy can be found in the `ClaimsBasedAuthorization` sample. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimtype.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimtype.md deleted file mode 100644 index 332342b7d0cd0..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimtype.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: d17b5831-9a2c-45c4-b0d1-68f48e72e861 -author: "BrucePerlerMS" ---- -# \ - -Specifies a single optional or required claim for incoming security tokens. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](claimtyperequired.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|The claim type. Typically a URI. Required.| -|optional|A boolean value that specifies whether the claim type is optional. Optional.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](claimtyperequired.md)|Specifies the set of required claims for incoming security tokens.| diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimtyperequired.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimtyperequired.md deleted file mode 100644 index d7f34e37b8658..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/claimtyperequired.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: c469d71f-6c77-4a24-97aa-53efa126ceef -author: "BrucePerlerMS" ---- -# \ - -Specifies the set of required claims for incoming security tokens. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - - None - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](claimtype.md)|Specifies a single optional or required claim for incoming security tokens.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](identityconfiguration.md)|Specifies service-level identity settings.| diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/clear.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/clear.md deleted file mode 100644 index 6e3ecf73f169f..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/clear.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 54dcd1d1-038f-4fc8-a3a4-56ba7a1ca0fd -author: "BrucePerlerMS" ---- -# \ - -Clears all security token handlers from the current token handler collection. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - - None - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](securitytokenhandlers.md)|Specifies a collection of security token handlers that are registered with the endpoint.| diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/cookiehandler.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/cookiehandler.md deleted file mode 100644 index 26f42e4b0ae3f..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/cookiehandler.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: bfdc127f-8d94-4566-8bef-f583c6ae7398 -author: "BrucePerlerMS" ---- -# \ - -Configures the that the (SAM) uses to read and write cookies. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel-services.md)\ -    [**\**](federationconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|name|Specifies the base name for any cookies written. The default is "FedAuth".| -|path|Specifies the path value for any cookies written. The default is "HttpRuntime.AppDomainAppVirtualPath".| -|mode|One of the values that specifies the kind of cookie handler used by the SAM. The following values may be used:

- "Default" — The same as "Chunked".
- "Chunked" — Uses an instance of the class. This cookie handler ensures that individual cookies do not exceed a set maximum size. It accomplishes this by potentially "chunking" one logical cookie into a number of cookies on-the-wire.
- "Custom" — Uses an instance of a custom class derived from . The derived class is referenced by the `` child element.

The default is "Default".| -|persistentSessionLifetime|Specifies the lifetime of persistent sessions. If zero, transient sessions are always used. The default value is "0:0:0", which specifies a transient session. The maximum value is "365:0:0", which specifies a session of 365 days. The value should be specified according to the following restriction: ``, where the leftmost value specifies days, the middle value (if present) specifies hours, and the rightmost value (if present) specifies minutes.| -|requireSsl|Specifies whether the "Secure" flag is emitted for any cookies written. If this value is set, the sign-in session cookies will only be available over HTTPS. The default is "true".| -|hideFromScript|Controls whether the "HttpOnly" flag is emitted for any cookies written. Certain web browsers honor this flag by keeping client-side script from accessing the cookie value. The default is "true".| -|domain|The domain value for any cookies written. The default is "".| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](chunkedcookiehandler.md)|Configures the . This element may only be present if the `mode` attribute of the `` element is "Default" or "Chunked".| -|[\](customcookiehandler.md)|Sets the custom cookie handler type. This element must be present if the `mode` attribute of the `` element is "Custom". It cannot be present for any other values of the `mode` attribute. The custom type must be derived from the class.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](federationconfiguration.md)|Contains the settings that configure the (WSFAM) and the (SAM).| - -## Remarks - - The is responsible for reading and writing raw cookies at the HTTP protocol level. You can configure either a or a custom cookie handler derived from the class. - - To configure a chunked cookie handler, set the mode attribute to "Chunked" or "Default". The default chunk size is 2000 bytes, but you may optionally specify a different chunk size by including a `` child element. - - To configure a custom cookie handler, set the mode attribute to "Custom". You must also specify a `` child element that references the type of your custom handler. - - The `` element is represented by the class. The cookie handler that was specified in configuration is available from the property of the object set on the property. - -## Example - - The following XML shows a `` element. In this example, because the `mode` attribute is not specified, the default cookie handler will be used by the SAM. This is an instance of the class. Because the `` child element is not specified, the default chunk size will be used. HTTPS will not be required because the `requireSsl` attribute is set `false`. - -> [!WARNING] -> In this example, HTTPS is not required to write session cookies. This is because the `requireSsl` attribute on the `` element is set to `false`. This setting is not recommended for most production environments as it may present a security risk. - -```xml - -``` - -## See also - -- -- -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/customcookiehandler.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/customcookiehandler.md deleted file mode 100644 index 87751dbcfa554..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/customcookiehandler.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: a03b153d-5ec6-4915-9031-6f0c3fd348be -author: "BrucePerlerMS" ---- -# \ - -Sets the custom cookie handler type. This element may only be present if the `mode` attribute of the `` element is "Custom". The custom type must be derived from the class. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel-services.md)\ -    [**\**](federationconfiguration.md)\ -      [**\**](cookiehandler.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|Specifies a custom type that derives from the class. For more information about how to specify the `type` attribute, see [Custom Type References](../windows-workflow-foundation/index.md).| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](cookiehandler.md)|Configures the that the uses to read and write cookies.| - -## Remarks - - When you specify a custom cookie handler by setting the `mode` attribute of the `` element to "Custom", you must specify the type of the custom cookie handler by including a `` child element that references the cookie handler type. This element cannot be specified when the `mode` attribute is set to "Chunked" or "Default". Custom cookie handlers must derive from the class. - - The `` element is represented by the class. - -## Example - - The following example configures the SAM to use a custom cookie handler of type `MyNamespace.MyCustomCookieHandler`. - -```xml - - - -``` - -## See also - -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/federationconfiguration.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/federationconfiguration.md deleted file mode 100644 index 1e5bf6565e638..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/federationconfiguration.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 8b14054c-6d07-46ab-ab58-03f14beac0f2 -author: "BrucePerlerMS" ---- -# \ - -Configures the (WSFAM) and the (SAM) when using federated authentication through the WS-Federation protocol. Configures the when using the or the class to provide claims-based access control. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel-services.md)\ -    **\** - -## Syntax - -```xml - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|name|The name of this federation configuration element. This attribute primarily provides an extensibility point for future protocols. Optional.| -|identityConfigurationName|The name of the identity configuration section as specified in an [\](identityconfiguration.md) element to use. If this attribute is not specified, the default identity configuration section is used. Optional.| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](cookiehandler.md)|Configures the cookie handler used by the SAM. Optional.| -|[\](servicecertificate.md)|Configures the certificate that is used to encrypt and decrypt tokens. Optional.| -|[\](wsfederation.md)|Configures the WS-Federation Authentication Module (WSFAM). Optional.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](system-identitymodel-services.md)|Configuration section for authentication using the WS-Federation protocol.| - -## Remarks - - The \ element provides settings in two different scenarios: - -- When using WS-Federation in a passive Web application, the element contains settings that configure the (WSFAM) and the (SAM). It also references the identity configuration to be used to configure security token handlers and certificates, and components like the claims authorization manager and the claims authentication manager. - -- When using the or the class to provide claims-based access control in your code, the element references the identity configuration that configures the claims authorization manager and policy that is used to make authorization decisions. This is true, even in scenarios that are not passive Web scenarios; for example, Windows Communication Foundation (WCF) applications or an application that is not Web-based. If the application is not a passive Web application, the [\](claimsauthorizationmanager.md) element (and its child policy elements, if present) of the identity configuration referenced by the `` element are the only settings applied. All others are ignored. - - Regardless of the scenario, the runtime loads the default federation configuration. The behavior is defined as follows: - -1. If there is no `` element present, the runtime creates a federation configuration and populates it with default values. This default federation configuration will reference the default identity configuration. - -2. If a single `` element is present, it is the default federation configuration regardless of whether it is named or unnamed. If its `identityConfiguration` attribute is specified, the named identity configuration is referenced; otherwise, the default identity configuration is referenced. - -3. If an unnamed `` element is present, it is the default federation configuration. If its `identityConfiguration` attribute is specified, the named identity configuration is referenced; otherwise, the default identity configuration is referenced. - -4. If multiple named `` elements are present and no unnamed `` element is present, an exception is thrown. - - Typically, only a single `` section is defined. This section is the default federation configuration. You may specify multiple, uniquely-named `` elements; however, in this case, if you want to load a federation configuration other than the unnamed one, you must provide a handler for the. event and set the property inside the handler to a object initialized with values from the appropriate `` element in the configuration file. - - The `` element is represented by the class. The configuration object itself is represented by the class. A single instance is set on the property and provides federated configuration for the application. - -## Example - - The following XML shows a `` element that specifies settings for the WSFAM and specifies that the default cookie handler (an instance of the class) be used by the SAM. - -> [!WARNING] -> In this example, neither the cookie handler nor WSFAM are required to use HTTPS. This is because the `requireHttps` attribute on the `` element and the `requireSsl` attribute on the `` are `false`. These settings are not recommended for most production environments as they may present a security risk. - -```xml - - - - - - -``` - -## See also - -- -- -- -- [\](identityconfiguration.md) diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/identityconfiguration.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/identityconfiguration.md deleted file mode 100644 index 6e58ea41ee947..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/identityconfiguration.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 1db76253-07da-447b-9e7a-3705c7228cf4 -author: "BrucePerlerMS" ---- - -# \ - -Specifies service-level identity settings. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    **\** - -## Syntax - -```xml - - - maximumClockSkew=TimeSpan > - - -``` - -## Attributes and Elements - -The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|name|The name of the identity configuration section. You can use this name to reference a specific configuration section. If no `name` attribute is specified, the section defines the default configuration. The default configuration is always used for passive federation scenarios. For more information, see the [\](federationconfiguration.md) element.| -|saveBootstrapContext|Specifies whether bootstrap tokens should be included in the session token. The value may also be set on a token handler collection by setting the `saveBootstrapContext` attribute on the [\](securitytokenhandlerconfiguration.md) element. A value set on the token handler collection overrides the value set on the service.| -|maximumClockSkew|A that specifies the maximum allowed clock skew. Controls the maximum allowed clock skew when performing time-sensitive operations, such as validating the expiration time of a sign-in session. The default is 5 minutes, "00:05:00". For more information about how to specify values, see [Timespan Values](../windows-workflow-foundation/index.md). The maximum clock skew may also be set on a token handler collection by setting the `maximumClockSkew` attribute on the [\](securitytokenhandlerconfiguration.md) element. A value set on the token handler collection overrides the value set on the service.| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](caches.md)|Registers the caches used for session tokens and token replay detection. Can be specified at the service-level or on a security token handler collection. Optional.| -|[\](certificatevalidation.md)|Controls the settings that token handlers use to validate certificates. Can be specified at the service-level or on a security token handler collection. Optional.| -|[\](claimsauthenticationmanager.md)|Registers a claims authentication manager for the incoming claims. Optional.| -|[\](claimsauthorizationmanager.md)|Registers a claims authorization manager for the incoming claims. Optional.| -|[\](claimtyperequired.md)|Specifies the set of required claims for incoming security tokens. Optional.| -|[\](securitytokenhandlers.md)|Specifies a collection of security token handlers. Zero or more collections of security token handlers can be specified. Optional.| -|[\](tokenreplaydetection.md)|Enables token replay detection and specifies the expiration time for tokens. Can be specified at the service-level or on a security token handler collection. Optional.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](system-identitymodel.md)|Provides configuration for enabling Windows Identity Foundation (WIF) options in applications.| - -## Remarks - -Multiple identity configurations may be defined, each with a unique name. The behavior is as follows: - -1. If no `` element is specified. A default identity configuration is created at runtime and populated with default values. - -2. If a single `` element is specified. It is the default identity configuration. It does not matter whether it is named or unnamed. - -3. If multiple `` elements are specified. The unnamed element specifies the default identity configuration. It is recommended that when you specify multiple `` elements, one of them should be unnamed. - -> [!WARNING] -> If you specify multiple `` elements, one of them should be unnamed. The unnamed element will be the default identity configuration. - - Some of the settings specified in the `` element can be overridden by settings on a security token handler collection or by settings on individual security token handlers. - -> [!IMPORTANT] -> When using the or the class to provide claims-based access control in your code, the identity configuration that is referenced by the `` element configures the claims authorization manager and policy that is used to make authorization decisions. This is true, even in scenarios that are not passive Web scenarios, for example Windows Communication Foundation (WCF) applications or an application that is not Web-based. If the application is not a passive Web application, the [\](claimsauthorizationmanager.md) element (and its child policy elements, if present) of the referenced identity configuration are the only settings applied. All other settings are ignored. For more information, see the [\](federationconfiguration.md) element. - -The `` element is represented by the class. An identity configuration section is represented by the class. - -> [!IMPORTANT] -> Specifying the following elements as child elements of the `` element has been deprecated, although the behavior is still supported for backward compatibility. These elements should, instead, be specified under the [\](securitytokenhandlerconfiguration.md) element. -> -> - [\](audienceuris.md) -> - [\](issuernameregistry.md) -> - [\](issuertokenresolver.md) -> - [\](servicetokenresolver.md) - -## Example - -The following example creates an identity configuration named "alternateConfiguration". The identity configuration specifies default settings. - -```xml - - - -``` - -## See also - -- -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/index.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/index.md deleted file mode 100644 index 9bb7dc87017e6..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/index.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -description: "Learn more about: Windows Identity Foundation Configuration Schema" -title: "Windows Identity Foundation Configuration Schema" -ms.date: "03/30/2017" -ms.assetid: 4d4f6d76-49a5-4bad-b345-097b2e2844e9 -author: "BrucePerlerMS" ---- -# Windows Identity Foundation Configuration Schema - -The topics in this section provide information about the Windows Identity Foundation (WIF) configuration schema. You can also configure an application to use WIF through classes exposed by the framework. These classes are noted in the sections that treat relevant elements in the schema. The following shows the basic XML tag structure exposed by the WIF configuration schema. Attributes are omitted. Highlighted comments indicate major components of the schema. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## In This Section - -[\](system-identitymodel.md) Provides configuration for enabling WIF options in applications. - -[\](system-identitymodel-services.md) Provides configuration for passive federation using WIF. Configures the Session Authentication Module (SAM) and the Federated Authentication Module (WSFAM). diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/issuernameregistry.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/issuernameregistry.md deleted file mode 100644 index be06f87f03ad0..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/issuernameregistry.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 58b39d12-c953-40c4-88af-d7eb3343ca28 -author: "BrucePerlerMS" ---- -# \ - -Configures the issuer name registry that is used by handlers in the token handler collection. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](securitytokenhandlerconfiguration.md)\ -          **\** - -## Syntax - -```xml - - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|A type that derives from the class. For more information about how to specify a custom `type`, see [Custom Type References].| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](trustedissuers.md)|When the `type` attribute specifies the configuration-based issuer name registry (the class), the [\](trustedissuers.md) element must be specified. The [\](trustedissuers.md) element can take ``, ``, or `` elements as child elements.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](securitytokenhandlerconfiguration.md)|Provides configuration for a collection of security token handlers.| - -## Remarks - - All issuer tokens are validated using an issuer name registry. This is an object that derives from the class. The issuer name registry is used to associate a mnemonic name to the cryptographic material that is needed to verify the signatures of tokens produced by the corresponding issuer. The issuer name registry maintains a list of issuers that are trusted by the relying party (RP) application. The type of the issuer name registry is specified using the `type` attribute. The `` element can have one or more child elements that provide configuration for the specified type. You provide the logic that processes these child elements by overriding the method. - - WIF provides a single issuer name registry type out of the box, the class. This class uses a set of trusted issuer certificates that are specified in configuration. It requires a child configuration element, ``, under which the collection of trusted issuer certificates is configured. Trusted certificates are specified using the ASN.1 encoded form of the certificate thumbprint and are added or removed from the collection by using ``, ``, or `` elements. - - The `` element is represented by the class. - -> [!NOTE] -> Specifying the `` element as a child element of the [\](identityconfiguration.md) element has been deprecated, but is still supported for backward compatibility. Settings on the `` element override those on the `` element. - -## Example - - The following XML shows how to specify the configuration based issuer name registry. - -```xml - - - - - -``` - -## See also - -- -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/issuertokenresolver.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/issuertokenresolver.md deleted file mode 100644 index 85abe5baa4b62..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/issuertokenresolver.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: f74392f6-3f5b-4880-bd8a-3a9130d31e65 -author: "BrucePerlerMS" ---- -# \ - -Registers the issuer token resolver that is used by handlers in the token handler collection. The issuer token resolver is used to resolve the signing token on incoming tokens and messages. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](securitytokenhandlerconfiguration.md)\ -          **\** - -## Syntax - -```xml - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|Specifies the type of the issuer token resolver. Must be either the class or a type that derives from the class. Required.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](securitytokenhandlerconfiguration.md)|Provides configuration for a collection of security token handlers.| - -## Remarks - - The issuer token resolver is used to resolve the signing token on incoming tokens and messages. It is used to retrieve the cryptographic material that is used for checking the signature. You must specify the `type` attribute. The type specified can be either or a custom type that derives from the class. - - Some token handlers allow you to specify issuer token resolver settings in configuration. Settings on individual token handlers override those specified on the security token handler collection. - -> [!NOTE] -> Specifying the `` element as a child element of the [\](identityconfiguration.md) element has been deprecated, but is still supported for backward compatibility. Settings on the `` element override those on the `` element. - -## Example - - The following XML shows configuration for an issuer token resolver that is based on a custom class that derives from . The token resolver maintains a dictionary of audience-key pairs that is initialized from a custom configuration element (``) defined for the class. The class overrides the method to process this element. The override is shown in the following example; however, the methods it calls are not shown for brevity. For the complete example, see the `CustomToken` sample. - -```xml - - - -``` - -## Example - -```csharp -public override void LoadCustomConfiguration(System.Xml.XmlNodeList nodelist) -{ - foreach (XmlNode node in nodelist) - { - XmlDictionaryReader rdr = XmlDictionaryReader.CreateDictionaryReader(new XmlTextReader(new StringReader(node.OuterXml))); - rdr.MoveToContent(); - - string symmetricKey = rdr.GetAttribute("symmetricKey"); - string audience = rdr.GetAttribute("audience"); - - this.AddAudienceKeyPair(audience, symmetricKey); - } -} -``` - -## See also - -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/nameclaimtype.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/nameclaimtype.md deleted file mode 100644 index 33e6cbe859668..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/nameclaimtype.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 17514d95-f0f5-4789-8e28-346640dc227c -author: "BrucePerlerMS" ---- -# \ - -Sets the claim type that specifies the property. The claim type is used to search for a in the collection of objects returned by the method of this token handler. The value of the matching claim is then set as the name of the generated from this token handler. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](add.md)\ -          [**\**](samlsecuritytokenrequirement.md)\ -            **\** - -## Syntax - -```xml - - - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|value|A string that specifies the URI that represents the claim type of the claim to use for the property. Required.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](samlsecuritytokenrequirement.md)|Provides configuration for the class, the class, or a derived class of either of these classes.| - -## Remarks - - The `` element sets the property when a object is initialized from configuration. - -## Example - -```xml - - - - - -``` - -## See also - -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/remove.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/remove.md deleted file mode 100644 index 42e9d20641469..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/remove.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 4058e2f1-7db4-4d1a-84dd-1b52836f2ae6 -author: "BrucePerlerMS" ---- -# \ - -Removes the specified security token handler from the token handler collection. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|The CLR type name of the token handler to be removed. For more information about how to specify the `type` attribute, see [Custom Type References](/previous-versions/windows-identity-foundation/gg638728(v=msdn.10)#custom-type-references). Required.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](securitytokenhandlers.md)|Specifies a collection of security token handlers that are registered with the endpoint.| - -## Example - - The following XML shows the use of the `` and `` elements to replace the default session token handler with a custom session token handler. The XML is taken from the `ClaimsAwareWebFarm` sample. - -```xml - - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/roleclaimtype.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/roleclaimtype.md deleted file mode 100644 index d07743046e3eb..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/roleclaimtype.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 69a49deb-6369-41ba-806b-ae8d21fac64b -author: "BrucePerlerMS" ---- -# \ - -Specifies the claim type that defines the role type claims in the collection of objects returned by the method of the token handler. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](add.md)\ -          [**\**](samlsecuritytokenrequirement.md)\ -            **\** - -## Syntax - -```xml - - - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|value|A string that specifies the URI that represents the claim type of the claim to use for the role claim type.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](samlsecuritytokenrequirement.md)|Provides configuration for the class, the class, or a derived class of either of these classes.| - -## Remarks - - The `` element sets the property when a object is initialized from configuration. - -## Example - -```xml - - - - - -``` - -## See also - -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/samlsecuritytokenrequirement.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/samlsecuritytokenrequirement.md deleted file mode 100644 index c82c340ca6415..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/samlsecuritytokenrequirement.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 09202d12-88d3-49cc-953b-703bcc1690eb -author: "BrucePerlerMS" ---- -# \ - -Provides configuration for the class, the class, or a derived class of either of these classes. Represented by the class. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](add.md)\ -          **\** - -## Syntax - -```xml - - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|mapToWindows|Specifies whether the token handler should map the validating token to a Windows account by using the incoming UPN claim. The default is "false".| -|issuerCertificateRevocationMode|An value that specifies the revocation mode to use for the X.509 certificate. The default value is "Online".| -|issuerCertificateValidationMode|An value that specifies the validation mode to use for the X.509 certificate. The default value is "PeerOrChainTrust".| -|issuerCertificateTrustedStoreLocation|A value that specifies the X.509 certificate store. The default value is "LocalMachine".| -|issuerCertificateValidator|A custom type that derives from . If the `issuerCertificateValidationMode` attribute is "Custom", an instance of this type is used for issuer certificate validation.| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](nameclaimtype.md)|Sets the claim type that specifies the property.| -|[\](roleclaimtype.md)|Specifies the claim type that defines the role type claims in the collection of objects returned by the method of the token handler.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](add.md)|Adds the specified security token handler to the token handler collection.| - -## Remarks - - The `` element is represented by the class in the object model and is used to configure the `SamlSecurityTokenRequirement` property on a or a . - -## Example - -```xml - - - - - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/securitytokenhandlerconfiguration.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/securitytokenhandlerconfiguration.md deleted file mode 100644 index 62fe64dbeda0c..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/securitytokenhandlerconfiguration.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 28724cc6-020c-4a06-9a1f-d7594f315019 -author: "BrucePerlerMS" ---- -# \ - -Provides configuration for the collection of token handlers. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|saveBootstrapContext|Specifies whether bootstrap tokens should be included in the session token. The value may also be set on a token handler collection by setting the `saveBootstrapContext` attribute on the [\](identityconfiguration.md) element. A value set on the token handler collection overrides the value set on the service.| -|maximumClockSkew|A that specifies the maximum allowed clock skew. Controls the maximum allowed clock skew when performing time-sensitive operations, such as validating the expiration time of a sign-in session. The default is 5 minutes, "00:05:00". For more information about how to specify values, see [Timespan Values](../windows-workflow-foundation/index.md). The maximum clock skew may also be set at the service level by setting the `maximumClockSkew` attribute on the [\](identityconfiguration.md) element. A value set on the token handler collection overrides the value set on the service.| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](audienceuris.md)|Specifies the set of URIs that are acceptable identifiers of this relying party. Optional.| -|[\](caches.md)|Registers the caches used for session tokens and token replay detection. Can be specified at the service-level or on a security token handler collection. Optional.| -|[\](certificatevalidation.md)|Controls the settings that token handlers use to validate certificates. Can be specified at the service-level or on a security token handler collection. These settings are overridden if a specific handler is configured with its own validator. Optional.| -|[\](issuernameregistry.md)|Configures the issuer name registry that is used by handlers in the token handler collection. Optional.| -|[\](issuertokenresolver.md)|Registers the issuer token resolver that is used by handlers in the token handler collection. The issuer token resolver is used to resolve the signing token on incoming tokens and messages. Optional.| -|[\](servicetokenresolver.md)|Registers the service token resolver that is used by handlers in the token handler collection. The service token resolver is used to resolve the encryption token on incoming tokens and messages. Optional.| -|[\](tokenreplaydetection.md)|Enables token replay detection and specifies the expiration time for tokens. Can be specified at the service-level or on a security token handler collection. Optional.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](securitytokenhandlers.md)|Specifies a collection of security token handlers that are registered with the endpoint.| - -## Remarks - - This section provides property values for a object. Settings configured in this section override those configured on the service. Some of these settings can, in turn, be overridden by settings that are specified when a handler is added to the security token handler collection. - -## Example - -```xml - - - - - - - - - - - - - - - - - - - - - - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/securitytokenhandlers.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/securitytokenhandlers.md deleted file mode 100644 index 3bfe1a67a9bc2..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/securitytokenhandlers.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: f11a631d-4094-4e11-bb03-4ede74b30281 -author: "BrucePerlerMS" ---- -# \ - -Specifies a collection of security token handlers that are registered with the endpoint. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|name|Specifies the name of a token handler collection. The only values recognized by the framework are "ActAs" and "OnBehalfOf". If token handler collections are specified with either of these names, the collection will be used when processing ActAs or OnBehalfOf tokens respectively.| - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](add.md)|Adds a security token handler to the token handler collection.| -|[\](clear.md)|Clears all security token handlers from the token handler collection.| -|[\](remove.md)|Removes a security token handler from the token handler collection.| -|[\](securitytokenhandlerconfiguration.md)|Provides configuration for the collection of token handlers.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](identityconfiguration.md)|Specifies service-level identity settings.| - -## Remarks - - You can specify one or more named collections of security token handlers in a service configuration. You can specify a name for a collection by using the `name` attribute. The only names that the framework handles are "ActAs" and "OnBehalfOf". If handlers exist in these collections, they are used by a security token service (STS) instead of the default handlers when processing `ActAs` and `OnBehalfOf` tokens. - - By default, the collection is populated with the following handler types: , , , , , , and . You can modify the collection by using the ``, ``, and `` elements. You must ensure that only a single handler of any particular type exists in the collection. For example, if you derive a handler from the class, either your handler or the may be configured in a single collection, but not both. - - Use the `` element to specify configuration settings for the handlers in the collection. Settings specified through this element override those specified on the service through the [\](identityconfiguration.md) element. Some handlers (including several of the built-in handler types) can support additional configuration through a child element of the `` element. Settings specified on a handler override equivalent settings specified on the collection or the service. diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/servicecertificate.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/servicecertificate.md deleted file mode 100644 index fa3f002c360a5..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/servicecertificate.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 42c7f291-2ec3-43c5-8872-35897ff3c660 -author: "BrucePerlerMS" ---- -# \ - -Configures the X.509 certificate that is used to encrypt and decrypt tokens. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel-services.md)\ -    [**\**](federationconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - - None - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](certificatereference.md)|Specifies settings that are used to find and validate an X.509 certificate in a certificate store.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](federationconfiguration.md)|Contains the settings that configure the (WSFAM) and the (SAM).| - -## Example - - The following XML shows the use of the \ element. The XML is taken from the `CustomToken` sample. - -```xml - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/servicetokenresolver.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/servicetokenresolver.md deleted file mode 100644 index dcea10ad4324d..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/servicetokenresolver.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 6e9001e1-e064-4f47-84b2-46225c177746 -author: "BrucePerlerMS" ---- -# \ - -Registers the service token resolver that is used by handlers in the token handler collection. The service token resolver is used to resolve the encryption token on incoming tokens and messages. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](securitytokenhandlerconfiguration.md)\ -          **\** - -## Syntax - -```xml - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|Specifies the type of the service token resolver. Either the type or a type that derives from the class. For more information about how to specify the `type` attribute, see [Custom Type References]. Required.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](securitytokenhandlerconfiguration.md)|Provides configuration for a collection of security token handlers.| - -## Remarks - - The service token resolver can be used to resolve the encryption token on incoming tokens and messages. It is used to retrieve the key that should be used to decrypt incoming tokens. You must specify the `type` attribute. The type specified can be either or a custom type that derives from the class. - - Some token handlers allow you to specify service token resolver settings in configuration. Settings on individual token handlers override those specified on the security token handler collection. - -> [!NOTE] -> Specifying the `` element as a child element of the [\](identityconfiguration.md) element has been deprecated, but is still supported for backward compatibility. Settings on the `` element override those on the `` element. - -## Example - -```xml - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessionsecuritytokencache.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessionsecuritytokencache.md deleted file mode 100644 index 897d05a3745cd..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessionsecuritytokencache.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: d43e676c-0153-485c-ab31-0257a2db7507 -author: "BrucePerlerMS" ---- -# \ - -Registers a cache for session tokens with a service or a security token handler collection. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](caches.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|A type that derives from the class.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](caches.md)|Registers the caches used by a service or a security token handler collection.| - -## Example - - The following XML shows the configuration of a custom cache for holding session security tokens (). The configuration is taken from the `ClaimsAwareWebFarm` sample. For more information about this sample, see [WIF Code Sample Index](/previous-versions/dotnet/framework/security/wif-code-sample-index). - -```xml - - - - - - -``` - -## See also - -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessiontokenrequirement.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessiontokenrequirement.md deleted file mode 100644 index 24d4abe5b716f..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/sessiontokenrequirement.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 496a1735-cbb7-49d5-a6aa-dd5550462073 -author: "BrucePerlerMS" ---- -# \ - -Provides configuration for the class or derived classes. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](add.md)\ -          **\** - -## Syntax - -```xml - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|lifetime|Specifies the lifetime of session tokens.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](add.md)|Adds the specified security token handler to the token handler collection.| - -## Example - -```xml - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/system-identitymodel-services.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/system-identitymodel-services.md deleted file mode 100644 index 81d9673874f5b..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/system-identitymodel-services.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: fa1624dd-2d74-4ae3-942e-498cee261ac5 -author: "BrucePerlerMS" ---- -# \ - -Configuration section for authentication using the WS-Federation protocol. - -[**\**](../configuration-element.md)\ -  **\** - -## Syntax - -```xml - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - - None - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](federationconfiguration.md)|Contains the settings that configure the (WSFAM) and the (SAM) HTTP modules.| - -### Parent Elements - - None - -## Remarks - - Add a `` section to your application’s configuration file to provide settings for the SAM and WSFAM. - -> [!IMPORTANT] -> When using the or the class to provide claims-based access control in your code, the claims authorization manager () and policy that is used to make authorization decisions are configured through an `` element that is implicitly or explicitly referenced from a `` element in this section. For more information, see the **Remarks** under the [\](federationconfiguration.md) element. - - The `` section is represented by the class. The collection of child `` elements configured in the section is represented by the class. - -## Example - - The following XML shows how to add a `` section to a configuration file. You must first add section declarations for both the `` section and the `` sections. (When you add a `` section, you should also add a declaration for the `` section to ensure that a default `` section can be created by the runtime if necessary.) After the section declarations have been added, you can configure federated authentication settings under the `` element. - -```xml - - -
-
- - - - - - - - - - - - -``` diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/system-identitymodel.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/system-identitymodel.md deleted file mode 100644 index 8fbde1a11a838..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/system-identitymodel.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 210ce7e9-d07b-400c-800f-5f525dcf95e8 -author: "BrucePerlerMS" ---- -# \ - -Provides configuration for enabling Windows Identity Foundation (WIF) options in applications. - -[**\**](../configuration-element.md)\ -  **\** - -## Syntax - -```xml - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - - None - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|[\](identityconfiguration.md)|Specifies service-level identity settings.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|``|The root element in every configuration file used by the common language runtime and .NET Framework applications.| - -## Remarks - - Add a `` section to the configuration file to configure a service or application to use Windows Identity Foundation (WIF). The `` element is represented by the class. - -## Example - - The following example shows how to add a `` section to a configuration file. You must first add the configuration section and namespace declaration under the `` element. Then you can add the `` element to your configuration file to specify one or more identity configurations. - -```xml - - - -
-
- - - ... - - - - - - - - - - - - - - - - ... - - -``` - -## See also - -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/toc.yml b/docs/framework/configure-apps/file-schema/windows-identity-foundation/toc.yml deleted file mode 100644 index 4cb6ac1dd1b6f..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/toc.yml +++ /dev/null @@ -1,89 +0,0 @@ -- name: WIF Configuration Schema - href: index.md - items: - - name: - href: system-identitymodel.md - items: - - name: - href: identityconfiguration.md - items: - - name: - href: caches.md - items: - - name: - href: sessionsecuritytokencache.md - - name: - href: tokenreplaycache.md - - name: - href: certificatevalidation.md - items: - - name: - href: certificatevalidator.md - - name: - href: claimsauthenticationmanager.md - - name: - href: claimsauthorizationmanager.md - - name: - href: claimtyperequired.md - items: - - name: - href: claimtype.md - - name: - href: securitytokenhandlers.md - items: - - name: - href: securitytokenhandlerconfiguration.md - items: - - name: - href: audienceuris.md - - name: - href: issuernameregistry.md - items: - - name: - href: trustedissuers.md - - name: - href: issuertokenresolver.md - - name: - href: servicetokenresolver.md - - name: - href: add.md - items: - - name: - href: x509securitytokenhandlerrequirement.md - - name: - href: usernamesecuritytokenhandlerrequirement.md - - name: - href: samlsecuritytokenrequirement.md - items: - - name: - href: nameclaimtype.md - - name: - href: roleclaimtype.md - - name: - href: sessiontokenrequirement.md - - name: - href: clear.md - - name: - href: remove.md - - name: - href: tokenreplaydetection.md - - name: - href: system-identitymodel-services.md - items: - - name: - href: federationconfiguration.md - items: - - name: - href: wsfederation.md - - name: - href: servicecertificate.md - items: - - name: - href: certificatereference.md - - name: - href: cookiehandler.md - items: - - name: - href: chunkedcookiehandler.md - - name: - href: customcookiehandler.md diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/tokenreplaycache.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/tokenreplaycache.md deleted file mode 100644 index b5c75864754ff..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/tokenreplaycache.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 1572ab23-6933-41b5-bfb4-0c4548145500 -author: "BrucePerlerMS" ---- -# \ - -Registers a token replay cache with a service or a security token handler collection. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](caches.md)\ -        **\** - -## Syntax - -```xml - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|type|A type that derives from the class. For more information about how to specify a custom `type`, see [Custom Type References]. - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](caches.md)|Registers the caches used by a service or a security token handler collection.| - -## Remarks - - The token replay cache is used to detect replayed tokens. Token replay detection is enabled by the [\](tokenreplaydetection.md) element, which also specifies the maximum expiration time for tokens. - -## Example - - The following XML shows the configuration of a custom cache for detecting replayed tokens. - -```xml - - - - -``` - -## See also - -- -- [\](tokenreplaydetection.md) diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/tokenreplaydetection.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/tokenreplaydetection.md deleted file mode 100644 index 1c2a0be5eacfc..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/tokenreplaydetection.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: ac3f588e-5f75-4275-b969-2d492ecc3b47 -author: "BrucePerlerMS" ---- -# \ - -Enables token replay detection and specifies the expiration time for tokens. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - - -``` - -## Type - - - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|enabled|A value that specifies whether token replay detection is enabled; "true" to enable token replay detection.| -|expirationPeriod|A that specifies the maximum amount of time before an item is considered expired and removed from the cache. For more information about how to specify values, see [Timespan Values](../windows-workflow-foundation/index.md).| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](identityconfiguration.md)|Specifies service-level identity settings.| -|[\](securitytokenhandlerconfiguration.md)|Provides configuration for a collection of security token handlers.| - -## Remarks - - A `` element can be specified at the service level under the `` element or on the security token handler collection level under the `` element. Settings on a token handler collection override those specified on the service. - - The type of the token replay cache is specified by the [\](tokenreplaycache.md) element. diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/trustedissuers.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/trustedissuers.md deleted file mode 100644 index 6ae29ae46df4b..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/trustedissuers.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: d818c917-07b4-40db-9801-8676561859fd -author: "BrucePerlerMS" ---- -# \ - -Configures the list of trusted issuer certificates used by the configuration-based issuer name registry (). - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](securitytokenhandlerconfiguration.md)\ -          [**\**](issuernameregistry.md)\ -            **\** - -## Syntax - -```xml - - - - - - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - - None - -### Child Elements - -|Element|Description| -|-------------|-----------------| -|``|Adds a certificate to the collection of trusted issuers. The certificate is specified with the `thumbprint` attribute. This attribute is required and should contain the ASN.1 encoded form of the certificate thumbprint. The `name` attribute is optional and can be used to specify a friendly name for the certificate.| -|``|Clears all certificates from the collection of trusted issuers.| -|``|Removes a certificate from the collection of trusted issuers. The certificate is specified with the `thumbprint` attribute. This attribute is required.| - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](issuernameregistry.md)|Configures the issuer name registry. **Important:** The `type` attribute of the `` element must reference the class for the `` element to be valid.| - -## Remarks - - Windows Identity Foundation (WIF) provides a single implementation of the class out of the box, the class. The configuration issuer name registry maintains a list of trusted issuers that is loaded from configuration. The list associates each issuer name with the X.509 certificate that is needed to verify the signature of tokens produced by the issuer. The list of trusted issuer certificates is specified under the `` element. Each element in the list associates a mnemonic issuer name with the X.509 certificate that is needed to verify the signature of tokens produced by that issuer. Trusted certificates are specified using the ASN.1 encoded form of the certificate thumbprint and are added the collection by using `` element. You can clear or remove issuers (certificates) from the list by using the `` and `` elements. - - The `type` attribute of the `` element must reference the class for the `` element to be valid. - -## Example - - The following XML shows how to specify the configuration based issuer name registry. - -```xml - - - - - -``` - -## See also - -- -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/usernamesecuritytokenhandlerrequirement.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/usernamesecuritytokenhandlerrequirement.md deleted file mode 100644 index 6373ae7773fb2..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/usernamesecuritytokenhandlerrequirement.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: 6ec3bac1-b014-49ae-843c-c54518cb709a -author: "BrucePerlerMS" ---- -# \ - -Provides configuration for the class or derived classes. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](add.md)\ -          **\** - -## Syntax - -```xml - - - - - - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|membershipProviderName|Specifies the that should be used by the security token handler.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](add.md)|Adds the specified security token handler to the token handler collection.| - -## Remarks - - The `` element sets the property when a object is initialized from configuration. - -## Example - -```xml - - " -title: "" -ms.date: "03/30/2017" -ms.assetid: c537f770-68bd-4f82-96ad-6424ad91369f -author: "BrucePerlerMS" ---- -# \ - -Provides configuration for the (WSFAM). - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel-services.md)\ -    [**\**](federationconfiguration.md)\ -      **\** - -## Syntax - -```xml - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|authenticationType|A URI that specifies the authentication type. Sets the WS-Federation sign-in request wauth parameter. Optional. The default is an empty string, which specifies that the wauth parameter is not included in the request.| -|freshness|The desired maximum age of authentication requests, in minutes. Sets the WS-Federation sign-in request wfresh parameter. Optional. The default is zero. Optional. **Warning:** In the next release of .NET Framework 4.5, the `freshness` attribute will be of type `xs:string` and its default value will be `null`.| -|homeRealm|The home realm of the identity provider (IdP) to use for authentication. Sets the WS-Federation sign-in request whr parameter. Optional. The default is an empty string, which specifies that the whr parameter is not included in the request.| -|issuer|The URI of the intended token issuer. Sets the base URL of WS-Federation sign-in requests and sign-out requests Required.| -|persistentCookiesOnPassiveRedirects|Specifies whether persistent cookies are issued on authentication. Optional. The default is "false", cookies are not issued.| -|passiveRedirectEnabled|Specifies whether the WSFAM is enabled to automatically redirect unauthorized requests to an STS. Optional. The default is "true", unauthorized requests are automatically redirected.| -|policy|A URL that specifies the location of the relevant policy to use on sign-in requests. The default is an empty string. Sets the WS-Federation sign-in request wp parameter. Optional. The default is an empty string, which specifies that the wp parameter is not included in the request.| -|realm|The URI of the requesting realm. (A URI that identifies the relying party (RP) to the security token service (STS).) Sets the request wtrealm WS-Federation sign-in request parameter. Required.| -|reply|A URL that identifies the address at which the relying party (RP) application would like to receive replies from the Security Token Service (STS). Sets the WS-Federation sign-in request wreply parameter. Optional. The default is an empty string, which specifies that the wreply parameter is not included in the request.| -|request|The token issuance request. Sets the WS-Federation sign-in request wreq parameter. Optional. The default is an empty string, which specifies that the wreq parameter is not included in the request. Not including the wreq or the wreqptr parameter in the request implies that the STS knows what kind of token to issue.| -|requestPtr|A URL that specifies the location of the token issuance request. Sets the request wreqptr parameter. Optional. The default is an empty string, which specifies that the wreqptr parameter is not included in the request. Not including the wreq or the wreqptr parameter in the request implies that the STS knows what kind of token to issue.| -|requireHttps|Specifies whether communication with the security token service (STS) must use HTTPS protocol. Optional. The default is "true", HTTPS must be used.| -|resource|A URI that identifies the resource being accessed, the relying party (RP), to the to the security token service (STS). Optional. Sets the WS-Federation sign-in request wres parameter. Optional. The default is an empty string, which specifies that the wres parameter is not included in the request. **Note:** wres is a legacy parameter. Specify the `realm` attribute to use the wtrealm parameter instead.| -|signInQueryString|Provides an extensibility point to specify application defined query parameters in the WS-Federation sign-in request URL. Optional. The default is an empty string, which specifies that no additional parameters should be included in the request. The parameters are specified as a query string fragment using the following form: `"param1=value1¶m2=value2¶m3=value3"` and so on. **Note:** In a configuration file the ‘&" character in the query string must be specified using its entity reference, `&`.| -|signOutQueryString|Provides an extensibility point to specify application defined query parameters in the WS-Federation sign-in request URL. Optional. The default is an empty string, which specifies that no additional parameters should be included in the request. The parameters are specified as a query string fragment using the following form: `"param1=value1¶m2=value2¶m3=value3"` and so on. **Note:** In a configuration file the ‘&" character in the query string must be specified using its entity reference, `&`.| -|signOutReply|Specifies the URL to which the client should be redirected by the security token service (STS) during passive sign-out through the WS-Federation protocol. Sets the wreply parameter on a WS-Federation sign-out request. Optional. The default is an empty string, which specifies that no additional parameters should be included in the request.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](federationconfiguration.md)|Contains the settings that configure the (WSFAM) and the (SAM).| - -## Remarks - - You can use the `` element to configure default WS-Federation parameter settings and default behavior for the WSFAM. WS-Federation parameter settings defined under the `` element set equivalent properties exposed by the class. These properties remain the same for every request issued by the WSFAM. You can change the WS-Federation parameters dynamically during request processing by adding event handlers for the events exposed by WSFAM; for example, the event. For more information, see the documentation for the class. - - The `` element is represented by the class. The configuration object itself is represented by the class. A single instance is set on the object that is accessed through the property and provides configuration for the WSFAM. - -## Example - - The following XML shows a `` element that specifies settings for the WSFAM. - -> [!WARNING] -> In this example, the WSFAM is not required to use HTTPS. This is because the `requireHttps` attribute on the `` element is set `false`. This setting is not recommended for most production environments as it may present a security risk. - -```xml - -``` - -## See also - -- -- diff --git a/docs/framework/configure-apps/file-schema/windows-identity-foundation/x509securitytokenhandlerrequirement.md b/docs/framework/configure-apps/file-schema/windows-identity-foundation/x509securitytokenhandlerrequirement.md deleted file mode 100644 index ce5c5237884d1..0000000000000 --- a/docs/framework/configure-apps/file-schema/windows-identity-foundation/x509securitytokenhandlerrequirement.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -description: "Learn more about: " -title: "" -ms.date: "03/30/2017" -ms.assetid: aca22c2c-5ae7-42af-9bbd-15c2524692ce -author: "BrucePerlerMS" ---- -# \ - -Provides optional configuration for the class or derived classes. - -[**\**](../configuration-element.md)\ -  [**\**](system-identitymodel.md)\ -    [**\**](identityconfiguration.md)\ -      [**\**](securitytokenhandlers.md)\ -        [**\**](add.md)\ -          **\** - -## Syntax - -```xml - - - - - - mapToWindows=xs:boolean - certificateValidationMode="None||ChainTrust||PeerTrust||PeerOrChainTrust||Custom" - certificateValidator="Namespace.Class, Assembly" - revocationMode="NoCheck||Offline||Online" - trustedStoreLocation="CurrentUser||LocalMachine" - - - - - -``` - -## Attributes and Elements - - The following sections describe attributes, child elements, and parent elements. - -### Attributes - -|Attribute|Description| -|---------------|-----------------| -|certificateValidationMode|An value that specifies the validation mode to use for the X.509 certificate. The default value is "PeerOrChainTrust".| -|mapToWindows|Specifies whether the token handler should map the validating token to a Windows account by using the incoming UPN claim. The default is "false".| -|revocationMode|An value that specifies the revocation mode to use for the X.509 certificate. The default value is "Online".| -|trustedStoreLocation|A value that specifies the X.509 certificate store. The default value is "LocalMachine".| -|certificateValidator|A custom type that derives from . If the `certificateValidationMode` attribute is "Custom", an instance of this type is used for issuer certificate validation.| - -### Child Elements - - None - -### Parent Elements - -|Element|Description| -|-------------|-----------------| -|[\](add.md)|Adds the specified security token handler to the token handler collection.| - -## Example - -```xml - - - -``` diff --git a/docs/framework/configure-apps/how-to-enable-and-disable-automatic-binding-redirection.md b/docs/framework/configure-apps/how-to-enable-and-disable-automatic-binding-redirection.md index 6455b114e4176..80f8fc6cb59c8 100644 --- a/docs/framework/configure-apps/how-to-enable-and-disable-automatic-binding-redirection.md +++ b/docs/framework/configure-apps/how-to-enable-and-disable-automatic-binding-redirection.md @@ -9,11 +9,13 @@ ms.assetid: 5fca42f3-bdce-4b81-a704-61e42c89d3ba --- # How to: Enable and Disable Automatic Binding Redirection -When you compile apps in Visual Studio that target the .NET Framework 4.5.1 and later versions, binding redirects may be automatically added to the app configuration file to override assembly unification. Binding redirects are added if your app or its components reference more than one version of the same assembly, even if you manually specify binding redirects in the configuration file for your app. The automatic binding redirection feature affects desktop apps and web apps that target the .NET Framework 4.5.1 or a later version, although the behavior is slightly different for a web app. You can enable automatic binding redirection if you have existing apps that target previous versions of the .NET Framework, or you can disable this feature if you want to manually author binding redirects. +When you compile apps in Visual Studio that target .NET Framework 4.5.1 and later versions, binding redirects may be automatically added to the app configuration file to override assembly unification. Binding redirects are added if your app or its components reference more than one version of the same assembly, even if you manually specify binding redirects in the configuration file for your app. The automatic binding redirection feature affects desktop apps and web apps that target .NET Framework 4.5.1 or a later version, although the behavior is slightly different for a web app. You can enable automatic binding redirection if you have existing apps that target previous versions of the .NET Framework, or you can disable this feature if you want to manually author binding redirects. + +[!INCLUDE [net-framework-vs](../../../includes/net-framework-vs.md)] ## Disable automatic binding redirects in desktop apps -Automatic binding redirects are enabled by default for Windows desktop apps that target the .NET Framework 4.5.1 and later versions. The binding redirects are added to the output configuration (**app.config**) file when the app is compiled and override the assembly unification that might otherwise take place. The source **app.config** file is not modified. You can disable this feature by modifying the project file for the app or by deselecting a checkbox in the project's properties in Visual Studio. +Automatic binding redirects are enabled by default for Windows desktop apps that target .NET Framework 4.5.1 and later versions. The binding redirects are added to the output configuration (**app.config**) file when the app is compiled and override the assembly unification that might otherwise take place. The source **app.config** file is not modified. You can disable this feature by modifying the project file for the app or by deselecting a checkbox in the project's properties in Visual Studio. ### Disable through project properties diff --git a/docs/framework/configure-apps/redirect-assembly-versions.md b/docs/framework/configure-apps/redirect-assembly-versions.md index e4fd8fdcc3231..f4f5f7e4e3bc5 100644 --- a/docs/framework/configure-apps/redirect-assembly-versions.md +++ b/docs/framework/configure-apps/redirect-assembly-versions.md @@ -57,7 +57,7 @@ You can redirect compile-time binding references to .NET Framework assemblies, t ### Rely on automatic binding redirection -When you create a desktop app in Visual Studio that targets the .NET Framework 4.5.1 or a later version, the app uses automatic binding redirection. This means that if two components reference different versions of the same strong-named assembly, the runtime automatically adds a binding redirection to the newer version of the assembly in the output app configuration (app.config) file. This redirection overrides the assembly unification that might otherwise take place. The source app.config file is not modified. For example, let's say that your app directly references an out-of-band .NET Framework component but uses a third-party library that targets an older version of the same component. When you compile the app, the output app configuration file is modified to contain a binding redirection to the newer version of the component. If you create a web app, you receive a build warning regarding the binding conflict, which in turn, gives you the option to add the necessary binding redirect to the source web configuration file. +When you create a desktop app in Visual Studio that targets .NET Framework 4.5.1 or a later version, the app uses automatic binding redirection. This means that if two components reference different versions of the same strong-named assembly, the runtime automatically adds a binding redirection to the newer version of the assembly in the output app configuration (app.config) file. This redirection overrides the assembly unification that might otherwise take place. The source app.config file is not modified. For example, let's say that your app directly references an out-of-band .NET Framework component but uses a third-party library that targets an older version of the same component. When you compile the app, the output app configuration file is modified to contain a binding redirection to the newer version of the component. If you create a web app, you receive a build warning regarding the binding conflict, which in turn, gives you the option to add the necessary binding redirect to the source web configuration file. If you manually add binding redirects to the source app.config file, at compile time, Visual Studio tries to unify the assemblies based on the binding redirects you added. For example, let's say you insert the following binding redirect for an assembly: diff --git a/docs/framework/cross-platform/app-resources-for-libraries-that-target-multiple-platforms.md b/docs/framework/cross-platform/app-resources-for-libraries-that-target-multiple-platforms.md deleted file mode 100644 index f3d566b5b3e89..0000000000000 --- a/docs/framework/cross-platform/app-resources-for-libraries-that-target-multiple-platforms.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -description: "Learn more about: App Resources for Libraries That Target Multiple Platforms" -title: "App Resources for Libraries That Target Multiple Platforms" -ms.date: "07/18/2018" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "multiple platforms, resources for" - - "resources [.NET Framework]" - - ".NET Framework, resources when targeting multiple platforms" - - "resources, for multiple platforms" - - "targeting multiple platforms, resources for" -ms.assetid: 72c76f0b-7255-4576-9261-3587f949669c ---- -# App Resources for Libraries That Target Multiple Platforms - -You can use the .NET Framework [Portable Class Library](portable-class-library.md) project type to ensure that resources in your class libraries can be accessed from multiple platforms. This project type is available in Visual Studio 2012 and targets the portable subset of the .NET Framework class library. Using a Portable Class Library ensures that your library can be accessed from desktop apps, Silverlight apps, Windows Phone apps, and Windows 8.x Store apps. - -[!INCLUDE[standard](../../../includes/pcl-to-standard.md)] - - The Portable Class Library project makes only a very limited subset of the types in the namespace available to your application, but it does allow you to use the class to retrieve resources. However, if you are creating an app by using Visual Studio, you should use the strongly typed wrapper created by Visual Studio instead of using the class directly. - - To create a strongly typed wrapper in Visual Studio, set the main resource file's **Access Modifier** in the Visual Studio Resource Designer to **Public**. This creates a [resourceFileName].designer.cs or [resourceFileName].designer.vb file that contains the strongly typed ResourceManager wrapper. For more information about using a strongly typed resource wrapper, see the "Generating a Strongly Typed Resource Class" section in the [Resgen.exe (Resource File Generator)](../../framework/tools/resgen-exe-resource-file-generator.md) topic. - -## Resource Manager in the Portable Class Library - - In a Portable Class Library project, all access to resources is handled by the class. Because types in the namespace, such as and , are not accessible from a Portable Class Library project, they cannot be used to access resources. - - The Portable Class Library project includes the four members listed in the following table. These constructors and methods enable you to instantiate a object and retrieve string resources. - -|`ResourceManager` member|Description| -|------------------------------|-----------------| -||Creates a instance to access the named resource file found in the specified assembly.| -||Creates a instance that corresponds to the specified type.| -||Retrieves a named resource for the current culture.| -||Retrieves a named resource belonging to the specified culture.| - - The exclusion of other members from the Portable Class Library means that serialized objects, non-string data, and images cannot be retrieved from a resource file. To use resources from a Portable Class Library, you should store all object data in string form. For example, you can store numeric values in a resource file by converting them to strings, and you can retrieve them and then convert them back to numbers by using the numeric data type's `Parse` or `TryParse` method. You can convert images or other binary data to a string representation by calling the method, and restore them to a byte array by calling the method. - -## The Portable Class Library and Windows Store Apps - - Portable Class Library projects store resources in .resx files, which are then compiled into .resources files and embedded in the main assembly or in satellite assemblies at compile time. Windows 8.x Store apps, on the other hand, require resources to be stored in .resw files, which are then compiled into a single package resource index (PRI) file. However, despite the incompatible file formats, your Portable Class Library will work in a Windows 8.x Store app. - - To consume your class library from a Windows 8.x Store app, add a reference to it in your Windows Store app project. Visual Studio will transparently extract the resources from your assembly into a .resw file and use it to generate a PRI file from which the Windows Runtime can extract resources. At run time, the Windows Runtime executes the code in your Portable Class Library, but it retrieves your Portable Class Library's resources from the PRI file. - - If your Portable Class Library project includes localized resources, you use the hub-and-spoke model to deploy them just as you would for a library in a desktop app. To consume your main resource file and any localized resource files in your Windows 8.x Store app, you add a reference to the main assembly. At compile time, Visual Studio extracts the resources from your main resource file and any localized resource files into separate .resw files. It then compiles the .resw files into a single PRI file that the Windows Runtime accesses at run time. - - - -## Example: Non-Localized Portable Class Library - - The following simple, non-localized Portable Class Library example uses resources to store the names of columns and to determine the number of characters to reserve for tabular data. The example uses a file named LibResources.resx to store the string resources listed in the following table. - -|Resource name|Resource value| -|-------------------|--------------------| -|Born|Birthdate| -|BornLength|12| -|Hired|Hire Date| -|HiredLength|12| -|ID|ID| -|ID.Length|12| -|Name|Name| -|NameLength|25| -|Title|Employee Database| - - The following code defines a `UILibrary` class that uses the Resource Manager wrapper named `resources` generated by Visual Studio when the **Access Modifier** for the file is changed to **Public**. The UILibrary class parses the string data as necessary. . Note that the class is in the `MyCompany.Employees` namespace. - - [!code-csharp[Conceptual.Resources.Portable#1](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/uilibrary.cs#1)] - [!code-vb[Conceptual.Resources.Portable#1](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.resources.portable/vb/uilibrary.vb#1)] - - The following code illustrates how the `UILibrary` class and its resources can be accessed from a console-mode app. It requires a reference to UILibrary.dll to be added to the console app project. - - [!code-csharp[Conceptual.Resources.Portable#2](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program.cs#2)] - [!code-vb[Conceptual.Resources.Portable#2](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.resources.portable/vb/module1.vb#2)] - - The following code illustrates how the `UILibrary` class and its resources can be accessed from a Windows 8.x Store app. It requires a reference to UILibrary.dll to be added to the Windows Store app project. - - [!code-csharp[Conceptual.Resources.PortableMetro#1](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetro/cs/blankpage.xaml.cs#1)] - -## Example: Localized Portable Class Library - - The following localized Portable Class Library example includes resources for the French (France) and English (United States) cultures. The English (United States) culture is the app's default culture; its resources are shown in the table in the [previous section](app-resources-for-libraries-that-target-multiple-platforms.md#NonLoc). The resources file for the French (France) culture is named LibResources.fr-FR.resx and consists of the string resources listed in the following table. The source code for the `UILibrary` class is the same as that shown in the previous section. - -|Resource name|Resource value| -|-------------------|--------------------| -|Born|Date de naissance| -|BornLength|20| -|Hired|Date embauché| -|HiredLength|16| -|ID|ID| -|Name|Nom| -|Title|Base de données des employés| - - The following code illustrates how the `UILibrary` class and its resources can be accessed from a console-mode app. It requires a reference to UILibrary.dll to be added to the console app project. - - [!code-csharp[Conceptual.Resources.Portable#3](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portable/cs/program2.cs#3)] - [!code-vb[Conceptual.Resources.Portable#3](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.resources.portable/vb/module2.vb#3)] - - The following code illustrates how the `UILibrary` class and its resources can be accessed from a Windows 8.x Store app. It requires a reference to UILibrary.dll to be added to the Windows Store app project. It uses the static `ApplicationLanguages.PrimaryLanguageOverride` property to set the app's preferred language to French. - - [!code-csharp[Conceptual.Resources.PortableMetroLoc#1](../../../samples/snippets/csharp/VS_Snippets_CLR/conceptual.resources.portablemetroloc/cs/blankpage.xaml.cs#1)] - [!code-vb[Conceptual.Resources.PortableMetroLoc#1](../../../samples/snippets/visualbasic/VS_Snippets_CLR/conceptual.resources.portablemetroloc/vb/blankpage.xaml.vb#1)] - -## See also - -- -- [Resources in Desktop Apps](../../framework/resources/index.md) -- [Packaging and Deploying Resources](../../framework/resources/packaging-and-deploying-resources-in-desktop-apps.md) diff --git a/docs/framework/cross-platform/index.md b/docs/framework/cross-platform/index.md deleted file mode 100644 index 67ceda90940b0..0000000000000 --- a/docs/framework/cross-platform/index.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -description: "Learn more about: Develop for multiple platforms with .NET Framework" -title: "Developing for Multiple Platforms with .NET Framework" -ms.date: 10/21/2020 -ms.assetid: b153baaa-130c-4169-860b-e580591de91e ---- -# Develop for multiple platforms with .NET Framework - -You can develop apps for both Microsoft and non-Microsoft platforms by using .NET Framework and Visual Studio. - -[!INCLUDE [net-framework-future](../../../includes/net-framework-future.md)] - -## Options for cross-platform development - -[!INCLUDE[standard](../../../includes/pcl-to-standard.md)] - -To develop for multiple platforms, you can share source code or binaries, and you can make calls between .NET Framework code and Windows Runtime APIs. - -|If you want to...|Use...| -|-----------------------|------------| -|Share source code between Windows Phone 8.1 and Windows 8.1 apps|**Shared projects** (Universal Apps template in Visual Studio 2013, Update 2).

- Currently no Visual Basic support.
- You can separate platform-specific code by using #`if` statements.

For details, see:

- [Start coding](/windows/uwp/get-started/create-uwp-apps)
- [Using Visual Studio to build Universal XAML Apps](https://devblogs.microsoft.com/visualstudio/using-visual-studio-to-build-universal-xaml-apps/) (blog post)
- [Using Visual Studio to Build XAML Converged Apps](https://channel9.msdn.com/Events/Build/2014/3-591) (video)| -|Share binaries between apps that target different platforms|**Portable Class Library projects** for code that is platform-agnostic.

- This approach is typically used for code that implements business logic.
- You can use Visual Basic or C#.
- API support varies by platform.
- Portable Class Library projects that target Windows 8.1 and Windows Phone 8.1 support Windows Runtime APIs and XAML. These features aren't available in older versions of the Portable Class Library.
- If needed, you can abstract out platform-specific code by using interfaces or abstract classes.

For details, see:

- [Portable Class Library](portable-class-library.md)
- [How to Make Portable Class Libraries Work for You](/archive/blogs/dsplaisted/how-to-make-portable-class-libraries-work-for-you) (blog post)
- [Using Portable Class Library with MVVM](using-portable-class-library-with-model-view-view-model.md)
- [App Resources for Libraries That Target Multiple Platforms](app-resources-for-libraries-that-target-multiple-platforms.md)
- [.NET Portability Analyzer](https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilityAnalyzer) (Visual Studio extension)| -|Share source code between apps for platforms other than Windows 8.1 and Windows Phone 8.1|**Add as link** feature.

- This approach is suitable for app logic that's common to both apps but not portable, for some reason. You can use this feature for C# or Visual Basic code.
For example, Windows Phone 8 and Windows 8 share Windows Runtime APIs, but Portable Class Libraries do not support Windows Runtime for those platforms. You can use `Add as link` to share common Windows Runtime code between a Windows Phone 8 app and a Windows Store app that targets Windows 8.

For details, see:

- [Share code with Add as Link](/previous-versions/windows/apps/jj714082(v=vs.105))
- [How to: Add Existing Items to a Project](/previous-versions/visualstudio/visual-studio-2010/9f4t9t92(v=vs.100))| -|Write Windows Store apps using the .NET Framework or call Windows Runtime APIs from .NET Framework code|**Windows Runtime APIs** from your .NET Framework C# or Visual Basic code, and use the .NET Framework to create Windows Store apps. You should be aware of API differences between the two platforms. However, there are classes to help you work with those differences.

For details, see:

- [.NET Framework Support for Windows Store Apps and Windows Runtime](support-for-windows-store-apps-and-windows-runtime.md)
- [Passing a URI to the Windows Runtime](passing-a-uri-to-the-windows-runtime.md)
-
- | -|Build .NET Framework apps for non-Microsoft platforms|**Portable Class Library reference assemblies** in the .NET Framework, and a Visual Studio extension or third-party tool such as Xamarin.

For details, see:

- [Portable Class Library now available on all platforms.](https://devblogs.microsoft.com/dotnet/portable-class-library-pcl-now-available-on-all-platforms/) (blog post)
- [Xamarin documentation](/xamarin)| -|Use JavaScript and HTML for cross-platform development|**Universal App templates** in Visual Studio 2013, Update 2 to develop against Windows Runtime APIs for Windows 8.1 and Windows Phone 8.1. Currently, you can't use JavaScript and HTML with .NET Framework APIs to develop cross-platform apps.

For details, see:

- [JavaScript Project Templates](/previous-versions/windows/apps/hh758331(v=win.10))
- [Porting a Windows Runtime app using JavaScript to Windows Phone](/previous-versions/windows/apps/dn636144(v=win.10))| diff --git a/docs/framework/cross-platform/media/add-portable-class-library.png b/docs/framework/cross-platform/media/add-portable-class-library.png deleted file mode 100644 index 8925c3ecaf1fe..0000000000000 Binary files a/docs/framework/cross-platform/media/add-portable-class-library.png and /dev/null differ diff --git a/docs/framework/cross-platform/media/pcl-project-properties.png b/docs/framework/cross-platform/media/pcl-project-properties.png deleted file mode 100644 index 81f08ba39fbb7..0000000000000 Binary files a/docs/framework/cross-platform/media/pcl-project-properties.png and /dev/null differ diff --git a/docs/framework/cross-platform/media/using-portable-class-library-with-model-view-view-model/mvvm-share-assemblies-across-platforms.png b/docs/framework/cross-platform/media/using-portable-class-library-with-model-view-view-model/mvvm-share-assemblies-across-platforms.png deleted file mode 100644 index c08eb915aee7f..0000000000000 Binary files a/docs/framework/cross-platform/media/using-portable-class-library-with-model-view-view-model/mvvm-share-assemblies-across-platforms.png and /dev/null differ diff --git a/docs/framework/cross-platform/passing-a-uri-to-the-windows-runtime.md b/docs/framework/cross-platform/passing-a-uri-to-the-windows-runtime.md deleted file mode 100644 index f98f5e59bdfc0..0000000000000 --- a/docs/framework/cross-platform/passing-a-uri-to-the-windows-runtime.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: "Learn more about: Passing a URI to the Windows Runtime" -title: "Passing a URI to the Windows Runtime" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "Windows Runtime, .NET Framework support for" - - "Windows Runtime, passing a URI to" -ms.assetid: 3eb5ce6f-f304-4f87-8e81-0f25092f5ad4 ---- -# Passing a URI to the Windows Runtime - -Windows Runtime methods accept only absolute URIs. If you pass a relative URI to a Windows Runtime method, an exception is thrown. Here's why: When you use the Windows Runtime in .NET Framework code, the class appears as in Intellisense. The class allows relative URIs, but the class does not. This is also true for methods you expose in Windows Runtime Components. If your component exposes a method that takes a URI, the signature in your code includes . However, to users of your component, the signature includes . A URI that is passed to your component must be an absolute URI. - -This topic shows how to detect an absolute URI and how to create one when referring to a resource in the app package. - -## Detecting and using an absolute URI - -Use the property to ensure that a URI is absolute before passing it to the Windows Runtime. Using this property is more efficient than catching and handling the exception. - -## Using an absolute URI for a resource in the app package - -If you want to specify a URI for a resource that your app package contains, you can use the `ms-appx` or `ms-appx-web` scheme to create an absolute URI. - -The following example shows how to set the property for a control and the property for an control to resources that are contained in a folder named Pages, using both XAML and code. - -[!code-xaml[System.URIToWindowsURI#1](../../../samples/snippets/csharp/VS_Snippets_CLR_System/system.uritowindowsuri/cs/mainpage.xaml#1)] -[!code-csharp[System.URIToWindowsURI#2](../../../samples/snippets/csharp/VS_Snippets_CLR_System/system.uritowindowsuri/cs/mainpage.xaml.cs#2)] -[!code-vb[System.URIToWindowsURI#2](../../../samples/snippets/visualbasic/VS_Snippets_CLR_System/system.uritowindowsuri/vb/mainpage.xaml.vb#2)] - -For more information about these schemes, see [URI schemes](/windows/uwp/app-resources/uri-schemes) in the Windows Dev Center. - -## See also - -- [.NET Framework Support for Windows Store Apps and Windows Runtime](support-for-windows-store-apps-and-windows-runtime.md) diff --git a/docs/framework/cross-platform/portable-class-library.md b/docs/framework/cross-platform/portable-class-library.md deleted file mode 100644 index 9a90158767000..0000000000000 --- a/docs/framework/cross-platform/portable-class-library.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: "Cross-Platform Development with the Portable Class Library" -description: Build cross-platform apps and libraries for Microsoft platforms quickly and easily using the Portable Class Library project type in .NET. -ms.date: 09/17/2018 -helpviewer_keywords: - - "Portable Class Library [.NET Framework]" - - "targeting multiple platforms" - - "multiple platforms, targeting" -ms.assetid: c31e1663-c164-4e65-b66d-d3aa8750a154 ---- -# Cross-platform development with the Portable Class Library - -The Portable Class Library project type in Visual Studio helps you build cross-platform apps and libraries for Microsoft platforms quickly and easily. - -[!INCLUDE[standard](../../../includes/pcl-to-standard.md)] - -Portable class libraries can help you reduce the time and costs of developing and testing code. Use this project type to write and build portable .NET Framework assemblies, and then reference those assemblies from apps that target multiple platforms such as the .NET Framework, iOS, or Mac. - -Even after you create a Portable Class Library project in Visual Studio and start developing it, you can change the target platforms. Visual Studio compiles your library with the new assemblies, which helps you identify the changes you need to make in your code. - -## Create a Portable Class Library project - -To create a Portable Class Library, use the template provided in Visual Studio. Create a new project (**File** > **New Project**), and in the **New Project** dialog box, select your programming language (Visual C# or Visual Basic). Then, select the **Class Library (Legacy Portable)** template. Enter a name for your project and choose **OK**. - -The **Add Portable Class Library** dialog box appears. Choose two or more targets, and then choose **OK**. - -![Add portable class library targets in Visual Studio](media/add-portable-class-library.png) - -## Change targets - -You can change the target platforms of a portable class library project when you create it or after you've started development. If you want to change the targets after you've created your project, in **Solution Explorer**, open the shortcut menu for your Portable Class Library project (not the solution), and then choose **Properties**. On the project properties page, the **Library** tab shows the platforms that your project currently targets. - -![Project properties for Portable Class Library in Visual Studio](media/pcl-project-properties.png) - -To add or remove targets, choose the **Change** button, and then select and clear the appropriate check boxes. - -When you change the targets, the APIs that are available to you for developing your project will change to match your selection. Visual Studio reports the errors and warnings that may occur as a result of the targets changing. - -If you want to evaluate the portability of your assemblies before you make changes in Visual Studio, you can use the [.NET Portability Analyzer](https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilityAnalyzer). - -## Supported types and members - -The types and members that are available in Portable Class Library projects are constrained by several compatibility factors: - -- They must be shared across the targets you selected. - -- The must behave similarly across those targets. - -- They must not be candidates for deprecation. - -- They must make sense in a portable environment, especially when supporting members are not portable. - -If a member is supported in the Portable Class Library and for your selected targets, it will appear in your project in IntelliSense. However, remember that an API may be supported in the Portable Class Library, but whether you can use the API depends on the targets you select. - -## API differences in the Portable Class Library - -To make Portable Class Library assemblies compatible across all supported platforms, some members have been slightly changed in the Portable Class Library. - -## Use the Portable Class Library - -After you build your Portable Class Library project, you just reference it from other projects. You can reference either the project or specific assemblies that contain the classes you want to access. - -To run an app that references a Portable Class Library assembly, the required version (or later) of the targeted platforms must be installed on your computer. Visual Studio contains all the required frameworks, so you can run the app without further modification on the computer that you used to develop the app. - -### Deploy a Universal Windows app - -When you create a Universal Windows app that references a Portable Class Library assembly, everything you need to deploy the app is included in the app package, and no further steps are required. - -### Deploy a .NET Framework app - -When you deploy a .NET Framework app that references a Portable Class Library assembly, you must specify a dependency on the correct version of the .NET Framework. By specifying this dependency, you ensure that the required version is installed with your app. - -- To create a dependency with ClickOnce deployment: In **Solution Explorer**, choose the project node for the project you want to publish. (This is the project that references the Portable Class Library project.) On the menu bar, choose **Project** > **Properties**, and then choose the **Publish** tab. On the **Publish** page, choose **Prerequisites**. Select the required .NET Framework version as a prerequisite. - -- To create a dependency with a setup project: In **Solution Explorer**, choose the setup project. On the menu bar, choose **Project** > **Properties** > **Prerequisites**. Select the required .NET Framework version as a prerequisite. - -For more information about deploying .NET Framework apps, see [Deployment Guide for Developers](../../framework/deployment/deployment-guide-for-developers.md). - -## See also - -- [Using Portable Class Library with MVVM](using-portable-class-library-with-model-view-view-model.md) -- [App Resources for Libraries That Target Multiple Platforms](app-resources-for-libraries-that-target-multiple-platforms.md) -- [.NET Portability Analyzer](https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilityAnalyzer) -- [.NET Framework Support for Windows Store Apps and Windows Runtime](support-for-windows-store-apps-and-windows-runtime.md) -- [Deployment](../../framework/deployment/net-framework-applications.md) diff --git a/docs/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime.md b/docs/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime.md deleted file mode 100644 index cdc1293918a51..0000000000000 --- a/docs/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime.md +++ /dev/null @@ -1,159 +0,0 @@ ---- -description: "Learn more about: .NET Framework Support for Microsoft Store Apps and Windows Runtime" -title: ".NET Framework Support for Microsoft Store Apps and Windows Runtime" -ms.date: "03/30/2017" -helpviewer_keywords: - - "Windows Store apps, .NET Framework support for" - - "Windows Runtime, .NET Framework support for" - - ".NET for Windows Store apps" - - ".NET Framework, and Windows Store apps" - - ".NET Framework, and Windows Runtime" -ms.assetid: 6fa7d044-ae12-4c54-b8ee-50915607a565 ---- -# .NET Framework Support for Microsoft Store Apps and Windows Runtime - -The .NET Framework 4.5 supports a number of software development scenarios with the Windows Runtime. These scenarios fall into three categories: - -- Developing Windows 8.x Store apps with XAML controls, as described in [Roadmap for Windows Store apps using C# or Visual Basic](/previous-versions/windows/apps/br229583(v=win.10)), [How tos (XAML)](/previous-versions/windows/apps/br229566(v=win.10)), and [.NET for Windows Store apps overview](/previous-versions/windows/apps/br230302(v=vs.140)). - -- Developing class libraries to use in the Windows 8.x Store apps that you create with the .NET Framework. - -- Developing Windows Runtime Components, packaged in .WinMD files, that can be used by any programming language that supports the Windows Runtime. For example, see [Creating Windows Runtime Components in C# and Visual Basic](/windows/uwp/winrt-components/creating-windows-runtime-components-in-csharp-and-visual-basic). - -This article outlines the support that the .NET Framework provides for all three categories, and describes the scenarios for Windows Runtime Components. The first section includes basic information about the relationship between the .NET Framework and the Windows Runtime, and explains some oddities you might encounter in the Help system and the IDE. The [second section](#WindowsRuntimeComponents) discusses scenarios for developing Windows Runtime Components. - -## The Basics - -The .NET Framework supports the three development scenarios listed earlier by providing .NET for Windows 8.x Store apps, and by supporting the Windows Runtime itself. - -- [.NET Framework and Windows Runtime namespaces](/previous-versions/windows/apps/br230302(v=vs.140)#net-framework-and-windows-runtime-namespaces) provides a streamlined view of the .NET Framework class libraries and include only the types and members you can use to create Windows 8.x Store apps and Windows Runtime Components. - - - When you use Visual Studio (Visual Studio 2012 or later) to develop a Windows 8.x Store app or a Windows Runtime component, a set of reference assemblies ensures that you see only the relevant types and members. - - - This streamlined API set is simplified further by the removal of features that are duplicated within the .NET Framework or that duplicate Windows Runtime features. For example, it contains only the generic versions of collection types, and the XML document object model is eliminated in favor of the Windows Runtime XML API set. - - - Features that simply wrap the operating system API are also removed, because the Windows Runtime is easy to call from managed code. - - To read more about the .NET for Windows 8.x Store apps, see the [.NET for Windows Store apps overview](/previous-versions/windows/apps/br230302(v=vs.140)). To read about the API selection process, see the [.NET for Metro style apps](https://devblogs.microsoft.com/dotnet/net-for-metro-style-apps/) entry in the .NET blog. - -- The [Windows Runtime](/uwp/api/) provides the user interface elements for building Windows 8.x Store apps, and provides access to operating system features. Like the .NET Framework, the Windows Runtime has metadata that enables the C# and Visual Basic compilers to use the Windows Runtime the way they use the .NET Framework class libraries. The .NET Framework makes it easier to use the Windows Runtime by hiding some differences: - - - Some differences in programming patterns between the .NET Framework and the Windows Runtime, such as the pattern for adding and removing event handlers, are hidden. You simply use the .NET Framework pattern. - - - Some differences in commonly used types (for example, primitive types and collections) are hidden. You simply use the .NET Framework type, as discussed in [Differences That Are Visible in the IDE](#DifferencesVisibleInIDE), later in this article. - -Most of the time, .NET Framework support for the Windows Runtime is transparent. The next section discusses some of the apparent differences between managed code and the Windows Runtime. - - - -### The .NET Framework and the Windows Runtime Reference Documentation - -The Windows Runtime and the .NET Framework documentation sets are separate. If you press F1 to display Help on a type or member, reference documentation from the appropriate set is displayed. However, if you browse through the [Windows Runtime reference](/uwp/api/) you might encounter examples that seem puzzling: - -- Topics such as the interface don't have declaration syntax for Visual Basic or C#. Instead, a note appears above the syntax section (in this case, ".NET: This interface appears as System.Collections.Generic.IEnumerable\"). This is because the .NET Framework and the Windows Runtime provide similar functionality with different interfaces. In addition, there are behavioral differences: `IIterable` has a `First` method instead of a method to return the enumerator. Instead of forcing you to learn a different way of performing a common task, the .NET Framework supports the Windows Runtime by making your managed code appear to use the type you're familiar with. You won't see the `IIterable` interface in the IDE, and therefore the only way you'll encounter it in the Windows Runtime reference documentation is by browsing through that documentation directly. - -- The documentation illustrates a closely related issue: Its parameter types appear to be different for different languages. For C# and Visual Basic, the parameter types are and . Again, this is because the .NET Framework has its own `String` and `Uri` types, and for such commonly used types it doesn't make sense to force .NET Framework users to learn a different way of doing things. In the IDE, the .NET Framework hides the corresponding Windows Runtime types. - -- In a few cases, such as the structure, the .NET Framework provides a type with the same name but more functionality. For example, a set of constructor and property topics are associated with `GridLength`, but they have syntax blocks only for Visual Basic and C# because the members are available only in managed code. In the Windows Runtime, structures have only fields. The Windows Runtime structure requires a helper class, , to provide equivalent functionality. You won't see that helper class in the IDE when you're writing managed code. - -- In the IDE, Windows Runtime types appear to derive from . They appear to have members inherited from , such as . These members operate as they would if the types actually inherited from , and Windows Runtime types can be cast to . This functionality is part of the support that the .NET Framework provides for the Windows Runtime. However, if you view the types in the Windows Runtime reference documentation, no such members appear. The documentation for these apparent inherited members is provided by the reference documentation. - - - -### Differences That Are Visible in the IDE - -In more advanced programming scenarios, such as using a Windows Runtime component written in C# to provide the application logic for a Windows 8.x Store app built for Windows using JavaScript, such differences are apparent in the IDE as well as in the documentation. When your component returns an `IDictionary` to JavaScript, and you look at it in the JavaScript debugger, you'll see the methods of `IMap` because JavaScript uses the Windows Runtime type. Some commonly used collection types that appear differently in the two languages are shown in the following table: - -|Windows Runtime type|Corresponding .NET Framework type| -|--------------------------------------------------------------|---------------------------------------| -|`IIterable`|`IEnumerable`| -|`IIterator`|`IEnumerator`| -|`IVector`|`IList`| -|`IVectorView`|`IReadOnlyList`| -|`IMap`|`IDictionary`| -|`IMapView`|`IReadOnlyDictionary`| -|`IBindableIterable`|`IEnumerable`| -|`IBindableVector`|`IList`| -|`Windows.UI.Xaml.Data.INotifyPropertyChanged`|`System.ComponentModel.INotifyPropertyChanged`| -|`Windows.UI.Xaml.Data.PropertyChangedEventHandler`|`System.ComponentModel.PropertyChangedEventHandler`| -|`Windows.UI.Xaml.Data.PropertyChangedEventArgs`|`System.ComponentModel.PropertyChangedEventArgs`| - -In the Windows Runtime, `IMap` and `IMapView` are iterated using `IKeyValuePair`. When you pass them to managed code, they appear as `IDictionary` and `IReadOnlyDictionary`, so naturally you use `System.Collections.Generic.KeyValuePair` to enumerate them. - -The way interfaces appear in managed code affects the way types that implement these interfaces appear. For example, the `PropertySet` class implements `IMap`, which appears in managed code as `IDictionary`. `PropertySet` appears as if it implemented `IDictionary` instead of `IMap`, so in managed code it appears to have an `Add` method, which behaves like the `Add` method on .NET Framework dictionaries. It doesn't appear to have an `Insert` method. - -For more information about using the .NET Framework to create a Windows Runtime component, and a walkthrough that shows how to use such a component with JavaScript, see [Creating Windows Runtime Components in C# and Visual Basic](/windows/uwp/winrt-components/creating-windows-runtime-components-in-csharp-and-visual-basic). - -### Primitive Types - -To enable the natural use of the Windows Runtime in managed code, .NET Framework primitive types appear instead of Windows Runtime primitive types in your code. In the .NET Framework, primitive types like the `Int32` structure have many useful properties and methods, such as the `Int32.TryParse` method. By contrast, primitive types and structures in the Windows Runtime have only fields. When you use primitives in managed code, they appear to be .NET Framework types, and you can use the properties and methods of the .NET Framework types as you normally would. The following list provides a summary: - -- For the Windows Runtime primitives `Int32`, `Int64`, `Single`, `Double`, `Boolean`, `String` (an immutable collection of Unicode characters), `Enum`, `UInt32`, `UInt64`, and `Guid`, use the type of the same name in the `System` namespace. - -- For `UInt8`, use `System.Byte`. - -- For `Char16`, use `System.Char`. - -- For the `IInspectable` interface, use `System.Object`. - -- For `HRESULT`, use a structure with one `System.Int32` member. - -As with interface types, the only time you might see evidence of this representation is when your .NET Framework project is a Windows Runtime component that is used by a Windows 8.x Store app built using JavaScript. - -Other basic, commonly used Windows Runtime types that appear in managed code as their .NET Framework equivalents include the `Windows.Foundation.DateTime` structure, which appears in managed code as the structure, and the `Windows.Foundation.TimeSpan` structure, which appears as the structure. - -### Other Differences - -In a few cases, the fact that .NET Framework types appear in your code instead of Windows Runtime types requires action on your part. For example, the class appears as in .NET Framework code. allows a relative URI, but requires an absolute URI. Therefore, when you pass a URI to a Windows Runtime method, you must ensure that it's absolute. See [Passing a URI to the Windows Runtime](passing-a-uri-to-the-windows-runtime.md). - - - -## Scenarios for Developing Windows Runtime Components - -The scenarios that are supported for managed Windows Runtime Components depend on the following general principles: - -- Windows Runtime Components that are built using the .NET Framework have no apparent differences from other Windows Runtimelibraries. For example, if you re-implement a native Windows Runtime component by using managed code, the two components are outwardly indistinguishable. The fact that your component is written in managed code is invisible to the code that uses it, even if that code is itself managed code. However, internally, your component is true managed code and runs on the common language runtime (CLR). - -- Components can contain types that implement application logic, Windows 8.x Store UI controls, or both. - - > [!NOTE] - > It's good practice to separate UI elements from application logic. Also, you can't use Windows 8.x Store UI controls in a Windows 8.x Store app built for Windows using JavaScript and HTML. - -- A component can be a project within a Visual Studio solution for a Windows 8.x Store app, or a reusable component that you can add to multiple solutions. - - > [!NOTE] - > If your component will be used only with C# or Visual Basic, there's no reason to make it a Windows Runtime component. If you make it an ordinary .NET Framework class library instead, you don't have to restrict its public API surface to Windows Runtime types. - -- You can release versions of reusable components by using the Windows Runtime attribute to identify which types (and which members within a type) were added in different versions. - -- The types in your component can derive from Windows Runtime types. Controls can derive from the primitive control types in the namespace or from more finished controls such as . - - > [!IMPORTANT] - > Starting with Windows 8 and the .NET Framework 4.5, all public types in a managed Windows Runtime component must be sealed. A type in another Windows Runtime component can't derive from them. If you want to provide polymorphic behavior in your component, you can create an interface and implement it in the polymorphic types. - -- All parameter and return types on the public types in your component must be Windows Runtime types (including the Windows Runtime types that your component defines). - -The following sections provide examples of common scenarios. - -### Application Logic for a Windows 8.x Store App with JavaScript - -When you develop a Windows 8.x Store app for Windows using JavaScript, you might find that some parts of the application logic perform better in managed code, or are easier to develop. JavaScript can't use .NET Framework class libraries directly, but you can make the class library a .WinMD file. In this scenario, the Windows Runtime component is an integral part of the app, so it doesn't make sense to provide version attributes. - -### Reusable Windows 8.x Store UI Controls - -You can package a set of related UI controls in a reusable Windows Runtime component. The component can be marketed on its own or used as an element in the apps you create. In this scenario, it makes sense to use the Windows Runtime attribute to improve compatibility. - -### Reusable Application Logic from Existing .NET Framework Apps - -You can package managed code from your existing desktop apps as a standalone Windows Runtime component. This enables you to use the component in Windows 8.x Store apps built using C++ or JavaScript, as well as in Windows 8.x Store apps built using C# or Visual Basic. Versioning is an option if there are multiple reuse scenarios for the code. - -## Related Topics - -|Title|Description| -|-----------|-----------------| -|[.NET for Windows Store apps overview](/previous-versions/windows/apps/br230302(v=vs.140))|Describes the .NET Framework types and members that you can use to create Windows 8.x Store apps and Windows RuntimeComponents. (In the Windows Dev Center.)| -|[Roadmap for Windows Store apps using C# or Visual Basic](/previous-versions/windows/apps/br229583(v=win.10))|Provides key resources to help you get started developing Windows 8.x Store apps by using C# or Visual Basic, including many Quickstart topics, guidelines, and best practices. (In the Windows Dev Center.)| -|[How tos (XAML)](/previous-versions/windows/apps/br229566(v=win.10))|Provides key resources to help you get started developing Windows 8.x Store apps by using C# or Visual Basic, including many Quickstart topics, guidelines, and best practices. (In the Windows Dev Center.)| -|[Creating Windows Runtime Components in C# and Visual Basic](/windows/uwp/winrt-components/creating-windows-runtime-components-in-csharp-and-visual-basic)|Describes how to create a Windows Runtime component using the .NET Framework, explains how to use it as part of a Windows 8.x Store app built for Windows using JavaScript, and describes how to debug the combination with Visual Studio. (In the Windows Dev Center.)| -|[Windows Runtime reference](/uwp/api/)|The reference documentation for the Windows Runtime. (In the Windows Dev Center.)| -|[Passing a URI to the Windows Runtime](passing-a-uri-to-the-windows-runtime.md)|Describes an issue that can arise when you pass a URI from managed code to the Windows Runtime, and how to avoid it.| diff --git a/docs/framework/cross-platform/using-portable-class-library-with-model-view-view-model.md b/docs/framework/cross-platform/using-portable-class-library-with-model-view-view-model.md deleted file mode 100644 index 35d9385b445c1..0000000000000 --- a/docs/framework/cross-platform/using-portable-class-library-with-model-view-view-model.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -description: "Learn more about: Using Portable Class Library with Model-View-View Model" -title: "Using Portable Class Library with Model-View-View Model" -ms.date: "07/18/2018" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "Portable Class Library [.NET Framework], and MVVM" - - "MVVM, and Portable Class Library" -ms.assetid: 41a0b9f8-15a2-431a-bc35-e310b2953b03 ---- -# Using Portable Class Library with Model-View-View Model - -You can use the .NET Framework [Portable Class Library](portable-class-library.md) to implement the Model-View-View Model (MVVM) pattern and share assemblies across multiple platforms. - -[!INCLUDE[standard](../../../includes/pcl-to-standard.md)] - - MVVM is an application pattern that isolates the user interface from the underlying business logic. You can implement the model and view model classes in a Portable Class Library project in Visual Studio 2012, and then create views that are customized for different platforms. This approach enables you to write the data model and business logic only once, and use that code from .NET Framework, Silverlight, Windows Phone, and Windows 8.x Store apps, as shown in the following illustration. - - ![Shows the Portable Class Library with MVVM sharing assemblies across platforms.](./media/using-portable-class-library-with-model-view-view-model/mvvm-share-assemblies-across-platforms.png) - - This topic does not provide general information about the MVVM pattern. It only provides information about how to use Portable Class Library to implement MVVM. For more information about MVVM, see the [MVVM Quickstart Using the Prism Library 5.0 for WPF](/previous-versions/msp-n-p/gg430857(v=pandp.40)). - -## Classes That Support MVVM - - When you target the .NET Framework 4.5, .NET for Windows 8.x Store apps, Silverlight, or Windows Phone 7.5 for your Portable Class Library project, the following classes are available for implementing the MVVM pattern: - -- class - -- class - -- class - -- class - -- class - -- class - -- class - -- class - -- class - -- class - -- All classes in the namespace - -## Implementing MVVM - - To implement MVVM, you typically create both the model and the view model in a Portable Class Library project, because a Portable Class Library project cannot reference a non-portable project. The model and view model can be in the same project or in separate projects. If you use separate projects, add a reference from the view model project to the model project. - - After you compile the model and view model projects, you reference those assemblies in the app that contains the view. If the view interacts only with the view model, you only have to reference the assembly that contains the view model. - -### Model - - The following example shows a simplified model class that could reside in a Portable Class Library project. - - [!code-csharp[PortableClassLibraryMVVM#1](../../../samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/customer.cs#1)] - [!code-vb[PortableClassLibraryMVVM#1](../../../samples/snippets/visualbasic/VS_Snippets_CLR/portableclasslibrarymvvm/vb/customer.vb#1)] - - The following example shows a simple way to populate, retrieve, and update the data in a Portable Class Library project. In a real app, you would retrieve the data from a source such as a Windows Communication Foundation (WCF) service. - - [!code-csharp[PortableClassLibraryMVVM#2](../../../samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/customerrepository.cs#2)] - [!code-vb[PortableClassLibraryMVVM#2](../../../samples/snippets/visualbasic/VS_Snippets_CLR/portableclasslibrarymvvm/vb/customerrepository.vb#2)] - -### View Model - - A base class for view models is frequently added when implementing the MVVM pattern. The following example shows a base class. - - [!code-csharp[PortableClassLibraryMVVM#3](../../../samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/viewmodelbase.cs#3)] - [!code-vb[PortableClassLibraryMVVM#3](../../../samples/snippets/visualbasic/VS_Snippets_CLR/portableclasslibrarymvvm/vb/viewmodelbase.vb#3)] - - An implementation of the interface is frequently used with the MVVM pattern. The following example shows an implementation of the interface. - - [!code-csharp[PortableClassLibraryMVVM#4](../../../samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/relaycommand.cs#4)] - [!code-vb[PortableClassLibraryMVVM#4](../../../samples/snippets/visualbasic/VS_Snippets_CLR/portableclasslibrarymvvm/vb/relaycommand.vb#4)] - - The following example shows a simplified view model. - - [!code-csharp[PortableClassLibraryMVVM#5](../../../samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/mainpageviewmodel.cs#5)] - [!code-vb[PortableClassLibraryMVVM#5](../../../samples/snippets/visualbasic/VS_Snippets_CLR/portableclasslibrarymvvm/vb/customerviewmodel.vb#5)] - -### View - - From a .NET Framework 4.5 app, Windows 8.x Store app, Silverlight-based app, or Windows Phone 7.5 app, you can reference the assembly that contains the model and view model projects. You then create a view that interacts with the view model. The following example shows a simplified Windows Presentation Foundation (WPF) app that retrieves and updates data from the view model. You could create similar views in Silverlight, Windows Phone, or Windows 8.x Store apps. - - [!code-xaml[PortableClassLibraryMVVM#6](../../../samples/snippets/csharp/VS_Snippets_CLR/portableclasslibrarymvvm/cs/mainwindow.xaml#6)] - -## See also - -- [Portable Class Library](portable-class-library.md) diff --git a/docs/framework/data/adonet/ado-net-architecture.md b/docs/framework/data/adonet/ado-net-architecture.md index a3b0ce74fc9b5..90abdca66a378 100644 --- a/docs/framework/data/adonet/ado-net-architecture.md +++ b/docs/framework/data/adonet/ado-net-architecture.md @@ -53,7 +53,7 @@ ADO.NET architecture ## WCF Data Services - WCF Data Services is used to deploy data services on the Web or an intranet. The data is structured as entities and relationships according to the specifications of the Entity Data Model. Data deployed on this model is addressable by standard HTTP protocol. For more information, see [WCF Data Services 4.5](../wcf/index.md). + WCF Data Services is used to deploy data services on the Web or an intranet. The data is structured as entities and relationships according to the specifications of the Entity Data Model. Data deployed on this model is addressable by standard HTTP protocol. For more information, see [WCF Data Services 4.5](/previous-versions/dotnet/framework/data/wcf/index). ## XML and ADO.NET diff --git a/docs/framework/data/adonet/ado-net-technology-options-and-guidelines.md b/docs/framework/data/adonet/ado-net-technology-options-and-guidelines.md index ef034672f9d71..6acb88bdc24e1 100644 --- a/docs/framework/data/adonet/ado-net-technology-options-and-guidelines.md +++ b/docs/framework/data/adonet/ado-net-technology-options-and-guidelines.md @@ -42,7 +42,7 @@ The ADO.NET Data Platform is a multi-release strategy to decrease the amount of ## WCF Data Services - WCF Data Services deploys data services on the Web or on an intranet. The data is structured as entities and relationships according to the specifications of the Entity Data Model. Data deployed on this model is addressable by standard HTTP protocol. For more information, see [WCF Data Services 4.5](../wcf/index.md). + WCF Data Services deploys data services on the Web or on an intranet. The data is structured as entities and relationships according to the specifications of the Entity Data Model. Data deployed on this model is addressable by standard HTTP protocol. For more information, see [WCF Data Services 4.5](/previous-versions/dotnet/framework/data/wcf/index). ## See also diff --git a/docs/framework/data/adonet/code-access-security.md b/docs/framework/data/adonet/code-access-security.md index 21592cac89d95..f530510a4357f 100644 --- a/docs/framework/data/adonet/code-access-security.md +++ b/docs/framework/data/adonet/code-access-security.md @@ -46,7 +46,7 @@ The .NET Framework offers role-based security as well as code access security (C The CLR uses permissions to implement its mechanism for enforcing restrictions on managed code. Role-based security permissions provide a mechanism for discovering whether a user (or the agent acting on the user's behalf) has a particular identity or is a member of a specified role. For more information, see [Security Permissions](/previous-versions/dotnet/netframework-4.0/5ba4k1c5(v=vs.100)). - Depending on the type of application you are building, you should also consider implementing role-based permissions in the database. For more information on role-based security in SQL Server, see [SQL Server Security](./sql/sql-server-security.md). + Depending on the type of application you are building, you should also consider implementing role-based permissions in the database. For more information on role-based security in SQL Server, see [SQL Server Security](/previous-versions/dotnet/framework/data/adonet/sql/sql-server-security). ## Assemblies diff --git a/docs/framework/data/adonet/ef/migration-considerations.md b/docs/framework/data/adonet/ef/migration-considerations.md index bf0c2deaa610b..a87ef3315ca5d 100644 --- a/docs/framework/data/adonet/ef/migration-considerations.md +++ b/docs/framework/data/adonet/ef/migration-considerations.md @@ -94,7 +94,7 @@ The ADO.NET Entity Framework provides several benefits to an existing applicatio - Applications that use XML data. - Object serialization enables you to create Entity Framework data services. These services provide data to applications that consume XML data, such as AJAX-based Internet applications. In these cases, consider using WCF Data Services. These data services are based on the Entity Data Model and provide dynamic access to entity data by using standard Representational State Transfer (REST) HTTP actions, such as GET, PUT, and POST. For more information, see [WCF Data Services 4.5](../../wcf/index.md). + Object serialization enables you to create Entity Framework data services. These services provide data to applications that consume XML data, such as AJAX-based Internet applications. In these cases, consider using WCF Data Services. These data services are based on the Entity Data Model and provide dynamic access to entity data by using standard Representational State Transfer (REST) HTTP actions, such as GET, PUT, and POST. For more information, see [WCF Data Services 4.5](/previous-versions/dotnet/framework/data/wcf/index). The Entity Framework does not support a native-XML data type. This means that when an entity is mapped to a table with an XML column, the equivalent entity property for the XML column is a string. Objects can be disconnected and serialized as XML. For more information, see [Serializing Objects](/previous-versions/dotnet/netframework-4.0/bb738446(v=vs.100)). diff --git a/docs/framework/data/adonet/index.md b/docs/framework/data/adonet/index.md index 157b9ea3180bc..d96a597e0d0cd 100644 --- a/docs/framework/data/adonet/index.md +++ b/docs/framework/data/adonet/index.md @@ -7,57 +7,54 @@ ms.assetid: 5b96ed06-9759-4966-a797-a1d5f6ee50ca --- # ADO.NET -ADO.NET is a set of classes that expose data access services for .NET Framework programmers. ADO.NET provides a rich set of components for creating distributed, data-sharing applications. It is an integral part of the .NET Framework, providing access to relational, XML, and application data. ADO.NET supports a variety of development needs, including the creation of front-end database clients and middle-tier business objects used by applications, tools, languages, or Internet browsers. - -## In This Section - - [What's New in ADO.NET](whats-new.md) - Introduces features that are new in ADO.NET. - - [ADO.NET Overview](ado-net-overview.md) - Provides an introduction to the design and components of ADO.NET. - - [Entity Framework](/ef/ef6/index) - Describes how to create applications using the Entity Framework. - - [Securing ADO.NET Applications](securing-ado-net-applications.md) - Describes secure coding practices when using ADO.NET. - - [Data Type Mappings in ADO.NET](data-type-mappings-in-ado-net.md) - Describes data type mappings between .NET Framework data types and the .NET Framework data providers. - - [DataSets, DataTables, and DataViews](./dataset-datatable-dataview/index.md) - Describes how to create and use `DataSets`, typed `DataSets`, `DataTables`, and `DataViews`. - - [LINQ to DataSet](linq-to-dataset.md) - Provides information about LINQ to DataSet, including programming examples. - - [Retrieving and Modifying Data in ADO.NET](retrieving-and-modifying-data.md) - Describes how to connect to a data source and how to retrieve and modify data using `Commands`, `DataReaders`, and `DataAdapters`. - - [SQL Server and ADO.NET](./sql/index.md) - Describes how to work with features and functionality that are specific to SQL Server. - - [Oracle and ADO.NET](oracle-and-adonet.md) - Describes features and behaviors that are specific to the .NET Framework Data Provider for Oracle. - -## Related Sections - - [Language-Integrated Query (LINQ) - C#](../../../csharp/programming-guide/concepts/linq/index.md) - Provides links to LINQ topics and samples using C#. - - [Language-Integrated Query (LINQ) - Visual Basic](../../../visual-basic/programming-guide/concepts/linq/index.md) - Provides links to LINQ topics and samples using Visual Basic. - - [WCF Data Services 4.5](../wcf/index.md) - Describes how to use WCF Data Services to deploy data services on the Web or an intranet that implement the Open Data Protocol (OData). - - [.NET Framework Development Guide](../../development-guide.md) - Provides links to information about standard development tasks in the .NET Framework. - - [Samples and tutorials](../../../samples-and-tutorials/index.md) +ADO.NET is a set of classes that expose data access services for .NET Framework programmers. ADO.NET provides a rich set of components for creating distributed, data-sharing applications. It is an integral part of the .NET Framework, providing access to relational, XML, and application data. ADO.NET supports a variety of development needs, including the creation of front-end database clients and middle-tier business objects used by applications, tools, languages, or Internet browsers. + +## In This Section + + [What's New in ADO.NET](whats-new.md)\ + Introduces features that are new in ADO.NET. + + [ADO.NET Overview](ado-net-overview.md)\ + Provides an introduction to the design and components of ADO.NET. + + [Entity Framework](/ef/ef6/index) + Describes how to create applications using the Entity Framework. + + [Securing ADO.NET Applications](securing-ado-net-applications.md)\ + Describes secure coding practices when using ADO.NET. + + [Data Type Mappings in ADO.NET](data-type-mappings-in-ado-net.md)\ + Describes data type mappings between .NET Framework data types and the .NET Framework data providers. + + [DataSets, DataTables, and DataViews](./dataset-datatable-dataview/index.md)\ + Describes how to create and use `DataSets`, typed `DataSets`, `DataTables`, and `DataViews`. + + [LINQ to DataSet](linq-to-dataset.md)\ + Provides information about LINQ to DataSet, including programming examples. + + [Retrieving and Modifying Data in ADO.NET](retrieving-and-modifying-data.md)\ + Describes how to connect to a data source and how to retrieve and modify data using `Commands`, `DataReaders`, and `DataAdapters`. + + [SQL Server and ADO.NET](./sql/index.md)\ + Describes how to work with features and functionality that are specific to SQL Server. + + [Oracle and ADO.NET](oracle-and-adonet.md)\ + Describes features and behaviors that are specific to the .NET Framework Data Provider for Oracle. + +## Related Sections + + [Language-Integrated Query (LINQ) - C#](../../../csharp/programming-guide/concepts/linq/index.md)\ + Provides links to LINQ topics and samples using C#. + + [Language-Integrated Query (LINQ) - Visual Basic](../../../visual-basic/programming-guide/concepts/linq/index.md)\ + Provides links to LINQ topics and samples using Visual Basic. + + [.NET Framework Development Guide](../../development-guide.md)\ + Provides links to information about standard development tasks in the .NET Framework. + + [Samples and tutorials](../../../samples-and-tutorials/index.md)\ Provides a list of .NET samples and tutorials. - + ## See also - [Accessing data in Visual Studio](/visualstudio/data-tools/accessing-data-in-visual-studio) diff --git a/docs/framework/data/adonet/privacy-and-data-security.md b/docs/framework/data/adonet/privacy-and-data-security.md index 7a93c5d5207be..3c8185bae5c06 100644 --- a/docs/framework/data/adonet/privacy-and-data-security.md +++ b/docs/framework/data/adonet/privacy-and-data-security.md @@ -29,5 +29,5 @@ Safeguarding and managing sensitive information in an ADO.NET application is dep ## See also - [Securing ADO.NET Applications](securing-ado-net-applications.md) -- [SQL Server Security](./sql/sql-server-security.md) +- [SQL Server Security](/previous-versions/dotnet/framework/data/adonet/sql/sql-server-security) - [ADO.NET Overview](ado-net-overview.md) diff --git a/docs/framework/data/adonet/secure-client-applications.md b/docs/framework/data/adonet/secure-client-applications.md index b2f4ffd3521c4..258c1b5117aca 100644 --- a/docs/framework/data/adonet/secure-client-applications.md +++ b/docs/framework/data/adonet/secure-client-applications.md @@ -63,7 +63,7 @@ Applications typically consist of many parts that must all be protected from vul |--------------|-----------------| |[Configuration of Remote Applications](/previous-versions/dotnet/netframework-4.0/b8tysty8(v=vs.100))|Discusses how to configure remoting applications in order to avoid common problems.| |[Security in Remoting](/previous-versions/dotnet/netframework-4.0/9hwst9th(v=vs.100))|Describes authentication and encryption as well as additional security topics relevant to remoting.| -|[Security and Remoting Considerations](../../misc/security-and-remoting-considerations.md)|Describes security issues with protected objects and application domain crossing.| +|[Security and Remoting Considerations](/previous-versions/dotnet/framework/code-access-security/security-and-remoting-considerations)|Describes security issues with protected objects and application domain crossing.| ## See also diff --git a/docs/framework/data/adonet/secure-data-access.md b/docs/framework/data/adonet/secure-data-access.md index 9841a53eba76b..34507644dc7fb 100644 --- a/docs/framework/data/adonet/secure-data-access.md +++ b/docs/framework/data/adonet/secure-data-access.md @@ -23,7 +23,7 @@ To write secure ADO.NET code, you have to understand the security mechanisms ava |[Protecting Connection Information](protecting-connection-information.md)|Describes security best practices and techniques for protecting connection information, such as using protected configuration to encrypt connection strings.| |[Recommendations for Data Access Strategies](/previous-versions/visualstudio/visual-studio-2008/8fxztkff(v=vs.90))|Provides recommendations for accessing data and performing database operations.| |[Connection String Builders](connection-string-builders.md)|Describes how to build connection strings from user input at run time.| -|[Overview of SQL Server Security](./sql/overview-of-sql-server-security.md)|Describes the SQL Server security architecture.| +|[Overview of SQL Server Security](/previous-versions/dotnet/framework/data/adonet/sql/overview-of-sql-server-security)|Describes the SQL Server security architecture.| ## Parameterized Commands and SQL Injection @@ -35,7 +35,7 @@ To write secure ADO.NET code, you have to understand the security mechanisms ava |--------------|-----------------| |[DataAdapter Parameters](dataadapter-parameters.md)|Describes how to use parameters with a `DataAdapter`.| |[Modifying Data with Stored Procedures](modifying-data-with-stored-procedures.md)|Describes how to specify parameters and obtain a return value.| -|[Managing Permissions with Stored Procedures in SQL Server](./sql/managing-permissions-with-stored-procedures-in-sql-server.md)|Describes how to use SQL Server stored procedures to encapsulate data access.| +|[Managing Permissions with Stored Procedures in SQL Server](/previous-versions/dotnet/framework/data/adonet/sql/managing-permissions-with-stored-procedures-in-sql-server)|Describes how to use SQL Server stored procedures to encapsulate data access.| ## Script Exploits @@ -93,7 +93,7 @@ To write secure ADO.NET code, you have to understand the security mechanisms ava ## See also - [Securing ADO.NET Applications](securing-ado-net-applications.md) -- [SQL Server Security](./sql/sql-server-security.md) +- [SQL Server Security](/previous-versions/dotnet/framework/data/adonet/sql/sql-server-security) - [Recommendations for Data Access Strategies](/previous-versions/visualstudio/visual-studio-2008/8fxztkff(v=vs.90)) - [Protecting Connection Information](protecting-connection-information.md) - [Connection String Builders](connection-string-builders.md) diff --git a/docs/framework/data/adonet/securing-ado-net-applications.md b/docs/framework/data/adonet/securing-ado-net-applications.md index c24820fbb3d63..cf8781f6f1d07 100644 --- a/docs/framework/data/adonet/securing-ado-net-applications.md +++ b/docs/framework/data/adonet/securing-ado-net-applications.md @@ -34,7 +34,7 @@ Writing secure code does not guard against self-inflicted security holes when wo [DataSet and DataTable security guidance](dataset-datatable-dataview/security-guidance.md) Provides security guidance for and . - [SQL Server Security](./sql/sql-server-security.md) + [SQL Server Security](/previous-versions/dotnet/framework/data/adonet/sql/sql-server-security) Describes SQL Server security features from a developer's perspective. [Security Considerations](./ef/security-considerations.md) diff --git a/docs/framework/data/adonet/security-overview.md b/docs/framework/data/adonet/security-overview.md index 732b13025570a..f7b9f653d9b7d 100644 --- a/docs/framework/data/adonet/security-overview.md +++ b/docs/framework/data/adonet/security-overview.md @@ -67,7 +67,7 @@ For more information, see the following resources: |Resource|Description| |--------------|-----------------| |[Code Access Security and ADO.NET](code-access-security.md)|Describes the interactions between code access security, role-based security, and partially trusted environments from the perspective of an ADO.NET application.| -|[Code Access Security](../../misc/code-access-security.md)|Contains links to additional topics describing CAS in the .NET Framework.| +|[Code Access Security](/previous-versions/dotnet/framework/code-access-security/code-access-security)|Contains links to additional topics describing CAS in the .NET Framework.| ## Database Security @@ -89,7 +89,7 @@ For more information, see the following resources: |Resource|Description| |--------------|-----------------| -|[SQL Server Security](./sql/sql-server-security.md)|Provides an overview of SQL Server security with application scenarios that provide guidance for creating secure ADO.NET applications that target SQL Server.| +|[SQL Server Security](/previous-versions/dotnet/framework/data/adonet/sql/sql-server-security)|Provides an overview of SQL Server security with application scenarios that provide guidance for creating secure ADO.NET applications that target SQL Server.| |[Recommendations for Data Access Strategies](/previous-versions/visualstudio/visual-studio-2008/8fxztkff(v=vs.90))|Provides recommendations for accessing data and performing database operations.| ## Security Policy and Administration @@ -107,5 +107,5 @@ For more information, see the following resources: - [Securing ADO.NET Applications](securing-ado-net-applications.md) - [Security in .NET](../../../standard/security/index.md) -- [SQL Server Security](./sql/sql-server-security.md) +- [SQL Server Security](/previous-versions/dotnet/framework/data/adonet/sql/sql-server-security) - [ADO.NET Overview](ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql-server-connection-pooling.md b/docs/framework/data/adonet/sql-server-connection-pooling.md index d8053825f2a40..7b763b650ee0b 100644 --- a/docs/framework/data/adonet/sql-server-connection-pooling.md +++ b/docs/framework/data/adonet/sql-server-connection-pooling.md @@ -134,7 +134,7 @@ using (SqlConnection connection = new SqlConnection( ### Application Role Alternatives - We recommend that you take advantage of security mechanisms that you can use instead of application roles. For more information, see [Creating Application Roles in SQL Server](./sql/creating-application-roles-in-sql-server.md). + We recommend that you take advantage of security mechanisms that you can use instead of application roles. For more information, see [Creating Application Roles in SQL Server](/previous-versions/dotnet/framework/data/adonet/sql/creating-application-roles-in-sql-server). ## See also diff --git a/docs/framework/data/adonet/sql/application-security-scenarios-in-sql-server.md b/docs/framework/data/adonet/sql/application-security-scenarios-in-sql-server.md deleted file mode 100644 index 20668fb26f578..0000000000000 --- a/docs/framework/data/adonet/sql/application-security-scenarios-in-sql-server.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -description: "Learn more about: Application Security Scenarios in SQL Server" -title: "Application Security Scenarios in SQL Server" -ms.date: "03/30/2017" -ms.assetid: 0164f3a4-406e-4693-bec3-03c8e18b46d7 ---- -# Application Security Scenarios in SQL Server - -There is no single correct way to create a secure SQL Server client application. Every application is unique in its requirements, deployment environment, and user population. An application that is reasonably secure when it is initially deployed can become less secure over time. It is impossible to predict with any accuracy what threats may emerge in the future. - - SQL Server, as a product, has evolved over many versions to incorporate the latest security features that enable developers to create secure database applications. However, security doesn't come in the box; it requires continual monitoring and updating. - -## Common Threats - - Developers need to understand security threats, the tools provided to counter them, and how to avoid self-inflicted security holes. Security can best be thought of as a chain, where a break in any one link compromises the strength of the whole. The following list includes some common security threats that are discussed in more detail in the topics in this section. - -### SQL Injection - - SQL Injection is the process by which a malicious user enters Transact-SQL statements instead of valid input. If the input is passed directly to the server without being validated and if the application inadvertently executes the injected code, then the attack has the potential to damage or destroy data. You can thwart SQL Server injection attacks by using stored procedures and parameterized commands, avoiding dynamic SQL, and restricting permissions on all users. - -### Elevation of Privilege - - Elevation of privilege attacks occur when a user is able to assume the privileges of a trusted account, such as an owner or administrator. Always run under least-privileged user accounts and assign only needed permissions. Avoid using administrative or owner accounts for executing code. This limits the amount of damage that can occur if an attack succeeds. When performing tasks that require additional permissions, use procedure signing or impersonation only for the duration of the task. You can sign stored procedures with certificates or use impersonation to temporarily assign permissions. - -### Probing and Intelligent Observation - - A probing attack can use error messages generated by an application to search for security vulnerabilities. Implement error handling in all procedural code to prevent SQL Server error information from being returned to the end user. - -### Authentication - - A connection string injection attack can occur when using SQL Server logins if a connection string based on user input is constructed at run time. If the connection string is not checked for valid keyword pairs, an attacker can insert extra characters, potentially accessing sensitive data or other resources on the server. Use Windows authentication wherever possible. If you must use SQL Server logins, use the to create and validate connection strings at run time. - -### Passwords - - Many attacks succeed because an intruder was able to obtain or guess a password for a privileged user. Passwords are your first line of defense against intruders, so setting strong passwords is essential to the security of your system. Create and enforce password policies for mixed mode authentication. - - Always assign a strong password to the `sa` account, even when using Windows Authentication. - -## In This Section - - [Managing Permissions with Stored Procedures in SQL Server](managing-permissions-with-stored-procedures-in-sql-server.md) - Describes how to use stored procedures to manage permissions and control data access. Using stored procedures is an effective way to respond to many security threats. - - [Writing Secure Dynamic SQL in SQL Server](writing-secure-dynamic-sql-in-sql-server.md) - Describes techniques for writing secure dynamic SQL using stored procedures. - - [Signing Stored Procedures in SQL Server](signing-stored-procedures-in-sql-server.md) - Describes how to sign a stored procedure with a certificate to enable users to work with data they do not have direct access to. This enables stored procedures to perform operations that the caller does not have permissions to perform directly. - - [Customizing Permissions with Impersonation in SQL Server](customizing-permissions-with-impersonation-in-sql-server.md) - Describes how to use the EXECUTE AS clause to impersonate another user. Impersonation switches the execution context from the caller to the specified user. - - [Granting Row-Level Permissions in SQL Server](granting-row-level-permissions-in-sql-server.md) - Describes how to implement row-level permissions to restrict data access. - - [Creating Application Roles in SQL Server](creating-application-roles-in-sql-server.md) - Describes features and functionality of application roles. - - [Enabling Cross-Database Access in SQL Server](enabling-cross-database-access-in-sql-server.md) - Describes how to enable cross-database access without jeopardizing security. - -## See also - -- [SQL Server Security](sql-server-security.md) -- [Overview of SQL Server Security](overview-of-sql-server-security.md) -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/authentication-in-sql-server.md b/docs/framework/data/adonet/sql/authentication-in-sql-server.md deleted file mode 100644 index f7543284a45b1..0000000000000 --- a/docs/framework/data/adonet/sql/authentication-in-sql-server.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: "Authentication in SQL Server" -description: Learn about authentication with SQL Server for ADO.NET, including Windows authentication mode and mixed mode. -ms.date: "05/22/2018" -ms.assetid: 646ddbf5-dd4e-4285-8e4a-f565f666c5cc ---- -# Authentication in SQL Server - -SQL Server supports two authentication modes, Windows authentication mode and mixed mode. - -- Windows authentication is the default, and is often referred to as integrated security because this SQL Server security model is tightly integrated with Windows. Specific Windows user and group accounts are trusted to log in to SQL Server. Windows users who have already been authenticated do not have to present additional credentials. - -- Mixed mode supports authentication both by Windows and by SQL Server. User name and password pairs are maintained within SQL Server. - -> [!IMPORTANT] -> We recommend using Windows authentication wherever possible. Windows authentication uses a series of encrypted messages to authenticate users in SQL Server. When SQL Server logins are used, SQL Server login names and encrypted passwords are passed across the network, which makes them less secure. - - With Windows authentication, users are already logged onto Windows and do not have to log on separately to SQL Server. The following `SqlConnection.ConnectionString` specifies Windows authentication without requiring users to provide a user name or password. - -```csharp -"Server=MSSQL1;Database=AdventureWorks;Integrated Security=true;" -``` - -> [!NOTE] -> Logins are distinct from database users. You must map logins or Windows groups to database users or roles in a separate operation. You then grant permissions to users or roles to access database objects. - -## Authentication Scenarios - - Windows authentication is usually the best choice in the following situations: - -- There is a domain controller. - -- The application and the database are on the same computer. - -- You are using an instance of SQL Server Express or LocalDB. - - SQL Server logins are often used in the following situations: - -- If you have a workgroup. - -- Users connect from different, non-trusted domains. - -- Internet applications, such as ASP.NET. - -> [!NOTE] -> Specifying Windows authentication does not disable SQL Server logins. Use the ALTER LOGIN DISABLE Transact-SQL statement to disable highly-privileged SQL Server logins. - -## Login Types - - SQL Server supports three types of logins: - -- A local Windows user account or trusted domain account. SQL Server relies on Windows to authenticate the Windows user accounts. - -- Windows group. Granting access to a Windows group grants access to all Windows user logins that are members of the group. - -- SQL Server login. SQL Server stores both the username and a hash of the password in the master database, by using internal authentication methods to verify login attempts. - -> [!NOTE] -> SQL Server provides logins created from certificates or asymmetric keys that are used only for code signing. They cannot be used to connect to SQL Server. - -## Mixed Mode Authentication - - If you must use mixed mode authentication, you must create SQL Server logins, which are stored in SQL Server. You then have to supply the SQL Server user name and password at run time. - -> [!IMPORTANT] -> SQL Server installs with a SQL Server login named `sa` (an abbreviation of "system administrator"). Assign a strong password to the `sa` login and do not use the `sa` login in your application. The `sa` login maps to the `sysadmin` fixed server role, which has irrevocable administrative credentials on the whole server. There are no limits to the potential damage if an attacker gains access as a system administrator. - - SQL Server provides Windows password policy mechanisms for SQL Server logins. Password complexity policies are designed to deter brute force attacks by increasing the number of possible passwords. SQL Server can apply the same complexity and expiration policies to passwords used inside SQL Server. - -> [!IMPORTANT] -> Concatenating connection strings from user input can leave you vulnerable to a connection string injection attack. Use the to create syntactically valid connection strings at run time. For more information, see [Connection String Builders](../connection-string-builders.md). - -## External Resources - - For more information, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Principals](/sql/relational-databases/security/authentication-access/principals-database-engine)|Describes logins and other security principals in SQL Server.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Connecting to a Data Source](../connecting-to-a-data-source.md) -- [Connection Strings](../connection-strings.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/authorization-and-permissions-in-sql-server.md b/docs/framework/data/adonet/sql/authorization-and-permissions-in-sql-server.md deleted file mode 100644 index 8d3526a637d26..0000000000000 --- a/docs/framework/data/adonet/sql/authorization-and-permissions-in-sql-server.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: "Authorization and Permissions in SQL Server" -description: Learn to explicitly grant permissions to make database objects that you create accessible to users in SQL Server with ADO.NET. -ms.date: "03/30/2017" -ms.assetid: d340405c-91f4-4837-a3cc-a238ee89888a ---- -# Authorization and Permissions in SQL Server - -When you create database objects, you must explicitly grant permissions to make them accessible to users. Every securable object has permissions that can be granted to a principal using permission statements. - -## The Principle of Least Privilege - - Developing an application using a least-privileged user account (LUA) approach is an important part of a defensive, in-depth strategy for countering security threats. The LUA approach ensures that users follow the principle of least privilege and always log on with limited user accounts. Administrative tasks are broken out using fixed server roles, and the use of the `sysadmin` fixed server role is severely restricted. - - Always follow the principle of least privilege when granting permissions to database users. Grant the minimum permissions necessary to a user or role to accomplish a given task. - -> [!IMPORTANT] -> Developing and testing an application using the LUA approach adds a degree of difficulty to the development process. It is easier to create objects and write code while logged on as a system administrator or database owner than it is using a LUA account. However, developing applications using a highly privileged account can obfuscate the impact of reduced functionality when least privileged users attempt to run an application that requires elevated permissions in order to function correctly. Granting excessive permissions to users in order to reacquire lost functionality can leave your application vulnerable to attack. Designing, developing and testing your application logged on with a LUA account enforces a disciplined approach to security planning that eliminates unpleasant surprises and the temptation to grant elevated privileges as a quick fix. You can use a SQL Server login for testing even if your application is intended to deploy using Windows authentication. - -## Role-Based Permissions - - Granting permissions to roles rather than to users simplifies security administration. Permission sets that are assigned to roles are inherited by all members of the role. It is easier to add or remove users from a role than it is to recreate separate permission sets for individual users. Roles can be nested; however, too many levels of nesting can degrade performance. You can also add users to fixed database roles to simplify assigning permissions. - - You can grant permissions at the schema level. Users automatically inherit permissions on all new objects created in the schema; you do not need to grant permissions as new objects are created. - -## Permissions Through Procedural Code - - Encapsulating data access through modules such as stored procedures and user-defined functions provides an additional layer of protection around your application. You can prevent users from directly interacting with database objects by granting permissions only to stored procedures or functions while denying permissions to underlying objects such as tables. SQL Server achieves this by ownership chaining. - -## Permission Statements - - The three Transact-SQL permission statements are described in the following table. - -|Permission Statement|Description| -|--------------------------|-----------------| -|GRANT|Grants a permission.| -|REVOKE|Revokes a permission. This is the default state of a new object. A permission revoked from a user or role can still be inherited from other groups or roles to which the principal is assigned.| -|DENY|DENY revokes a permission so that it cannot be inherited. DENY takes precedence over all permissions, except DENY does not apply to object owners or members of `sysadmin`. If you DENY permissions on an object to the `public` role it is denied to all users and roles except for object owners and `sysadmin` members.| - -- The GRANT statement can assign permissions to a group or role that can be inherited by database users. However, the DENY statement takes precedence over all other permission statements. Therefore, a user who has been denied a permission cannot inherit it from another role. - -> [!NOTE] -> Members of the `sysadmin` fixed server role and object owners cannot be denied permissions. - -## Ownership Chains - - SQL Server ensures that only principals that have been granted permission can access objects. When multiple database objects access each other, the sequence is known as a chain. When SQL Server is traversing the links in the chain, it evaluates permissions differently than it would if it were accessing each item separately. When an object is accessed through a chain, SQL Server first compares the object's owner to the owner of the calling object (the previous link in the chain). If both objects have the same owner, permissions on the referenced object are not checked. Whenever an object accesses another object that has a different owner, the ownership chain is broken and SQL Server must check the caller's security context. - -## Procedural Code and Ownership Chaining - - Suppose that a user is granted execute permissions on a stored procedure that selects data from a table. If the stored procedure and the table have the same owner, the user doesn't need to be granted any permissions on the table and can even be denied permissions. However, if the stored procedure and the table have different owners, SQL Server must check the user's permissions on the table before allowing access to the data. - -> [!NOTE] -> Ownership chaining does not apply in the case of dynamic SQL statements. To call a procedure that executes an SQL statement, the caller must be granted permissions on the underlying tables, leaving your application vulnerable to SQL Injection attack. SQL Server provides new mechanisms, such as impersonation and signing modules with certificates, that do not require granting permissions on the underlying tables. These can also be used with CLR stored procedures. - -## External Resources - - For more information, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Permissions](/sql/relational-databases/security/permissions-database-engine)|Contains topics describing permissions hierarchy, catalog views, and permissions of fixed server and database roles.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Authentication in SQL Server](authentication-in-sql-server.md) -- [Server and Database Roles in SQL Server](server-and-database-roles-in-sql-server.md) -- [Ownership and User-Schema Separation in SQL Server](ownership-and-user-schema-separation-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/clr-integration-security-in-sql-server.md b/docs/framework/data/adonet/sql/clr-integration-security-in-sql-server.md deleted file mode 100644 index c28b9aa31ea9e..0000000000000 --- a/docs/framework/data/adonet/sql/clr-integration-security-in-sql-server.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -description: "Learn more about: CLR Integration Security in SQL Server" -title: "CLR Integration Security in SQL Server" -ms.date: "03/30/2017" -ms.assetid: 489fe096-fd1d-42de-8438-bf7aed46aea2 ---- -# CLR Integration Security in SQL Server - -Microsoft SQL Server provides the integration of the common language runtime (CLR) component of the .NET Framework. CLR integration allows you to write stored procedures, triggers, user-defined types, user-defined functions, user-defined aggregates, and streaming table-valued functions, using any .NET Framework language, such as Microsoft Visual Basic .NET or Microsoft Visual C#. - - The CLR supports a security model called code access security (CAS) for managed code. In this model, permissions are granted to assemblies based on evidence supplied by the code in metadata. SQL Server integrates the user-based security model of SQL Server with the code access-based security model of the CLR. - -## External Resources - - For more information on CLR integration with SQL Server, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Code Access Security](../../../misc/code-access-security.md)|Contains topics describing CAS in the .NET Framework.| -|[CLR Integration Security](/sql/relational-databases/clr-integration/security/clr-integration-security)|Discusses the security model for managed code executing inside of SQL Server.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [SQL Server Common Language Runtime Integration](sql-server-common-language-runtime-integration.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/creating-application-roles-in-sql-server.md b/docs/framework/data/adonet/sql/creating-application-roles-in-sql-server.md deleted file mode 100644 index fd6d46dad1da6..0000000000000 --- a/docs/framework/data/adonet/sql/creating-application-roles-in-sql-server.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -description: "Learn more about: Creating Application Roles in SQL Server" -title: "Creating Application Roles in SQL Server" -ms.date: "03/30/2017" -ms.assetid: 27442435-dfb2-4062-8c59-e2960833a638 ---- -# Creating Application Roles in SQL Server - -Application roles provide a way to assign permissions to an application instead of a database role or user. Users can connect to the database, activate the application role, and assume the permissions granted to the application. The permissions granted to the application role are in force for the duration of the connection. - -> [!IMPORTANT] -> Application roles are activated when a client application supplies an application role name and a password in the connection string. They present a security vulnerability in a two-tier application because the password must be stored on the client computer. In a three-tier application, you can store the password so that it cannot be accessed by users of the application. - -## Application Role Features - - Application roles have the following features: - -- Unlike database roles, application roles contain no members. - -- Application roles are activated when an application supplies the application role name and a password to the `sp_setapprole` system stored procedure. - -- The password must be stored on the client computer and supplied at run time; an application role cannot be activated from inside of SQL Server. - -- The password is not encrypted. The parameter password is stored as a one-way hash. - -- Once activated, permissions acquired through the application role remain in effect for the duration of the connection. - -- The application role inherits permissions granted to the `public` role. - -- If a member of the `sysadmin` fixed server role activates an application role, the security context switches to that of the application role for the duration of the connection. - -- If you create a `guest` account in a database that has an application role, you do not need to create a database user account for the application role or for any of the logins that invoke it. Application roles can directly access another database only if a `guest` account exists in the second database - -- Built-in functions that return login names, such as SYSTEM_USER, return the name of the login that invoked the application role. Built-in functions that return database user names return the name of the application role. - -### The Principle of Least Privilege - - Application roles should be granted only required permissions in case the password is compromised. Permissions to the `public` role should be revoked in any database using an application role. Disable the `guest` account in any database you do not want callers of the application role to have access to. - -### Application Role Enhancements - - The execution context can be switched back to the original caller after activating an application role, removing the need to disable connection pooling. The `sp_setapprole` procedure has a new option that creates a cookie, which contains context information about the caller. You can revert the session by calling the `sp_unsetapprole` procedure, passing it the cookie. - -## Application Role Alternatives - - Application roles depend on the security of a password, which presents a potential security vulnerability. Passwords may be exposed by being embedded in application code or saved on disk. - - You may want to consider the following alternatives. - -- Use context switching with the EXECUTE AS statement with its NO REVERT and WITH COOKIE clauses. You can create a user account in a database that is not mapped to a login. You then assign permissions to this account. Using EXECUTE AS with a login-less user is more secure because it is permission-based, not password-based. For more information, see [Customizing Permissions with Impersonation in SQL Server](customizing-permissions-with-impersonation-in-sql-server.md). - -- Sign stored procedures with certificates, granting only permission to execute the procedures. For more information, see [Signing Stored Procedures in SQL Server](signing-stored-procedures-in-sql-server.md). - -## External Resources - - For more information, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Application Roles](/sql/relational-databases/security/authentication-access/application-roles)|Describes how to create and use application roles in SQL Server 2008.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Overview of SQL Server Security](overview-of-sql-server-security.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/customizing-permissions-with-impersonation-in-sql-server.md b/docs/framework/data/adonet/sql/customizing-permissions-with-impersonation-in-sql-server.md deleted file mode 100644 index 3f8470183f6a1..0000000000000 --- a/docs/framework/data/adonet/sql/customizing-permissions-with-impersonation-in-sql-server.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -description: "Learn more about: Customizing Permissions with Impersonation in SQL Server" -title: "Customizing Permissions with Impersonation in SQL Server" -ms.date: "03/30/2017" -ms.assetid: dc733d09-1d6d-4af0-9c4b-8d24504860f1 ---- -# Customizing Permissions with Impersonation in SQL Server - -Many applications use stored procedures to access data, relying on ownership chaining to restrict access to base tables. You can grant EXECUTE permissions on stored procedures, revoking or denying permissions on the base tables. SQL Server does not check the permissions of the caller if the stored procedure and tables have the same owner. However, ownership chaining doesn't work if objects have different owners or in the case of dynamic SQL. - - You can use the EXECUTE AS clause in a stored procedure when the caller doesn't have permissions on the referenced database objects. The effect of the EXECUTE AS clause is that the execution context is switched to the proxy user. All code, as well as any calls to nested stored procedures or triggers, executes under the security context of the proxy user. Execution context is reverted to the original caller only after execution of the procedure or when a REVERT statement is issued. - -## Context Switching with the EXECUTE AS Statement - - The Transact-SQL EXECUTE AS statement allows you to switch the execution context of a statement by impersonating another login or database user. This is a useful technique for testing queries and procedures as another user. - -```sql -EXECUTE AS LOGIN = 'loginName'; -EXECUTE AS USER = 'userName'; -``` - - You must have IMPERSONATE permissions on the login or user you are impersonating. This permission is implied for `sysadmin` for all databases, and `db_owner` role members in databases that they own. - -## Granting Permissions with the EXECUTE AS Clause - - You can use the EXECUTE AS clause in the definition header of a stored procedure, trigger, or user-defined function (except for inline table-valued functions). This causes the procedure to execute in the context of the user name or keyword specified in the EXECUTE AS clause. You can create a proxy user in the database that is not mapped to a login, granting it only the necessary permissions on the objects accessed by the procedure. Only the proxy user specified in the EXECUTE AS clause must have permissions on all objects accessed by the module. - -> [!NOTE] -> Some actions, such as TRUNCATE TABLE, do not have grantable permissions. By incorporating the statement within a procedure and specifying a proxy user who has ALTER TABLE permissions, you can extend the permissions to truncate the table to callers who have only EXECUTE permissions on the procedure. - - The context specified in the EXECUTE AS clause is valid for the duration of the procedure, including nested procedures and triggers. Context reverts to the caller when execution is complete or the REVERT statement is issued. - - There are three steps involved in using the EXECUTE AS clause in a procedure. - -1. Create a proxy user in the database that is not mapped to a login. This is not required, but it helps when managing permissions. - -```sql -CREATE USER proxyUser WITHOUT LOGIN -``` - -1. Grant the proxy user the necessary permissions. - -2. Add the EXECUTE AS clause to the stored procedure or user-defined function. - -```sql -CREATE PROCEDURE [procName] WITH EXECUTE AS 'proxyUser' AS ... -``` - -> [!NOTE] -> Applications that require auditing can break because the original security context of the caller is not retained. Built-in functions that return the identity of the current user, such as SESSION_USER, USER, or USER_NAME, return the user associated with the EXECUTE AS clause, not the original caller. - -### Using EXECUTE AS with REVERT - - You can use the Transact-SQL REVERT statement to revert to the original execution context. - - The optional clause, WITH NO REVERT COOKIE = @variableName, allows you switch the execution context back to the caller if the @variableName variable contains the correct value. This allows you to switch the execution context back to the caller in environments where connection pooling is used. Because the value of @variableName is known only to the caller of the EXECUTE AS statement, the caller can guarantee that the execution context cannot be changed by the end user that invokes the application. When the connection is closed, it is returned to the pool. For more information on connection pooling in ADO.NET, see [SQL Server Connection Pooling (ADO.NET)](../sql-server-connection-pooling.md). - -### Specifying the Execution Context - - In addition to specifying a user, you can also use EXECUTE AS with any of the following keywords. - -- CALLER. Executing as CALLER is the default; if no other option is specified, then the procedure executes in the security context of the caller. - -- OWNER. Executing as OWNER executes the procedure in the context of the procedure owner. If the procedure is created in a schema owned by `dbo` or the database owner, the procedure will execute with unrestricted permissions. - -- SELF. Executing as SELF executes in the security context of the creator of the stored procedure. This is equivalent to executing as a specified user, where the specified user is the person creating or altering the procedure. - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Overview of SQL Server Security](overview-of-sql-server-security.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Managing Permissions with Stored Procedures in SQL Server](managing-permissions-with-stored-procedures-in-sql-server.md) -- [Writing Secure Dynamic SQL in SQL Server](writing-secure-dynamic-sql-in-sql-server.md) -- [Signing Stored Procedures in SQL Server](signing-stored-procedures-in-sql-server.md) -- [Modifying Data with Stored Procedures](../modifying-data-with-stored-procedures.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/data-encryption-in-sql-server.md b/docs/framework/data/adonet/sql/data-encryption-in-sql-server.md deleted file mode 100644 index 4d7eeb51382a9..0000000000000 --- a/docs/framework/data/adonet/sql/data-encryption-in-sql-server.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: "Learn more about: Data Encryption in SQL Server" -title: "Data Encryption in SQL Server" -ms.date: "03/30/2017" -ms.assetid: 83b992f7-b351-4678-b4b9-f4ffd58134cc ---- -# Data Encryption in SQL Server - -SQL Server provides functions to encrypt and decrypt data using a certificate, asymmetric key, or symmetric key. It manages all of these in an internal certificate store. The store uses an encryption hierarchy that secures certificates and keys at one level with the layer above it in the hierarchy. This feature area of SQL Server is called Secret Storage. - - The fastest mode of encryption supported by the encryption functions is symmetric key encryption. This mode is suitable for handling large volumes of data. The symmetric keys can be encrypted by certificates, passwords or other symmetric keys. - -## Keys and Algorithms - - SQL Server supports several symmetric key encryption algorithms, including DES, Triple DES, RC2, RC4, 128-bit RC4, DESX, 128-bit AES, 192-bit AES, and 256-bit AES. The algorithms are implemented using the Windows Crypto API. - - Within the scope of a database connection, SQL Server can maintain multiple open symmetric keys. An open key is retrieved from the store and is available for decrypting data. When a piece of data is decrypted, there is no need to specify the symmetric key to use. Each encrypted value contains the key identifier (key GUID) of the key used to encrypt it. The engine matches the encrypted byte stream to an open symmetric key, if the correct key has been decrypted and is open. This key is then used to perform decryption and return the data. If the correct key is not open, NULL is returned. - - For an example that shows how to work with encrypted data in a database, see [Encrypt a Column of Data](/sql/relational-databases/security/encryption/encrypt-a-column-of-data). - -## External Resources - - For more information on data encryption, see the following resources. - -|Resource|Description| -|-|-| -|[SQL Server Encryption](/sql/relational-databases/security/encryption/sql-server-encryption)|Provides an overview of encryption in SQL Server. This topic includes links to additional articles.| -|[Encryption Hierarchy](/sql/relational-databases/security/encryption/encryption-hierarchy)|Provides an overview of encryption in SQL Server. This topic provides links to additional articles.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Authentication in SQL Server](authentication-in-sql-server.md) -- [Server and Database Roles in SQL Server](server-and-database-roles-in-sql-server.md) -- [Ownership and User-Schema Separation in SQL Server](ownership-and-user-schema-separation-in-sql-server.md) -- [Authorization and Permissions in SQL Server](authorization-and-permissions-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/enabling-cross-database-access-in-sql-server.md b/docs/framework/data/adonet/sql/enabling-cross-database-access-in-sql-server.md deleted file mode 100644 index 3fe4128462374..0000000000000 --- a/docs/framework/data/adonet/sql/enabling-cross-database-access-in-sql-server.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: "Learn more about: Enabling Cross-Database Access in SQL Server" -title: "Enabling Cross-Database Access in SQL Server" -ms.date: "03/30/2017" -ms.assetid: 10663fb6-434c-4c81-8178-ec894b9cf895 ---- -# Enabling Cross-Database Access in SQL Server - -Cross-database ownership chaining occurs when a procedure in one database depends on objects in another database. A cross-database ownership chain works in the same way as ownership chaining within a single database, except that an unbroken ownership chain requires that all the object owners are mapped to the same login account. If the source object in the source database and the target objects in the target databases are owned by the same login account, SQL Server does not check permissions on the target objects. - -## Off By Default - - Ownership chaining across databases is turned off by default. Microsoft recommends that you disable cross-database ownership chaining because it exposes you to the following security risks: - -- Database owners and members of the `db_ddladmin` or the `db_owners` database roles can create objects that are owned by other users. These objects can potentially target objects in other databases. This means that if you enable cross-database ownership chaining, you must fully trust these users with data in all databases. - -- Users with CREATE DATABASE permission can create new databases and attach existing databases. If cross-database ownership chaining is enabled, these users can access objects in other databases that they might not have privileges in from the newly created or attached databases that they create. - -## Enabling Cross-database Ownership Chaining - - Cross-database ownership chaining should only be enabled in environments where you can fully trust highly-privileged users. It can be configured during setup for all databases, or selectively for specific databases using the Transact-SQL commands `sp_configure` and `ALTER DATABASE`. - - To selectively configure cross-database ownership chaining, use `sp_configure` to turn it off for the server. Then use the ALTER DATABASE command with SET DB_CHAINING ON to configure cross-database ownership chaining for only the databases that require it. - - The following sample turns on cross-database ownership chaining for all databases: - -```sql -EXECUTE sp_configure 'show advanced', 1; -RECONFIGURE; -EXECUTE sp_configure 'cross db ownership chaining', 1; -RECONFIGURE; -``` - - The following sample turns on cross-database ownership chaining for specific databases: - -```sql -ALTER DATABASE Database1 SET DB_CHAINING ON; -ALTER DATABASE Database2 SET DB_CHAINING ON; -``` - -### Dynamic SQL - - Cross-database ownership chaining does not work in cases where dynamically created SQL statements are executed unless the same user exists in both databases. You can work around this in SQL Server by creating a stored procedure that accesses data in another database and signing the procedure with a certificate that exists in both databases. This gives users access to the database resources used by the procedure without granting them database access or permissions. - -## External Resources - - For more information, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Extending Database Impersonation by Using EXECUTE AS](/previous-versions/sql/sql-server-2008-r2/ms188304(v=sql.105)) and [Cross DB Ownership Chaining Option](/sql/database-engine/configure-windows/cross-db-ownership-chaining-server-configuration-option).|Articles describe how to configure cross-database ownership chaining for an instance of SQL Server.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Overview of SQL Server Security](overview-of-sql-server-security.md) -- [Managing Permissions with Stored Procedures in SQL Server](managing-permissions-with-stored-procedures-in-sql-server.md) -- [Writing Secure Dynamic SQL in SQL Server](writing-secure-dynamic-sql-in-sql-server.md) -- [Signing Stored Procedures in SQL Server](signing-stored-procedures-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server.md b/docs/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server.md deleted file mode 100644 index a2ce36ca5c641..0000000000000 --- a/docs/framework/data/adonet/sql/granting-row-level-permissions-in-sql-server.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -description: "Learn more about: Granting Row-Level Permissions in SQL Server" -title: "Granting Row-Level Permissions in SQL Server" -ms.date: "03/30/2017" -ms.assetid: a55aaa12-34ab-41cd-9dec-fd255b29258c ---- - -# Granting Row-Level Permissions in SQL Server - -In some scenarios, there is a requirement to control access to data at a more granular level than what simply granting, revoking, or denying permissions provides. For example, a hospital database application may require individual Doctors to be restricted to accessing information related to only their patients. Similar requirements exist in many environments, including finance, law, government, and military applications. To help address these scenarios, SQL Server 2016 provides a [Row-Level Security](/sql/relational-databases/security/row-level-security) feature that simplifies and centralizes row-level access logic in a security policy. For earlier versions of SQL Server, similar functionality can be achieved by using views to enact row-level filtering. - -## Implementing Row-level Filtering - -Row-level filtering is used for applications storing information in a single table like in the hospital example above. To implement row-level filtering each row has a column that defines a differentiating parameter, such as a user name, label or other identifier. You create either a security policy or a view on the table, which filters the rows that the user can access. You then create parameterized stored procedures, which control the types of queries the user can execute. - -The following example describes how to configure row-level filtering based on a user or login name: - -- Create the table, adding a column to store the name. - -- Enable row-level filtering: - - - If you are using SQL Server 2016 or higher, or [Azure SQL Database](/azure/sql-database/), create a security policy that adds a predicate on the table restricting the rows returned to those that match either the current database user (using the CURRENT_USER() built-in function) or the current login name (using the SUSER_SNAME() built-in function): - - ```sql - CREATE SCHEMA Security - GO - - CREATE FUNCTION Security.userAccessPredicate(@UserName sysname) - RETURNS TABLE - WITH SCHEMABINDING - AS - RETURN SELECT 1 AS accessResult - WHERE @UserName = SUSER_SNAME() - GO - - CREATE SECURITY POLICY Security.userAccessPolicy - ADD FILTER PREDICATE Security.userAccessPredicate(UserName) ON dbo.MyTable, - ADD BLOCK PREDICATE Security.userAccessPredicate(UserName) ON dbo.MyTable - GO - ``` - - - If you are using a version of SQL Server prior to 2016, you can achieve similar functionality using a view: - - ```sql - CREATE VIEW vw_MyTable - AS - RETURN SELECT * FROM MyTable - WHERE UserName = SUSER_SNAME() - GO - ``` - -- Create stored procedures to select, insert, update, and delete data. If the filtering is enacted by a security policy, the stored procedures should perform these operations on the base table directly; otherwise, if the filtering is enacted by a view, the stored procedures should instead operate against the view. The security policy or view will automatically filter the rows returned or modified by user queries, and the stored procedure will provide a harder security boundary to prevent users with direct query access from successfully running queries that can infer the existence of filtered data. - -- For stored procedures that insert data, capture the user name using the same function specified in the security policy or view, and insert that value into the UserName column. - -- Deny all permissions on the tables (and views, if applicable) to the `public` role. Users will not be able to inherit permissions from other database roles, because the filter predicate is based on user or login names, not on roles. - -- Grant EXECUTE on the stored procedures to database roles. Users can only access data through the stored procedures provided. - -## See also - -- [Row-Level Security](/sql/relational-databases/security/row-level-security) -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Overview of SQL Server Security](overview-of-sql-server-security.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Managing Permissions with Stored Procedures in SQL Server](managing-permissions-with-stored-procedures-in-sql-server.md) -- [Writing Secure Dynamic SQL in SQL Server](writing-secure-dynamic-sql-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/index.md b/docs/framework/data/adonet/sql/index.md index 771091eeb5118..a591b8f4a1c73 100644 --- a/docs/framework/data/adonet/sql/index.md +++ b/docs/framework/data/adonet/sql/index.md @@ -7,35 +7,32 @@ ms.assetid: c18b1fb1-2af1-4de7-80a4-95e56fd976cb --- # SQL Server and ADO.NET -This section describes features and behaviors that are specific to the .NET Framework Data Provider for SQL Server (). - - provides access to versions of SQL Server, which encapsulates database-specific protocols. The functionality of the data provider is designed to be similar to that of the .NET Framework data providers for OLE DB, ODBC, and Oracle. includes a tabular data stream (TDS) parser to communicate directly with SQL Server. - +This section describes features and behaviors that are specific to the .NET Framework Data Provider for SQL Server (). + + provides access to versions of SQL Server, which encapsulates database-specific protocols. The functionality of the data provider is designed to be similar to that of the .NET Framework data providers for OLE DB, ODBC, and Oracle. includes a tabular data stream (TDS) parser to communicate directly with SQL Server. + > [!NOTE] -> To use the .NET Framework Data Provider for SQL Server, an application must reference the namespace. - -## In This Section - - [SQL Server Security](sql-server-security.md) - Provides an overview of SQL Server security features, and application scenarios for creating secure ADO.NET applications that target SQL Server. - - [SQL Server Data Types and ADO.NET](sql-server-data-types.md) - Describes how to work with SQL Server data types and how they interact with .NET Framework data types. - - [SQL Server Binary and Large-Value Data](sql-server-binary-and-large-value-data.md) - Describes how to work with large value data in SQL Server. - - [SQL Server Data Operations in ADO.NET](sql-server-data-operations.md) - Describes how to work with data in SQL Server. Contains sections about bulk copy operations, MARS, asynchronous operations, and table-valued parameters. - - [SQL Server Features and ADO.NET](sql-server-features-and-adonet.md) - Describes SQL Server features that are useful for ADO.NET application developers. - - [LINQ to SQL](./linq/index.md) - Describes the basic building blocks, processes, and techniques required for creating LINQ to SQL applications. - +> To use the .NET Framework Data Provider for SQL Server, an application must reference the namespace. + +## In This Section + + [SQL Server Data Types and ADO.NET](sql-server-data-types.md)\ + Describes how to work with SQL Server data types and how they interact with .NET Framework data types. + + [SQL Server Binary and Large-Value Data](sql-server-binary-and-large-value-data.md)\ + Describes how to work with large value data in SQL Server. + + [SQL Server Data Operations in ADO.NET](sql-server-data-operations.md)\ + Describes how to work with data in SQL Server. Contains sections about bulk copy operations, MARS, asynchronous operations, and table-valued parameters. + + [SQL Server Features and ADO.NET](sql-server-features-and-adonet.md)\ + Describes SQL Server features that are useful for ADO.NET application developers. + + [LINQ to SQL](./linq/index.md)\ + Describes the basic building blocks, processes, and techniques required for creating LINQ to SQL applications. + For complete documentation of the SQL Server Database Engine, see [SQL Server technical documentation](/sql/sql-server/sql-server-technical-documentation). - + ## See also - [Securing ADO.NET Applications](../securing-ado-net-applications.md) diff --git a/docs/framework/data/adonet/sql/linq/security-in-linq-to-sql.md b/docs/framework/data/adonet/sql/linq/security-in-linq-to-sql.md index 609d5096ecfe8..db64ab1192219 100644 --- a/docs/framework/data/adonet/sql/linq/security-in-linq-to-sql.md +++ b/docs/framework/data/adonet/sql/linq/security-in-linq-to-sql.md @@ -20,7 +20,7 @@ Security risks are always present when you connect to a database. Although LINQ Using passwords in connection strings should be avoided whenever possible. Not only is a connection string a security risk in its own right, but the connection string may also be added in clear text to the object model or external mapping file when using the Object Relational Designer or SQLMetal command-line tool. Anyone with access to the object model or external mapping file via the file system could see the connection password (if it is included in the connection string). - To minimize such risks, use integrated security to make a trusted connection with SQL Server. By using this approach, you do not have to store a password in the connection string. For more information, see [SQL Server Security](../sql-server-security.md). + To minimize such risks, use integrated security to make a trusted connection with SQL Server. By using this approach, you do not have to store a password in the connection string. For more information, see [SQL Server Security](/previous-versions/dotnet/framework/data/adonet/sql/sql-server-security). In the absence of integrated security, a clear-text password will be needed in the connection string. The best way to help secure your connection string, in increasing order of risk, is as follows: diff --git a/docs/framework/data/adonet/sql/managing-permissions-with-stored-procedures-in-sql-server.md b/docs/framework/data/adonet/sql/managing-permissions-with-stored-procedures-in-sql-server.md deleted file mode 100644 index dd0d55112e21e..0000000000000 --- a/docs/framework/data/adonet/sql/managing-permissions-with-stored-procedures-in-sql-server.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "Managing Permissions with Stored Procedures in SQL Server" -description: Learn how to restrict access to your data and database objects by implementing access using stored procedures or user-defined functions. -ms.date: "03/30/2017" -ms.assetid: 08fa34e8-2ffa-470d-ba62-e511a5f8558e ---- -# Managing Permissions with Stored Procedures in SQL Server - -One method of creating multiple lines of defense around your database is to implement all data access using stored procedures or user-defined functions. You revoke or deny all permissions to underlying objects, such as tables, and grant EXECUTE permissions on stored procedures. This effectively creates a security perimeter around your data and database objects. - -## Stored Procedure Benefits - - Stored procedures have the following benefits: - -- Data logic and business rules can be encapsulated so that users can access data and objects only in ways that developers and database administrators intend. - -- Parameterized stored procedures that validate all user input can be used to thwart SQL injection attacks. If you use dynamic SQL, be sure to parameterize your commands, and never include parameter values directly into a query string. - -- Ad hoc queries and data modifications can be disallowed. This prevents users from maliciously or inadvertently destroying data or executing queries that impair performance on the server or the network. - -- Errors can be handled in procedure code without being passed directly to client applications. This prevents error messages from being returned that could aid in a probing attack. Log errors and handle them on the server. - -- Stored procedures can be written once, and accessed by many applications. - -- Client applications do not need to know anything about the underlying data structures. Stored procedure code can be changed without requiring changes in client applications as long as the changes do not affect parameter lists or returned data types. - -- Stored procedures can reduce network traffic by combining multiple operations into one procedure call. - -## Stored Procedure Execution - - Stored procedures take advantage of ownership chaining to provide access to data so that users do not need to have explicit permission to access database objects. An ownership chain exists when objects that access each other sequentially are owned by the same user. For example, a stored procedure can call other stored procedures, or a stored procedure can access multiple tables. If all objects in the chain of execution have the same owner, then SQL Server only checks the EXECUTE permission for the caller, not the caller's permissions on other objects. Therefore you need to grant only EXECUTE permissions on stored procedures; you can revoke or deny all permissions on the underlying tables. - -## Best Practices - - Simply writing stored procedures isn't enough to adequately secure your application. You should also consider the following potential security holes. - -- Grant EXECUTE permissions on the stored procedures for database roles you want to be able to access the data. - -- Revoke or deny all permissions to the underlying tables for all roles and users in the database, including the `public` role. All users inherit permissions from public. Therefore denying permissions to `public` means that only owners and `sysadmin` members have access; all other users will be unable to inherit permissions from membership in other roles. - -- Do not add users or roles to the `sysadmin` or `db_owner` roles. System administrators and database owners can access all database objects. - -- Disable the `guest` account. This will prevent anonymous users from connecting to the database. The guest account is disabled by default in new databases. - -- Implement error handling and log errors. - -- Create parameterized stored procedures that validate all user input. Treat all user input as untrusted. - -- Avoid dynamic SQL unless absolutely necessary. Use the Transact-SQL QUOTENAME() function to delimit a string value and escape any occurrence of the delimiter in the input string. - -## External Resources - - For more information, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Stored Procedures](/sql/relational-databases/stored-procedures/stored-procedures-database-engine) and [SQL Injection](/sql/relational-databases/security/sql-injection)|Articles describe how to create stored procedures and how SQL Injection works.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Overview of SQL Server Security](overview-of-sql-server-security.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Writing Secure Dynamic SQL in SQL Server](writing-secure-dynamic-sql-in-sql-server.md) -- [Signing Stored Procedures in SQL Server](signing-stored-procedures-in-sql-server.md) -- [Customizing Permissions with Impersonation in SQL Server](customizing-permissions-with-impersonation-in-sql-server.md) -- [Modifying Data with Stored Procedures](../modifying-data-with-stored-procedures.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/overview-of-sql-server-security.md b/docs/framework/data/adonet/sql/overview-of-sql-server-security.md deleted file mode 100644 index dd4ca390cec03..0000000000000 --- a/docs/framework/data/adonet/sql/overview-of-sql-server-security.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Overview of SQL Server Security" -description: Learn about the SQL Server security architecture to understand which features and functionality counter known threats, and to anticipate future threats. -ms.date: "03/30/2017" -ms.assetid: ae66dd75-5c16-4cc0-9e12-774dd26d3fb9 ---- -# Overview of SQL Server Security - -A defense-in-depth strategy, with overlapping layers of security, is the best way to counter security threats. SQL Server provides a security architecture that is designed to allow database administrators and developers to create secure database applications and counter threats. Each version of SQL Server has improved on previous versions of SQL Server with the introduction of new features and functionality. However, security does not ship in the box. Each application is unique in its security requirements. Developers need to understand which combination of features and functionality are most appropriate to counter known threats, and to anticipate threats that may arise in the future. - - A SQL Server instance contains a hierarchical collection of entities, starting with the server. Each server contains multiple databases, and each database contains a collection of securable objects. Every SQL Server securable has associated *permissions* that can be granted to a *principal*, which is an individual, group or process granted access to SQL Server. The SQL Server security framework manages access to securable entities through *authentication* and *authorization*. - -- Authentication is the process of logging on to SQL Server by which a principal requests access by submitting credentials that the server evaluates. Authentication establishes the identity of the user or process being authenticated. - -- Authorization is the process of determining which securable resources a principal can access, and which operations are allowed for those resources. - - The topics in this section cover SQL Server security fundamentals, providing links to the complete documentation in the SQL Server docs. - -## In This Section - - [Authentication in SQL Server](authentication-in-sql-server.md) - Describes logins and authentication in SQL Server and provides links to additional resources. - - [Server and Database Roles in SQL Server](server-and-database-roles-in-sql-server.md) - Describes fixed server and database roles, custom database roles, and built-in accounts and provides links to additional resources. - - [Ownership and User-Schema Separation in SQL Server](ownership-and-user-schema-separation-in-sql-server.md) - Describes object ownership and user-schema separation and provides links to additional resources. - - [Authorization and Permissions in SQL Server](authorization-and-permissions-in-sql-server.md) - Describes granting permissions using the principle of least privilege and provides links to additional resources. - - [Data Encryption in SQL Server](data-encryption-in-sql-server.md) - Describes data encryption options in SQL Server and provides links to additional resources. - - [CLR Integration Security in SQL Server](clr-integration-security-in-sql-server.md) - Provides links to CLR integration security resources. - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [SQL Server Security](sql-server-security.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/ownership-and-user-schema-separation-in-sql-server.md b/docs/framework/data/adonet/sql/ownership-and-user-schema-separation-in-sql-server.md deleted file mode 100644 index 7f6ccd53aec22..0000000000000 --- a/docs/framework/data/adonet/sql/ownership-and-user-schema-separation-in-sql-server.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "Ownership and User-Schema Separation in SQL Server" -description: Learn how user-schema separation allows flexibility in managing SQL Server database object permissions. Schemas group objects into separate namespaces. -ms.date: "03/30/2017" -ms.assetid: 242830c1-31b5-4427-828c-cc22ff339f30 ---- -# Ownership and User-Schema Separation in SQL Server - -A core concept of SQL Server security is that owners of objects have irrevocable permissions to administer them. You cannot remove privileges from an object owner, and you cannot drop users from a database if they own objects in it. - -## User-Schema Separation - - User-schema separation allows for more flexibility in managing database object permissions. A *schema* is a named container for database objects, which allows you to group objects into separate namespaces. For example, the AdventureWorks sample database contains schemas for Production, Sales, and HumanResources. - - The four-part naming syntax for referring to objects specifies the schema name. - -```text -Server.Database.DatabaseSchema.DatabaseObject -``` - -### Schema Owners and Permissions - - Schemas can be owned by any database principal, and a single principal can own multiple schemas. You can apply security rules to a schema, which are inherited by all objects in the schema. Once you set up access permissions for a schema, those permissions are automatically applied as new objects are added to the schema. Users can be assigned a default schema, and multiple database users can share the same schema. - - By default, when developers create objects in a schema, the objects are owned by the security principal that owns the schema, not the developer. Object ownership can be transferred with ALTER AUTHORIZATION Transact-SQL statement. A schema can also contain objects that are owned by different users and have more granular permissions than those assigned to the schema, although this is not recommended because it adds complexity to managing permissions. Objects can be moved between schemas, and schema ownership can be transferred between principals. Database users can be dropped without affecting schemas. - -### Built-In Schemas - - SQL Server ships with ten pre-defined schemas that have the same names as the built-in database users and roles. These exist mainly for backward compatibility. You can drop the schemas that have the same names as the fixed database roles if you do not need them. You cannot drop the following schemas: - -- `dbo` - -- `guest` - -- `sys` - -- `INFORMATION_SCHEMA` - - If you drop them from the model database, they will not appear in new databases. - -> [!NOTE] -> The `sys` and `INFORMATION_SCHEMA` schemas are reserved for system objects. You cannot create objects in these schemas and you cannot drop them. - -#### The dbo Schema - - The `dbo` schema is the default schema for a newly created database. The `dbo` schema is owned by the `dbo` user account. By default, users created with the CREATE USER Transact-SQL command have `dbo` as their default schema. - - Users who are assigned the `dbo` schema do not inherit the permissions of the `dbo` user account. No permissions are inherited from a schema by users; schema permissions are inherited by the database objects contained in the schema. - -> [!NOTE] -> When database objects are referenced by using a one-part name, SQL Server first looks in the user's default schema. If the object is not found there, SQL Server looks next in the `dbo` schema. If the object is not in the `dbo` schema, an error is returned. - -## External Resources - - For more information on object ownership and schemas, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[User-Schema Separation](/previous-versions/sql/sql-server-2008-r2/ms190387(v=sql.105))|Describes the changes introduced by user-schema separation. Includes new behavior, its impact on ownership, catalog views, and permissions.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Authentication in SQL Server](authentication-in-sql-server.md) -- [Server and Database Roles in SQL Server](server-and-database-roles-in-sql-server.md) -- [Authorization and Permissions in SQL Server](authorization-and-permissions-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/server-and-database-roles-in-sql-server.md b/docs/framework/data/adonet/sql/server-and-database-roles-in-sql-server.md deleted file mode 100644 index c8b90442f0138..0000000000000 --- a/docs/framework/data/adonet/sql/server-and-database-roles-in-sql-server.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "Server and Database Roles in SQL Server" -description: Learn about fixed server and fixed database roles, which have a fixed set of permissions assigned to them. SQL Server uses role-based security. -ms.date: "03/30/2017" -ms.assetid: 5482dfdb-e498-4614-8652-b174829eed13 ---- -# Server and Database Roles in SQL Server - -All versions of SQL Server use role-based security, which allows you to assign permissions to a role, or group of users, instead of to individual users. Fixed server and fixed database roles have a fixed set of permissions assigned to them. - -## Fixed Server Roles - - Fixed server roles have a fixed set of permissions and server-wide scope. They are intended for use in administering SQL Server and the permissions assigned to them cannot be changed. Logins can be assigned to fixed server roles without having a user account in a database. - -> [!IMPORTANT] -> The `sysadmin` fixed server role encompasses all other roles and has unlimited scope. Do not add principals to this role unless they are highly trusted. `sysadmin` role members have irrevocable administrative privileges on all server databases and resources. - - Be selective when you add users to fixed server roles. For example, the `bulkadmin` role allows users to insert the contents of any local file into a table, which could jeopardize data integrity. - -## Fixed Database Roles - - Fixed database roles have a pre-defined set of permissions that are designed to allow you to easily manage groups of permissions. Members of the `db_owner` role can perform all configuration and maintenance activities on the database. - - For more information about SQL Server predefined roles, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Server-Level Roles](/sql/relational-databases/security/authentication-access/server-level-roles)|Describes fixed server roles and the permissions associated with them in SQL Server.| -|[Database-Level Roles](/sql/relational-databases/security/authentication-access/database-level-roles)|Describes fixed database roles and the permissions associated with them| - -## Database Roles and Users - - Logins must be mapped to database user accounts in order to work with database objects. Database users can then be added to database roles, inheriting any permission sets associated with those roles. All permissions can be granted. - - You must also consider the `public` role, the `dbo` user account, and the `guest` account when you design security for your application. - -### The public Role - - The `public` role is contained in every database, which includes system databases. It cannot be dropped and you cannot add or remove users from it. Permissions granted to the `public` role are inherited by all other users and roles because they belong to the `public` role by default. Grant `public` only the permissions you want all users to have. - -### The dbo User Account - - The `dbo`, or database owner, is a user account that has implied permissions to perform all activities in the database. Members of the `sysadmin` fixed server role are automatically mapped to `dbo`. - -> [!NOTE] -> `dbo` is also the name of a schema, as discussed in [Ownership and User-Schema Separation in SQL Server](ownership-and-user-schema-separation-in-sql-server.md). - - The `dbo` user account is frequently confused with the `db_owner` fixed database role. The scope of `db_owner` is a database; the scope of `sysadmin` is the whole server. Membership in the `db_owner` role does not confer `dbo` user privileges. - -### The guest User Account - - After a user has been authenticated and allowed to log in to an instance of SQL Server, a separate user account must exist in each database the user has to access. Requiring a user account in each database prevents users from connecting to an instance of SQL Server and accessing all the databases on a server. The existence of a `guest` user account in the database circumvents this requirement by allowing a login without a database user account to access a database. - - The `guest` account is a built-in account in all versions of SQL Server. By default, it is disabled in new databases. If it is enabled, you can disable it by revoking its CONNECT permission by executing the Transact-SQL REVOKE CONNECT FROM GUEST statement. - -> [!IMPORTANT] -> Avoid using the `guest` account; all logins without their own database permissions obtain the database permissions granted to this account. If you must use the `guest` account, grant it minimum permissions. - - For more information about SQL Server logins, users and roles, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Getting Started with Database Engine Permissions](/sql/relational-databases/security/authentication-access/getting-started-with-database-engine-permissions)|Contains links to topics that describe principals, roles, credentials, securables and permissions.| -|[Principals](/sql/relational-databases/security/authentication-access/principals-database-engine)|Describes principals and contains links to topics that describe server and database roles.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Authentication in SQL Server](authentication-in-sql-server.md) -- [Ownership and User-Schema Separation in SQL Server](ownership-and-user-schema-separation-in-sql-server.md) -- [Authorization and Permissions in SQL Server](authorization-and-permissions-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/signing-stored-procedures-in-sql-server.md b/docs/framework/data/adonet/sql/signing-stored-procedures-in-sql-server.md deleted file mode 100644 index b02900ec64441..0000000000000 --- a/docs/framework/data/adonet/sql/signing-stored-procedures-in-sql-server.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -description: "Learn more about: Signing Stored Procedures in SQL Server" -title: "Signing Stored Procedures in SQL Server" -ms.date: "01/05/2018" -ms.assetid: eeed752c-0084-48e5-9dca-381353007a0d ---- -# Signing Stored Procedures in SQL Server - -A digital signature is a data digest encrypted with the private key of the signer. The private key ensures that the digital signature is unique to its bearer or owner. You can sign stored procedures, functions (except for inline table-valued functions), triggers, and assemblies. - -You can sign a stored procedure with a certificate or an asymmetric key. This is designed for scenarios when permissions cannot be inherited through ownership chaining or when the ownership chain is broken, such as dynamic SQL. You can then create a user mapped to the certificate, granting the certificate user permissions on the objects the stored procedure needs to access. - -You can also create a login mapped to the same certificate, and then grant any necessary server-level permissions to that login, or add the login to one or more of the fixed server roles. This is designed to avoid enabling the `TRUSTWORTHY` database setting for scenarios in which higher level permissions are needed. - -When the stored procedure is executed, SQL Server combines the permissions of the certificate user and/or login with those of the caller. Unlike the `EXECUTE AS` clause, it does not change the execution context of the procedure. Built-in functions that return login and user names return the name of the caller, not the certificate user name. - -## Creating Certificates - -When you sign a stored procedure with a certificate or asymmetric key, a data digest consisting of the encrypted hash of the stored procedure code, along with the execute-as user, is created using the private key. At run time, the data digest is decrypted with the public key and compared with the hash value of the stored procedure. Changing the execute-as user invalidates the hash value so that the digital signature no longer matches. Modifying the stored procedure drops the signature entirely, which prevents someone who does not have access to the private key from changing the stored procedure code. In either case, you must re-sign the procedure each time you change the code or the execute-as user. - -There are two required steps involved in signing a module: - -1. Create a certificate using the Transact-SQL `CREATE CERTIFICATE [certificateName]` statement. This statement has several options for setting a start and end date and a password. The default expiration date is one year. - -1. Sign the procedure with the certificate using the Transact-SQL `ADD SIGNATURE TO [procedureName] BY CERTIFICATE [certificateName]` statement. - -Once the module has been signed, one or more principals needs to be created in order to hold the additional permissions that should be associated with the certificate. - -If the module needs additional database-level permissions: - -1. Create a database user associated with that certificate using the Transact-SQL `CREATE USER [userName] FROM CERTIFICATE [certificateName]` statement. This user exists in the database only and is not associated with a login unless a login has also been created from that same certificate. - -1. Grant the certificate user the required database-level permissions. - -If the module needs additional server-level permissions: - -1. Copy the certificate to the `master` database. - -1. Create a login associated with that certificate using the Transact-SQL `CREATE LOGIN [userName] FROM CERTIFICATE [certificateName]` statement. - -1. Grant the certificate login the required server-level permissions. - -> [!NOTE] -> A certificate cannot grant permissions to a user that has had permissions revoked using the DENY statement. DENY always takes precedence over GRANT, preventing the caller from inheriting permissions granted to the certificate user. - -## External Resources - -For more information, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Module Signing](/previous-versions/sql/sql-server-2008/ms345102(v=sql.100))|Describes module signing, providing a sample scenario and links to the relevant Transact-SQL articles.| -|[Signing Stored Procedures with a Certificate](/sql/relational-databases/tutorial-signing-stored-procedures-with-a-certificate)|Provides a tutorial for signing a stored procedure with a certificate.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Overview of SQL Server Security](overview-of-sql-server-security.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Managing Permissions with Stored Procedures in SQL Server](managing-permissions-with-stored-procedures-in-sql-server.md) -- [Writing Secure Dynamic SQL in SQL Server](writing-secure-dynamic-sql-in-sql-server.md) -- [Customizing Permissions with Impersonation in SQL Server](customizing-permissions-with-impersonation-in-sql-server.md) -- [Modifying Data with Stored Procedures](../modifying-data-with-stored-procedures.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/sql-server-express-security.md b/docs/framework/data/adonet/sql/sql-server-express-security.md deleted file mode 100644 index 3435728b57b63..0000000000000 --- a/docs/framework/data/adonet/sql/sql-server-express-security.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -description: "Learn more about: SQL Server Express Security" -title: "SQL Server Express Security" -ms.date: "03/30/2017" -ms.assetid: cf9cf6d9-4b05-43e9-ac7b-6cefbfcd6d4e ---- -# SQL Server Express Security - -Microsoft SQL Server Express Edition (SQL Server Express) is based on Microsoft SQL Server, and supports most of the features of the database engine. It is designed so that nonessential features and network connectivity are off by default. This reduces the surface area available for attack by a malicious user. - - SQL Server Express is usually installed as a named instance. The default name of the instance is `SQLExpress`. A named instance is identified by the network name of the computer plus the instance name that you specify during installation. - -## Network Access - - For security reasons, networking protocols are disabled by default in SQL Server Express. This prevents attacks from outside users that might compromise the computer that hosts the instance of SQL Server Express. You must explicitly enable network connectivity and start the SQL Server Browser service to connect to a SQL Server Express instance from another computer. - - Once network connectivity is enabled, a SQL Server Express instance has the same security requirements as the other editions of SQL Server. - -## User Instances - - A user instance is a separate instance of the SQL Server Express database engine that is generated by a parent instance of SQL Server Express. The primary goal of a user instance is to allow users who are running Windows under a least-privilege user account to have system administrator (`sysadmin`) privileges on the SQL Server Express instance on their local computer. User instances are not intended for users who are system administrators on their own computers. - - A user instance is generated from a primary instance of SQL Server or SQL Server Express on behalf of a user. It runs as a user process under the Windows security context of the user, not as a service. SQL Server logins are disallowed; only Windows logins are supported. This prevents software executing on a user instance from making system-wide changes that the user would not have permissions to make. A user instance is also known as a child or client instance, and is sometimes referred to by using the RANU acronym ("run as normal user"). - - Each user instance is isolated from its parent instance and from other user instances running on the same computer. Databases installed on user instances are opened in single-user mode only; multiple users cannot connect to them. Replication, distributed queries and remote connections are disabled for user instances. When connected to a user instance, users do not have any special privileges on the parent SQL Server Express instance. - -## External Resources - - For more information about SQL Server Express, see the following resources. - -||| -|-|-| -|[Microsoft SQL Server 2005 Express Edition Books Online](/previous-versions/sql/sql-server-2005/ms165706(v=sql.90))|Complete documentation for SQL Server 2005 Express Edition.| -|[User Instances for Non-Administrators](/previous-versions/sql/sql-server-2008/ms143684(v=sql.100))|Describes how to create and deploy user instances.| -|[SQL Server Express User Instances](sql-server-express-user-instances.md)|Describes user instance capabilities in an ADO.NET application. Provides information about how to enable a user instance, connect to a user instance using a , user instance lifetime, and user instance scenarios.| - -## See also - -- [SQL Server Security](sql-server-security.md) -- [SQL Server Express User Instances](sql-server-express-user-instances.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/adonet/sql/sql-server-security.md b/docs/framework/data/adonet/sql/sql-server-security.md deleted file mode 100644 index 3ea81be933ee1..0000000000000 --- a/docs/framework/data/adonet/sql/sql-server-security.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -description: "Learn more about: SQL Server Security" -title: "SQL Server Security" -ms.date: "03/30/2017" -ms.assetid: 9053724d-a1fb-4f0f-b9dc-7f6dd893e8ff ---- -# SQL Server Security - -SQL Server has many features that support creating secure database applications. - - Common security considerations, such as data theft or vandalism, apply regardless of the version of SQL Server you are using. Data integrity should also be considered as a security issue. If data is not protected, it is possible that it could become worthless if ad hoc data manipulation is permitted and the data is inadvertently or maliciously modified with incorrect values or deleted entirely. In addition, there are often legal requirements that must be adhered to, such as the correct storage of confidential information. Storing some kinds of personal data is proscribed entirely, depending on the laws that apply in a particular jurisdiction. - - Each version of SQL Server has different security features, as does each version of Windows, with later versions having enhanced functionality over earlier ones. It is important to understand that security features alone cannot guarantee a secure database application. Each database application is unique in its requirements, execution environment, deployment model, physical location, and user population. Some applications that are local in scope may need only minimal security whereas other local applications or applications deployed over the Internet may require stringent security measures and ongoing monitoring and evaluation. - - The security requirements of a SQL Server database application should be considered at design time, not as an afterthought. Evaluating threats early in the development cycle gives you the opportunity to mitigate potential damage wherever a vulnerability is detected. - - Even if the initial design of an application is sound, new threats may emerge as the system evolves. By creating multiple lines of defense around your database, you can minimize the damage inflicted by a security breach. Your first line of defense is to reduce the attack surface area by never to granting more permissions than are absolutely necessary. - - The topics in this section briefly describe the security features in SQL Server that are relevant for developers, with links to relevant articles in the SQL Server docs and other resources that provide more detailed coverage. - -## In This Section - - [Overview of SQL Server Security](overview-of-sql-server-security.md) - Describes the architecture and security features of SQL Server. - - [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) - Contains topics discussing various application security scenarios for ADO.NET and SQL Server applications. - - [SQL Server Express Security](sql-server-express-security.md) - Describes security considerations for SQL Server Express. - -## Related Sections - -[Security Center for SQL Server Database Engine and Azure SQL Database](/sql/relational-databases/security/security-center-for-sql-server-database-engine-and-azure-sql-database) -Describes security considerations for SQL Server and Azure SQL Database. - -[Security Considerations for a SQL Server Installation](/sql/sql-server/install/security-considerations-for-a-sql-server-installation) -Describes security concerns to consider before installing SQL Server. - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [SQL Server and ADO.NET](index.md) diff --git a/docs/framework/data/adonet/sql/toc.yml b/docs/framework/data/adonet/sql/toc.yml index 0dfa3433bffd3..7ae06b0f7c2fd 100644 --- a/docs/framework/data/adonet/sql/toc.yml +++ b/docs/framework/data/adonet/sql/toc.yml @@ -1,42 +1,9 @@ - name: SQL Server and ADO.NET href: index.md - name: SQL Server Security - href: sql-server-security.md items: - name: Overview of SQL Server Security - href: overview-of-sql-server-security.md - items: - - name: Authentication in SQL Server - href: authentication-in-sql-server.md - - name: Server and Database Roles in SQL Server - href: server-and-database-roles-in-sql-server.md - - name: Ownership and User-Schema Separation in SQL Server - href: ownership-and-user-schema-separation-in-sql-server.md - - name: Authorization and Permissions in SQL Server - href: authorization-and-permissions-in-sql-server.md - - name: Data Encryption in SQL Server - href: data-encryption-in-sql-server.md - - name: CLR Integration Security in SQL Server - href: clr-integration-security-in-sql-server.md - name: Application Security Scenarios in SQL Server - href: application-security-scenarios-in-sql-server.md - items: - - name: Managing Permissions with Stored Procedures in SQL Server - href: managing-permissions-with-stored-procedures-in-sql-server.md - - name: Writing Secure Dynamic SQL in SQL Server - href: writing-secure-dynamic-sql-in-sql-server.md - - name: Signing Stored Procedures in SQL Server - href: signing-stored-procedures-in-sql-server.md - - name: Customizing Permissions with Impersonation in SQL Server - href: customizing-permissions-with-impersonation-in-sql-server.md - - name: Granting Row-Level Permissions in SQL Server - href: granting-row-level-permissions-in-sql-server.md - - name: Creating Application Roles in SQL Server - href: creating-application-roles-in-sql-server.md - - name: Enabling Cross-Database Access in SQL Server - href: enabling-cross-database-access-in-sql-server.md - - name: SQL Server Express Security - href: sql-server-express-security.md - name: SQL Server Data Types and ADO.NET href: sql-server-data-types.md items: diff --git a/docs/framework/data/adonet/sql/writing-secure-dynamic-sql-in-sql-server.md b/docs/framework/data/adonet/sql/writing-secure-dynamic-sql-in-sql-server.md deleted file mode 100644 index f930daca1edb7..0000000000000 --- a/docs/framework/data/adonet/sql/writing-secure-dynamic-sql-in-sql-server.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -description: "Learn more about: Writing Secure Dynamic SQL in SQL Server" -title: "Writing Secure Dynamic SQL in SQL Server" -ms.date: "03/30/2017" -ms.assetid: df5512b0-c249-40d2-82f9-f9a2ce6665bc ---- -# Writing Secure Dynamic SQL in SQL Server - -SQL Injection is the process by which a malicious user enters Transact-SQL statements instead of valid input. If the input is passed directly to the server without being validated and if the application inadvertently executes the injected code, the attack has the potential to damage or destroy data. - - Any procedure that constructs SQL statements should be reviewed for injection vulnerabilities because SQL Server will execute all syntactically valid queries that it receives. Even parameterized data can be manipulated by a skilled and determined attacker. If you use dynamic SQL, be sure to parameterize your commands, and never include parameter values directly into the query string. - -## Anatomy of a SQL Injection Attack - - The injection process works by prematurely terminating a text string and appending a new command. Because the inserted command may have additional strings appended to it before it is executed, the malefactor terminates the injected string with a comment mark "--". Subsequent text is ignored at execution time. Multiple commands can be inserted using a semicolon (;) delimiter. - - As long as injected SQL code is syntactically correct, tampering cannot be detected programmatically. Therefore, you must validate all user input and carefully review code that executes constructed SQL commands in the server that you are using. Never concatenate user input that is not validated. String concatenation is the primary point of entry for script injection. - - Here are some helpful guidelines: - -- Never build Transact-SQL statements directly from user input; use stored procedures to validate user input. - -- Validate user input by testing type, length, format, and range. Use the Transact-SQL QUOTENAME() function to escape system names or the REPLACE() function to escape any character in a string. - -- Implement multiple layers of validation in each tier of your application. - -- Test the size and data type of input and enforce appropriate limits. This can help prevent deliberate buffer overruns. - -- Test the content of string variables and accept only expected values. Reject entries that contain binary data, escape sequences, and comment characters. - -- When you are working with XML documents, validate all data against its schema as it is entered. - -- In multi-tiered environments, all data should be validated before admission to the trusted zone. - -- Do not accept the following strings in fields from which file names can be constructed: AUX, CLOCK$, COM1 through COM8, CON, CONFIG$, LPT1 through LPT8, NUL, and PRN. - -- Use objects with stored procedures and commands to provide type checking and length validation. - -- Use expressions in client code to filter invalid characters. - -## Dynamic SQL Strategies - - Executing dynamically created SQL statements in your procedural code breaks the ownership chain, causing SQL Server to check the permissions of the caller against the objects being accessed by the dynamic SQL. - - SQL Server has methods for granting users access to data using stored procedures and user-defined functions that execute dynamic SQL. - -- Using impersonation with the Transact-SQL EXECUTE AS clause, as described in [Customizing Permissions with Impersonation in SQL Server](customizing-permissions-with-impersonation-in-sql-server.md). - -- Signing stored procedures with certificates, as described in [Signing Stored Procedures in SQL Server](signing-stored-procedures-in-sql-server.md). - -### EXECUTE AS - - The EXECUTE AS clause replaces the permissions of the caller with that of the user specified in the EXECUTE AS clause. Nested stored procedures or triggers execute under the security context of the proxy user. This can break applications that rely on row-level security or require auditing. Some functions that return the identity of the user return the user specified in the EXECUTE AS clause, not the original caller. Execution context is reverted to the original caller only after execution of the procedure or when a REVERT statement is issued. - -### Certificate Signing - - When a stored procedure that has been signed with a certificate executes, the permissions granted to the certificate user are merged with those of the caller. The execution context remains the same; the certificate user does not impersonate the caller. Signing stored procedures requires several steps to implement. Each time the procedure is modified, it must be re-signed. - -### Cross Database Access - - Cross-database ownership chaining does not work in cases where dynamically created SQL statements are executed. You can work around this in SQL Server by creating a stored procedure that accesses data in another database and signing the procedure with a certificate that exists in both databases. This gives users access to the database resources used by the procedure without granting them database access or permissions. - -## External Resources - - For more information, see the following resources. - -|Resource|Description| -|--------------|-----------------| -|[Stored Procedures](/sql/relational-databases/stored-procedures/stored-procedures-database-engine) and [SQL Injection](/sql/relational-databases/security/sql-injection)|Topics describe how to create stored procedures and how SQL Injection works.| - -## See also - -- [Securing ADO.NET Applications](../securing-ado-net-applications.md) -- [Overview of SQL Server Security](overview-of-sql-server-security.md) -- [Application Security Scenarios in SQL Server](application-security-scenarios-in-sql-server.md) -- [Managing Permissions with Stored Procedures in SQL Server](managing-permissions-with-stored-procedures-in-sql-server.md) -- [Signing Stored Procedures in SQL Server](signing-stored-procedures-in-sql-server.md) -- [Customizing Permissions with Impersonation in SQL Server](customizing-permissions-with-impersonation-in-sql-server.md) -- [ADO.NET Overview](../ado-net-overview.md) diff --git a/docs/framework/data/index.md b/docs/framework/data/index.md index a94ef2ff75a86..4edb13d949a26 100644 --- a/docs/framework/data/index.md +++ b/docs/framework/data/index.md @@ -2,7 +2,7 @@ title: "Data and modeling - .NET" description: View links to articles that describe modeling and how to access data in .NET. The articles cover WCF Data Services, ADO.NET, and transaction processing. ms.date: "09/09/2019" -helpviewer_keywords: +helpviewer_keywords: - ".NET Framework, data access" - "data access [.NET Framework], about .NET Framework data access" - "data [.NET Framework], accessing" @@ -10,29 +10,26 @@ ms.assetid: 8c37635d-e2c1-4b64-a258-61d9e87405e6 --- # Data and modeling in .NET -This section provides information on how to access data in the .NET Framework. - +This section provides information on how to access data in .NET Framework. + ## In this section - [WCF Data Services 4.5](./wcf/index.md) - Provides information about how to use WCF Data Services to deploy data services on the Web or an intranet. + [ADO.NET](./adonet/index.md)\\ + Describes the ADO.NET architecture and how to use the ADO.NET classes to manage application data and interact with data sources, including Microsoft SQL Server, OLE DB data sources, and XML. + + [Transaction Processing](./transactions/index.md)\ + Discusses the .NET support for transactions. - [ADO.NET](./adonet/index.md) - Describes the ADO.NET architecture and how to use the ADO.NET classes to manage application data and interact with data sources, including Microsoft SQL Server, OLE DB data sources, and XML. - - [Transaction Processing](./transactions/index.md) - Discusses the .NET support for transactions. - ## Related sections - [Language Integrated Query (LINQ)](../../csharp/programming-guide/concepts/linq/index.md) - Provides links to relevant documentation for Language Integrated Query (LINQ) using C#. - - [Language-Integrated Query (LINQ) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/index.md) - Provides links to relevant documentation for Language Integrated Query (LINQ) using Visual Basic. - - [XML Documents and Data](../../standard/data/xml/index.md) - Provides an overview to a comprehensive and integrated set of classes that work with XML documents and data in the .NET Framework. - - [XML Standards Reference](/previous-versions/dotnet/netframework-4.0/ms256177(v=vs.100)) + [Language Integrated Query (LINQ)](../../csharp/programming-guide/concepts/linq/index.md)\ + Provides links to relevant documentation for Language Integrated Query (LINQ) using C#. + + [Language-Integrated Query (LINQ) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/index.md)\ + Provides links to relevant documentation for Language Integrated Query (LINQ) using Visual Basic. + + [XML Documents and Data](../../standard/data/xml/index.md)\ + Provides an overview to a comprehensive and integrated set of classes that work with XML documents and data in .NET Framework. + + [XML Standards Reference](/previous-versions/dotnet/netframework-4.0/ms256177(v=vs.100))\ Provides reference information on XML standards that Microsoft supports. diff --git a/docs/framework/data/toc.yml b/docs/framework/data/toc.yml index 24eafe6235ca4..f2d1a423f8398 100644 --- a/docs/framework/data/toc.yml +++ b/docs/framework/data/toc.yml @@ -1,9 +1,7 @@ -- name: Data and Modeling +- name: Data and modeling href: index.md items: - - name: WCF Data Services 4.5 - href: wcf/ - name: ADO.NET href: adonet/ - - name: Transaction Processing + - name: Transaction processing href: transactions/ diff --git a/docs/framework/data/wcf/accessing-data-service-resources-wcf-data-services.md b/docs/framework/data/wcf/accessing-data-service-resources-wcf-data-services.md deleted file mode 100644 index 0efcd744eb50e..0000000000000 --- a/docs/framework/data/wcf/accessing-data-service-resources-wcf-data-services.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -description: "Learn more about: Accessing Data Service Resources (WCF Data Services)" -title: "Accessing Data Service Resources (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, querying" - - "getting started, WCF Data Services" - - "querying the data service [WCF Data Service]" - - "WCF Data Services, getting started" - - "WCF Data Services, accessing data" -ms.assetid: 9665ff5b-3e3a-495d-bf83-d531d5d060ed ---- -# Accessing Data Service Resources (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services supports the Open Data Protocol (OData) to expose your data as a feed with resources that are addressable by URIs. These resources are represented according to the entity-relationship conventions of the [Entity Data Model](../adonet/entity-data-model.md). In this model, entities represent operational units of data that are data types in an application domain, such as customers, orders, items, and products. Entity data is accessed and changed by using the semantics of representational state transfer (REST), specifically the standard HTTP verbs of GET, PUT, POST, and DELETE. - -## Addressing Resources - - In OData, you address any data exposed by the data model by using a URI. For example, the following URI returns a feed that is the Customers entity set, which contains entries for all instances of the Customer entity type: - - - - Entities have special properties called entity keys. An entity key is used to uniquely identify a single entity in an entity set. This enables you to address a specific instance of an entity type in the entity set. For example, the following URI returns an entry for a specific instance of the Customer entity type that has a key value of `ALFKI`: - - - - Primitive and complex properties of an entity instance can also be individually addressed. For example, the following URI returns an XML element that contains the `ContactName` property value for a specific Customer: - - - - When you include the `$value` endpoint in the previous URI, only the value of the primitive property is returned in the response message. The following example returns only the string "Maria Anders" without the XML element: - - - - Relationships between entities are defined in the data model by associations. These associations enable you to address related entities by using navigation properties of an entity instance. A navigation property can return either a single related entity, in the case of a many-to-one relationship, or a set of related entities, in the case of a one-to-many relationship. For example, the following URI returns a feed that is the set of all the Orders that are related to a specific Customer: - - - - Relationships, which are usually bi-directional, are represented by a pair of navigation properties. As the reverse of the relationship shown in the previous example, the following URI returns a reference to the Customer entity to which a specific Order entity belongs: - - - - OData also enables you to address resources based on the results of query expressions. This makes it possible to filter sets of resources based on an evaluated expression. For example, the following URI filters the resources to return only the Orders for the specified Customer that have shipped since September 22, 1997: - -`https://services.odata.org/Northwind/Northwind.svc/Customers('ALFKI')/Orders?$filter=ShippedDate gt datetime'1997-09-22T00:00:00'` - - For more information, see [OData: URI Conventions](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/). - -## System Query Options - - OData defines a set of system query options that you can use to perform traditional query operations against resources, such as filtering, sorting, and paging. For example, the following URI returns the set of all the `Order` entities, along with related `Order_Detail` entities, the postal codes of which do not end in `100`: - -`https://services.odata.org/Northwind/Northwind.svc/Orders?$filter=not endswith(ShipPostalCode,'100')&$expand=Order_Details&$orderby=ShipCity` - - The entries in the returned feed are also ordered by the value of the ShipCity property of the orders. - - WCF Data Services supports the following OData system query options: - -|Query Option|Description| -|------------------|-----------------| -|`$orderby`|Defines a default sort order for entities in the returned feed. The following query orders the returned customers feed by county and city:

`https://services.odata.org/Northwind/Northwind.svc/Customers?$orderby=Country,City>`| -|`$top`|Specifies the number of entities to include in the returned feed. The following example skips the first 10 customers and then returns the next 10:

`https://services.odata.org/Northwind/Northwind.svc/Customers?$skip=10&$top=10`| -|`$skip`|Specifies the number of entities to skip before starting to return entities in the feed. The following example skips the first 10 customers and then returns the next 10:

`https://services.odata.org/Northwind/Northwind.svc/Customers?$skip=10&$top=10`| -|`$filter`|Defines an expression that filters the entities returned in the feed based on specific criteria. This query option supports a set of logical comparison operators, arithmetic operators, and predefined query functions that are used to evaluate the filter expression. The following example returns all orders the postal codes of which do not end in 100:

`https://services.odata.org/Northwind/Northwind.svc/Orders?$filter=not endswith(ShipPostalCode,'100')`| -|`$expand`|Specifies which related entities are returned by the query. Related entities are included as either a feed or an entry inline with the entity returned by the query. The following example returns the order for the customer 'ALFKI' along with the item details for each order:

`https://services.odata.org/Northwind/Northwind.svc/Customers('ALFKI')/Orders?$expand=Order_Details`| -|`$select`|Specifies a projection that defines the properties of the entity are returned in the projection. By default, all properties of an entity are returned in a feed. The following query returns only three properties of the `Customer` entity:

`https://services.odata.org/Northwind/Northwind.svc/Customers?$select=CustomerID,CompanyName,City`| -|`$inlinecount`|Requests that a count of the number of entities returned in the feed be included with the feed.| - -## Addressing Relationships - - In addition to addressing entity sets and entity instances, OData also enables you to address the associations that represent relationships between entities. This functionality is required to be able to create or change a relationship between two entity instances, such as the shipper that is related to a given order in the Northwind sample database. OData supports a `$link` operator to specifically address the associations between entities. For example, the following URI is specified in an HTTP PUT request message to change the shipper for the specified order to a new shipper. - -`https://services.odata.org/Northwind/Northwind.svc/Orders(10643)/$links/Shipper` - - For more information, see section `3.2. Addressing Links between Entries` at [OData: URI Conventions](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/). - -## Consuming the Returned Feed - - The URI of an OData resource enables you to address entity data exposed by the service. When you enter a URI into the address field of a Web browser, a OData feed representation of the requested resource is returned. For more information, see the [WCF Data Services Quickstart](quickstart-wcf-data-services.md). Although a Web browser may be useful for testing that a data service resource returns the expected data, production data services that can also create, update, and delete data are generally accessed by application code or scripting languages in a Web page. For more information, see [Using a Data Service in a Client Application](using-a-data-service-in-a-client-application-wcf-data-services.md). - -## See also - -- [Open Data Protocol Web site](https://www.odata.org/) diff --git a/docs/framework/data/wcf/accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md b/docs/framework/data/wcf/accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md deleted file mode 100644 index 924499df2ff1a..0000000000000 --- a/docs/framework/data/wcf/accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: "Accessing the Service from a Web Browser (WCF Data Services Quickstart)" -description: Learn to start WCF Data Services in Visual Studio and disable feed reading in a browser. Get the service definition document and access data service resources. -ms.date: "03/30/2017" -ms.assetid: 5a6fa180-3094-4e6e-ba2b-8c80975d18d1 -recommendations: false ---- -# Accessing the Service from a Web Browser (WCF Data Services Quickstart) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -This is the second task of the WCF Data Services quickstart. In this task, you start the WCF Data Services from Visual Studio and optionally disable feed reading in the Web browser. You then retrieve the service definition document as well as access data service resources by submitting HTTP GET requests through a Web browser to the exposed resources. - -> [!NOTE] -> By default, Visual Studio auto-assigns a port number to the `localhost` URI on your computer. This task uses the port number `12345` in the URI examples. For more information about how to set a specific port number in your Visual Studio project see [Creating the Data Service](creating-the-data-service.md). - -## To request the default service document by using Internet Explorer - -1. In Internet Explorer, from the **Tools** menu, select **Internet Options**, click the **Content** tab, click **Settings**, and clear **Turn on feed viewing**. - - This makes sure that feed reading is disabled. If you do not disable this functionality, then the Web browser will treat the returned AtomPub encoded document as an XML feed instead of displaying the raw XML data. - - > [!NOTE] - > If your browser cannot display the feed as raw XML data, you should still be able to view the feed as the source code for the page. - -2. In Visual Studio, press the **F5** key to start debugging the application. - -3. Open a Web browser on the local computer. In the address bar, enter the following URI: - - ```http - http://localhost:12345/northwind.svc - ``` - - This returns the default service document, which contains a list of entity sets that are exposed by this data service. - -## To access entity set resources from a Web browser - -1. In the address bar of your Web browser, enter the following URI: - - ```http - http://localhost:12345/northwind.svc/Customers - ``` - - This returns a set of all customers in the Northwind sample database. - -2. In the address bar of your Web browser, enter the following URI: - - ```http - http://localhost:12345/northwind.svc/Customers('ALFKI') - ``` - - This returns an entity instance for the specific customer, `ALFKI`. - -3. In the address bar of your Web browser, enter the following URI: - - ```http - http://localhost:12345/northwind.svc/Customers('ALFKI')/Orders - ``` - - This traverses the relationship between customers and orders to return a set of all orders for the specific customer `ALFKI`. - -4. In the address bar of your Web browser, enter the following URI: - - ```http - http://localhost:12345/northwind.svc/Customers('ALFKI')/Orders?$filter=OrderID eq 10643 - ``` - - This filters orders that belong to the specific customer `ALFKI` so that only a specific order is returned based on the supplied `OrderID` value. - -## Next Steps - -You have successfully accessed the WCF Data Services from a Web browser, with the browser issuing HTTP GET requests to specified resources. A Web browser provides an easy way to experiment with the addressing syntax of requests and view the results. However, a production data service is not generally accessed by this method. Typically, applications interact with the data service through application code or scripting languages. Next, you will create a client application that uses client libraries to access data service resources as if they were common language runtime (CLR) objects: - -> [!div class="nextstepaction"] -> [Creating the .NET Framework Client Application](creating-the-dotnet-client-application-wcf-data-services-quickstart.md) - -## See also - -- [Accessing Data Service Resources](accessing-data-service-resources-wcf-data-services.md) diff --git a/docs/framework/data/wcf/application-scenarios-wcf-data-services.md b/docs/framework/data/wcf/application-scenarios-wcf-data-services.md deleted file mode 100644 index 5b6d6f3f74e4b..0000000000000 --- a/docs/framework/data/wcf/application-scenarios-wcf-data-services.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -description: "Learn more about: Application Scenarios (WCF Data Services)" -title: "Application Scenarios (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, learn more" - - "WCF Data Services, scenarios" -ms.assetid: 7c82658f-e7c0-46b6-834d-6592f67ab5ea ---- - -# Application Scenarios (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services supports a core set of scenarios for exposing and consuming data as Open Data Protocol (OData) feeds. This topic points you to the topics relevant to these scenarios. - -Expose relational data from a database as an OData feed. - -- [Quickstart](quickstart-wcf-data-services.md) - -- [Exposing Your Data as a Service](exposing-your-data-as-a-service-wcf-data-services.md) - -- [How to: Create a Data Service Using an ADO.NET Entity Framework Data Source](create-a-data-service-using-an-adonet-ef-data-wcf.md) - -Expose arbitrary CLR data classes as an OData feed. - -- [Exposing Your Data as a Service](exposing-your-data-as-a-service-wcf-data-services.md) - -- [How to: Create a Data Service Using the Reflection Provider](create-a-data-service-using-rp-wcf-data-services.md) - -- [Data Services Providers](data-services-providers-wcf-data-services.md) - -Consume an OData feed in a .NET Framework-based client application. - -- [Quickstart](quickstart-wcf-data-services.md) - -- [Using a Data Service in a Client Application](using-a-data-service-in-a-client-application-wcf-data-services.md) - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) - -Consume an OData feed in a Silverlight-based client application. - -- [WCF Data Services (Silverlight)](/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc838234(v=vs.95)) - -- [Asynchronous Operations](asynchronous-operations-wcf-data-services.md) - -- [How to: Bind Data Service Data to Controls (Silverlight Client)](/previous-versions/dotnet/wcf-data-services/ee681614(v=vs.103)) - -Consume an OData feed in an AJAX-based client application. - -- [Using a Data Service in a Client Application](using-a-data-service-in-a-client-application-wcf-data-services.md) - -- [OData: URI Conventions](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/) - -- [OData: JavaScript Object Notation (JSON) Format](https://www.odata.org/developers/protocols/json-format/) - -Create an end-to-end data solution that uses OData to transfer data between client and server. - -- [Quickstart](quickstart-wcf-data-services.md) - -- [Using a Data Service in a Client Application](using-a-data-service-in-a-client-application-wcf-data-services.md) - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) - -Create a .NET Framework-based client application that consumes an OData feed asynchronously to avoid latency issues on the client. - -- [How to: Execute Asynchronous Data Service Queries](how-to-execute-asynchronous-data-service-queries-wcf-data-services.md) - -- [Asynchronous Operations](asynchronous-operations-wcf-data-services.md) - -- [WCF Data Services (Silverlight)](/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc838234(v=vs.95)) - -Expose and consume an OData feed with a binary large object that is accessed and changed as a stream. - -- [Streaming Provider](streaming-provider-wcf-data-services.md) - -- [Working with Binary Data](working-with-binary-data-wcf-data-services.md) - -Bind OData feeds to controls in a Windows Presentation Framework (WPF) application. - -- [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md) - -- [How to: Bind Data to Windows Presentation Foundation Elements](bind-data-to-wpf-elements-wcf-data-services.md) - -- [How to: Bind Data Using a Project Data Source](how-to-bind-data-using-a-project-data-source-wcf-data-services.md) - -Intercept incoming messages to the data service to perform data validation and role-based filtering of queries. - -- [How to: Intercept Data Service Messages](how-to-intercept-data-service-messages-wcf-data-services.md) - -- [Interceptors](interceptors-wcf-data-services.md) - -Create endpoints on a data service to enable custom service behaviors. - -- [How to: Define a Service Operation](how-to-define-a-service-operation-wcf-data-services.md) - -- [Service Operations](service-operations-wcf-data-services.md) - -## See also - -- [Quickstart](quickstart-wcf-data-services.md) -- [Resources](wcf-data-services-resources.md) diff --git a/docs/framework/data/wcf/asynchronous-operations-wcf-data-services.md b/docs/framework/data/wcf/asynchronous-operations-wcf-data-services.md deleted file mode 100644 index 0dea633e82957..0000000000000 --- a/docs/framework/data/wcf/asynchronous-operations-wcf-data-services.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -description: "Learn more about: Asynchronous Operations (WCF Data Services)" -title: "Asynchronous Operations (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, asynchronous operations" - - "asynchronous operations [WCF Data Services]" - - "WCF Data Services, client library" -ms.assetid: 679644c7-e3fc-422c-b14a-b44b683900d0 ---- -# Asynchronous Operations (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -Web applications must accommodate higher latency between client and server than applications that run inside internal networks. To optimize the performance and user experience of your application, we recommend using the asynchronous methods of the and classes when accessing WCF Data Services servers over the Web. - - Although the WCF Data Services servers process HTTP requests asynchronously, some methods of the WCF Data Services client libraries are synchronous and wait until the entire request-response exchange is completed before continuing execution. The asynchronous methods of the WCF Data Services client libraries do not wait for this exchange to complete and can allow your application to maintain a responsive user interface in the meantime. - - You can perform asynchronous operations by using a pair of methods on the and classes that start with *Begin* and *End* respectively. The *Begin* methods register a delegate that the service calls when the operation is complete. The *End* methods should be called in the delegate that is registered to handle the callback from the completed operations. When you call the *End* method to complete an asynchronous operation, you must do so from the same or instance that you used to begin the operation. Each *Begin* method takes a `state` parameter that can pass a state object to the callback. This state object is retrieved from the that is supplied with the callback and is used to call the corresponding *End* method to complete the asynchronous operation. For example, when you supply the instance as the `state` parameter when you call the method on the instance, the same instance is returned by the . This instance of is then used to call the method to complete the query operation. For more information, see [How to: Execute Asynchronous Data Service Queries](how-to-execute-asynchronous-data-service-queries-wcf-data-services.md). - -> [!NOTE] -> Only asynchronous operations are supported by the client libraries that are provided in the .NET Framework for Silverlight. For more information, see [WCF Data Services (Silverlight)](/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc838234(v=vs.95)). - - The .NET Framework client libraries support the following asynchronous operations: - -|Operation|Methods| -|---------------|-------------| -|Executing a .|-
- | -|Executing a query from the .|-
- | -|Executing a batch query from the .|-
- | -|Loading a related entity into the .|-
- | -|Saving changes to objects in the |-
- | - -## Threading Considerations for Asynchronous Operations - - In a multi-threaded application, the delegate that is registered as a callback for the asynchronous operation is not necessarily invoked on the same thread that was used to call the *Begin* method, which creates the initial request. In an application where the callback must be invoked on a specific thread, you must explicitly marshal the execution of the *End* method, which handles the response, to the desired thread. For example, in Windows Presentation Foundation (WPF)-based applications and Silverlight-based applications, the response must be marshaled back to the UI thread by using the method on the object. For more information, see [Querying the Data Service (WCF Data Services/Silverlight)](/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc903932(v=vs.95)). - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/attach-an-existing-entity-to-dc-wcf-data.md b/docs/framework/data/wcf/attach-an-existing-entity-to-dc-wcf-data.md deleted file mode 100644 index f4d37fc4e8373..0000000000000 --- a/docs/framework/data/wcf/attach-an-existing-entity-to-dc-wcf-data.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -description: "Learn more about: How to: Attach an Existing Entity to the DataServiceContext (WCF Data Services)" -title: "How to: Attach an Existing Entity to the DataServiceContext (WCF Data Services)" -ms.date: "03/30/2017" -ms.topic: how-to -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, changing data" -ms.assetid: e3f2d71d-434c-4e98-91c3-95adae4702b6 ---- -# How to: Attach an Existing Entity to the DataServiceContext (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -When an entity already exists in a data service, the WCF Data Services client library enables you to attach an object that represents the entity directly to the without first executing a query. For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example shows how to create an existing `Customer` object that contains changes to be saved to the data service. The object is attached to the context and the method is called to mark the attached object as before the method is called. - - [!code-csharp[Astoria Northwind Client#AttachObject](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#attachobject)] - [!code-vb[Astoria Northwind Client#AttachObject](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#attachobject)] - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/batching-operations-wcf-data-services.md b/docs/framework/data/wcf/batching-operations-wcf-data-services.md deleted file mode 100644 index cf186d7055afe..0000000000000 --- a/docs/framework/data/wcf/batching-operations-wcf-data-services.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: "Learn more about: Batching Operations (WCF Data Services)" -title: "Batching Operations (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, client library" -ms.assetid: 962a49d1-cc11-4b96-bc7d-071dd6607d6c ---- -# Batching Operations (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -The Open Data Protocol (OData) supports batch processing of requests to an OData-based service. For more information, see [OData: Batch Processing](https://www.odata.org/documentation/odata-version-2-0/batch-processing/). In WCF Data Services, each operation that uses the , such as executing a query or saving changes, results in a separate request being sent to the data service. In order to maintain a logical scope for sets of operations, you can explicitly define operational batches. This ensures that all operations in the batch are sent to the data service in a single HTTP request, enables the server to process the operations atomically, and reduces the number of round trips to the data service. - -## Batching Query Operations - - To execute multiple queries in a single batch, you must create each query in the batch as a separate instance of the class. When you create a query request in this manner, the query itself is defined as a URI, and it follows the rules for addressing resources. For more information, see [Accessing Data Service Resources](accessing-data-service-resources-wcf-data-services.md). The batched query requests are sent to the data service when the method is called that contains the query request objects. This method returns a object, which is a collection of objects that represent responses to individual queries in the batch, each of which contains either a collection of objects returned by the query or error information. When any single query operation in the batch fails, error information is returned in the object for the operation that failed and the remaining operations are still executed. For more information, see [How to: Execute Queries in a Batch](how-to-execute-queries-in-a-batch-wcf-data-services.md). - - Batched queries can also be executed asynchronously. For more information, see [Asynchronous Operations](asynchronous-operations-wcf-data-services.md). - -## Batching the SaveChanges Operation - - When you call the method, all changes that the context tracks are translated into REST-based operations that are sent as requests to the OData service. By default, these changes are not sent in a single request message. To require that all changes be sent in a single request, you must call the method and include a value of in the enumeration that you supply to the method. - - You can also asynchronously save batched changes. For more information, see [Asynchronous Operations](asynchronous-operations-wcf-data-services.md). - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/bind-data-to-wpf-elements-wcf-data-services.md b/docs/framework/data/wcf/bind-data-to-wpf-elements-wcf-data-services.md deleted file mode 100644 index f6c08608e821b..0000000000000 --- a/docs/framework/data/wcf/bind-data-to-wpf-elements-wcf-data-services.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -description: "Learn more about: How to: Bind Data to Windows Presentation Foundation Elements (WCF Data Services)" -title: "How to: Bind Data to Windows Presentation Foundation Elements (WCF Data Services)" -ms.date: "03/30/2017" -ms.topic: how-to -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "data binding, WCF Data Services" - - "WCF Data Services, data binding" -ms.assetid: d6538ab0-0abe-426a-b9d9-e6f3a5ca2016 ---- -# How to: Bind Data to Windows Presentation Foundation Elements (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -With WCF Data Services, you can bind Windows Presentation Foundation (WPF) elements such as a or to an instance of , which handles the events raised by the controls to keep the synchronized with changes made to data in the controls. For more information, see [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example is from the code-behind page for an Extensible Application Markup Language (XAML) page that defines the `SalesOrders` window in WPF. When the window is loaded, a is created based on the result of a query that returns customers, filtered by country/region. All of the pages of this paged result are loaded, along with the related orders, and are bound to the property of the that is the root layout control for the WPF window. For more information, see [Loading Deferred Content](loading-deferred-content-wcf-data-services.md). - - [!code-csharp[Astoria Northwind Client#BindPagedData](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf3.xaml.cs#bindpageddata)] - [!code-vb[Astoria Northwind Client#BindPagedData](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf3.xaml.vb#bindpageddata)] - -## Example - - The following XAML defines the `SalesOrders` window in WPF for the previous example. - - [!code-xaml[Astoria Northwind Client#BindPagedDataXaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf3.xaml#bindpageddataxaml)] - -## Example - - The following example is from the code-behind page for an Extensible Application Markup Language (XAML) page that defines the `SalesOrders` window in WPF. When the window is loaded, a is created based on the result of a query that returns customers with related objects, filtered by country/region. This result is bound to the property of the that is the root layout control for the WPF window. - - [!code-csharp[Astoria Northwind Client#WpfDataBinding](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf.xaml.cs#wpfdatabinding)] - [!code-vb[Astoria Northwind Client#WpfDataBinding](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf.xaml.vb#wpfdatabinding)] - -## Example - - The following XAML defines the `SalesOrders` window in WPF for the previous example. - - [!code-xaml[Astoria Northwind Client#WpfDataBindingXaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf.xaml#wpfdatabindingxaml)] diff --git a/docs/framework/data/wcf/binding-data-to-controls-wcf-data-services.md b/docs/framework/data/wcf/binding-data-to-controls-wcf-data-services.md deleted file mode 100644 index 6dc6147b3cab0..0000000000000 --- a/docs/framework/data/wcf/binding-data-to-controls-wcf-data-services.md +++ /dev/null @@ -1,123 +0,0 @@ ---- -description: "Learn more about: Binding Data to Controls (WCF Data Services)" -title: "Binding Data to Controls (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "client applications, WCF Data Services" - - "WCF Data Services, client library" - - "data binding, WCF Data Services" -ms.assetid: b32e1d49-c214-4cb1-867e-88fbb3d08c8d ---- -# Binding Data to Controls (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -With WCF Data Services, you can bind controls such as the `ComboBox` and `ListView` controls to an instance of the class. This collection, which inherits from the class, contains the data from an Open Data Protocol (OData) feed. This class represents a dynamic data collection that provides notifications when items get added or removed. When you use an instance of for data binding, the WCF Data Services client libraries handle these events to ensure that objects tracked by the remain synchronized with the data in the bound UI element. - - The class (indirectly) implements the interface to alert the context when objects are added to or removed from the collection. Data service type objects used with a must also implement the interface to alert the when properties of objects in the binding collection have changed. - -> [!NOTE] -> When you use the **Add Service Reference** dialog or the [DataSvcUtil.exe](wcf-data-service-client-utility-datasvcutil-exe.md) tool with the `/dataservicecollection` option to generate the client data service classes, the generated data classes implement the interface. For more information, see [How to: Manually Generate Client Data Service Classes](how-to-manually-generate-client-data-service-classes-wcf-data-services.md). - -## Creating the Binding Collection - - Create a new instance of the class by calling one of the class constructor methods with a supplied instance and optionally a or LINQ query that, when it is executed, returns an instance. This provides the source of objects for the binding collection, which are materialized from an OData feed. For more information, see [Object Materialization](object-materialization-wcf-data-services.md). By default, changes made to bound objects and items inserted into the collection are automatically tracked by the . If you need to manually track these changes, call one of the constructor methods that takes a `trackingMode` parameter and specify a value of . - - The following example shows how to create an instance of based on a supplied and a that returns all customers with related orders: - - [!code-csharp[Astoria Northwind Client#CustomersOrders2Binding](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders2.cs#customersorders2binding)] - [!code-vb[Astoria Northwind Client#CustomersOrders2Binding](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorders2.vb#customersorders2binding)] - -## Binding Data to Windows Presentation Foundation Elements - - Because the class inherits from the class, you can bind objects to an element, or control, in a Windows Presentation Foundation (WPF) application as you would when using the class for binding. For more information, see [Data Binding (Windows Presentation Foundation)](/dotnet/desktop/wpf/data/data-binding-overview). One way to bind data service data to WPF controls is to set the `DataContext` property of the element to the instance of the class that contains the query result. In this case, you use the property to set the object source for the control. Use the property to specify which property of the bound object to display. If you are binding an element to a related object that is returned by a navigation property, include the path in the binding defined for the property. This path is relative to the root object set by the property of the parent control. The following example sets the property of a element to bind the parent control to an of customer objects: - - [!code-csharp[Astoria Northwind Client#MasterDetailBinding](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderscustom.xaml.cs#masterdetailbinding)] - [!code-csharp[Astoria Northwind Client#MasterDetailBinding](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf.xaml.cs#masterdetailbinding)] - [!code-vb[Astoria Northwind Client#MasterDetailBinding](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderscustom.xaml.vb#masterdetailbinding)] - [!code-vb[Astoria Northwind Client#MasterDetailBinding](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf.xaml.vb#masterdetailbinding)] - [!code-vb[Astoria Northwind Client#MasterDetailBinding](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderscustom2.xaml.vb#masterdetailbinding)] - - The following example shows the XAML binding definition of the child and controls: - - [!code-xaml[Astoria Northwind Client#MasterDetailXaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf.xaml#masterdetailxaml)] - - For more information, see [How to: Bind Data to Windows Presentation Foundation Elements](bind-data-to-wpf-elements-wcf-data-services.md). - - When an entity participates in a one-to-many or many-to-many relationship, the navigation property for the relationship returns a collection of related objects. When you use the **Add Service Reference** dialog box or the DataSvcUtil.exe tool to generate the client data service classes, the navigation property returns an instance of . This enables you to bind related objects to a control, and support common WPF binding scenarios, such as the master-detail binding pattern for related entities. In the previous XAML example, the XAML code binds the master to the root data element. The order is then bound to the Orders returned from the selected Customers object, which is in turn bound to the root data element of the . - -## Binding Data to Windows Forms Controls - - To bind objects to a Windows Form control, set the `DataSource` property of the control to the instance of the class that contains the query result. - -> [!NOTE] -> Data binding is only supported for controls that listen for change events by implementing the and interfaces. When a control does not support this kind of change notification, changes that are made to the underlying are not reflected in the bound control. - - The following example binds an to a control: - - [!code-csharp[Astoria Northwind Client#CustomersOrdersDataBindingSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders.cs#customersordersdatabindingspecific)] - [!code-vb[Astoria Northwind Client#CustomersOrdersDataBindingSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorders.vb#customersordersdatabindingspecific)] - - When you use the **Add Service Reference** dialog to generate the client data service classes, a project data source is also created that is based on the generated . With this data source, you can create UI elements or controls that display data from the data service simply by dragging items from the **Data Sources** window onto the designer. These items become elements in the application UI that are bound to the data source. For more information, see [How to: Bind Data Using a Project Data Source](how-to-bind-data-using-a-project-data-source-wcf-data-services.md). - -## Binding Paged Data - - A data service can be configured to limit the amount of queried data that is returned in a single response message. For more information, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md). When the data service is paging response data, each response contains a link that is used to return the next page of results. For more information, see [Loading Deferred Content](loading-deferred-content-wcf-data-services.md). In this case, you must explicitly load pages by calling the method on the by passing the URI obtained from the property, as in the following example: - - [!code-csharp[Astoria Northwind Client#BindPagedDataSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf3.xaml.cs#bindpageddataspecific)] - [!code-vb[Astoria Northwind Client#BindPagedDataSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf3.xaml.vb#bindpageddataspecific)] - - Related objects are loaded in a similar manner. For more information, see [How to: Bind Data to Windows Presentation Foundation Elements](bind-data-to-wpf-elements-wcf-data-services.md). - -## Customizing Data Binding Behaviors - - The class enables you to intercept the events raised when changes are made to the collection, such as an object being added or removed, and when changes are made to the properties of object in a collection. You can modify the data binding events to override the default behavior, which includes the following constraints: - -- No validation is performed within the delegates. - -- Adding an entity automatically adds related entities. - -- Deleting an entity does not delete the related entities. - - When you create a new instance of , you have the option to specify the following parameters that define delegates to methods that handle the events raised when bound objects are changed: - -- `entityChanged` - a method that is called when the property of a bound object is changed. This delegate accepts an object and returns a Boolean value that indicates whether the default behavior, to call on the , should still occur. - -- `entityCollectionChanged` - a method that is called when an object is added or removed from the binding collection. This delegate accepts an object and returns a Boolean value that indicates whether the default behavior, to call for an action or for a action on the , should still occur. - -> [!NOTE] -> WCF Data Services performs no validation of the custom behaviors that you implement in these delegates. - - In the following example, the action is customized to call the and method to remove `Orders_Details` entities that belong to a deleted `Orders` entity. This custom action is performed because dependent entities are not automatically deleted when the parent entity is deleted. - - [!code-csharp[Astoria Northwind Client#CustomersOrdersDeleteRelated](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderscustom.xaml.cs#customersordersdeleterelated)] - [!code-vb[Astoria Northwind Client#CustomersOrdersDeleteRelated](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderscustom.xaml.vb#customersordersdeleterelated)] - [!code-vb[Astoria Northwind Client#CustomersOrdersDeleteRelated](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderscustom2.xaml.vb#customersordersdeleterelated)] - - For more information, see [How to: Customize Data Binding Behaviors](how-to-customize-data-binding-behaviors-wcf-data-services.md). - - The default behavior when an object is removed from a by using the method is that the object is also marked as deleted in the . To change this behavior, you can specify a delegate to a method in the `entityCollectionChanged` parameter that is called when the event occurs. - -## Data Binding with Custom Client Data Classes - - To be able to load objects into a , the objects themselves must implement the interface. Data service client classes that are generated when you use the **Add Service Reference** dialog box or the [DataSvcUtil.exe](wcf-data-service-client-utility-datasvcutil-exe.md) tool implement this interface. If you provide your own client data classes, you must use another type of collection for data binding. When objects change, you must handle events in the data bound controls to call the following methods of the class: - -- - when a new object is added to the collection. - -- - when an object is removed from the collection. - -- - when a property is changed on an object in the collection. - -- - when an object is added to a collection of related object. - -- - when an object is added to a collection of related objects. - - For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md). - -## See also - -- [How to: Manually Generate Client Data Service Classes](how-to-manually-generate-client-data-service-classes-wcf-data-services.md) -- [How to: Add a Data Service Reference](how-to-add-a-data-service-reference-wcf-data-services.md) diff --git a/docs/framework/data/wcf/calling-service-operations-wcf-data-services.md b/docs/framework/data/wcf/calling-service-operations-wcf-data-services.md deleted file mode 100644 index 94aa284f06ed2..0000000000000 --- a/docs/framework/data/wcf/calling-service-operations-wcf-data-services.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -description: "Learn more about: Calling Service Operations (WCF Data Services)" -title: "Calling Service Operations (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -ms.assetid: 1767f3a7-29d2-4834-a763-7d169693fa8b ---- -# Calling Service Operations (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -The Open Data Protocol (OData) defines service operations for a data service. WCF Data Services enables you to define such operations as methods on the data service. Like other data service resources, these service operations are addressed by using URIs. A service operation can return collections of entity types, single entity type instances, and primitive types, such as integer and string. A service operation can also return `null` (`Nothing` in Visual Basic). The WCF Data Services client library can be used to access service operations that support HTTP GET requests. These kinds of service operations are defined as methods that have the applied. For more information, see [Service Operations](service-operations-wcf-data-services.md). - - Service operations are exposed in the metadata returned by a data service that implements the OData. In the metadata, service operations are represented as `FunctionImport` elements. When generating the strongly typed , the Add Service Reference and DataSvcUtil.exe tools ignore this element. Because of this, you will not find a method on the context that can be used to call a service operation directly. However, you can still use the WCF Data Services client to call service operations in one of these two ways: - -- By calling the method on the , supplying the URI of the service operation, along with any parameters. This method is used to call any GET service operation. - -- By using the method on the to create a object. When calling , the name of the service operation is supplied to the `entitySetName` parameter. This method returns a object that calls the service operation when enumerated or when the method is called. This method is used to call GET service operations that return a collection. A single parameter can be supplied by using the method. The object returned by this method can be further composed against like any query object. For more information, see [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - -## Considerations for Calling Service Operations - - The following considerations apply when using the WCF Data Services client to call service operations. - -- When accessing the data service asynchronously, you must use the equivalent asynchronous / methods on or the / methods on . - -- The WCF Data Services client library cannot materialize the results from a service operation that returns a collection of primitive types. - -- The WCF Data Services client library does not support calling POST service operations. Service operations that are called by an HTTP POST are defined by using the with the `Method="POST"` parameter. To call a service operation by using an HTTP POST request, you must instead use an . - -- You cannot use to call a GET service operation that returns a single result, of either entity or primitive type, or that requires more than one input parameter. You must instead call the method. - -- Consider creating an extension method on the strongly typed partial class, which is generated by the tools, that uses either the or the method to call a service operation. This enables you to call service operations directly from the context. For more information, see the blog post [Service Operations and the WCF Data Services Client](/archive/blogs/astoriateam/service-operations-and-the-wcf-data-services-client). - -- When you use to call a service operation, the client library automatically escapes characters supplied to the by performing percent-encoding of reserved characters, such as ampersand (&), and escaping of single-quotes in strings. However, when you call one of the *Execute* methods to call a service operation, you must remember to perform this escaping of any user-supplied string values. Single-quotes in URIs are escaped as pairs of single-quotes. - -## Examples of Calling Service Operations - - This section contains the following examples of how to call service operations by using the WCF Data Services client library: - -- [Calling Execute<T> to Return a Collection of Entities](calling-service-operations-wcf-data-services.md#ExecuteIQueryable) - -- [Using CreateQuery<T> to Return a Collection of Entities](calling-service-operations-wcf-data-services.md#CreateQueryIQueryable) - -- [Calling Execute<T> to Return a Single Entity](calling-service-operations-wcf-data-services.md#ExecuteSingleEntity) - -- [Calling Execute<T> to Return a Collection of Primitive Values](calling-service-operations-wcf-data-services.md#ExecutePrimitiveCollection) - -- [Calling Execute<T> to Return a Single Primitive Value](calling-service-operations-wcf-data-services.md#ExecutePrimitiveValue) - -- [Calling a Service Operation that Returns No Data](calling-service-operations-wcf-data-services.md#ExecuteVoid) - -- [Calling a Service Operation Asynchronously](calling-service-operations-wcf-data-services.md#ExecuteAsync) - - - -### Calling Execute\ to Return a Collection of Entities - - The following example calls a service operation named GetOrdersByCity, which takes a string parameter of `city` and returns an : - - [!code-csharp[Astoria Northwind Client#CallServiceOperationIQueryable](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#callserviceoperationiqueryable)] - [!code-vb[Astoria Northwind Client#CallServiceOperationIQueryable](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#callserviceoperationiqueryable)] - - In this example, the service operation returns a collection of `Order` objects with related `Order_Detail` objects. - - - -### Using CreateQuery\ to Return a Collection of Entities - - The following example uses the to return a that is used to call the same GetOrdersByCity service operation: - - [!code-csharp[Astoria Northwind Client#CallServiceOperationCreateQuery](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#callserviceoperationcreatequery)] - [!code-vb[Astoria Northwind Client#CallServiceOperationCreateQuery](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#callserviceoperationcreatequery)] - - In this example, the method is used to add the parameter to the query, and the method is used to include related Order_Details objects in the results. - - - -### Calling Execute\ to Return a Single Entity - - The following example calls a service operation named GetNewestOrder that returns only a single Order entity: - - [!code-csharp[Astoria Northwind Client#CallServiceOperationSingleEntity](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#callserviceoperationsingleentity)] - [!code-vb[Astoria Northwind Client#CallServiceOperationSingleEntity](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#callserviceoperationsingleentity)] - - In this example, the method is used to request only a single Order entity on execution. - - - -### Calling Execute\ to Return a Collection of Primitive Values - - The following example calls a service operation that returns a collection of string values: - - [!code-csharp[Astoria Northwind Client#CallServiceOperationEnumString](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#callserviceoperationenumstring)] - - - -### Calling Execute\ to Return a Single Primitive Value - - The following example calls a service operation that returns a single string value: - - [!code-csharp[Astoria Northwind Client#CallServiceOperationSingleInt](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#callserviceoperationsingleint)] - [!code-vb[Astoria Northwind Client#CallServiceOperationSingleInt](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#callserviceoperationsingleint)] - - Again in this example, the method is used to request only a single integer value on execution. - - - -### Calling a Service Operation that Returns No Data - - The following example calls a service operation that returns no data: - - [!code-csharp[Astoria Northwind Client#CallServiceOperationVoid](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#callserviceoperationvoid)] - [!code-vb[Astoria Northwind Client#CallServiceOperationVoid](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#callserviceoperationvoid)] - - Because not data is returned, the value of the execution is not assigned. The only indication that the request has succeeded is that no is raised. - - - -### Calling a Service Operation Asynchronously - - The following example calls a service operation asynchronously by calling and : - - [!code-csharp[Astoria Northwind Client#CallServiceOperationAsync](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#callserviceoperationasync)] - [!code-vb[Astoria Northwind Client#CallServiceOperationAsync](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#callserviceoperationasync)] - - [!code-csharp[Astoria Northwind Client#OnAsyncExecutionComplete](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#onasyncexecutioncomplete)] - [!code-vb[Astoria Northwind Client#OnAsyncExecutionComplete](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#onasyncexecutioncomplete)] - - Because no data is returned, the value returned by the execution is not assigned. The only indication that the request has succeeded is that no is raised. - - The following example calls the same service operation asynchronously by using : - - [!code-csharp[Astoria Northwind Client#CallServiceOperationQueryAsync](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#callserviceoperationqueryasync)] - [!code-vb[Astoria Northwind Client#CallServiceOperationQueryAsync](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#callserviceoperationqueryasync)] - - [!code-csharp[Astoria Northwind Client#OnAsyncQueryExecutionComplete](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#onasyncqueryexecutioncomplete)] - [!code-vb[Astoria Northwind Client#OnAsyncQueryExecutionComplete](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#onasyncqueryexecutioncomplete)] - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md b/docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md deleted file mode 100644 index a7edd29ceefbd..0000000000000 --- a/docs/framework/data/wcf/configuring-the-data-service-wcf-data-services.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -description: "Learn more about: Configuring the Data Service (WCF Data Services)" -title: "Configuring the Data Service (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, configuring" -ms.assetid: 59efd4c8-cc7a-4800-a0a4-d3f8abe6c55c ---- -# Configuring the Data Service (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -With WCF Data Services, you can create data services that expose Open Data Protocol (OData) feeds. Data in these feeds can come from a variety of data sources. WCF Data Services uses data providers to expose this data as an OData feed. These providers include an Entity Framework provider, a reflection provider, and a set of custom data service provider interfaces. The provider implementation defines the data model for the service. For more information, see [Data Services Providers](data-services-providers-wcf-data-services.md). - - In WCF Data Services, a data service is a class that inherits from the class, where the type of the data service is the entity container of the data model. This entity container has one or more properties that return an , which are used to access entity sets in the data model. - - The behaviors of the data service are defined by the members of the class, and by members of the class, which is accessed from the property of the class. The class is supplied to the `InitializeService` method that is implemented by the data service, as in the following implementation of a Northwind data service: - -[!code-csharp[Astoria Northwind Service#DataServiceConfigComplete](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.svc.cs#dataserviceconfigcomplete)] -[!code-vb[Astoria Northwind Service#DataServiceConfigComplete](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind.svc.vb#dataserviceconfigcomplete)] - -## Data Service Configuration Settings - - The class enables you to specify the following data service behaviors: - -|Member|Behavior| -|------------|--------------| -||Enables you to disable count requests that are submitted to the data service by using the `$count` path segment and the `$inlinecount` query option. For more information, see [OData: URI Conventions](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/).| -||Enables you to disable support for data projection in requests that are submitted to the data service by using the `$select` query option. For more information, see [OData: URI Conventions](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/).| -||Enables a data type to be exposed in the metadata for a dynamic metadata provider defined by using the interface.| -||Enables you to specify whether the data service runtime should convert the type that is contained in the payload to the actual property type that is specified in the request.| -||Enables you to specify whether or not registered change interceptors are invoked on the related entities when a relationship link between two entities is deleted.| -||Enables you to limit the number of change sets and query operations that are allowed in a single batch. For more information, see [OData: Batch](https://www.odata.org/documentation/odata-version-2-0/batch-processing/) and [Batching Operations](batching-operations-wcf-data-services.md).| -||Enables you to limit the number of changes that can be included in a single change set. For more information, see [How to: Enable Paging of Data Service Results](how-to-enable-paging-of-data-service-results-wcf-data-services.md).| -||Enables you to limit the size of a response by limiting the number of related entities that can be included in a single request by using the `$expand` query operator. For more information, see [OData: URI Conventions](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/) and [Loading Deferred Content](loading-deferred-content-wcf-data-services.md).| -||Enables you to limit the size of a response by limiting the depth of the graph of related entities that can be included in a single request by using the `$expand` query operator. For more information, see [OData: URI Conventions](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/) and [Loading Deferred Content](loading-deferred-content-wcf-data-services.md).| -||Enables you to limit the number of entities to be inserted that can be contained in a single POST request.| -||Defines the version of the Atom protocol that is used by the data service. When the value of the is set to a value less than the maximum value of , the latest functionality of WCF Data Services is not available to clients accessing the data service. For more information, see [Data Service Versioning](data-service-versioning-wcf-data-services.md).| -||Enables you to limit the size of a response by limiting the number of entities in each entity set that is returned as a data feed.| -||Adds a data type to the list of types that are recognized by the data service.| -||Sets the access rights for entity set resources that are available on the data service. An asterisk (`*`) value can be supplied for the name parameter to set access for all remaining entity sets to the same level. We recommend that you set access to entity sets to provide the least privilege access to data service resources that are required by client applications. For more information, see [Securing WCF Data Services](securing-wcf-data-services.md). For examples of the minimum access rights required for a given URI and HTTP action, see the table in the [Minimum Resource Access Requirements](configuring-the-data-service-wcf-data-services.md#accessRequirements) section.| -||Sets the maximum page size for an entity set resource. For more information, see [How to: Enable Paging of Data Service Results](how-to-enable-paging-of-data-service-results-wcf-data-services.md).| -||Sets the access rights for service operations that are defined on the data service. For more information, see [Service Operations](service-operations-wcf-data-services.md). An asterisk (`*`) value can be supplied for the name parameter to set access for all service operations to the same level. We recommend that you set access to service operations to provide the least privilege access to data service resources that are required by client applications. For more information, see [Securing WCF Data Services](securing-wcf-data-services.md).| -||This configuration property enables you to more easily troubleshoot a data service by returning more information in the error response message. This option is not intended to be used in a production environment. For more information, see [Developing and Deploying WCF Data Services](developing-and-deploying-wcf-data-services.md).| - - - -## Minimum Resource Access Requirements - - The following table details the minimum entity set rights that must be granted to execute a specific operation. Path examples are based on the Northwind data service that is created when you complete the [quickstart](quickstart-wcf-data-services.md). Because both the enumeration and the enumeration are defined by using the , you can use a logical OR operator to specify multiple permissions for a single entity set or operation. For more information, see [How to: Enable Access to the Data Service](how-to-enable-access-to-the-data-service-wcf-data-services.md). - -|Path/Action|`GET`|`DELETE`|`MERGE`|`POST`|`PUT`| -|------------------|-----------|--------------|-------------|------------|-----------| -|`/Customers`||Not supported|Not supported||Not supported| -|`/Customers('ALFKI')`|| and | and |n/a| and | -|`/Customers('ALFKI')/Orders`|`Customers`:

-and-

`Orders`: |Not supported|Not supported|`Customers`: and or

-and-

`Orders` `:` and |Not supported| -|`/Customers('ALFKI')/Orders(10643)`|`Customers`:

-and-

`Orders`: |`Customers`:

-and-

`Orders`: and |`Customers`:

-and-

`Orders`: and |Not supported|`Customers`:

-and-

`Orders`: and | -|`/Orders(10643)/Customer`|`Customers`:

-and-

`Orders`: |`Customers`: and

-and-

`Orders`: |`Customers`: and ;

-and-

`Orders`: |`Customers`:

-and-

`Orders`: and |Not supported| -|`/Customers('ALFKI')/$links/Orders`|`Customers`:

-and-

`Orders`: |Not supported|Not supported|`Customers`: and or

-and-

`Orders`: |Not supported| -|`/Customers('ALFKI')/$links/Orders(10643)`|`Customers`:

-and-

`Orders`: |`Customers`: and or

-and-

`Orders`: |Not supported|Not supported|Not supported| -|`/Orders(10643)/$links/Customer`|`Customers`:

-and-

`Orders`: |`Orders`: and or |`Customers`:

-and-

`Orders`: and |Not supported|`Customers`: ;

-and-

`Orders`: and | -|`/Customers/$count`||Not supported|Not supported|Not supported|Not supported| -|`/Customers('ALFKI')/ContactName`||Not supported||Not supported|| -|`/Customers('ALFKI')/Address/StreetAddress/$value` 1|||Not supported|Not supported|Not supported| -|`/Customers('ALFKI')/ContactName/$value`|| and ||Not supported|| -|`/Customers('ALFKI')/$value` 2||Not supported|Not supported|Not supported|| -|`/Customers?$select=Orders/*&$expand=Orders`|`Customers`:

-and-

`Orders`: |Not supported|Not supported|`Customers`: |Not supported| -|`/Customers('ALFKI')?$select=Orders/*&$expand=Orders`|`Customers`:

-and-

`Orders`: |Not supported|Not supported|Not supported|Not supported| - - 1 In this example, `Address` represents a complex type property of the `Customers` entity that has a property named `StreetAddress`. The model used by the Northwind data services does not explicitly define this complex type. When the data model is defined by using the Entity Framework provider, you can use the Entity Data Model tools to define such a complex type. For more information, see [How to: Create and Modify Complex Types](/previous-versions/dotnet/netframework-4.0/dd456820(v=vs.100)). - - 2 This URI is supported when a property that returns a binary large object (BLOB) is defined as the media resource that belongs to an entity that is a media link entry, which in this case, is `Customers`. For more information, see [Streaming Provider](streaming-provider-wcf-data-services.md). - - - -## Versioning Requirements - - The following data service configuration behaviors require version 2 of the OData protocol, or later versions: - -- Support for count requests. - -- Support for the $select query option for projection. - - For more information, see [Data Service Versioning](data-service-versioning-wcf-data-services.md). - -## See also - -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [Hosting the Data Service](hosting-the-data-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/create-a-data-service-using-an-adonet-ef-data-wcf.md b/docs/framework/data/wcf/create-a-data-service-using-an-adonet-ef-data-wcf.md deleted file mode 100644 index 83bf0e2a1acfd..0000000000000 --- a/docs/framework/data/wcf/create-a-data-service-using-an-adonet-ef-data-wcf.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -description: "Learn more about: How to: Create a Data Service Using an ADO.NET Entity Framework Data Source (WCF Data Services)" -title: "How to: Create a Data Service Using an ADO.NET Entity Framework Data Source (WCF Data Services)" -ms.date: 08/24/2018 -ms.topic: how-to -helpviewer_keywords: - - "WCF Data Services, providers" - - "WCF Data Services, Entity Framework" -ms.assetid: 6d11fec8-0108-42f5-8719-2a7866d04428 ---- -# How to: Create a Data Service Using an ADO.NET Entity Framework Data Source (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services exposes entity data as a data service. This entity data is provided by the ADO.NETEntity Framework when the data source is a relational database. This topic shows you how to create an Entity Framework-based data model in a Visual Studio Web application that is based on an existing database and use this data model to create a new data service. - -The Entity Framework also provides a command line tool that can generate an Entity Framework model outside of a Visual Studio project. For more information, see [How to: Use EdmGen.exe to Generate the Model and Mapping Files](../adonet/ef/how-to-use-edmgen-exe-to-generate-the-model-and-mapping-files.md). - -## To add an Entity Framework model that is based on an existing database to an existing Web application - -1. On the **Project** menu, click **Add** > **New Item**. - -2. In the **Templates** pane, click the **Data** category, and then select **ADO.NET Entity Data Model**. - -3. Enter the model name and then click **Add**. - - The first page of the Entity Data Model Wizard is displayed. - -4. In the **Choose Model Contents** dialog box, select **Generate from database**. Then click **Next**. - -5. Click the **New Connection** button. - -6. In the **Connection Properties** dialog box, type your server name, select the authentication method, type the database name, and then click **OK**. - - The **Choose Your Data Connection** dialog box is updated with your database connection settings. - -7. Ensure that the **Save entity connection settings in App.Config as:** checkbox is checked. Then click **Next**. - -8. In the **Choose Your Database Objects** dialog box, select all of database objects that you plan to expose in the data service. - - > [!NOTE] - > Objects included in the data model are not automatically exposed by the data service. They must be explicitly exposed by the service itself. For more information, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md). - -9. Click **Finish** to complete the wizard. - - This creates a default data model based on the specific database. The Entity Framework enables to customize the data model. For more information, see [Entity Data Model Tools Tasks](/previous-versions/dotnet/netframework-4.0/bb738480(v=vs.100)). - -## To create the data service by using the new data model - -1. In Visual Studio, open the .edmx file that represents the data model. - -2. In the **Model Browser**, right-click the model, click **Properties**, and then note the name of the entity container. - -3. In **Solution Explorer**, right-click the name of your ASP.NET project, and then click **Add** > **New Item**. - -4. In the **Add New Item** dialog box, select the **WCF Data Service** template in the **Web** category. - - ![WCF Data Service item template in Visual Studio 2015](./media/wcf-data-service-item-template.png) - - > [!NOTE] - > The **WCF Data Service** template is available in Visual Studio 2015, but not in Visual Studio 2017 or later. - -5. Supply a name for the service, and then click **OK**. - - Visual Studio creates the XML markup and code files for the new service. By default, the code-editor window opens. - -6. In the code for the data service, replace the comment `/* TODO: put your data source class name here */` in the definition of the class that defines the data service with the type that inherits from the class and that is the entity container of the data model, which was noted in step 2. - -7. In the code for the data service, enable authorized clients to access the entity sets that the data service exposes. For more information, see [Creating the Data Service](creating-the-data-service.md). - -8. To test the Northwind.svc data service by using a Web browser, follow the instructions in the topic [Accessing the Service from a Web Browser](accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md). - -## See also - -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [Data Services Providers](data-services-providers-wcf-data-services.md) -- [How to: Create a Data Service Using the Reflection Provider](create-a-data-service-using-rp-wcf-data-services.md) -- [How to: Create a Data Service Using a LINQ to SQL Data Source](create-a-data-service-using-linq-to-sql-wcf.md) diff --git a/docs/framework/data/wcf/create-a-data-service-using-linq-to-sql-wcf.md b/docs/framework/data/wcf/create-a-data-service-using-linq-to-sql-wcf.md deleted file mode 100644 index a2c4090e8772c..0000000000000 --- a/docs/framework/data/wcf/create-a-data-service-using-linq-to-sql-wcf.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -description: "Learn more about: How to: Create a Data Service Using a LINQ to SQL Data Source (WCF Data Services)" -title: "How to: Create a Data Service Using a LINQ to SQL Data Source (WCF Data Services)" -ms.date: "03/30/2017" -ms.topic: how-to -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, LINQ to SQL" - - "WCF Data Services, providers" -ms.assetid: 3b01c2fd-8c6e-4bf5-b38f-9e61bdc3c328 ---- -# How to: Create a Data Service Using a LINQ to SQL Data Source (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services exposes entity data as a data service. The reflection provider enables you to define a data model that is based on any class that exposes members that return an implementation. To be able to make updates to data in the data source, these classes must also implement the interface. For more information, see [Data Services Providers](data-services-providers-wcf-data-services.md). This topic shows you how to create LINQ to SQL classes that access the Northwind sample database by using the reflection provider, as well as how to create the data service that is based on these data classes. - -## To add LINQ to SQL classes to a project - -1. From within a Visual Basic or C# application, on the **Project** menu, click **Add** > **New Item**. - -2. Click the **LINQ to SQL Classes** template. - -3. Change the name to **Northwind.dbml**. - -4. Click **Add**. - - The Northwind.dbml file is added to the project and the Object Relational Designer (O/R Designer) opens. - -5. In **Server**/**Database Explorer**, under Northwind, expand **Tables** and drag the `Customers` table onto the Object Relational Designer (O/R Designer). - - A `Customer` entity class is created and appears on the design surface. - -6. Repeat step 6 for the `Orders`, `Order_Details`, and `Products` tables. - -7. Right-click the new .dbml file that represents the LINQ to SQL classes and click **View Code**. - - This creates a new code-behind page named Northwind.cs that contains a partial class definition for the class that inherits from the class, which in this case is `NorthwindDataContext`. - -8. Replace the contents of the Northwind.cs code file with the following code. This code implements the reflection provider by extending the and data classes generated by LINQ to SQL: - - [!code-csharp[Astoria Linq Provider#Linq2SqlProvider](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.cs#linq2sqlprovider)] - [!code-vb[Astoria Linq Provider#Linq2SqlProvider](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_linq_provider/vb/northwind.vb#linq2sqlprovider)] - -### To create a data service by using a LINQ to SQL-based data model - -1. In **Solution Explorer**, right-click the name of your ASP.NET project, and then click **Add** > **New Item**. - -2. In the **Add New Item** dialog box, select the **WCF Data Service** template from the **Web** category. - - ![WCF Data Service item template in Visual Studio 2015](./media/wcf-data-service-item-template.png) - - > [!NOTE] - > The **WCF Data Service** template is available in Visual Studio 2015, but not in Visual Studio 2017 or later. - -3. Supply a name for the service, and then click **OK**. - - Visual Studio creates the XML markup and code files for the new service. By default, the code-editor window opens. - -4. In the code for the data service, replace the comment `/* TODO: put your data source class name here */` in the definition of the class that defines the data service with the type that is the entity container of the data model, which in this case is `NorthwindDataContext`. - -5. In the code for the data service, replace the placeholder code in the `InitializeService` function with the following: - - [!code-csharp[Astoria Linq Provider#EnableAccess](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_linq_provider/cs/northwind.svc.cs#enableaccess)] - [!code-vb[Astoria Linq Provider#EnableAccess](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_linq_provider/vb/northwind.svc.vb#enableaccess)] - - This enables authorized clients to access resources for the three specified entity sets. - -6. To test the Northwind.svc data service by using a Web browser, follow the instructions in the topic [Accessing the Service from a Web Browser](accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md). - -## See also - -- [How to: Create a Data Service Using an ADO.NET Entity Framework Data Source](create-a-data-service-using-an-adonet-ef-data-wcf.md) -- [How to: Create a Data Service Using the Reflection Provider](create-a-data-service-using-rp-wcf-data-services.md) -- [Data Services Providers](data-services-providers-wcf-data-services.md) diff --git a/docs/framework/data/wcf/create-a-data-service-using-rp-wcf-data-services.md b/docs/framework/data/wcf/create-a-data-service-using-rp-wcf-data-services.md deleted file mode 100644 index e3a8b3f595009..0000000000000 --- a/docs/framework/data/wcf/create-a-data-service-using-rp-wcf-data-services.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: "Learn more about: How to: Create a Data Service Using the Reflection Provider (WCF Data Services)" -title: "How to: Create a Data Service Using the Reflection Provider (WCF Data Services)" -ms.date: "03/30/2017" -ms.topic: how-to -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, providers" -ms.assetid: 7315c6d8-f452-4fb2-a0c1-76ab0593c146 ---- -# How to: Create a Data Service Using the Reflection Provider (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables you to define a data model that is based on arbitrary classes as long as those classes are exposed as objects that implement the interface. For more information, see [Data Services Providers](data-services-providers-wcf-data-services.md). - -## Example - - The following example defines a data model that includes `Orders` and `Items`. The entity container class `OrderItemData` has two public methods that return interfaces. These interfaces are the entity sets of the `Orders` and `Items` entity types. An `Order` can include multiple `Items`, so the `Orders` entity type has an `Items` navigation property that returns a collection of `Items` objects. The `OrderItemData` entity container class is the generic type of the class from which the `OrderItems` data service is derived. - -> [!NOTE] -> Because this example demonstrates an in-memory data provider and changes are not persisted outside of the current object instances, there is no benefit derived from implementing the interface. For an example that implements the interface, see [How to: Create a Data Service Using a LINQ to SQL Data Source](create-a-data-service-using-linq-to-sql-wcf.md). - - [!code-csharp[Astoria Reflection Provider#CustomIQueryable](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_reflection_provider/cs/orderitems.svc.cs#customiqueryable)] - [!code-vb[Astoria Reflection Provider#CustomIQueryable](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_reflection_provider/vb/orderitems.svc.vb#customiqueryable)] - -## See also - -- [How to: Create a Data Service Using a LINQ to SQL Data Source](create-a-data-service-using-linq-to-sql-wcf.md) -- [Data Services Providers](data-services-providers-wcf-data-services.md) -- [How to: Create a Data Service Using an ADO.NET Entity Framework Data Source](create-a-data-service-using-an-adonet-ef-data-wcf.md) diff --git a/docs/framework/data/wcf/create-an-asynchronous-wpf-application-wcf-data-services.md b/docs/framework/data/wcf/create-an-asynchronous-wpf-application-wcf-data-services.md deleted file mode 100644 index c3fec98f9a346..0000000000000 --- a/docs/framework/data/wcf/create-an-asynchronous-wpf-application-wcf-data-services.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -description: "Learn more about: How to: Create an Asynchronous Windows Presentation Framework Application (WCF Data Services)" -title: "How to: Create an Asynchronous Windows Presentation Framework Application (WCF Data Services)" -ms.date: "03/30/2017" -ms.topic: how-to -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, asynchronous operations" -ms.assetid: 834614df-1427-4839-b0be-90f68e5afffd ---- -# How to: Create an Asynchronous Windows Presentation Framework Application (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -With WCF Data Services, you can bind data obtained from a data service to UI element of a Windows Presentation Framework (WPF) application. For more information, see [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md).You can also execute operations against the data service in an asynchronous manner, which enables the application to continue to respond while waiting for a response to a data service request. Applications for Silverlight are required to access the data service asynchronously. For more information, see [Asynchronous Operations](asynchronous-operations-wcf-data-services.md). - - This topic shows how to access a data service asynchronously and bind the results to elements of a WPF application. The examples in this topic use the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following XAML defines the window of the WPF application. - - [!code-xaml[Astoria Northwind Client#WpfDataBindingAsyncXaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerordersasync.xaml#wpfdatabindingasyncxaml)] - -## Example - - The following code-behind page for the XAML file executes an asynchronous query by using the data service and binds the results to elements in the WPF window. - - [!code-csharp[Astoria Northwind Client#WpfDataBindingAsync](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerordersasync.xaml.cs#wpfdatabindingasync)] - [!code-vb[Astoria Northwind Client#WpfDataBindingAsync](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerordersasync.xaml.vb#wpfdatabindingasync)] - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/creating-the-data-service.md b/docs/framework/data/wcf/creating-the-data-service.md deleted file mode 100644 index da1f8b2a4b874..0000000000000 --- a/docs/framework/data/wcf/creating-the-data-service.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -title: Create a WCF data service in Visual Studio -description: Learn how to create a sample data service that uses WCF Data Services to expose an OData feed based on a sample database. -ms.date: 08/24/2018 -dev_langs: - - "csharp" - - "vb" -ms.assetid: 34d1d971-5e18-4c22-9bf6-d3612e27ea59 -recommendations: false ---- -# Create the data service - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -In this topic, you create a sample data service that uses WCF Data Services to expose an Open Data Protocol (OData) feed that's based on the Northwind sample database. The task involves the following basic steps: - -1. Create an ASP.NET Web application. - -2. Define the data model by using the Entity Data Model tools. - -3. Add the data service to the Web application. - -4. Enable access to the data service. - -## Create the ASP.NET web app - -1. In Visual Studio, on the **File** menu, select **New** > **Project**. - -1. In the **New Project** dialog box, under either Visual Basic or Visual C# select the **Web** category, and then select **ASP.NET Web Application**. - -1. Enter `NorthwindService` as the name of the project and then select **OK**. - -1. In the **New ASP.NET Web Application** dialog, select **Empty** and then select **OK**. - -1. (Optional) Specify a specific port number for your Web application. Note: the port number `12345` is used in this series of quickstart topics. - - 1. In **Solution Explorer**, right-click on the ASP.NET project that you just created, and then choose **Properties**. - - 2. Select the **Web** tab, and set the value of the **Specific port** text box to `12345`. - -## Define the data model - -1. In **Solution Explorer**, right-click the name of the ASP.NET project, and then click **Add** > **New Item**. - -2. In the **Add New Item** dialog box, select the **Data** category, and then select **ADO.NET Entity Data Model**. - -3. For the name of the data model, enter `Northwind.edmx`. - -4. In the **Entity Data Model Wizard**, select **EF Designer from Database**, and then click **Next**. - -5. Connect the data model to the database by doing one of the following steps, and then click **Next**: - - - If you don't have a database connection already configured, click **New Connection** and create a new connection. For more information, see [How to: Create Connections to SQL Server Databases](/previous-versions/visualstudio/visual-studio-2008/s4yys16a(v=vs.90)). This SQL Server instance must have the Northwind sample database attached. - - \- or - - - - If you have a database connection already configured to connect to the Northwind database, select that connection from the list of connections. - -6. On the final page of the wizard, select the check boxes for all tables in the database, and clear the check boxes for views and stored procedures. - -7. Click **Finish** to close the wizard. - -## Create the WCF data service - -1. In **Solution Explorer**, right-click on the ASP.NET project, and then choose **Add** > **New Item**. - -2. In the **Add New Item** dialog box, select the **WCF Data Service** item template from the **Web** category. - - ![WCF Data Service item template in Visual Studio 2015](./media/wcf-data-service-item-template.png) - - > [!NOTE] - > The **WCF Data Service** template is available in Visual Studio 2015, but not in Visual Studio 2017 or later. - -3. For the name of the service, type `Northwind`. - - Visual Studio creates the XML markup and code files for the new service. By default, the code-editor window opens. In **Solution Explorer**, the service has the name Northwind with the extension *.svc.cs* or *.svc.vb*. - -4. In the code for the data service, replace the comment `/* TODO: put your data source class name here */` in the definition of the class that defines the data service with the type that is the entity container of the data model, which in this case is `NorthwindEntities`. The class definition should look this the following: - - [!code-csharp[Astoria Quickstart Service#ServiceDefinition](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs#servicedefinition)] - [!code-vb[Astoria Quickstart Service#ServiceDefinition](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_service/vb/northwind.svc.vb#servicedefinition)] - -## Enable access to data service resources - -1. In the code for the data service, replace the placeholder code in the `InitializeService` function with the following: - - [!code-csharp[Astoria Quickstart Service#AllReadConfig](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs#allreadconfig)] - [!code-vb[Astoria Quickstart Service#AllReadConfig](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_service/vb/northwind.svc.vb#allreadconfig)] - - This enables authorized clients to have read and write access to resources for the specified entity sets. - - > [!NOTE] - > Any client that can access the ASP.NET application can also access the resources exposed by the data service. In a production data service, to prevent unauthorized access to resources you should also secure the application itself. For more information, see [Securing WCF Data Services](securing-wcf-data-services.md). - -## Next steps - -You have successfully created a new data service that exposes an OData feed that is based on the Northwind sample database, and you have enabled access to the feed for clients that have permissions on the ASP.NET Web application. Next, you'll start the data service from Visual Studio and access the OData feed by submitting HTTP GET requests through a Web browser: - -> [!div class="nextstepaction"] -> [Access the service from a web browser](accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md) - -## See also - -- [ADO.NET Entity Data Model Tools](/previous-versions/dotnet/netframework-4.0/bb399249(v=vs.100)) diff --git a/docs/framework/data/wcf/creating-the-dotnet-client-application-wcf-data-services-quickstart.md b/docs/framework/data/wcf/creating-the-dotnet-client-application-wcf-data-services-quickstart.md deleted file mode 100644 index b6c6e10292f17..0000000000000 --- a/docs/framework/data/wcf/creating-the-dotnet-client-application-wcf-data-services-quickstart.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -description: "Learn more about: Creating the .NET Framework Client Application (WCF Data Services Quickstart)" -title: "Creating the .NET Framework Client Application (WCF Data Services Quickstart)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -ms.assetid: 41ade767-eeab-437d-9121-9797e8fb8045 ---- -# Creating the .NET Framework Client Application (WCF Data Services Quickstart) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -This is the final task of the WCF Data Services quickstart. In this task, you will add a console application to the solution, add a reference to the Open Data Protocol (OData) feed into this new client application, and access the OData feed from the client application by using the generated client data service classes and client libraries. - -> [!NOTE] -> A .NET Framework-based client application is not required to access a data feed. The data service can be accessed by any application component that consumes an OData feed. For more information, see [Using a Data Service in a Client Application](using-a-data-service-in-a-client-application-wcf-data-services.md). - -## To create the client application by using Visual Studio - -1. In **Solution Explorer**, right-click the solution, click **Add**, and then click **New Project**. - -2. In the left pane, select **Installed** > [**Visual C#** or **Visual Basic**] > **Windows Desktop**, and then select the **WPF App** template. - -3. Enter `NorthwindClient` for the project name, and then click **OK**. - -4. Open the file MainWindow.xaml and replace the XAML code with the following code: - - [!code-xaml[Astoria Quickstart Client#Window1Xaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_client/vb/window1.xaml#window1xaml)] - -## To add a data service reference to the project - -1. In **Solution Explorer**, right-click the NorthwindClient project, click **Add** > **Service Reference**, and then click **Discover**. - - This displays the Northwind data service that you created in the first task. - -2. In the **Namespace** text box, type `Northwind`, and then click **OK**. - - This adds a new code file to the project, which contains the data classes that are used to access and interact with data service resources as objects. The data classes are created in the namespace `NorthwindClient.Northwind`. - -## To access data service data in the WPF application - -1. In **Solution Explorer** under **NorthwindClient**, right-click the project and click **Add Reference**. - -2. In the **Add Reference** dialog box, click the **.NET** tab, select the System.Data.Services.Client.dll assembly, and then click **OK**. - -3. In **Solution Explorer** under **NorthwindClient**, open the code page for the MainWindow.xaml file, and add the following `using` statement (`Imports` in Visual Basic). - - [!code-csharp[Astoria Quickstart Client#Using](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/window1.xaml.cs#using)] - [!code-vb[Astoria Quickstart Client#Using](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_client/vb/window1.xaml.vb#using)] - -4. Insert the following code that queries that data service and binds the result to a into the `MainWindow` class: - - > [!NOTE] - > You must replace the host name `localhost:12345` with the server and port that is hosting your instance of the Northwind data service. - - [!code-csharp[Astoria Quickstart Client#QueryCode](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/window1.xaml.cs#querycode)] - [!code-vb[Astoria Quickstart Client#QueryCode](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_client/vb/window1.xaml.vb#querycode)] - -5. Insert the following code that saves changes into the `MainWindow` class: - - [!code-csharp[Astoria Quickstart Client#SaveChanges](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_client/cs/window1.xaml.cs#savechanges)] - [!code-vb[Astoria Quickstart Client#SaveChanges](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_client/vb/window1.xaml.vb#savechanges)] - -## To build and run the NorthwindClient application - -1. In **Solution Explorer**, right-click the NorthwindClient project and select **Set as startup project**. - -2. Press **F5** to start the application. - - This builds the solution and starts the client application. Data is requested from the service and displayed in the console. - -3. Edit a value in the **Quantity** column of the data grid, and then click **Save**. - - Changes are saved to the data service. - - > [!NOTE] - > This version of the NorthwindClient application does not support adding and deleting of entities. - -## Next Steps - -You have successfully created the client application that accesses the sample Northwind OData feed. You've also completed the WCF Data Services quickstart! - -For more information about accessing an OData feed from a .NET Framework application, see [WCF Data Services Client Library](wcf-data-services-client-library.md). - -## See also - -- [Getting Started](getting-started-with-wcf-data-services.md) -- [Resources](wcf-data-services-resources.md) diff --git a/docs/framework/data/wcf/custom-data-service-providers-wcf-data-services.md b/docs/framework/data/wcf/custom-data-service-providers-wcf-data-services.md deleted file mode 100644 index 1d372f31e11f7..0000000000000 --- a/docs/framework/data/wcf/custom-data-service-providers-wcf-data-services.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -description: "Learn more about: Custom Data Service Providers (WCF Data Services)" -title: "Custom Data Service Providers (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, providers" -ms.assetid: e702ecdb-3419-4743-92a9-c3c0e7d44082 ---- -# Custom Data Service Providers (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services includes a set of providers that enables you to define a data model based on late-bound data types. - -|Provider|Description| -|--------------|-----------------| -|Metadata provider|This is the core custom data service provider that enables you to define a custom data model at runtime by implementing the interface.| -|Query provider|This provider enables you to execute queries against a custom data model that is defined by using the interface. The query provider is created by implementing the interface.| -|Update provider|This provider enables you to make updates to types that are exposed in a custom data service provider and to manage concurrency. An update provider is created by implementing the interface| -|Paging provider|This provider is used with the custom data service provider to enable server-driven paging support. A paging provider for a custom data service is created by implementing the interface.| -|Streaming provider|This provider enables you to expose binary large object data types as a stream. A streaming provider is created by implementing the interface. The streaming provider can also be used with Entity Framework and reflection data source providers. For more information, see [Streaming Provider](streaming-provider-wcf-data-services.md).| - -## See also - -- [Data Services Providers](data-services-providers-wcf-data-services.md) -- [Entity Framework Provider](entity-framework-provider-wcf-data-services.md) -- [Reflection Provider](reflection-provider-wcf-data-services.md) diff --git a/docs/framework/data/wcf/data-service-versioning-wcf-data-services.md b/docs/framework/data/wcf/data-service-versioning-wcf-data-services.md deleted file mode 100644 index 0afc6ad06392a..0000000000000 --- a/docs/framework/data/wcf/data-service-versioning-wcf-data-services.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -description: "Learn more about: Data Service Versioning (WCF Data Services)" -title: "Data Service Versioning (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "versioning, WCF Data Services" - - "versioning [WCF Data Services]" - - "WCF Data Services, versioning" -ms.assetid: e3e899cc-7f25-4f67-958f-063f01f79766 ---- -# Data Service Versioning (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -The Open Data Protocol (OData) enables you to create data services so that clients can access data as resources using URIs that are based on a data model. OData also supports the definition of service operations. After initial deployment, and potentially several times during their lifetime, these data services may need to be changed for a variety of reasons, such as changing business needs, information technology requirements, or to address other issues. When you make changes to an existing data service, you must consider whether to define a new version of your data service and how best to minimize the impact on existing client applications. This topic provides guidance on when and how to create a new version of a data service. It also describes how WCF Data Services handles an exchange between clients and data services that support different versions of the OData protocol. - -## Versioning a WCF Data Service - - Once a data service is deployed and the data is being consumed, changes to the data service have the potential to cause compatibility issues with existing client applications. However, because changes are often required by the overall business needs of the service, you must consider when and how to create a new version of your data service with the least impact on client applications. - -### Data Model Changes that Recommend a New Data Service Version - - When considering whether to publish a new version of a data service, it is important to understand how the different kinds of changes may affect client applications. Changes to a data service that might require you to create a new version of a data service can be divided into the following two categories: - -- Changes to the service contract—which include updates to service operations, changes to the accessibility of entity sets (feeds), version changes, and other changes to service behaviors. - -- Changes to the data contract—which include changes to the data model, feed formats, or feed customizations. - - The following table details for which kinds of changes you should consider publishing a new version of the data service: - -|Type of Change|Requires a new version|New version not needed| -|--------------------|----------------------------|----------------------------| -|Service operations|- Add new parameter
- Change return type
- Remove service operation|- Delete existing parameter
- Add new service operation| -|Service behaviors|- Disable count requests
- Disable projection support
- Increase the required data service version|- Enable count requests
- Enable projection support
- Decrease the required data service version| -|Entity set permissions|- Restrict entity set permissions
- Change response code (new first digit value) 1|- Relax entity set permissions
- Change response code (same first digit value)| -|Entity properties|- Remove existing property or relationship
- Add non-nullable property
- Change existing property|- Add nullable property2| -|Entity sets|- Remove entity set|- Add derived type
- Change base type
- Add entity set| -|Feed customization|- Change entity-property mapping|| - - 1 This may depend on how strictly a client application relies on receiving a specific error code. - - 2 You can set the property to `true` to have the client ignore any new properties sent by the data service that are not defined on the client. However, when inserts are made, the properties not included by the client in the POST request are set to their default values. For updates, any existing data in a property unknown to the client might be overwritten with default values. In this case, you should send the update as a MERGE request, which is the default. For more information, see [Managing the Data Service Context](managing-the-data-service-context-wcf-data-services.md). - -### How to Version a Data Service - - When required, a new data service version is defined by creating a new instance of the service with an updated service contract or data model. This new service is then exposed by using a new URI endpoint, which differentiates it from the previous version. For example: - -- Old version: `http://services.odata.org/Northwind/v1/Northwind.svc/` - -- New version: `http://services.odata.org/Northwind/v2/Northwind.svc/` - - When upgrading a data service, clients will need to also be updated based on the new data service metadata and to use the new root URI. When possible, you should maintain the previous version of the data service to support clients that have not yet been upgraded to use the new version. Older versions of a data service can be removed when they are no longer needed. You should consider maintaining the data service endpoint URI in an external configuration file. - -## OData Protocol Versions - - As new versions of OData are released, client applications may not be using the same version of the OData protocol that is supported by the data service. An older client application may access a data service that supports a newer version of OData. A client application may also be using a newer version of the WCF Data Services client library, which supports a newer version of OData than does the data service that is being accessed. - - WCF Data Services leverages the support provided by OData to handle such versioning scenarios. There is also support for generating and using data model metadata to create client data service classes when the client uses a different version of OData than the data service uses. For more information, see the Protocol Versioning section in the [OData: Overview](https://www.odata.org/documentation/odata-version-2-0/overview/) article. - -### Version Negotiation - - The data service can be configured to define the highest version of the OData protocol that will be used by the service, regardless of the version requested by the client. You can do this by specifying a value for the property of the used by the data service. For more information, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md). - - When an application uses the WCF Data Services client libraries to access a data service, the libraries automatically set these headers to the correct values, depending on the version of OData and the features that are used in your application. By default, WCF Data Services uses the lowest protocol version that supports the requested operation. - - The following table details the versions of .NET Framework and Silverlight that include WCF Data Services support for specific versions of the OData protocol. - -|OData Protocol Version|Support introduced in…| -|-----------------------------------------------------------------------------------|----------------------------| -|Version 1|- .NET Framework 3.5 Service Pack 1 (SP1)
- Silverlight version 3| -|Version 2|- .NET Framework 4
- Silverlight version 4| - -### Metadata Versions - - By default, WCF Data Services uses version 1.1 of CSDL to represent a data model. This is always the case for data models that are based on either a reflection provider or a custom data service provider. However, when the data model is defined by using the Entity Framework, the version of CSDL returned is the same as the version that is used by the Entity Framework. The version of the CSDL is determined by the namespace of the [Schema element (CSDL)](/ef/ef6/modeling/designer/advanced/edmx/csdl-spec#schema-element-csdl). - - The `DataServices` element of the returned metadata also contains a `DataServiceVersion` attribute, which is the same value as the `DataServiceVersion` header in the response message. Client applications, such as the **Add Service Reference** dialog box in Visual Studio, use this information to generate client data service classes that work correctly with the version of WCF Data Services that host the data service. For more information, see the Protocol Versioning section in the [OData: Overview](https://www.odata.org/documentation/odata-version-2-0/overview/) article. - -## See also - -- [Data Services Providers](data-services-providers-wcf-data-services.md) -- [Defining WCF Data Services](defining-wcf-data-services.md) diff --git a/docs/framework/data/wcf/data-services-providers-wcf-data-services.md b/docs/framework/data/wcf/data-services-providers-wcf-data-services.md deleted file mode 100644 index b223679ff9944..0000000000000 --- a/docs/framework/data/wcf/data-services-providers-wcf-data-services.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: "Learn more about: Data Services Providers (WCF Data Services)" -title: "Data Services Providers (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, providers" -ms.assetid: a0160b1b-3d9c-4cc8-8391-cb0986a60a41 ---- -# Data Services Providers (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services supports multiple provider models for exposing data as an Open Data Protocol (OData) feed. This topic provides information to enable you to select the best WCF Data Services provider for your data source. - -## Data Source Providers - - WCF Data Services supports the following providers for defining the data model of a data service. - -|Provider|Description| -|--------------|-----------------| -|Entity Framework provider|This provider uses the ADO.NET Entity Framework to enable you to use relational data with a data service by defining a data model that maps to relational data. Your data source can be SQL Server or any other data source with third-party provider support for the Entity Framework. You should use the Entity Framework provider when you have a relational data source, such as a SQL Server database. For more information, see [Entity Framework Provider](entity-framework-provider-wcf-data-services.md).| -|Reflection provider|This provider uses reflection to enable you to define a data model based on existing data classes that can be exposed as instances of the interface. Updates are enabled by implementing the interface. You should use this provider when you have static data classes that are defined at runtime, such as those generated by LINQ to SQL or defined by a typed DataSet. For more information, see [Reflection Provider](reflection-provider-wcf-data-services.md).| -|Custom Data Service Providers|WCF Data Services includes a set of providers that enable you to dynamically define a data model based on late-bound data types. You should implement these interfaces when the data being exposed is not known when the application is being designed or when the Entity Framework or reflection providers are not sufficient. For more information, see [Custom Data Service Providers](custom-data-service-providers-wcf-data-services.md).| - -## Other Data Service Providers - - WCF Data Services has the following additional data service provider that enhances the performance of a data source defined by using one of the other providers. - -|Provider|Description| -|--------------|-----------------| -|Streaming provider|This provider enables you to expose binary large object data types by using WCF Data Services. A streaming provider is created by implementing the interface. This provider can be implemented together with any data source provider. For more information, see [Streaming Provider](streaming-provider-wcf-data-services.md).| - -## See also - -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md) -- [Hosting the Data Service](hosting-the-data-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/defining-wcf-data-services.md b/docs/framework/data/wcf/defining-wcf-data-services.md deleted file mode 100644 index a419197f52357..0000000000000 --- a/docs/framework/data/wcf/defining-wcf-data-services.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -description: "Learn more about: Defining WCF Data Services" -title: "Defining WCF Data Services" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, configuring" -ms.assetid: 05006ff3-02dc-410e-831e-54ec3e7e24ef ---- -# Defining WCF Data Services - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -This section describes how to create and configure WCF Data Services to expose data as an Open Data Protocol (OData) feed. For more information about the basic steps required to create a data service, see [Exposing Your Data as a Service](exposing-your-data-as-a-service-wcf-data-services.md). - -## In This Section - - [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md) - - Describes the data service configuration options provided by WCF Data Services. - - [Data Services Providers](data-services-providers-wcf-data-services.md) - - Describes the provider models for exposing data as a data service. - - [Service Operations](service-operations-wcf-data-services.md) - - Describes how to define service operations that expose methods on the server. - - [Feed Customization](feed-customization-wcf-data-services.md) - - Describes how to create a mapping between entities in the data model defined by the data service provider and elements in the data feed. - - [Interceptors](interceptors-wcf-data-services.md) - - Describes how to define interceptor methods to perform custom business logic on requests to the data service. - - [Developing and Deploying WCF Data Services](developing-and-deploying-wcf-data-services.md) - - Describes how to develop and deploy a data service by using Visual Studio. - - [Securing WCF Data Services](securing-wcf-data-services.md) - - Describes authentication and authorization for the data service and other security considerations. - - [Hosting the Data Service](hosting-the-data-service-wcf-data-services.md) - - Describes how to select a host for your data service. - - [Data Service Versioning](data-service-versioning-wcf-data-services.md) - - Describes how to work with different versions of the OData. - - [WCF Data Services Protocol Implementation Details](wcf-data-services-protocol-implementation-details.md) - - Describes optional functionalities of the OData protocol that are not currently implemented by WCF Data Services. - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [Accessing Data Service Resources](accessing-data-service-resources-wcf-data-services.md) -- [Getting Started](getting-started-with-wcf-data-services.md) diff --git a/docs/framework/data/wcf/developing-and-deploying-wcf-data-services.md b/docs/framework/data/wcf/developing-and-deploying-wcf-data-services.md deleted file mode 100644 index adb5753e93f1c..0000000000000 --- a/docs/framework/data/wcf/developing-and-deploying-wcf-data-services.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -description: "Learn more about: Develop and Deploy WCF Data Services" -title: "Developing and Deploying WCF Data Services" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, developing" - - "WCF Data Services, deploying" - - "deploying [WCF Data Services" - - "developing applications [WCF Data Services]" -ms.assetid: 6557c0e3-5aea-4f6e-bc14-77ad317a168b ---- -# Develop and Deploy WCF Data Services - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -This article provides information about developing and deploying WCF Data Services. For more basic information about WCF Data Services, see [Getting Started](getting-started-with-wcf-data-services.md) and [Overview](wcf-data-services-overview.md). - -## Develop WCF Data Services - -When you use WCF Data Services to create a data service that supports the Open Data Protocol (OData), you must perform the following basic tasks during development: - -1. **Define the data model** - - WCF Data Services supports a variety of data service providers that enable you to define a data model based on data from a variety of data sources, from relational databases to late-bound data types. For more information, see [Data Services Providers](data-services-providers-wcf-data-services.md). - -2. **Create the data service** - - The most basic data service exposes a class that inherits from the class, with a type `T` that is the namespace-qualified name of the entity container. For more information, see [Defining WCF Data Services](defining-wcf-data-services.md). - -3. **Configure the data service** - - By default, WCF Data Services disables access to resources that are exposed by an entity container. The interface enables you to configure access to resources and service operations, specify the supported version of OData, and to define other service-wide behaviors, such as batching behaviors or the maximum number of entities that can be returned in a single response feed. For more information, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md). - -This article primarily covers the development and deployment of data services by using Visual Studio. For information about the flexibility provided by WCF Data Services for exposing your data as OData feeds, see [Defining WCF Data Services](defining-wcf-data-services.md). - -### Choose a Development Web Server - -When you develop a WCF Data Service as an ASP.NET application or ASP.NET Web site by using Visual Studio 2015, you have a choice of Web servers on which to run the data service during development. The following Web servers integrate with Visual Studio to make it easier to test and debug your data services on the local computer. - -1. **Local IIS Server** - - When you create a data service that is an ASP.NET application or ASP.NET Web site that runs on Internet Information Services (IIS), we recommend that you develop and test your data service by using IIS on the local computer. Running the data service on IIS makes it easier to trace HTTP requests during debugging. This also enables you to predetermine the necessary rights required by IIS to access files, databases, and other resources required by the data service. To run your data service on IIS, make sure that both IIS and Windows Communication Foundation (WCF) are installed and configured correctly and grant access to IIS accounts in the file system and databases. For more information, see [How to: Develop a WCF Data Service Running on IIS](how-to-develop-a-wcf-data-service-running-on-iis.md). - - > [!NOTE] - > You must run Visual Studio with administrator rights to enable the develop environment to configure the local IIS server. - -2. **Visual Studio Development Server** - - Visual Studio includes a built-in Web server, the Visual Studio Development Server, which is the default Web server for ASP.NET projects. This Web server is designed to run ASP.NET projects on the local computer during development. The [WCF Data Services quickstart](quickstart-wcf-data-services.md) shows how to create a data service that runs in the Visual Studio Development Server. - - Be aware of the following limitations when you use the Visual Studio Development Server to develop the data service: - - - This server can only be accessed on the local computer. - - - This server listens on `localhost` and on a specific port, not on port 80, which is the default port for HTTP messages. For more information, see [Web Servers in Visual Studio for ASP.NET Web Projects](/previous-versions/aspnet/58wxa9w5(v=vs.120)). - - - This server runs the data service in the context of your current user account. For example, if you are running as an administrator-level user, a data service running in the Visual Studio Development Server will have administrator-level privileges. This can cause the data service to be able to access resources that it does not have the rights to access when deployed to an IIS server. - - - This server does not include the extra facilities of IIS, such as authentication. - - - This server cannot handle chunked HTTP streams, which are sent by default by the WCF Data Services client when accessing large binary data from the data service. For more information, see [Streaming Provider](streaming-provider-wcf-data-services.md). - - - This server has issues with processing the period (`.`) character in a URL, even though this character is supported by WCF Data Services in key values. - - > [!TIP] - > Even though you can use the Visual Studio Development Server to test your data services during development, you should test them again after deploying to a Web server that is running IIS. - -3. **Azure Development Environment** - - Azure Tools for Visual Studio includes an integrated set of tools for developing Azure services in Visual Studio. With these tools, you can develop a data service that can be deployed to Azure, and you can test the data service on the local computer before deployment. Use these tools when using Visual Studio to develop a data service that runs on the Azure platform. For information about installing the tools, see [Azure tools for Visual Studio 2015](../../../azure/vs2015-install.md). For more information about developing a data service that runs on Azure, see the post [Deploying an OData Service in Azure](/archive/blogs/astoriateam/deploying-an-odata-service-in-windows-azure). - -### Development Tips - -Consider the following when you develop a data service: - -- If you plan to authenticate users or restrict access for specific users, determine the security requirements of your data service. For more information, see [Securing WCF Data Services](securing-wcf-data-services.md). - -- An HTTP inspection program can be helpful when debugging a data service by enabling you to inspect the contents of request and response messages. Any network packet analyzer that can display raw packets can be used to inspect HTTP requests to and responses from the data service. - -- When debugging a data service, you may want to get more information about an error from the data service than during regular operation. You can get additional error information from the data service by setting the property in the to `true` and by setting the property of the attribute on the data service class to `true`. For more information, see the post [Debugging WCF Data Services](/archive/blogs/phaniraj/debugging-wcf-data-services). You can also enable tracing in WCF to view exceptions raised in the HTTP messaging layer. For more information, see [Configuring Tracing](../../wcf/diagnostics/tracing/configuring-tracing.md). - -- A data service is usually developed as an ASP.NET application project, but you can also create you data service as an ASP.NET Web site project in Visual Studio. For information about the differences between the two types of projects, see [Web Application Projects versus Web Site Projects in Visual Studio](/previous-versions/aspnet/dd547590(v=vs.110)). - -- When you create a data service by using the **Add New Item** dialog box in Visual Studio, the data service is hosted by ASP.NET in IIS. While ASP.NET and IIS is the default host for a data service, other hosting options are supported. For more information, see [Hosting the Data Service](hosting-the-data-service-wcf-data-services.md). - -## Deploy WCF Data Services - -WCF Data Service provides flexibility in choosing the process that hosts the data service. You can use Visual Studio to deploy a data service to the following platforms: - -- **IIS-Hosted Web Server** - - When a data service is developed as an ASP.NET project, it can be deployed to an IIS Web server by using the standard ASP.NET deployment processes. Visual Studio provides the following deployment technologies for ASP.NET, depending on the kind of ASP.NET project that hosts the data service that you are deploying. - - - **Deployment Technologies for ASP.NET Web Applications** - - - [How to: Create a Web Deployment Package in Visual Studio](/previous-versions/aspnet/dd465323(v=vs.110)) - - - [How to: Deploy a Web Project Using One-Click Publish in Visual Studio](/previous-versions/aspnet/dd465337(v=vs.110)) - - - **Deployment Technologies for ASP.NET Web Sites** - - - [How to: Copy Web Site Files with the Copy Web Site Tool](/previous-versions/aspnet/c95809c0(v=vs.100)) - - - [How to: Publish Web Sites](/previous-versions/aspnet/20yh9f1b(v=vs.100)) - - - [Walkthrough: Deploying an ASP.NET Web Application Using XCOPY](/previous-versions/aspnet/f735abw9(v=vs.100)) - - For more information about the deployment options for an ASP.NET application, see [Web Deployment Overview for Visual Studio and ASP.NET](/previous-versions/aspnet/dd394698(v=vs.110)). - - > [!TIP] - > Before you attempt to deploy the data service to IIS, make sure that you have tested the deployment to a Web server that is running IIS. For more information, see [How to: Develop a WCF Data Service Running on IIS](how-to-develop-a-wcf-data-service-running-on-iis.md). - -- **Azure** - - You can deploy a data service to Azure by using [Azure Tools for Visual Studio](../../../azure/vs2015-install.md). For more information about deploying a data service to Azure, see [Deploying an OData Service in Azure](/archive/blogs/astoriateam/deploying-an-odata-service-in-windows-azure). - -### Deployment Considerations - -Consider the following when deploying a data service: - -- When you deploy a data service that uses the Entity Framework provider to access a SQL Server database, you might also have to propagate data structures, data, or both with your data service deployment. Visual Studio can automatically create scripts (.sql files) to do this in the destination database, and these scripts can be included in the Web deployment package of an ASP.NET application. For more information, see [How to: Deploy a Database With a Web Application Project](/previous-versions/dd465343(v=vs.100)). For an ASP.NET Web site, you can do this by using the **Database Publishing Wizard** in Visual Studio. For more information, see [Publishing a SQL Database](/previous-versions/aspnet/bb907585(v=vs.100)). - -- Because WCF Data Services includes a basic WCF implementation, you can use Windows Server AppFabric to monitor a data service deployed to IIS running on Windows Server. For more information about using Windows Server AppFabric to monitor a data service, see the post [Tracking WCF Data Services with Windows Server AppFabric](/archive/blogs/rjacobs/tracking-wcf-data-services-with-windows-server-appfabric). - -## See also - -- [Hosting the Data Service](hosting-the-data-service-wcf-data-services.md) -- [Securing WCF Data Services](securing-wcf-data-services.md) -- [Defining WCF Data Services](defining-wcf-data-services.md) diff --git a/docs/framework/data/wcf/entity-framework-provider-wcf-data-services.md b/docs/framework/data/wcf/entity-framework-provider-wcf-data-services.md deleted file mode 100644 index 366374f143f19..0000000000000 --- a/docs/framework/data/wcf/entity-framework-provider-wcf-data-services.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -description: "Learn more about: Entity Framework Provider (WCF Data Services)" -title: "Entity Framework Provider (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, providers" -ms.assetid: 650b5eb6-c71d-4dc1-8b64-b6beaf752114 ---- -# Entity Framework Provider (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -Like WCF Data Services, the ADO.NET Entity Framework is based on the Entity Data Model, which is a type of entity-relationship model. The Entity Framework translates operations against its implementation of the Entity Data Model, which is called the *conceptual model*, into equivalent operations against a data source. This makes the Entity Framework an ideal provider for data services that are based on relational data, and any database that has a data provider that supports the Entity Framework can be used with WCF Data Services. For a list of the data sources that currently support the Entity Framework, see [Entity Framework Providers](/ef/ef6/fundamentals/providers/). - - In a conceptual model, the entity container is the root of the service. You must define a conceptual model in the Entity Framework before the data can be exposed by a data service. For more information, see [How to: Create a Data Service Using an ADO.NET Entity Framework Data Source](create-a-data-service-using-an-adonet-ef-data-wcf.md). - - WCF Data Services supports the optimistic concurrency model by enabling you to define a concurrency token for an entity. This concurrency token, which includes one or more properties of the entity, is used by the data service to determine whether a change has occurred in the data that is being requested, updated, or deleted. When token values obtained from the eTag in the request differ from the current values of the entity, an exception is raised by the data service. To indicate that a property is part of the concurrency token, you must apply the attribute `ConcurrencyMode="Fixed"` in the data model defined by the Entity Framework provider. The concurrency token cannot include a key property or a navigation property. For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md). - - To learn more about the Entity Framework, see [Entity Framework Overview](../adonet/ef/overview.md). - -## See also - -- [Data Services Providers](data-services-providers-wcf-data-services.md) -- [Reflection Provider](reflection-provider-wcf-data-services.md) -- [Entity Data Model](../adonet/entity-data-model.md) diff --git a/docs/framework/data/wcf/exposing-your-data-as-a-service-wcf-data-services.md b/docs/framework/data/wcf/exposing-your-data-as-a-service-wcf-data-services.md deleted file mode 100644 index 2658497a30752..0000000000000 --- a/docs/framework/data/wcf/exposing-your-data-as-a-service-wcf-data-services.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: "Learn more about: Expose Your Data as a Service (WCF Data Services)" -title: "Exposing Your Data as a Service (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, configuring" - - "getting started, WCF Data Services" - - "WCF Data Services, getting started" -ms.assetid: df0bbcee-f66f-4a88-abb4-4e73c8b9c908 ---- -# Expose Your Data as a Service (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services integrates with Visual Studio to enable you to more easily define services to expose your data as Open Data Protocol (OData) feeds. Creating a data service that exposes an OData feed involves the following basic steps: - -1. **Define the data model.** WCF Data Services natively supports data models that are based on the [ADO.NET Entity Framework](../adonet/ef/index.md). For more information, see [How to: Create a Data Service Using an ADO.NET Entity Framework Data Source](create-a-data-service-using-an-adonet-ef-data-wcf.md). - - WCF Data Services also supports data models that are based on common language runtime (CLR) objects that return an instance of the interface. This enables you to deploy data services that are based on lists, arrays, and collections in the .NET Framework. To enable create, update, and delete operations over these data structures, you must also implement the interface. For more information, see [How to: Create a Data Service Using the Reflection Provider](create-a-data-service-using-rp-wcf-data-services.md). - - For more advanced scenarios, WCF Data Services includes a set of providers that enable you to define a data model based on late-bound data types. For more information, see [Custom Data Service Providers](custom-data-service-providers-wcf-data-services.md). - -2. **Create the data service.** The most basic data service exposes a class that inherits from the class, with a type `T` that is the namespace-qualified name of the entity container. For more information, see [Defining WCF Data Services](defining-wcf-data-services.md). - -3. **Configure the data service.** By default, WCF Data Services disables access to resources that are exposed by an entity container. The interface enables you to configure access to resources and service operations, specify the supported version of OData, and to define other service-wide behaviors, such as batching behaviors or the maximum number of entities that can be returned in a single response. For more information, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md). - -For an example of how to create a simple data service that is based on the Northwind sample database, see [Quickstart](quickstart-wcf-data-services.md). - -## See also - -- [Getting Started](getting-started-with-wcf-data-services.md) -- [Overview](wcf-data-services-overview.md) diff --git a/docs/framework/data/wcf/feed-customization-wcf-data-services.md b/docs/framework/data/wcf/feed-customization-wcf-data-services.md deleted file mode 100644 index b80ad290b4295..0000000000000 --- a/docs/framework/data/wcf/feed-customization-wcf-data-services.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -description: "Learn more about: Feed Customization (WCF Data Services)" -title: "Feed Customization (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, feeds" - - "WCF Data Services, Atom protocol" - - "Atom Publishing Protocol [WCF Data Services]" - - "WCF Data Services, customizing feeds" -ms.assetid: 0d1a39bc-6462-4683-bd7d-e74e0fd28a85 ---- -# Feed Customization (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services uses the Open Data Protocol (OData) to expose data as a feed. OData supports both Atom and JavaScript Object Notation (JSON) formats for data feeds. When you use an Atom feed, OData provides a standard method to serialize data, such as entities and relationships, into an XML format that can be included in the body of HTTP message. OData defines a default entity-property mapping between the data that is contained in entities and Atom elements. For more information, see [OData: Atom Format](https://www.odata.org/documentation/odata-version-2-0/atom-format/). - - You may have an application scenario that requires that the property data returned by the data service be serialized in a customized manner rather than in the standard feed format. With OData, you can customize the serialization in a data feed so that properties of an entity may be mapped to unused elements and attributes of an entry or to custom elements of an entry in the feed. - -> [!NOTE] -> Feed customization is only supported for Atom feeds. Custom feeds are not returned when the JSON format is requested for the returned feed. - - With WCF Data Services, you can define an alternate entity-property mapping for an Atom payload by manually applying attributes to entity types in the data model. The data source provider of the data service determines how you should apply these attributes. - -> [!IMPORTANT] -> When you define custom feeds, you must guarantee that all entity properties that have custom mappings defined are included in the projection. When a mapped entity property is not included in the projection, data loss might occur. For more information, see [Query Projections](query-projections-wcf-data-services.md). - -## Customizing Feeds with the Entity Framework Provider - - The data model used with the Entity Framework provider is represented as XML in the .edmx file. In this case, the attributes that define custom feeds are added to the `EntityType` and `Property` elements that represent entity types and properties in the data model. These feed customization attributes are not defined in [\[MC-CSDL\]: Conceptual Schema Definition File Format](/openspecs/windows_protocols/mc-csdl/c03ad8c3-e8b7-4306-af96-a9e52bb3df12), which is the format that the Entity Framework provider uses to define the data model. Therefore, you must declare feed customization attributes in a specific schema namespace, which is defined as `m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"`. The following XML fragment shows feed customization attributes applied to `Property` elements of the `Products` entity type that define the `ProductName`, `ReorderLevel`, and `UnitsInStock` properties. - - [!code-xml[Astoria Custom Feeds#EdmFeedAttributes](../../../../samples/snippets/xml/VS_Snippets_Misc/astoria_custom_feeds/xml/northwind.csdl#edmfeedattributes)] - - These attributes produce the following customized data feed for the `Products` entity set. In the customized data feed, the `ProductName` property value is displayed in both in the `author` element and as the `ProductName` property element, and the `UnitsInStock` property is displayed in a custom element that has its own unique namespace and with the `ReorderLevel` property as an attribute: - - [!code-xml[Astoria Custom Feeds#EdmFeedResultProduct](../../../../samples/snippets/xml/VS_Snippets_Misc/astoria_custom_feeds/xml/edmfeedresult.xml#edmfeedresultproduct)] - - For more information, see [How to: Customize Feeds with the Entity Framework Provider](how-to-customize-feeds-with-ef-provider-wcf-data-services.md). - -> [!NOTE] -> Because extensions to the data model are not supported by the Entity Designer, you must manually modify the XML file that contains the data model. For more information about the .edmx file that is generated by the Entity Data Model tools, see [.edmx File Overview (Entity Framework)](/previous-versions/dotnet/netframework-4.0/cc982042(v=vs.100)). - -### Custom Feed Attributes - - The following table shows the XML attributes that customize feeds that you can add to the conceptual schema definition language (CSDL) that defines the data model. These attributes are equivalent to the properties of the used with the reflection provider. - -|Attribute name|Description| -|--------------------|-----------------| -|`FC_ContentKind`|Indicates the type of the content. The following keywords define syndication content types.

`text:` The property value is displayed in the feed as text.

`html:` The property value is displayed in the feed as HTML.

`xhtml:` The property value is displayed in the feed as XML-formatted HTML.

These keywords are equivalent to the values of the enumeration used with the reflection provider.

This attribute is not supported when the `FC_NsPrefix` and `FC_NsUri` attributes are used.

When you specify a value of `xhtml` for the `FC_ContentKind` attribute, you must ensure that the property value contains properly formatted XML. The data service returns the value without performing any transformations. You must also ensure that any XML element prefixes in the returned XML have a namespace URI and prefix defined in the mapped feed.| -|`FC_KeepInContent`|Indicates that the referenced property value should be included both in the content section of the feed and in the mapped location. Valid values are `true` and `false`. To make the resulting feed backward-compatible with earlier versions of WCF Data Services, specify a value of `true` to make sure that the value is included in the content section of the feed.| -|`FC_NsPrefix`|The namespace prefix of the XML element in a non-syndication mapping. This attribute must be used with the `FC_NsUri` attribute and cannot be used with the `FC_ContentKind` attribute.| -|`FC_NsUri`|The namespace URI of the XML element in a non-syndication mapping. This attribute must be used with the `FC_NsPrefix` attribute and cannot be used with the `FC_ContentKind` attribute.| -|`FC_SourcePath`|The path of the property of the entity to which this feed mapping rule applies. This attribute is only supported when it is used in an `EntityType` element.

The property cannot directly reference a complex type. For complex types, you must use a path expression where property names are separated by a backslash (`/`) character. For example, the following values are allowed for an entity type `Person` with an integer property `Age` and a complex property

`Address`:

`Age`

`Address/Street`

The property cannot be set to a value that contains a space or any other character that is not valid in a property name.| -|`FC_TargetPath`|The name of the target element of the resulting feed to map the property. This element can be an element defined by the Atom specification or a custom element.

The following keywords are predefined syndication target-path values that point to specific location in an OData feed.

`SyndicationAuthorEmail:` The `atom:email` child element of the `atom:author` element.

`SyndicationAuthorName:` The `atom:name` child element of the `atom:author` element.

`SyndicationAuthorUri:` The `atom:uri` child element of the `atom:author` element.

`SyndicationContributorEmail:` The `atom:email` child element of the `atom:contributor` element.

`SyndicationContributorName:` The `atom:name` child element of the `atom:contributor` element.

`SyndicationContributorUri:` The `atom:uri` child element of the `atom:contributor` element.

`SyndicationCustomProperty:` A custom property element. When mapping to a custom element, the target must be a path expression in which nested elements are separated by a backslash (`/`) and attributes are specified by an ampersand (`@`). In the following example, the string `UnitsInStock/@ReorderLevel` maps a property value to an attribute named `ReorderLevel` on a child element named `UnitsInStock` of the root entry element.

``

When the target is a custom element name, the `FC_NsPrefix` and `FC_NsUri` attributes must also be specified.

`SyndicationPublished:` The `atom:published` element.

`SyndicationRights:` The `atom:rights` element.

`SyndicationSummary:` The `atom:summary` element.

`SyndicationTitle:` The `atom:title` element.

`SyndicationUpdated:` The `atom:updated` element.

These keywords are equivalent to the values of the enumeration used with the reflection provider.| - -> [!NOTE] -> Attribute names and values are case-sensitive. Attributes can be applied either to the `EntityType` element or to one or more `Property` elements, but not to both. - -## Customizing Feeds with the Reflection Provider - - To customize feeds for a data model that was implemented by using the reflection provider, add one or more instances of the attribute to the classes that represent entity types in the data model. The properties of the class correspond to the feed customization attributes that are described in the previous section. The following is an example of the declaration of the `Order` type, with custom feed mapping defined for both properties. - -> [!NOTE] -> The data model for this example is defined in the topic [How to: Create a Data Service Using the Reflection Provider](create-a-data-service-using-rp-wcf-data-services.md). - - [!code-csharp[Astoria Custom Feeds#CustomOrderFeed](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/orderitems.svc.cs#customorderfeed)] - [!code-vb[Astoria Custom Feeds#CustomOrderFeed](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_custom_feeds/vb/orderitems.svc.vb#customorderfeed)] - - These attributes produce the following customized data feed for the `Orders` entity set. In this customized feed, the `OrderId` property value displays only in the `title` element of the `entry` and the `Customer` property value displays both in the `author` element and as the `Customer` property element: - - [!code-xml[Astoria Custom Feeds#IQueryableFeedResult](../../../../samples/snippets/xml/VS_Snippets_Misc/astoria_custom_feeds/xml/iqueryablefeedresult.xml#iqueryablefeedresult)] - - For more information, see [How to: Customize Feeds with the Reflection Provider](how-to-customize-feeds-with-the-reflection-provider-wcf-data-services.md). - -## Customizing Feeds with a Custom Data Service Provider - - Feed customization for a data model defined by using a custom data service provider is defined for a resource type by calling the on the that represents an entity type in the data model. For more information, see [Custom Data Service Providers](custom-data-service-providers-wcf-data-services.md). - -## Consuming Custom Feeds - - When your application directly consumes an OData feed, it must be able to process any customized elements and attributes in the returned feed. When you have implemented custom feeds in your data model, regardless of the data service provider, the `$metadata` endpoint returns custom feed information as custom feed attributes in the CSDL returned by the data service. When you use the **Add Service Reference** dialog or the [datasvcutil.exe](wcf-data-service-client-utility-datasvcutil-exe.md) tool to generate client data service classes, the customized feed attributes are used to guarantee that requests and responses to the data service are handled correctly. - -## Feed Customization Considerations - - You should consider the following when defining custom feed mappings. - -- The WCF Data Services client treats mapped elements in a feed as empty when they contain only white space. Because of this, mapped elements that contain only white space are not materialized on the client with the same white space. To preserve this white space on the client, you must set the value of `KeepInContext` to `true` in the feed mapping attribute. - -## Versioning Requirements - - Feed customization has the following OData protocol versioning requirements: - -- Feed customization requires that both the client and data service support version 2.0 of the OData protocol and later versions. - - For more information, see [Data Service Versioning](data-service-versioning-wcf-data-services.md). - -## See also - -- [Reflection Provider](reflection-provider-wcf-data-services.md) -- [Entity Framework Provider](entity-framework-provider-wcf-data-services.md) diff --git a/docs/framework/data/wcf/generating-the-data-service-client-library-wcf-data-services.md b/docs/framework/data/wcf/generating-the-data-service-client-library-wcf-data-services.md deleted file mode 100644 index 79d7e28b0c695..0000000000000 --- a/docs/framework/data/wcf/generating-the-data-service-client-library-wcf-data-services.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -description: "Learn more about: Generating the Data Service Client Library (WCF Data Services)" -title: "Generating the Data Service Client Library (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "client applications, WCF Data Services" - - "WCF Data Services, client library" - - "Add Service Reference dialog box" -ms.assetid: 314077c1-ac10-47e1-bed4-940b5462359d ---- -# Generating the Data Service Client Library (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -A data service that implements the Open Data Protocol (OData) can return a service metadata document that describes the data model exposed by the OData feed. For more information, see the Service Metadata Document section in the [OData: Overview](https://www.odata.org/documentation/odata-version-2-0/overview/) article. You can use the **Add Service Reference** dialog in Visual Studio to add a reference to an OData-based service. When you use this tool to add a reference to the metadata returned by an OData feed in a client project, it performs the following actions: - -- Requests the service metadata document from the data service and interprets the returned metadata. - - > [!NOTE] - > The returned metadata is stored in the client project as an .edmx file. This .edmx file cannot be opened by using the Entity Data Model designer because it does not have the same format an .edmx file used by the Entity Framework. You can view this metadata file by using the XML editor or any text editor. For more information, see [\[MC-EDMX\]: Entity Data Model for Data Services Packaging Format](/openspecs/windows_protocols/mc-edmx/5dff5e25-56a1-408b-9d44-bff6634c7d16). - -- Generates a representation of the service as an entity container class that inherits from . This generated entity container class resembles the entity container that the Entity Data Model tools generate. For more information, see [Object Services Overview (Entity Framework)](/previous-versions/bb386871(v=vs.100)). - -- Generates data classes for the data model types that it discovers in the service metadata. - -- Adds a reference to the `System.Data.Services.Client` assembly to the project. - - For more information, see [How to: Add a Data Service Reference](how-to-add-a-data-service-reference-wcf-data-services.md). - - The client data service classes can also be generated by using the [DataSvcUtil.exe](wcf-data-service-client-utility-datasvcutil-exe.md) tool at the command prompt. For more information, see [How to: Manually Generate Client Data Service Classes](how-to-manually-generate-client-data-service-classes-wcf-data-services.md). - -## Client Data Type Mapping - - When you use the **Add Service Reference** dialog in Visual Studio or the `DataSvcUtil.exe` tool to generate client data classes that are based on an OData feed, the .NET Framework data types are mapped to the primitive types from the data model as follows: - -|Data model type|.NET Framework data type| -|---------------------|------------------------------| -|`Edm.Binary`| `[]`| -|`Edm.Boolean`|| -|`Edm.Byte`|| -|`Edm.DateTime`|| -|`Edm.Decimal`|| -|`Edm.Double`|| -|`Edm.Guid`|| -|`Edm.Int16`|| -|`Edm.Int32`|| -|`Edm.Int64`|| -|`Edm.SByte`|| -|`Edm.Single`|| -|`Edm.String`|| - - For more information, see the Primitive Data Types section in the [OData: Overview](https://www.odata.org/documentation/odata-version-2-0/overview/) article. - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [Quickstart](quickstart-wcf-data-services.md) diff --git a/docs/framework/data/wcf/getting-started-with-wcf-data-services.md b/docs/framework/data/wcf/getting-started-with-wcf-data-services.md deleted file mode 100644 index 71dd6a658c9f7..0000000000000 --- a/docs/framework/data/wcf/getting-started-with-wcf-data-services.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -description: "Learn more about: Getting Started with WCF Data Services" -title: "Getting Started with WCF Data Services" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, getting started" -ms.assetid: c832fa5b-cf86-4690-be5a-a226c0e49530 ---- -# Getting Started with WCF Data Services - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -The topics in this section help you quickly understand Open Data Protocol (OData) and how to use WCF Data Services to expose and consume OData feeds by explaining the underlying technologies. This section includes both conceptual content and a [quickstart](quickstart-wcf-data-services.md) tutorial. - -## In This Section - - The following topics describe how to create data services by using WCF Data Services. - - [Exposing Your Data as a Service](exposing-your-data-as-a-service-wcf-data-services.md) - Describes the steps that are required to create a data service by using WCF Data Services. - - [Accessing Data Service Resources](accessing-data-service-resources-wcf-data-services.md) - Describes how to work with OData feeds. - - [Using a Data Service in a Client Application](using-a-data-service-in-a-client-application-wcf-data-services.md) - Describes how to work with an OData feed in a .NET Framework client application. - - [Quickstart](quickstart-wcf-data-services.md) - Shows how to create and access a simple OData-based service that exposes a feed based on the Northwind sample database. - - [Application Scenarios](application-scenarios-wcf-data-services.md) - Highlights a core set of OData scenarios that are supported by WCF Data Services. - - [Resources](wcf-data-services-resources.md) - Provides links to WCF Data Services and OData resources. - -## Related Sections - - [WCF Data Services (Silverlight)](/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc838234(v=vs.95)) - - [Getting Started](../adonet/ef/getting-started.md) diff --git a/docs/framework/data/wcf/hosting-the-data-service-wcf-data-services.md b/docs/framework/data/wcf/hosting-the-data-service-wcf-data-services.md deleted file mode 100644 index b955437f0a571..0000000000000 --- a/docs/framework/data/wcf/hosting-the-data-service-wcf-data-services.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -description: "Learn more about: Hosting the Data Service (WCF Data Services)" -title: "Hosting the Data Service (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, configuring" - - "WCF Data Services, Windows Communication Foundation" -ms.assetid: b48f42ce-22ce-4f8d-8f0d-f7ddac9125ee ---- -# Hosting the Data Service (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -By using WCF Data Services, you can create a service that exposes data as an Open Data Protocol (OData) feed. This data service is defined as a class that inherits from . This class provides the functionality required to process request messages, perform updates against the data source, and generate responses messages, as required by OData. However, a data service cannot bind to and listen on a network socket for incoming HTTP requests. For this required functionality, the data service relies on a hosting component. - - The data service host performs the following tasks on behalf of the data service: - -- Listens for requests and routes these requests to the data service. - -- Creates an instance of the data service for each request. - -- Requests that the data service process the incoming request. - -- Sends the response on behalf of the data service. - - To simplify hosting a data service, WCF Data Services is designed to integrate with Windows Communication Foundation (WCF). The data service provides a default WCF implementation that serves as the data service host in an ASP.NET application. Therefore, you can host a data service in one of the following ways: - -- In an ASP.NET application. - -- In a managed application that supports self-hosted WCF services. - -- In some other custom data service host. - -## Hosting a Data Service in an ASP.NET Application - -When you use the **Add New Item** dialog in Visual Studio 2015 to define a data service in an ASP.NET application, the tool generates two new files in the project. The first file has a `.svc` extension and instructs the WCF runtime how to instantiate the data service. The following is an example of this file for the Northwind sample data service created when you complete the [quickstart](quickstart-wcf-data-services.md): - -```aspx-csharp -<%@ ServiceHost Language="C#" - Factory="System.Data.Services.DataServiceHostFactory, - System.Data.Services, Version=4.0.0.0, - Culture=neutral, PublicKeyToken=b77a5c561934e089" - Service="NorthwindService.Northwind" %> -``` - - This directive tells the application to create the service host for the named data service class by using the class. - - The code-behind page for the `.svc` file contains the class that is the implementation of the data service itself, which is defined as follows for the Northwind sample data service: - - [!code-csharp[Astoria Quickstart Service#ServiceDefinition](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs#servicedefinition)] - [!code-vb[Astoria Quickstart Service#ServiceDefinition](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_service/vb/northwind.svc.vb#servicedefinition)] - - Because a data service behaves like a WCF service, the data service integrates with ASP.NET and follows the WCF Web programming model. For more information, see [WCF Services and ASP.NET](../../wcf/feature-details/wcf-services-and-aspnet.md) and [WCF Web HTTP Programming Model](../../wcf/feature-details/wcf-web-http-programming-model.md). - -## Self-Hosted WCF Services - - Because it incorporates a WCF implementation, WCF Data Services support self-hosting a data service as a WCF service. A service can be self-hosted in any .NET Framework application, such as a console application. The class, which inherits from , is used to instantiate the data service at a specific address. - - Self-hosting can be used for development and testing because it can make it easier to deploy and troubleshoot the service. However, this kind of hosting does not provide the advanced hosting and management features provided by ASP.NET or by Internet Information Services (IIS). For more information, see [Hosting in a Managed Application](../../wcf/feature-details/hosting-in-a-managed-application.md). - -## Defining a Custom Data Service Host - - For cases where the WCF host implementation is too restrictive, you can also define a custom host for a data service. Any class that implements interface can be used as the network host for a data service. A custom host must implement the interface and be able to handle the following basic responsibilities of the data service host: - -- Provide the data service with the service root path. - -- Process request and response headers information to the appropriate member implementation. - -- Handle exceptions raised by the data service. - -- Validate parameters in the query string. - -## See also - -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [Exposing Your Data as a Service](exposing-your-data-as-a-service-wcf-data-services.md) -- [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-add-a-data-service-reference-wcf-data-services.md b/docs/framework/data/wcf/how-to-add-a-data-service-reference-wcf-data-services.md deleted file mode 100644 index 4067db084961f..0000000000000 --- a/docs/framework/data/wcf/how-to-add-a-data-service-reference-wcf-data-services.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: "Learn more about: How to: Add a data service reference (WCF Data Services)" -title: "How to: Add a Data Service Reference (WCF Data Services)" -ms.date: 08/24/2018 -helpviewer_keywords: - - "WCF Data Services, configuring" -ms.assetid: 62c6f318-3ee1-433a-b7a3-efa234c3034c ---- -# How to: Add a data service reference (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -You can use the **Add Service Reference** dialog in Visual Studio to add a reference to WCF Data Services. This enables you to more easily access a data service in a client application that you develop in Visual Studio. When you complete this procedure, data classes are generated based on metadata that is obtained from the data service. For more information, see [Generating the Data Service Client Library](generating-the-data-service-client-library-wcf-data-services.md). - -## Add a data service reference - -1. (Optional) If the data service is not part of the solution and is not already running, start the data service and note the URI of the data service. - -2. In Visual Studio, in **Solution Explorer**, right-click the client project and then select **Add** > **Service Reference**. - -3. If the data service is part of the current solution, click **Discover**. - - -or- - - In the **Address** text box, type the base URL of the data service, such as `http://localhost:1234/Northwind.svc`, and then click **Go**. - -4. Select **OK**. - - A new code file that contains the data classes that can access and interact with data service resources is added to the project. - -## See also - -- [Quickstart](quickstart-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-add-modify-and-delete-entities-wcf-data-services.md b/docs/framework/data/wcf/how-to-add-modify-and-delete-entities-wcf-data-services.md deleted file mode 100644 index 4b00cd3670eb9..0000000000000 --- a/docs/framework/data/wcf/how-to-add-modify-and-delete-entities-wcf-data-services.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -description: "Learn more about: How to: Add, Modify, and Delete Entities (WCF Data Services)" -title: "How to: Add, Modify, and Delete Entities (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, changing data" -ms.assetid: a00f8933-b232-4445-95ba-adc634f055d8 ---- -# How to: Add, Modify, and Delete Entities (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -With the WCF Data Services client libraries, you can create, update, and delete entity data in a data service by performing equivalent actions on objects in the . For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example creates a new object instance and then calls the method on the to create the item in the context. An HTTP POST message is sent to the data service when the method is called. - - [!code-csharp[Astoria Northwind Client#AddProduct](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addproduct)] - [!code-vb[Astoria Northwind Client#AddProduct](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addproduct)] - -## Example - - The following example retrieves and modifies an existing object and then calls the method on the to mark the item in the context as updated. An HTTP MERGE message is sent to the data service when the method is called. - - [!code-csharp[Astoria Northwind Client#ModifyCustomer](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#modifycustomer)] - [!code-vb[Astoria Northwind Client#ModifyCustomer](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#modifycustomer)] - -## Example - - The following example calls the method on the to mark the item in the context as deleted. An HTTP DELETE message is sent to the data service when the method is called. - - [!code-csharp[Astoria Northwind Client#DeleteProduct](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#deleteproduct)] - [!code-vb[Astoria Northwind Client#DeleteProduct](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#deleteproduct)] - -## Example - - The following example creates a new object instance and then calls the method on the to create the item in the context along with the link to the related order. An HTTP POST message is sent to the data service when the method is called. - - [!code-csharp[Astoria Northwind Client#AddOrderDetailToOrderAuto](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addorderdetailtoorderauto)] - [!code-vb[Astoria Northwind Client#AddOrderDetailToOrderAuto](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addorderdetailtoorderauto)] - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [How to: Attach an Existing Entity to the DataServiceContext](attach-an-existing-entity-to-dc-wcf-data.md) -- [How to: Define Entity Relationships](how-to-define-entity-relationships-wcf-data-services.md) -- [Batching Operations](batching-operations-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-add-query-options-to-a-data-service-query-wcf-data-services.md b/docs/framework/data/wcf/how-to-add-query-options-to-a-data-service-query-wcf-data-services.md deleted file mode 100644 index c622f1bd06bfd..0000000000000 --- a/docs/framework/data/wcf/how-to-add-query-options-to-a-data-service-query-wcf-data-services.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -description: "Learn more about: How to: Add Query Options to a Data Service Query (WCF Data Services)" -title: "How to: Add Query Options to a Data Service Query (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "querying the data service [WCF Data Services]" - - "WCF Data Services, querying" - - "WCF Data Services, accessing data" -ms.assetid: e4258526-557e-4e96-91e1-2175400c7c8f ---- -# How to: Add Query Options to a Data Service Query (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables you to query a data service from a .NET Framework-based client application by using the generated client data service classes. The easiest to do this is to compose a Language Integrated Query (LINQ) query expression that includes the desired query options. You can also call a series of LINQ query methods to compose an equivalent query. Finally, you can use the method to add query options to a query. In each of these cases, the URI that is generated by the client includes the requested entity set with the selected query options applied. For more information, see [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example shows how to compose a LINQ query expression that returns only orders with a freight cost of more than $30 and that orders the results by the ship date in descending order. - - [!code-csharp[Astoria Northwind Client#AddQueryOptionsLinq](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addqueryoptionslinq)] - [!code-vb[Astoria Northwind Client#AddQueryOptionsLinq](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addqueryoptionslinq)] - -## Example - - The following example shows how to compose a LINQ query by using LINQ query methods that is equivalent to the previous query. - - [!code-csharp[Astoria Northwind Client#AddQueryOptionsLinqExpression](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addqueryoptionslinqexpression)] - [!code-vb[Astoria Northwind Client#AddQueryOptionsLinqExpression](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addqueryoptionslinqexpression)] - -## Example - - The following example shows how to use to the method to create a that is equivalent to the previous examples. - - [!code-csharp[Astoria Northwind Client#AddQueryOptions](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addqueryoptions)] - [!code-vb[Astoria Northwind Client#AddQueryOptions](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addqueryoptions)] - -## Example - - The following example shows how to use the `$orderby` query option to both filter and order returned Orders objects by the Freight property. - - [!code-csharp[Astoria Northwind Client#OrderWithFilter](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#orderwithfilter)] - [!code-vb[Astoria Northwind Client#OrderWithFilter](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#orderwithfilter)] - -## See also - -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) -- [How to: Project Query Results](how-to-project-query-results-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-bind-data-using-a-project-data-source-wcf-data-services.md b/docs/framework/data/wcf/how-to-bind-data-using-a-project-data-source-wcf-data-services.md deleted file mode 100644 index 831e790e8bdf6..0000000000000 --- a/docs/framework/data/wcf/how-to-bind-data-using-a-project-data-source-wcf-data-services.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -description: "Learn more about: How to: Bind Data Using a Project Data Source (WCF Data Services)" -title: "How to: Bind Data Using a Project Data Source (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "data binding, WCF Data Services" - - "WCF Data Services, data binding" -ms.assetid: 2477af0a-676f-44f7-b73d-e66208785509 ---- -# How to: Bind Data Using a Project Data Source (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -You can create data sources that are based on the generated data objects in an WCF Data Services client application. When you add a reference to a data service by using the **Add Service Reference** dialog, a project data source is created along with the generated client data classes. One data source is created for each entity set that the data service exposes. You can create forms that display data from the service by dragging these data source items from the **Data Sources** window onto the designer. These items become controls that are bound to the data source. During execution, this data source is bound to an instance of the class, which is filled with objects that are returned by a query to the data service. For more information, see [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md). - - The examples in this topic use the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Use a project data source in a WPF window - -1. In Visual Studio, in a WPF project, add a reference to the Northwind data service. For more information, see [How to: Add a Data Service Reference](how-to-add-a-data-service-reference-wcf-data-services.md). - -2. In the **Data Sources** window, expand the `Customers` node in the **NorthwindEntities** project data source. - -3. Click the **CustomerID** item, select **ComboBox** from the list, and drag the **CustomerID** item from the **Customers** node to the designer. - - This creates the following object elements in the XAML file for the window: - - - A element named `customersViewSource`. The property of the top-level object element is set to this new . - - - A data-bound named `CustomerID`. - - - A . - -4. Drag the **Orders** navigation property to the designer. - - This creates the following additional object elements in the XAML file for the window: - - - A second element named `customersOrdersViewSource`, the source of which is the `customerViewSource`. - - - A data-bound control named `ordersDataGrid`. - -5. (Optional) Drag additional items from the **Customers** node to the designer. - -6. Open the code page for the form and add the following `using` statements (`Imports` in Visual Basic): - - [!code-csharp[Astoria Northwind Client#CustomersOrdersUsingWpf](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf2.xaml.cs#customersordersusingwpf)] - -7. In the partial class that defines the form, add the following code that creates an instance and defines the `customerID` constant. - - [!code-csharp[Astoria Northwind Client#CustomersOrdersDefinitionWpf](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf2.xaml.cs#customersordersdefinitionwpf)] - [!code-vb[Astoria Northwind Client#CustomersOrdersDefinitionWpf](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf2.xaml.vb#customersordersdefinitionwpf)] - -8. In the designer, select the window. - - > [!NOTE] - > Make sure that you select the window itself, rather than selecting content that is within the window. If the window is selected, the **Name** text box near the top of the **Properties** window should contain the name of the window. - -9. In the **Properties** window, select the **Events** button. - -10. Find the **Loaded** event, and then double-click the drop-down list next to this event. - - Visual Studio opens the code-behind file for the window and generates a event handler. - -11. In the newly created event handler, copy and paste the following code. - - [!code-csharp[Astoria Northwind Client#CustomersOrdersDataBindingWpf](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderswpf2.xaml.cs#customersordersdatabindingwpf)] - [!code-vb[Astoria Northwind Client#CustomersOrdersDataBindingWpf](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderswpf2.xaml.vb#customersordersdatabindingwpf)] - -12. This code creates an instance of for the `Customers` type based on the execution of a LINQ query that returns an of `Customers` along with related `Orders` objects from the Northwind data service and binds it to the `customersViewSource`. - -## Use a project data source in a Windows form - -1. In the **Data Sources** window, expand the **Customers** node in the **NorthwindEntities** project data source. - -2. Click the **CustomerID** item, select **ComboBox** from the list, and drag the **CustomerID** item from the **Customers** node to the designer. - - This creates the following controls on the form: - - - An instance of named `customersBindingSource`. - - - An instance of named `customersBindingNavigator`. You can delete this control as it will not be needed. - - - A data-bound named `CustomerID`. - - - A . - -3. Drag the **Orders** navigation property to the form. - -4. This creates the `ordersBindingSource` control with the property of the control set to the `customersBindingSource` and the property set to `Customers`. It also creates the `ordersDataGridView` data-bound control on the form, accompanied by an appropriately titled label control. - -5. (Optional) Drag additional items from the **Customers** node to the designer. - -6. Open the code page for the form and add the following `using` statements (`Imports` in Visual Basic): - - [!code-csharp[Astoria Northwind Client#CustomersOrdersUsing](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders.cs#customersordersusing)] - [!code-vb[Astoria Northwind Client#CustomersOrdersUsing](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorders.vb#customersordersusing)] - -7. In the partial class that defines the form, add the following code that creates an instance and defines the `customerID` constant. - - [!code-csharp[Astoria Northwind Client#CustomersOrdersDefinition](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders.cs#customersordersdefinition)] - [!code-vb[Astoria Northwind Client#CustomersOrdersDefinition](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorders.vb#customersordersdefinition)] - -8. In the form designer, double-click the form. - - This opens the code page for the form and creates the method that handles the `Load` event for the form. - -9. In the `Load` event handler, copy and paste the following code. - - [!code-csharp[Astoria Northwind Client#CustomersOrdersDataBinding](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorders.cs#customersordersdatabinding)] - [!code-vb[Astoria Northwind Client#CustomersOrdersDataBinding](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorders.vb#customersordersdatabinding)] - -10. This code creates an instance of for the `Customers` type based on the execution of a that returns an of `Customers` from the Northwind data service and binds it to the `customersBindingSource`. - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [How to: Bind Data to Windows Presentation Foundation Elements](bind-data-to-wpf-elements-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-customize-data-binding-behaviors-wcf-data-services.md b/docs/framework/data/wcf/how-to-customize-data-binding-behaviors-wcf-data-services.md deleted file mode 100644 index 2ba1a3612848f..0000000000000 --- a/docs/framework/data/wcf/how-to-customize-data-binding-behaviors-wcf-data-services.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: "Learn more about: How to: Customize Data Binding Behaviors (WCF Data Services)" -title: "How to: Customize Data Binding Behaviors (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, customizing" - - "WCF Data Services, data binding" -ms.assetid: 40476b89-8941-4771-8d21-2fe430c85a9d ---- -# How to: Customize Data Binding Behaviors (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -With WCF Data Services, you can supply custom logic that is called by the when an object is added or removed from the binding collection or when a property change is detected. This custom logic is provided as methods, referenced as delegates, that return a value of `false` when the default behavior should still be performed when the custom method completes and `true` when subsequent processing of the event should be stopped. - - The examples in this topic supply custom methods for both the `entityChanged` and `entityCollectionChanged` parameters of . The examples in this topic use the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following code-behind page for the XAML file creates a with custom methods that are called when changes occur to data that is bound to the binding collection. When the event occurs, the supplied method prevents an item that has been removed from the binding collection from being deleted from the data service. When the event occurs, the `ShipDate` value is validated to ensure that changes are not made to orders that have already shipped. - - [!code-csharp[Astoria Northwind Client#WpfDataBindingCustom](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customerorderscustom.xaml.cs#wpfdatabindingcustom)] - [!code-vb[Astoria Northwind Client#WpfDataBindingCustom](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderscustom.xaml.vb#wpfdatabindingcustom)] - [!code-vb[Astoria Northwind Client#WpfDataBindingCustom](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderscustom2.xaml.vb#wpfdatabindingcustom)] - -## Example - - The following XAML defines the window for the previous example. - - [!code-xaml[Astoria Northwind Client#WpfDataBindingCustomXaml](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customerorderscustom.xaml#wpfdatabindingcustomxaml)] - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/how-to-customize-feeds-with-ef-provider-wcf-data-services.md b/docs/framework/data/wcf/how-to-customize-feeds-with-ef-provider-wcf-data-services.md deleted file mode 100644 index e2d95ed461bba..0000000000000 --- a/docs/framework/data/wcf/how-to-customize-feeds-with-ef-provider-wcf-data-services.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -description: "Learn more about: How to: Customize Feeds with the Entity Framework Provider (WCF Data Services)" -title: "How to: Customize Feeds with the Entity Framework Provider (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, customizing" - - "WCF Data Services, customizing feeds" -ms.assetid: fd16272e-36f2-415e-850e-8a81f2b17525 ---- -# How to: Customize Feeds with the Entity Framework Provider (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables you to customize the Atom serialization in a data service response so that properties of an entity may be mapped to unused elements that are defined in the AtomPub protocol. This topic shows how to define mapping attributes for the entity types in a data model that is defined in an .edmx file by using the Entity Framework provider. For more information, see [Feed Customization](feed-customization-wcf-data-services.md). - - In this topic you will manually modify the tool-generated .edmx file that contains the data model. You must manually modify the file because extensions to the data model are not supported by the Entity Designer. For more information about the .edmx file that the Entity Data Model tools generate, see [.edmx File Overview (Entity Framework)](/previous-versions/dotnet/netframework-4.0/cc982042(v=vs.100)). The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -### To manually modify the Northwind.edmx file to add feed customization attributes - -1. In **Solution Explorer**, right-click the `Northwind.edmx` file, and then click **Open with**. - -2. In the **Open With - Northwind.edmx** dialog box, select **XML Editor**, and then click **OK**. - -3. Locate the `ConceptualModels` element and replace the existing `Customers` entity type with the following element that contains feed customization mapping attributes: - - [!code-xml[Astoria Custom Feeds#EdmFeedCustomers](../../../../samples/snippets/xml/VS_Snippets_Misc/astoria_custom_feeds/xml/northwind.csdl#edmfeedcustomers)] - -4. Save changes and close the Northwind.edmx file. - -5. (Optional) Right-click the Northwind.edmx file and then click **Run Custom Tool**. - - This regenerates the object layer file, which may be required. - -6. Recompile the project. - -## Example - - The previous example returns the following result for the URI `http://myservice/Northwind.svc/Customers('ALFKI')`. - - [!code-xml[Astoria Custom Feeds#EdmFeedResult](../../../../samples/snippets/xml/VS_Snippets_Misc/astoria_custom_feeds/xml/edmfeedresult.xml#edmfeedresult)] - -## See also - -- [Entity Framework Provider](entity-framework-provider-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-customize-feeds-with-the-reflection-provider-wcf-data-services.md b/docs/framework/data/wcf/how-to-customize-feeds-with-the-reflection-provider-wcf-data-services.md deleted file mode 100644 index 0462abe041842..0000000000000 --- a/docs/framework/data/wcf/how-to-customize-feeds-with-the-reflection-provider-wcf-data-services.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -description: "Learn more about: How to: Customize Feeds with the Reflection Provider (WCF Data Services)" -title: "How to: Customize Feeds with the Reflection Provider (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, customizing" - - "WCF Data Services, customizing feeds" -ms.assetid: 00c23dcf-9bb8-459a-a012-6c4d9bcad7e9 ---- -# How to: Customize Feeds with the Reflection Provider (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables you to customize the Atom serialization in a data service response so that properties of an entity may be mapped to unused elements that are defined in the AtomPub protocol. This topic shows how to define mapping attributes for the entity types in a data model that is defined by using the reflection provider. For more information, see [Feed Customization](feed-customization-wcf-data-services.md). - - The data model for this example is defined in the topic [How to: Create a Data Service Using the Reflection Provider](create-a-data-service-using-rp-wcf-data-services.md) - -## Example - - In the following example, both properties of the `Order` type are mapped to existing Atom elements. The `Product` property of the `Item` type is mapped to a custom feed attribute in a separate namespace. - - [!code-csharp[Astoria Custom Feeds#CustomIQueryableFeeds](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_custom_feeds/cs/orderitems.svc.cs#customiqueryablefeeds)] - [!code-vb[Astoria Custom Feeds#CustomIQueryableFeeds](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_custom_feeds/vb/orderitems.svc.vb#customiqueryablefeeds)] - -## Example - - The previous example returns the following result for the URI `http://myservice/OrderItems.svc/Orders(0)?$expand=Items`. - - [!code-xml[Astoria Custom Feeds#IQueryableFeedResultInline](../../../../samples/snippets/xml/VS_Snippets_Misc/astoria_custom_feeds/xml/iqueryablefeedresultinline.xml#iqueryablefeedresultinline)] - -## See also - -- [Reflection Provider](reflection-provider-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-define-a-service-operation-wcf-data-services.md b/docs/framework/data/wcf/how-to-define-a-service-operation-wcf-data-services.md deleted file mode 100644 index 0ca6b870e9876..0000000000000 --- a/docs/framework/data/wcf/how-to-define-a-service-operation-wcf-data-services.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -description: "Learn more about: How to: Define a Service Operation (WCF Data Services)" -title: "How to: Define a Service Operation (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "Service Operations [WCF Data Services]" - - "WCF Data Services, service operations" -ms.assetid: dfcd3cb1-2f07-4d0b-b16a-6b056c4f45fa ---- -# How to: Define a Service Operation (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services expose methods that are defined on the server as service operations. Service operations allow a data service to provide access through a URI to a method that is defined on the server. To define a service operation, apply the [`WebGet]` or `[WebInvoke]` attribute to the method. To support query operators, the service operation must return an instance. Service operations may access the underlying data source through the property on the . For more information, see [Service Operations](service-operations-wcf-data-services.md). - -The example in this topic defines a service operation named `GetOrdersByCity` that returns a filtered instance of `Orders` and related `Order_Details` objects. The example accesses the instance that is the data source for the Northwind sample data service. This service is created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -### To define a service operation in the Northwind data service - -1. In the Northwind data service project, open the Northwind.svc file. - -2. In the `Northwind` class, define a service operation method named `GetOrdersByCity` as follows: - - [!code-csharp[Astoria Northwind Service#ServiceOperationDef](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#serviceoperationdef)] - [!code-vb[Astoria Northwind Service#ServiceOperationDef](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#serviceoperationdef)] - -3. In the `InitializeService` method of the `Northwind` class, add the following code to enable access to the service operation: - - [!code-csharp[Astoria Northwind Service#ServiceOperationConfig](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#serviceoperationconfig)] - [!code-vb[Astoria Northwind Service#ServiceOperationConfig](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#serviceoperationconfig)] - -### To query the GetOrdersByCity service operation - -- In a Web browser, enter one of the following URIs to invoke the service operation that is defined in the following example: - - - `http://localhost:12345/Northwind.svc/GetOrdersByCity?city='London'` - - - `http://localhost:12345/Northwind.svc/GetOrdersByCity?city='London'&$top=2` - - - `http://localhost:12345/Northwind.svc/GetOrdersByCity?city='London'&$expand=Order_Details&$orderby=RequiredDate desc` - -## Example - -The following example implements a service operation named `GetOrderByCity` on the Northwind data service. This operation uses the ADO.NET Entity Framework to return a set of `Orders` and related `Order_Details` objects as an instance based on the provided city name. - -> [!NOTE] -> Query operators are supported on this service operation endpoint because the method returns an instance. - -[!code-csharp[Astoria Northwind Service#ServiceOperation](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#serviceoperation)] -[!code-vb[Astoria Northwind Service#ServiceOperation](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#serviceoperation)] - -## See also - -- [Defining WCF Data Services](defining-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-define-entity-relationships-wcf-data-services.md b/docs/framework/data/wcf/how-to-define-entity-relationships-wcf-data-services.md deleted file mode 100644 index fae982a16a6ec..0000000000000 --- a/docs/framework/data/wcf/how-to-define-entity-relationships-wcf-data-services.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: "Learn more about: How to: Define Entity Relationships (WCF Data Services)" -title: "How to: Define Entity Relationships (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, changing data" -ms.assetid: cc255524-1534-4fae-b83c-250933d5a72b ---- -# How to: Define Entity Relationships (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -When you add a new entity in WCF Data Services, any relationships between the new entity and related entities are not automatically defined. You can create and change relationships between entity instances and have the client library reflect those changes in the data service. For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example creates a new object instance and then calls the method on the to create the item in the context along with the link to the related order. An HTTP POST message is sent to the data service when the method is called. - - [!code-csharp[Astoria Northwind Client#AddOrderDetailToOrderAuto](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addorderdetailtoorderauto)] - [!code-vb[Astoria Northwind Client#AddOrderDetailToOrderAuto](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addorderdetailtoorderauto)] - -## Example - - The following example shows how to use the method to add an `Order_Details` object to a related `Orders` object with a reference to a specific `Products` object. The and methods define the relationships. In this example, the navigation properties on the `Order_Details` object are also explicitly set. - - [!code-csharp[Astoria Northwind Client#AddOrderDetailToOrder](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addorderdetailtoorder)] - [!code-vb[Astoria Northwind Client#AddOrderDetailToOrder](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addorderdetailtoorder)] - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [How to: Add, Modify, and Delete Entities](how-to-add-modify-and-delete-entities-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-develop-a-wcf-data-service-running-on-iis.md b/docs/framework/data/wcf/how-to-develop-a-wcf-data-service-running-on-iis.md deleted file mode 100644 index 465d70c131a02..0000000000000 --- a/docs/framework/data/wcf/how-to-develop-a-wcf-data-service-running-on-iis.md +++ /dev/null @@ -1,164 +0,0 @@ ---- -description: "Learn more about: How to: Develop a WCF data service running on IIS" -title: "How to: Develop a WCF Data Service Running on IIS" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, developing" - - "WCF Data Services, deploying" - - "WCF Data Services, hosting" -ms.assetid: f6f768c5-4989-49e3-a36f-896ab4ded86e ---- -# How to: Develop a WCF data service running on IIS - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -This article shows how to use WCF Data Services to create a data service that's based on the Northwind sample database that's hosted by an ASP.NET Web app running on Internet Information Services (IIS). For an example of how to create the same Northwind data service as an ASP.NET Web app that runs on the ASP.NET Development Server, see the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -> [!NOTE] -> To create the Northwind data service, first install the Northwind sample database on the local computer. To install the database, run the Transact-SQL script from [Northwind and pubs sample databases for Microsoft SQL Server](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/northwind-pubs). - -This article shows how to create a data service by using the Entity Framework provider. Other data services providers are available. For more information, see [Data Services Providers](data-services-providers-wcf-data-services.md). - -After you create the service, you must explicitly provide access to data service resources. For more information, see [How to: Enable Access to the Data Service](how-to-enable-access-to-the-data-service-wcf-data-services.md). - -## Create the ASP.NET web application that runs on IIS - -1. In Visual Studio, on the **File** menu, select **New** > **Project**. - -2. In the **New Project** dialog box, select the **Installed** > [**Visual C#** or **Visual Basic**] > **Web** category. - -3. Select the **ASP.NET Web Application** template. - -4. Enter `NorthwindService` as the name of the project. - -5. Click **OK**. - -6. On the **Project** menu, select **NorthwindService Properties**. - -7. Select the **Web** tab, and then select **Use Local IIS Web Server**. - -8. Click **Create Virtual Directory** and then click **OK**. - -9. From the command prompt with administrator privileges, execute one of the following commands (depending on the operating system): - - - 32-bit systems: - - ```console - "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i - ``` - - - 64-bit systems: - - ```console - "%windir%\Microsoft.NET\Framework64\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i - ``` - - This makes sure that Windows Communication Foundation (WCF) is registered on the computer. - -10. From the command prompt with administrator privileges, execute one of the following commands (depending on the operating system): - - - 32-bit systems: - - ```console - "%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe" -i -enable - ``` - - - 64-bit systems: - - ```console - "%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe" -i -enable - ``` - - This makes sure that IIS runs correctly after WCF has been installed on the computer. You might have to also restart IIS. - -11. When the ASP.NET application runs on IIS7, you must also perform the following steps: - - 1. Open IIS Manager and navigate to the PhotoService application under **Default Web Site**. - - 2. In **Features View**, double-click **Authentication**. - - 3. On the **Authentication** page, select **Anonymous Authentication**. - - 4. In the **Actions** pane, click **Edit** to set the security principal under which anonymous users will connect to the site. - - 5. In the **Edit Anonymous Authentication Credentials** dialog box, select **Application pool identity**. - - > [!IMPORTANT] - > When you use the Network Service account, you grant anonymous users all the internal network access associated with that account. - -12. By using SQL Server Management Studio, the sqlcmd.exe utility, or the Transact-SQL Editor in Visual Studio, execute the following Transact-SQL command against the instance of SQL Server that has the Northwind database attached: - - ```sql - CREATE LOGIN [NT AUTHORITY\NETWORK SERVICE] FROM WINDOWS; - GO - ``` - - This creates a login in the SQL Server instance for the Windows account used to run IIS. This enables IIS to connect to the SQL Server instance. - -13. With the Northwind database attached, execute the following Transact-SQL commands: - - ```sql - USE Northwind - GO - CREATE USER [NT AUTHORITY\NETWORK SERVICE] - FOR LOGIN [NT AUTHORITY\NETWORK SERVICE] WITH DEFAULT_SCHEMA=[dbo]; - GO - ALTER LOGIN [NT AUTHORITY\NETWORK SERVICE] - WITH DEFAULT_DATABASE=[Northwind]; - GO - EXEC sp_addrolemember 'db_datareader', 'NT AUTHORITY\NETWORK SERVICE' - GO - EXEC sp_addrolemember 'db_datawriter', 'NT AUTHORITY\NETWORK SERVICE' - GO - ``` - - This grants rights to the new login, which enables IIS to read data from and write data to the Northwind database. - -## Define the data model - -1. In **Solution Explorer**, right-click the name of the ASP.NET project, and then click **Add** > **New Item**. - -2. In the **Add New Item** dialog box, select **ADO.NET Entity Data Model**. - -3. For the name of the data model, type `Northwind.edmx`. - -4. In the Entity Data Model Wizard, select **Generate from Database**, and then click **Next**. - -5. Connect the data model to the database by doing one of the following steps, and then click **Next**: - - - If you do not have a database connection already configured, click **New Connection** and create a new connection. For more information, see [How to: Create Connections to SQL Server Databases](/previous-versions/visualstudio/visual-studio-2008/s4yys16a(v=vs.90)). This SQL Server instance must have the Northwind sample database attached. - - \- or - - - - If you have a database connection already configured to connect to the Northwind database, select that connection from the list of connections. - -6. On the final page of the wizard, select the check boxes for all tables in the database, and clear the check boxes for views and stored procedures. - -7. Click **Finish** to close the wizard. - -## Create the data service - -1. In **Solution Explorer**, right-click the name of your ASP.NET project, and then click **Add** > **New Item**. - -2. In the **Add New Item** dialog box, select **WCF Data Service**. - - ![WCF Data Service item template in Visual Studio 2015](./media/wcf-data-service-item-template.png) - - > [!NOTE] - > The **WCF Data Service** template is available in Visual Studio 2015, but not in Visual Studio 2017 or later. - -3. For the name of the service, enter `Northwind`. - - Visual Studio creates the XML markup and code files for the new service. By default, the code-editor window opens. In **Solution Explorer**, the service has the name, Northwind, and the extension .svc.cs or .svc.vb. - -4. In the code for the data service, replace the comment `/* TODO: put your data source class name here */` in the definition of the class that defines the data service with the type that is the entity container of the data model, which in this case is `NorthwindEntities`. The class definition should look this the following: - - [!code-csharp[Astoria Quickstart Service#ServiceDefinition](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs#servicedefinition)] - [!code-vb[Astoria Quickstart Service#ServiceDefinition](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_service/vb/northwind.svc.vb#servicedefinition)] - -## See also - -- [Exposing Your Data as a Service](exposing-your-data-as-a-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-enable-access-to-the-data-service-wcf-data-services.md b/docs/framework/data/wcf/how-to-enable-access-to-the-data-service-wcf-data-services.md deleted file mode 100644 index 49ba3c3b1349e..0000000000000 --- a/docs/framework/data/wcf/how-to-enable-access-to-the-data-service-wcf-data-services.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: "Learn more about: How to: Enable Access to the Data Service (WCF Data Services)" -title: "How to: Enable Access to the Data Service (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, configuring" -ms.assetid: 3d830bcd-32b4-4f26-9287-d58a071452c6 ---- -# How to: Enable Access to the Data Service (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -In WCF Data Services, you must explicitly grant access to the resources that are exposed by a data service. This means that after you create a new data service, you must still explicitly provide access to individual resources as entity sets. This topic shows how to enable read and write access to five of the entity sets in the Northwind data service that is created when you complete the [quickstart](quickstart-wcf-data-services.md). Because the enumeration is defined by using the , you can use a logical OR operator to specify multiple permissions for a single entity set. - -> [!NOTE] -> Any client that can access the ASP.NET application can also access the resources exposed by the data service. In a production data service, to prevent unauthorized access to resources, you should also secure the application itself. For more information, see [Securing ASP.NET Web Sites](/previous-versions/aspnet/91f66yxt(v=vs.100)). - -### To enable access to the data service - -- In the code for the data service, replace the placeholder code in the `InitializeService` function with the following: - - [!code-csharp[Astoria Quickstart Service#AllReadConfig](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_quickstart_service/cs/northwind.svc.cs#allreadconfig)] - [!code-vb[Astoria Quickstart Service#AllReadConfig](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_quickstart_service/vb/northwind.svc.vb#allreadconfig)] - - This enables clients to have read and write access to the `Orders` and `Order_Details` entity sets and read-only access to the `Customers` entity sets. - -## See also - -- [How to: Develop a WCF Data Service Running on IIS](how-to-develop-a-wcf-data-service-running-on-iis.md) -- [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-enable-paging-of-data-service-results-wcf-data-services.md b/docs/framework/data/wcf/how-to-enable-paging-of-data-service-results-wcf-data-services.md deleted file mode 100644 index af33b2d7d8db5..0000000000000 --- a/docs/framework/data/wcf/how-to-enable-paging-of-data-service-results-wcf-data-services.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: "Learn more about: How to: Enable Paging of Data Service Results (WCF Data Services)" -title: "How to: Enable Paging of Data Service Results (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "paging output [WCF Data Services]" -ms.assetid: 9a316cbd-9612-4482-a541-a10bc78b2635 ---- -# How to: Enable Paging of Data Service Results (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables you to limit the number of entities returned by a data service query. Page limits are defined in the method that is called when the service is initialized and can be set separately for each entity set. - - When paging is enabled, the final entry in the feed contains a link to the next page of data. For more information, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md). - - This topic shows how to modify a data service to enable paging of returned `Customers` and `Orders` entity sets. The example in this topic uses the Northwind sample data service. This service is created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -### How to enable paging of returned Customers and Orders entity sets - -- In the code for the data service, replace the placeholder code in the `InitializeService` function with the following: - - [!code-csharp[Astoria Northwind Service#DataServiceConfigPaging](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.svc.cs#dataserviceconfigpaging)] - [!code-vb[Astoria Northwind Service#DataServiceConfigPaging](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind.svc.vb#dataserviceconfigpaging)] - -## See also - -- [Loading Deferred Content](loading-deferred-content-wcf-data-services.md) -- [How to: Load Paged Results](how-to-load-paged-results-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-execute-asynchronous-data-service-queries-wcf-data-services.md b/docs/framework/data/wcf/how-to-execute-asynchronous-data-service-queries-wcf-data-services.md deleted file mode 100644 index a6d0c7388a064..0000000000000 --- a/docs/framework/data/wcf/how-to-execute-asynchronous-data-service-queries-wcf-data-services.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -description: "Learn more about: How to: Execute Asynchronous Data Service Queries (WCF Data Services)" -title: "How to: Execute Asynchronous Data Service Queries (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, asynchronous operations" - - "asynchronous operations [WCF Data Services]" -ms.assetid: 902a2dc1-d0e9-4b00-90a8-becc4cb1f6a7 ---- -# How to: Execute Asynchronous Data Service Queries (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -By using the WCF Data Services client library, you can asynchronously perform client-server operations, such as executing queries and saving changes. For more information, see [Asynchronous Operations](asynchronous-operations-wcf-data-services.md). - -> [!NOTE] -> In an application where the callback must be invoked on a specific thread, you must explicitly marshal the execution of the method. For more information, see [Asynchronous Operations](asynchronous-operations-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example shows how to execute an asynchronous query by calling the method to start the query. The inline delegate calls the method to display the query results. - - [!code-csharp[Astoria Northwind Client#ExecuteQueryAsync](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#executequeryasync)] - [!code-vb[Astoria Northwind Client#ExecuteQueryAsync](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#executequeryasync)] - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/how-to-execute-data-service-queries-wcf-data-services.md b/docs/framework/data/wcf/how-to-execute-data-service-queries-wcf-data-services.md deleted file mode 100644 index f94d594311b7b..0000000000000 --- a/docs/framework/data/wcf/how-to-execute-data-service-queries-wcf-data-services.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -description: "Learn more about: How to: Execute Data Service Queries (WCF Data Services)" -title: "How to: Execute Data Service Queries (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "querying the data service [WCF Data Services]" - - "WCF Data Services, querying" - - "WCF Data Services, accessing data" -ms.assetid: 62997821-e0c6-4c4d-9fb7-1273fb5e5d18 ---- -# How to: Execute Data Service Queries (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables you to query a data service from a .NET Framework-based client application by using the generated client data service classes. You can execute queries by using one of these methods: - -- Executing a LINQ query against the named that you obtain from the that the `Add Data Service Reference` tool generates. - -- Implicitly, by enumerating over the named that you obtain from the that the `Add Data Service Reference` tool generates. - -- Explicitly, by calling the method on the , or the method for asynchronous execution. - - For more information, see [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example shows how to define and execute a LINQ query that returns all `Customers` against the Northwind data service. - - [!code-csharp[Astoria Northwind Client#GetAllCustomersLinq](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#getallcustomerslinq)] - [!code-vb[Astoria Northwind Client#GetAllCustomersLinq](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#getallcustomerslinq)] - -## Example - - The following example shows how to use the context that the `Add Data Service Reference` tool generates to implicitly execute a query that returns all `Customers` against the Northwind data service. The URI of the requested `Customers` entity set is determined automatically by the context. The query is executed implicitly when the enumeration occurs. - - [!code-csharp[Astoria Northwind Client#GetAllCustomers](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#getallcustomers)] - [!code-vb[Astoria Northwind Client#GetAllCustomers](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#getallcustomers)] - -## Example - - The following example shows how to use the to explicitly execute a query that returns all `Customers` against the Northwind data service. - - [!code-csharp[Astoria Northwind Client#GetAllCustomersExplicit](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#getallcustomersexplicit)] - [!code-vb[Astoria Northwind Client#GetAllCustomersExplicit](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#getallcustomersexplicit)] - -## See also - -- [How to: Add Query Options to a Data Service Query](how-to-add-query-options-to-a-data-service-query-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-execute-queries-in-a-batch-wcf-data-services.md b/docs/framework/data/wcf/how-to-execute-queries-in-a-batch-wcf-data-services.md deleted file mode 100644 index 5d9ca70d10915..0000000000000 --- a/docs/framework/data/wcf/how-to-execute-queries-in-a-batch-wcf-data-services.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: "Learn more about: How to: Execute Queries in a Batch (WCF Data Services)" -title: "How to: Execute Queries in a Batch (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, batch requests" -ms.assetid: 3b4db7df-bd33-43a1-8ea4-63a18e131f97 ---- -# How to: Execute Queries in a Batch (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -By using the WCF Data Services client library, you can execute more than one query against the data service in a single batch. For more information, see [Batching Operations](batching-operations-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example shows how to call the method to execute an array of objects that contains queries that return both `Customers` and `Products` objects from the Northwind data service. The collection of objects in the returned is enumerated, and the collection of objects contained in each is also enumerated. - - [!code-csharp[Astoria Northwind Client#BatchQuery](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#batchquery)] - [!code-vb[Astoria Northwind Client#BatchQuery](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#batchquery)] - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/how-to-intercept-data-service-messages-wcf-data-services.md b/docs/framework/data/wcf/how-to-intercept-data-service-messages-wcf-data-services.md deleted file mode 100644 index 26bafaafccb92..0000000000000 --- a/docs/framework/data/wcf/how-to-intercept-data-service-messages-wcf-data-services.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -description: "Learn more about: How to: Intercept Data Service Messages (WCF Data Services)" -title: "How to: Intercept Data Service Messages (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, customizing" - - "query interceptors [WCF Data Services]" -ms.assetid: 24b9df1b-b54b-4795-a033-edf333675de6 ---- -# How to: Intercept Data Service Messages (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -With WCF Data Services, you can intercept request messages so that you can add custom logic to an operation. To intercept a message, you use specially attributed methods in the data service. For more information, see [Interceptors](interceptors-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service. This service is created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -### To define a query interceptor for the Orders entity set - -1. In the Northwind data service project, open the Northwind.svc file. - -2. In the code page for the `Northwind` class, add the following `using` statement (`Imports` in Visual Basic). - - [!code-csharp[Astoria Northwind Service#UsingLinqExpressions](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#usinglinqexpressions)] - [!code-vb[Astoria Northwind Service#UsingLinqExpressions](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#usinglinqexpressions)] - -3. In the `Northwind` class, define a service operation method named `OnQueryOrders` as follows: - - [!code-csharp[Astoria Northwind Service#QueryInterceptorDef](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#queryinterceptordef)] - [!code-vb[Astoria Northwind Service#QueryInterceptorDef](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#queryinterceptordef)] - -### To define a change interceptor for the Products entity set - -1. In the Northwind data service project, open the Northwind.svc file. - -2. In the `Northwind` class, define a service operation method named `OnChangeProducts` as follows: - - [!code-csharp[Astoria Northwind Service#ChangeInterceptorDef](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#changeinterceptordef)] - [!code-vb[Astoria Northwind Service#ChangeInterceptorDef](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#changeinterceptordef)] - -## Example - - This example defines a query interceptor method for the `Orders` entity set that returns a lambda expression. This expression contains a delegate that filters the requested `Orders` based on related `Customers` that have a specific contact name. The name is in turn determined based on the requesting user. This example assumes that the data service is hosted within an ASP.NET Web application that uses WCF, and that authentication is enabled. The class is used to retrieve the principle of the current request. - - [!code-csharp[Astoria Northwind Service#QueryInterceptor](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#queryinterceptor)] - [!code-vb[Astoria Northwind Service#QueryInterceptor](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#queryinterceptor)] - -## Example - - This example defines a change interceptor method for the `Products` entity set. This method validates input to the service for an or operation and raises an exception if a change is being made to a discontinued product. It also blocks the deletion of products as an unsupported operation. - - [!code-csharp[Astoria Northwind Service#ChangeInterceptor](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#changeinterceptor)] - [!code-vb[Astoria Northwind Service#ChangeInterceptor](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#changeinterceptor)] - -## See also - -- [How to: Define a Service Operation](how-to-define-a-service-operation-wcf-data-services.md) -- [Defining WCF Data Services](defining-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-load-paged-results-wcf-data-services.md b/docs/framework/data/wcf/how-to-load-paged-results-wcf-data-services.md deleted file mode 100644 index 3116158b33339..0000000000000 --- a/docs/framework/data/wcf/how-to-load-paged-results-wcf-data-services.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: "Learn more about: How to: Load Paged Results (WCF Data Services)" -title: "How to: Load Paged Results (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, deferred content" - - "WCF Data Services, loading data" -ms.assetid: bb786ea4-f3ef-4ad3-9a41-3a0b7feb6a1f ---- -# How to: Load Paged Results (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables the data service to limit the number of entities that are returned in a single response feed. When this happens, the final entry in the feed contains a link to the next page of data. The URI for the next page of data is obtained by calling the method of the , which is returned when the is executed. The URI represented by this object is then used to load the next page of results. For more information, see [Loading Deferred Content](loading-deferred-content-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - This example uses a `do…while` loop to load `Customers` entities from a paged results from the data service. - - [!code-csharp[Astoria Northwind Client#GetCustomersPaged](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#getcustomerspaged)] - [!code-vb[Astoria Northwind Client#GetCustomersPaged](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#getcustomerspaged)] - -## Example - - This example returns related `Orders` entities with each `Customers` entity and uses a `do…while` loop to load `Customers` entities pages and a nested `while` loop to load pages of related `Orders` entities from the data service. - - [!code-csharp[Astoria Northwind Client#GetCustomersPagedNested](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#getcustomerspagednested)] - [!code-vb[Astoria Northwind Client#GetCustomersPagedNested](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#getcustomerspagednested)] - -## See also - -- [Loading Deferred Content](loading-deferred-content-wcf-data-services.md) -- [How to: Load Related Entities](how-to-load-related-entities-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-load-related-entities-wcf-data-services.md b/docs/framework/data/wcf/how-to-load-related-entities-wcf-data-services.md deleted file mode 100644 index c8423b660514a..0000000000000 --- a/docs/framework/data/wcf/how-to-load-related-entities-wcf-data-services.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: "Learn more about: How to: Load Related Entities (WCF Data Services)" -title: "How to: Load Related Entities (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, deferred content" - - "WCF Data Services, loading data" -ms.assetid: 6f143d30-d997-4e6b-bcf0-d5c394ecb108 ---- -# How to: Load Related Entities (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -When you need to load associated entities in WCF Data Services, you can use the method on the class. You can also use the method on the to require that related entities be eagerly loaded in the same query response. - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example shows how to explicitly load the `Customer` that is related to each returned `Orders` instance. - - [!code-csharp[Astoria Northwind Client#LoadRelatedOrderCustomer](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#loadrelatedordercustomer)] - [!code-vb[Astoria Northwind Client#LoadRelatedOrderCustomer](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#loadrelatedordercustomer)] - -## Example - - The following example shows how to use the method to return `Order Details` that belong to the `Orders` returned by the query. - - [!code-csharp[Astoria Northwind Client#ExpandOrderDetails](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#expandorderdetails)] - [!code-vb[Astoria Northwind Client#ExpandOrderDetails](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#expandorderdetails)] - -## See also - -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/how-to-manually-generate-client-data-service-classes-wcf-data-services.md b/docs/framework/data/wcf/how-to-manually-generate-client-data-service-classes-wcf-data-services.md deleted file mode 100644 index a1ac83ec232d3..0000000000000 --- a/docs/framework/data/wcf/how-to-manually-generate-client-data-service-classes-wcf-data-services.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -description: "Learn more about: How to: Manually Generate Client Data Service Classes (WCF Data Services)" -title: "How to: Manually Generate Client Data Service Classes (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, configuring" - - "WCF Data Services, client library" -ms.assetid: b98cb1d6-956a-4e50-add6-67e4f2587346 ---- -# How to: Manually Generate Client Data Service Classes (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services integrates with Visual Studio to enable you to automatically generate client data service classes when you use the **Add Service Reference** dialog box to add a reference to a data service in a Visual Studio project. For more information, see [How to: Add a Data Service Reference](how-to-add-a-data-service-reference-wcf-data-services.md). You can also manually generate the same client data service classes by using the code-generation tool, `DataSvcUtil.exe`. This tool, which is included with WCF Data Services, generates .NET Framework classes from the data service definition. It can also be used to generate data service classes from the conceptual model (.csdl) file and from the .edmx file that represents an Entity Framework model in a Visual Studio project. - - The example in this topic creates client data service classes based on the Northwind sample data service. This service is created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). Some examples in this topic require the conceptual model file for the Northwind model. For more information, see [How to: Use EdmGen.exe to Generate the Model and Mapping Files](../adonet/ef/how-to-use-edmgen-exe-to-generate-the-model-and-mapping-files.md). Some examples in this topic require the .edmx file for the Northwind model. For more information, see [.edmx File Overview](/previous-versions/dotnet/netframework-4.0/cc982042(v=vs.100)). - -### To generate C# classes that support data binding - -- At the command prompt, execute the following command without line breaks: - - ```console - "%windir%\Microsoft.NET\Framework\v3.5\DataSvcUtil.exe" /dataservicecollection /version:2.0 /language:CSharp /out:Northwind.cs /uri:http://localhost:12345/Northwind.svc - ``` - - > [!NOTE] - > You must replace the value supplied to the `/uri:` parameter with the URI of your instance of the Northwind sample data service. - -### To generate Visual Basic classes that support data binding - -- At the command prompt, execute the following command without line breaks: - - ```console - "%windir%\Microsoft.NET\Framework\v3.5\DataSvcUtil.exe" /dataservicecollection /version:2.0 /language:VB /out:Northwind.vb /uri:http://localhost:12345/Northwind.svc - ``` - - > [!NOTE] - > You must replace value supplied to the `/uri:` parameter with the URI of your instance of the Northwind sample data service. - -### To generate C# classes based on the service URI - -- At the command prompt, execute the following command without line breaks: - - ```console - "%windir%\Microsoft.NET\Framework\v3.5\DataSvcUtil.exe" /language:CSharp /out:northwind.cs /uri:http://localhost:12345/Northwind.svc - ``` - - > [!NOTE] - > You must replace the value supplied to the `/uri:` parameter with the URI of your instance of the Northwind sample data service. - -### To generate Visual Basic classes based on the service URI - -- At the command prompt, execute the following command without line breaks: - - ```console - "%windir%\Microsoft.NET\Framework\v3.5\datasvcutil.exe" /language:VB /out:Northwind.vb /uri:http://localhost:12345/Northwind.svc - ``` - - > [!NOTE] - > You must replace value supplied to the `/uri:` parameter with the URI of your instance of the Northwind sample data service. - -### To generate C# classes based on the conceptual model file (CSDL) - -- At the command prompt, execute the following command without line breaks: - - ```console - "%windir%\Microsoft.NET\Framework\v3.5\datasvcutil.exe" /language:CSharp /in:Northwind.csdl /out:Northwind.cs - ``` - -### To generate Visual Basic classes based on the conceptual model file (CSDL) - -- At the command prompt, execute the following command without line breaks: - - ```console - "%windir%\Microsoft.NET\Framework\v3.5\datasvcutil.exe" /language:VB /in:Northwind.csdl /out:Northwind.vb - ``` - -### To generate C# classes based on the .edmx file - -- At the command prompt, execute the following command without line breaks: - - ```console - "%windir%\Microsoft.NET\Framework\v3.5\datasvcutil.exe" /language:CSharp /in:Northwind.edmx /out:c:\northwind.cs - ``` - -### To generate Visual Basic classes based on the .edmx file - -- At the command prompt, execute the following command without line breaks: - - ```console - "%windir%\Microsoft.NET\Framework\v3.5\datasvcutil.exe" /language:VB /in:Northwind.edmx /out:c:\northwind.vb - ``` - -## See also - -- [Generating the Data Service Client Library](generating-the-data-service-client-library-wcf-data-services.md) -- [How to: Add a Data Service Reference](how-to-add-a-data-service-reference-wcf-data-services.md) -- [WCF Data Service Client Utility (DataSvcUtil.exe)](wcf-data-service-client-utility-datasvcutil-exe.md) diff --git a/docs/framework/data/wcf/how-to-project-query-results-wcf-data-services.md b/docs/framework/data/wcf/how-to-project-query-results-wcf-data-services.md deleted file mode 100644 index c581bf495136e..0000000000000 --- a/docs/framework/data/wcf/how-to-project-query-results-wcf-data-services.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -description: "Learn more about: How to: Project Query Results (WCF Data Services)" -title: "How to: Project Query Results (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "projection [WCF Data Services]" - - "WCF Data Services, projection" - - "query projection [WCF Data Services]" - - "WCF Data Services, querying" -ms.assetid: 474ac625-8770-43ba-8320-d3315ea9530f ---- -# How to: Project Query Results (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -Projection provides a mechanism to reduce the amount of data returned by a query by specifying that only certain properties of an entity are returned in the response. You can perform projections on the results of an WCF Data Services query either by using the `$select` query option or by using the [select](../../../csharp/language-reference/keywords/select-clause.md) clause ([Select](../../../visual-basic/language-reference/queries/select-clause.md) in Visual Basic) in a LINQ query. For more information, see [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - The following example shows a LINQ query that projects Customers entities into a new CustomerAddress type, which contains only address-specific properties plus the identity property. This `CustomerAddress` class is defined on the client and is attributed so that the client library can recognize it as an entity type. - - [!code-csharp[Astoria Northwind Client#SelectCustomerAddress](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#selectcustomeraddress)] - [!code-vb[Astoria Northwind Client#SelectCustomerAddress](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#selectcustomeraddress)] - -## Example - - The following example shows a LINQ query that projects returned Customers entities into a new CustomerAddressNonEntity type, which contains only address-specific properties and no identity property. This `CustomerAddressNonEntity` class is defined on the client and is not attributed as an entity type. - - [!code-csharp[Astoria Northwind Client#SelectCustomerAddressNonEntity](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#selectcustomeraddressnonentity)] - [!code-vb[Astoria Northwind Client#SelectCustomerAddressNonEntity](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#selectcustomeraddressnonentity)] - -## Example - - The following example shows the definitions of the `CustomerAddress` and `CustomerAddressNonEntity` types that are used in the previous examples. - - [!code-csharp[Astoria Northwind Client#CustomerAddressDefinition](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/customeraddress.cs#customeraddressdefinition)] - [!code-vb[Astoria Northwind Client#CustomerAddressDefinition](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/customeraddress.vb#customeraddressdefinition)] diff --git a/docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md b/docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md deleted file mode 100644 index 53220eda450ba..0000000000000 --- a/docs/framework/data/wcf/how-to-set-headers-in-the-client-request-wcf-data-services.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: "How to: Set Headers in the Client Request (WCF Data Services)" -description: Learn how to handle the SendingRequest event to add a new header to the request message before it is sent to the data service in WCF Data Services. -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, customizing requests" -ms.assetid: 3d55168d-5901-4f48-8117-6c93da3ab5ae ---- -# How to: Set Headers in the Client Request (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -When you use the WCF Data Services client library to access a data service that supports the Open Data Protocol (OData), the client library automatically sets the required HTTP headers in request messages sent to the data service. However, the client library does not know to set message headers that are required in certain cases, such as when the data service requires claims-based authentication or cookies. For more information, see [Securing WCF Data Services](securing-wcf-data-services.md#clientAuthentication). In these cases, you must manually set message headers in the request message before it is sent. The example in this topic shows how to handle the event to add a new header to the request message before it is sent to the data service. - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). You can also use the [Northwind sample data service](https://services.odata.org/Northwind/Northwind.svc/) that is published on the OData Web site; this sample data service is read-only and attempting to save changes returns an error. The sample data services on the OData website allow anonymous authentication. - -## Example - - The following example registers a handler for the event and then executes a query against the data service. - -> [!NOTE] -> When a data service requires you to manually set the message header for every request, consider registering the handler for the event by overriding the `OnContextCreated` partial method in the entity container that represents the data service, which in this case is `NorthwindEntities`. - -[!code-csharp[Astoria Northwind Client#RegisterHeadersQuery](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#registerheadersquery)] -[!code-vb[Astoria Northwind Client#RegisterHeadersQuery](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#registerheadersquery)] - -## Example - - The following method handles the event and adds an Authentication header to the request. - - [!code-csharp[Astoria Northwind Client#OnSendingRequest](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#onsendingrequest)] - [!code-vb[Astoria Northwind Client#OnSendingRequest](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#onsendingrequest)] - -## See also - -- [Securing WCF Data Services](securing-wcf-data-services.md) -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/index.md b/docs/framework/data/wcf/index.md deleted file mode 100644 index b776989e44a1c..0000000000000 --- a/docs/framework/data/wcf/index.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -title: "WCF Data Services 4.5" -description: Learn about WCF Data Services, a .NET Framework component which supports services to expose and consume data using REST semantics. -ms.date: "03/30/2017" -helpviewer_keywords: - - "Astoria" - - "WCF Data Services, getting started" -ms.assetid: 73d2bec3-7c92-4110-b905-11bb0462357a ---- - -# WCF Data Services 4.5 - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -## Overview - -WCF Data Services (formerly known as "ADO.NET Data Services") is a component of the .NET Framework that enables you to create services that use the Open Data Protocol (OData) to expose and consume data over the Web or intranet by using the semantics of [representational state transfer (REST)](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm). OData exposes data as resources that are addressable by URIs. Data is accessed and changed by using standard HTTP verbs of GET, PUT, POST, and DELETE. OData uses the entity-relationship conventions of the [Entity Data Model](../adonet/entity-data-model.md) to expose resources as sets of entities that are related by associations. - -WCF Data Services uses the OData protocol for addressing and updating resources. In this way, you can access these services from any client that supports OData. OData enables you to request and write data to resources by using well-known transfer formats: Atom, a set of standards for exchanging and updating data as XML, and JavaScript Object Notation (JSON), a text-based data exchange format used extensively in AJAX applications. - -WCF Data Services can expose data that originates from various sources as OData feeds. Visual Studio tools make it easier for you to create an OData-based service by using an ADO.NET Entity Framework data model. You can also create OData feeds based on common language runtime (CLR) classes and even late-bound or un-typed data. - -WCF Data Services also includes a set of client libraries, one for general .NET Framework client applications and another specifically for Silverlight-based applications. These client libraries provide an object-based programming model when you access an OData feed from environments such as the .NET Framework and Silverlight. - -## Where Should I Start? - -Depending on your interests, consider getting started with WCF Data Services in one of the following topics. - -I want to jump right in... - -- [Quickstart](quickstart-wcf-data-services.md) - -- [Getting Started](getting-started-with-wcf-data-services.md) - -Just show me some code... - -- [Quickstart](quickstart-wcf-data-services.md) - -- [How to: Execute Data Service Queries](how-to-execute-data-service-queries-wcf-data-services.md) - -- [How to: Bind Data to Windows Presentation Foundation Elements](bind-data-to-wpf-elements-wcf-data-services.md) - -I want to know more about OData... - -- [White paper: Introducing OData](https://download.microsoft.com/download/E/5/A/E5A59052-EE48-4D64-897B-5F7C608165B8/IntroducingOData.pdf) -- [Open Data Protocol website](https://www.odata.org/) -- [OData: SDK](https://www.odata.org/ecosystem/) - -I want to see end-to-end samples... - -- [WCF Data Services Quickstart](https://github.com/microsoftarchive/msdn-code-gallery-community-s-z/tree/master/WCF%20Data%20Services%20Quickstart%20(OData%20Service%20and%20WPF%20Client)) -- [OData SDK - Sample Code](https://www.odata.org/ecosystem/#sdk) - -How does it integrate with Visual Studio? - -- [Generating the Data Service Client Library](generating-the-data-service-client-library-wcf-data-services.md) - -- [Creating the Data Service](creating-the-data-service.md) - -- [Entity Framework Provider](entity-framework-provider-wcf-data-services.md) - -What can I do with it? - -- [Overview](wcf-data-services-overview.md) - -- [Application Scenarios](application-scenarios-wcf-data-services.md) - -I want to use LINQ... - -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) - -- [LINQ Considerations](linq-considerations-wcf-data-services.md) - -- [How to: Execute Data Service Queries](how-to-execute-data-service-queries-wcf-data-services.md) - -I still need some more information... - -- [WCF Data Services Team Blog](/archive/blogs/astoriateam/) - -- [Resources](wcf-data-services-resources.md) - -## In This Section - -[Overview](wcf-data-services-overview.md) - -Provides an overview of the features and functionality available in WCF Data Services. - -[What's New in WCF Data Services 5.0](/previous-versions/dotnet/wcf-data-services/ee373845(v=vs.103)) - -Describes new functionality in WCF Data Services and support for new OData features. - -[Getting Started](getting-started-with-wcf-data-services.md) - -Describes how to expose and consume OData feeds by using WCF Data Services. - -[Defining WCF Data Services](defining-wcf-data-services.md) - -Describes how to create and configure a data service that exposes OData feeds. - -[WCF Data Services Client Library](wcf-data-services-client-library.md) - -Describes how to use client libraries to consume OData feeds from a .NET Framework client application. - -## See also - -- [Representational State Transfer (REST)](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm) diff --git a/docs/framework/data/wcf/interceptors-wcf-data-services.md b/docs/framework/data/wcf/interceptors-wcf-data-services.md deleted file mode 100644 index 455e871d32620..0000000000000 --- a/docs/framework/data/wcf/interceptors-wcf-data-services.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -description: "Learn more about: Interceptors (WCF Data Services)" -title: "Interceptors (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, customizing" - - "query interceptors [WCF Data Services]" -ms.assetid: e33ae8dc-8069-41d0-99a0-75ff28db7050 ---- -# Interceptors (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables an application to intercept request messages so that you can add custom logic to an operation. You can use this custom logic to validate data in incoming messages. You can also use it to further restrict the scope of a query request, such as to insert a custom authorization policy on a per request basis. - - Interception is performed by specially attributed methods in the data service. These methods are called by WCF Data Services at the appropriate point in message processing. Interceptors are defined on a per-entity set basis, and interceptor methods cannot accept parameters from the request like service operations can. Query interceptor methods, which are called when processing an HTTP GET request, must return a lambda expression that determines whether an instance of the interceptor's entity set should be returned by the query results. This expression is used by the data service to further refine the requested operation. The following is an example definition of a query interceptor. - - [!code-csharp[Astoria Northwind Service#QueryInterceptorDef](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#queryinterceptordef)] - [!code-vb[Astoria Northwind Service#QueryInterceptorDef](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#queryinterceptordef)] - - For more information, see [How to: Intercept Data Service Messages](how-to-intercept-data-service-messages-wcf-data-services.md). - - Change interceptors, which are called when processing non-query operations, must return `void` (`Nothing` in Visual Basic). Change interceptor methods must accept the following two parameters: - -1. A parameter of a type that is compatible with the entity type of the entity set. When the data service invokes the change interceptor, the value of this parameter will reflect the entity information that is sent by the request. - -2. A parameter of type . When the data service invokes the change interceptor, the value of this parameter will reflect the operation that the request is trying to perform. - - The following is an example definition of a change interceptor. - - [!code-csharp[Astoria Northwind Service#ChangeInterceptorDef](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#changeinterceptordef)] - [!code-vb[Astoria Northwind Service#ChangeInterceptorDef](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#changeinterceptordef)] - - For more information, see [How to: Intercept Data Service Messages](how-to-intercept-data-service-messages-wcf-data-services.md). - - The following attributes are supported for interception. - - **[QueryInterceptor(** *EntitySetName* **)]** - Methods with the attribute applied are called when an HTTP GET request is received for the targeted entity set resource. These methods must always return a lambda expression in the form of `Expression>`. - - **[ChangeInterceptor(** *EntitySetName* **)]** - Methods with the attribute applied are called when an HTTP request other than HTTP GET request is received for the targeted entity set resource. These methods must always return `void` (`Nothing` in Visual Basic). - - For more information, see [How to: Intercept Data Service Messages](how-to-intercept-data-service-messages-wcf-data-services.md). - -## See also - -- [Service Operations](service-operations-wcf-data-services.md) diff --git a/docs/framework/data/wcf/linq-considerations-wcf-data-services.md b/docs/framework/data/wcf/linq-considerations-wcf-data-services.md deleted file mode 100644 index 3bf78f1c07562..0000000000000 --- a/docs/framework/data/wcf/linq-considerations-wcf-data-services.md +++ /dev/null @@ -1,233 +0,0 @@ ---- -description: "Learn more about: LINQ Considerations (WCF Data Services)" -title: "LINQ Considerations (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, LINQ" - - "querying the data service [WCF Data Services]" - - "WCF Data Services, querying" -ms.assetid: cc4ec9e9-348f-42a6-a78e-1cd40e370656 ---- -# LINQ Considerations (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -This topic provides information about the way in which LINQ queries are composed and executed when you are using the WCF Data Services client and limitations of using LINQ to query a data service that implements the Open Data Protocol (OData). For more information about composing and executing queries against an OData-based data service, see [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - -## Composing LINQ Queries - - LINQ enables you to compose queries against a collection of objects that implements . Both the **Add Service Reference** dialog box in Visual Studio and the DataSvcUtil.exe tool are used to generate a representation of an OData service as an entity container class that inherits from , as well as objects that represent the entities returned in feeds. These tools also generate properties on the entity container class for the collections that are exposed as feeds by the service. Each of these properties of the class that encapsulates the data service return a . Because the class implements the interface defined by LINQ, you can compose a LINQ query against feeds exposed by the data service, which are translated by the client library into a query request URI that is sent to the data service on execution. - -> [!IMPORTANT] -> The set of queries expressible in the LINQ syntax is broader than those enabled in the URI syntax that is used by OData data services. A is raised when the query cannot be mapped to a URI in the target data service. For more information, see the [Unsupported LINQ Methods](linq-considerations-wcf-data-services.md#unsupportedMethods) in this topic. - - The following example is a LINQ query that returns `Orders` that have a freight cost of more than $30 and sorts the results by the shipping date, starting with the latest ship date: - -[!code-csharp[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addqueryoptionslinqspecific)] -[!code-vb[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addqueryoptionslinqspecific)] - - This LINQ query is translated into the following query URI that is executed against the Northwind-based [quickstart](quickstart-wcf-data-services.md) data service: - -```http -http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight gt 30 -``` - - For more general information about LINQ, see [Language-Integrated Query (LINQ) - C#](../../../csharp/programming-guide/concepts/linq/index.md) or [Language-Integrated Query (LINQ) - Visual Basic](../../../visual-basic/programming-guide/concepts/linq/index.md). - - LINQ enables you to compose queries by using both the language-specific declarative query syntax, shown in the previous example, as well as a set of query methods known as standard query operators. An equivalent query to the previous example can be composed by using only the method-based syntax, as shown the following example: - -[!code-csharp[Astoria Northwind Client#AddQueryOptionsLinqExpressionSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addqueryoptionslinqexpressionspecific)] -[!code-vb[Astoria Northwind Client#AddQueryOptionsLinqExpressionSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addqueryoptionslinqexpressionspecific)] - - The WCF Data Services client is able to translate both kinds of composed queries into a query URI, and you can extend a LINQ query by appending query methods to a query expression. When you compose LINQ queries by appending method syntax to a query expression or a , the operations are added to the query URI in the order in which methods are called. This is equivalent to calling the method to add each query option to the query URI. - -## Executing LINQ Queries - - Certain LINQ query methods, such as or , when appended to the query, cause the query to be executed. A query is also executed when results are enumerated implicitly, such as during a `foreach` loop or when the query is assigned to a `List` collection. For more information, see [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - - The client executes a LINQ query in two parts. Whenever possible, LINQ expressions in a query are first evaluated on the client, and then a URI-based query is generated and sent to the data service for evaluation against data in the service. For more information, see the section [Client versus Server Execution](querying-the-data-service-wcf-data-services.md#executingQueries) in [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - - When a LINQ query cannot be translated in an OData-compliant query URI, an exception is raised when execution is attempted. For more information, see [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - -## LINQ Query Examples - - The examples in the following sections demonstrate the kinds of LINQ queries that can be executed against an OData service. - - - -### Filtering - - The LINQ query examples in this section filter data in the feed returned by the service. - - The following examples are equivalent queries that filter the returned `Orders` entities so that only orders with a freight cost greater than $30 are returned: - -- Using LINQ query syntax: - -[!code-csharp[Astoria Northwind Client#LinqWhereClauseSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqwhereclausespecific)] -[!code-vb[Astoria Northwind Client#LinqWhereClauseSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqwhereclausespecific)] - -- Using LINQ query methods: - -[!code-csharp[Astoria Northwind Client#LinqWhereMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqwheremethodspecific)] -[!code-vb[Astoria Northwind Client#LinqWhereMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqwheremethodspecific)] - -- The URI query string `$filter` option: - -[!code-csharp[Astoria Northwind Client#ExplicitQueryWhereMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#explicitquerywheremethodspecific)] -[!code-vb[Astoria Northwind Client#ExplicitQueryWhereMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#explicitquerywheremethodspecific)] - - All of the previous examples are translated to the query URI: `http://localhost:12345/northwind.svc/Orders()?$filter=Freight gt 30M`. - - - -### Sorting - - The following examples show equivalent queries that sort returned data both by the company name and by postal code, descending: - -- Using LINQ query syntax: - -[!code-csharp[Astoria Northwind Client#LinqOrderByClauseSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqorderbyclausespecific)] -[!code-vb[Astoria Northwind Client#LinqOrderByClauseSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqorderbyclausespecific)] - -- Using LINQ query methods: - -[!code-csharp[Astoria Northwind Client#LinqOrderByMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqorderbymethodspecific)] -[!code-vb[Astoria Northwind Client#LinqOrderByMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqorderbymethodspecific)] - -- URI query string `$orderby` option): - -[!code-csharp[Astoria Northwind Client#ExplicitQueryOrderByMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#explicitqueryorderbymethodspecific)] -[!code-vb[Astoria Northwind Client#ExplicitQueryOrderByMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#explicitqueryorderbymethodspecific)] - - All of the previous examples are translated to the query URI: `http://localhost:12345/northwind.svc/Customers()?$orderby=CompanyName,PostalCode desc`. - - - -### Projection - - The following examples show equivalent queries that project returned data into the narrower `CustomerAddress` type: - -- Using LINQ query syntax: - -[!code-csharp[Astoria Northwind Client#LinqSelectClauseSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqselectclausespecific)] -[!code-vb[Astoria Northwind Client#LinqSelectClauseSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqselectclausespecific)] - -- Using LINQ query methods: - -[!code-csharp[Astoria Northwind Client#LinqSelectMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqselectmethodspecific)] -[!code-vb[Astoria Northwind Client#LinqSelectMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqselectmethodspecific)] - -> [!NOTE] -> The `$select` query option cannot be added to a query URI by using the method. We recommend that you use the LINQ method to have the client generate the `$select` query option in the request URI. - - Both of the previous examples are translated to the query URI: `"http://localhost:12345/northwind.svc/Customers()?$filter=Country eq 'GerGerm'&$select=CustomerID,Address,City,Region,PostalCode,Country"`. - - - -### Client Paging - - The following examples show equivalent queries that request a page of sorted order entities that includes 25 orders, skipping the first 50 orders: - -- Applying query methods to a LINQ query: - -[!code-csharp[Astoria Northwind Client#LinqSkipTakeMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqskiptakemethodspecific)] -[!code-vb[Astoria Northwind Client#LinqSkipTakeMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqskiptakemethodspecific)] - -- URI query string `$skip` and `$top` options): - -[!code-csharp[Astoria Northwind Client#ExplicitQuerySkipTakeMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#explicitqueryskiptakemethodspecific)] -[!code-vb[Astoria Northwind Client#ExplicitQuerySkipTakeMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#explicitqueryskiptakemethodspecific)] - - Both of the previous examples are translated to the query URI: `http://localhost:12345/northwind.svc/Orders()?$orderby=OrderDate desc&$skip=50&$top=25`. - - - -### Expand - - When you query an OData data service, you can request that entities related to the entity targeted by the query be included the returned feed. The method is called on the for the entity set targeted by the LINQ query, with the related entity set name supplied as the `path` parameter. For more information, see [Loading Deferred Content](loading-deferred-content-wcf-data-services.md). - - The following examples show equivalent ways to use the method in a query: - -- In LINQ query syntax: - -[!code-csharp[Astoria Northwind Client#LinqQueryExpandSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqqueryexpandspecific)] -[!code-vb[Astoria Northwind Client#LinqQueryExpandSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqqueryexpandspecific)] - -- With LINQ query methods: - -[!code-csharp[Astoria Northwind Client#LinqQueryExpandMethodSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqqueryexpandmethodspecific)] -[!code-vb[Astoria Northwind Client#LinqQueryExpandMethodSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqqueryexpandmethodspecific)] - - Both of the previous examples are translated to the query URI: `http://localhost:12345/northwind.svc/Orders()?$filter=CustomerID eq 'ALFKI'&$expand=Order_Details`. - - - -## Unsupported LINQ Methods - - The following table contains the classes of LINQ methods are not supported and cannot be included in a query executed against an OData service: - -|Operation Type|Unsupported Method| -|--------------------|------------------------| -|Set operators|All set operators are unsupported against a , which included the following:

-
-
-
-
-
-
-
-
- | -|Ordering operators|The following ordering operators that require are unsupported against a :

-
-
-
- | -|Projection and filtering operators|The following projection and filtering operators that accept a positional argument are unsupported against a :

-
-
-
-
-
-
- | -|Grouping operators|All grouping operators are unsupported against a , including the following:

-
-

Grouping operations must be performed on the client.| -|Aggregate operators|All aggregate operations are unsupported against a , including the following:

-
-
-
-
-
-
-

Aggregate operations must either be performed on the client or be encapsulated by a service operation.| -|Paging operators|The following paging operators are not supported against a :

-
-
-
-
-

**Note:** Paging operators that are executed on an empty sequence return null.| -|Other operators|The following operators are also not supported against a :

-
-
-
-
- | - - - -## Supported Expression Functions - - The following common-language runtime (CLR) methods and properties are supported because they can be translated in a query expression for inclusion in the request URI to an OData service: - -| Member|Supported OData Function| -|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| -||`string concat(string p0, string p1)`| -||`bool substringof(string p0, string p1)`| -||`bool endswith(string p0, string p1)`| -||`int indexof(string p0, string p1)`| -||`int length(string p0)`| -||`string replace(string p0, string find, string replace)`| -||`string substring(string p0, int pos)`| -||`string substring(string p0, int pos, int length)`| -||`string tolower(string p0)`| -||`string toupper(string p0)`| -||`string trim(string p0)`| - -| Member1|Supported OData Function| -|-------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| -||`int day(DateTime p0)`| -||`int hour(DateTime p0)`| -||`int minute(DateTime p0)`| -||`int month(DateTime p0)`| -||`int second(DateTime p0)`| -||`int year(DateTime p0)`| - - 1The equivalent date and time properties of and the method in Visual Basic are also supported. - -| Member|Supported OData Function| -|---------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| -||`decimal ceiling(decimal p0)`| -||`double ceiling(double p0)`| -||`decimal floor(decimal p0)`| -||`double floor(double p0)`| -||`decimal round(decimal p0)`| -||`double round(double p0)`| - -| Member|Supported OData Function| -|---------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| -||`bool isof(type p0)`| - - The client may also be able to evaluate additional CLR functions on the client. A is raised for any expression that cannot be evaluated on the client and cannot be translated into a valid request URI for evaluation on the server. - -## See also - -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) -- [Query Projections](query-projections-wcf-data-services.md) -- [Object Materialization](object-materialization-wcf-data-services.md) -- [OData: URI Conventions](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/) diff --git a/docs/framework/data/wcf/loading-deferred-content-wcf-data-services.md b/docs/framework/data/wcf/loading-deferred-content-wcf-data-services.md deleted file mode 100644 index c310e6e54d614..0000000000000 --- a/docs/framework/data/wcf/loading-deferred-content-wcf-data-services.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -description: "Learn more about: Loading Deferred Content (WCF Data Services)" -title: "Loading Deferred Content (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, client library" - - "WCF Data Services, deferred content" - - "WCF Data Services, loading data" -ms.assetid: 32f9b588-c832-44c4-a7e0-fcce635df59a ---- -# Loading Deferred Content (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -By default, WCF Data Services limits the amount of data that a query returns. However, you can explicitly load additional data, including related entities, paged response data, and binary data streams, from the data service when it is needed. This topic describes how to load such deferred content into your application. - -## Related Entities - - When you execute a query, only entities in the addressed entity set are returned. For example, when a query against the Northwind data service returns `Customers` entities, by default the related `Orders` entities are not returned, even though there is a relationship between `Customers` and `Orders`. Also, when paging is enabled in the data service, you must explicitly load subsequent data pages from the service. There are two ways to load related entities: - -- **Eager loading**: You can use the `$expand` query option to request that the query return entities that are related by an association to the entity set that the query requested. Use the method on the to add the `$expand` option to the query that is sent to the data service. You can request multiple related entity sets by separating them by a comma, as in the following example. All entities requested by the query are returned in a single response. The following example returns `Order_Details` and `Customers` together with the `Orders` entity set: - - [!code-csharp[Astoria Northwind Client#ExpandOrderDetailsSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#expandorderdetailsspecific)] - [!code-vb[Astoria Northwind Client#ExpandOrderDetailsSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#expandorderdetailsspecific)] - - WCF Data Services limits to 12 the number of entity sets that can be included in a single query by using the `$expand` query option. - -- **Explicit loading**: You can call the method on the instance to explicitly load related entities. Each call to the method creates a separate request to the data service. The following example explicitly loads `Order_Details` for an `Orders` entity: - - [!code-csharp[Astoria Northwind Client#LoadRelatedOrderDetailsSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#loadrelatedorderdetailsspecific)] - [!code-vb[Astoria Northwind Client#LoadRelatedOrderDetailsSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#loadrelatedorderdetailsspecific)] - - When you consider which option to use, realize that there is a tradeoff between the number of requests to the data service and the amount of data that is returned in a single response. Use eager loading when your application requires associated objects and you want to avoid the added latency of additional requests to explicitly retrieve them. However, if there are cases when the application only needs the data for specific related entity instances, you should consider explicitly loading those entities by calling the method. For more information, see [How to: Load Related Entities](how-to-load-related-entities-wcf-data-services.md). - -## Paged Content - - When paging is enabled in the data service, the number of entries in the feed that the data service returns is limited by the configuration of the data service. Page limits can be set separately for each entity set. For more information, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md). When paging is enabled, the final entry in the feed contains a link to the next page of data. This link is contained in a object. You obtain the URI to the next page of data by calling the method on the returned when the is executed. The returned object is then used to load the next page of results. You must enumerate the query result before you call the method. Consider using a `do…while` loop to first enumerate the query result and then check for a `non-null` next link value. When the method returns `null` (`Nothing` in Visual Basic), there are no additional result pages for the original query. The following example shows a `do…while` loop that loads paged customer data from the Northwind sample data service. - - [!code-csharp[Astoria Northwind Client#LoadNextLink](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#loadnextlink)] - [!code-vb[Astoria Northwind Client#LoadNextLink](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#loadnextlink)] - - When a query requests that related entities are returned in a single response together with the requested entity set, paging limits may affect nested feeds that are included inline with the response. For example, when a paging limit is set in the Northwind sample data service for the `Customers` entity set, an independent paging limit can also be set for the related `Orders` entity set, as in the following example from the Northwind.svc.cs file that defines the Northwind sample data service. - - [!code-csharp[Astoria Northwind Service#DataServiceConfigPaging](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind.svc.cs#dataserviceconfigpaging)] - [!code-vb[Astoria Northwind Service#DataServiceConfigPaging](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind.svc.vb#dataserviceconfigpaging)] - - In this case, you must implement paging for both the top-level `Customers` and the nested `Orders` entity feeds. The following example shows the `while` loop used to load pages of `Orders` entities related to a selected `Customers` entity. - - [!code-csharp[Astoria Northwind Client#LoadNextOrdersLink](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#loadnextorderslink)] - [!code-vb[Astoria Northwind Client#LoadNextOrdersLink](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#loadnextorderslink)] - - For more information, see [How to: Load Paged Results](how-to-load-paged-results-wcf-data-services.md). - -## Binary Data Streams - - WCF Data Services enables you to access binary large object (BLOB) data as a data stream. Streaming defers the loading of binary data until it is needed, and the client can more efficiently process this data. In order to take advantage of this functionality, the data service must implement the provider. For more information, see [Streaming Provider](streaming-provider-wcf-data-services.md). When streaming is enabled, entity types are returned without the related binary data. In this case, you must use the method of the class to access the data stream for the binary data from the service. Similarly, use the method to add or change binary data for an entity as a stream. For more information, see [Working with Binary Data](working-with-binary-data-wcf-data-services.md). - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/managing-the-data-service-context-wcf-data-services.md b/docs/framework/data/wcf/managing-the-data-service-context-wcf-data-services.md deleted file mode 100644 index ebd7b8f40a586..0000000000000 --- a/docs/framework/data/wcf/managing-the-data-service-context-wcf-data-services.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -description: "Learn more about: Managing the Data Service Context (WCF Data Services)" -title: "Managing the Data Service Context (WCF Data Services)" -ms.date: "03/30/2017" -ms.assetid: 15b19d09-7de7-4638-9556-6ef396cc45ec ---- -# Managing the Data Service Context (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -The class encapsulates operations that are supported against a specified data service. Although OData services are stateless, the context is not. Therefore, you can use the class to maintain state on the client between interactions with the data service in order to support features such as change management. This class also manages identities and tracks changes. - -## Merge Options and Identity Resolution - - When a is executed, the entities in the response feed are materialized into objects. For more information, see [Object Materialization](object-materialization-wcf-data-services.md). The way in which entries in a response message are materialized into objects is performed based on identity resolution and depends on the merge option under which the query was executed. When multiple queries or load requests are executed in the scope of a single , the WCF Data Services client only tracks a single instance of an object that has a specific key value. This key, which is used to perform identity resolution, uniquely identifies an entity. - - By default, the client only materializes an entry in the response feed into an object for entities that are not already being tracked by the . This means that changes to objects already in the cache are not overwritten. This behavior is controlled by specifying a value for queries and load operations. This option is specified by setting the property on the . The default merge option value is . This only materializes objects for entities that are not already being tracked, which means that existing objects are not overwritten. Another way to prevent changes to objects on the client from being overwritten by updates from the data service is to specify . When you specify , values of objects on the client are replaced by the latest values from the entries in the response feed, even if changes have already been made to these objects. When a merge option is used, the cannot send changes made on client objects to the data service. With this option, changes are always overwritten with values from the data service. - -## Managing Concurrency - - OData supports optimistic concurrency that enables the data service to detect update conflicts. The data service provider can be configured in such a way that the data service checks for changes to entities by using a concurrency token. This token includes one or more properties of an entity type that are validated by the data service to determine whether a resource has changed. Concurrency tokens, which are included in the eTag header of requests to and responses from the data service, are managed for you by the WCF Data Services client. For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md). - - The tracks changes made to objects that have been reported manually by using , , and , or by a . When the method is called, the client sends changes back to the data service. can fail when data changes in the client conflict with changes in the data service. When this occurs, you must query for the entity resource again to receive the update data. To overwrite changes in the data service, execute the query using the merge option. When you call again, the changes preserved on the client are persisted to the data service, as long as other changes have not already been made to the resource in the data service. - -## Saving Changes - - Changes are tracked in the instance but not sent to the server immediately. After you are finished with the required changes for a specified activity, call to submit all the changes to the data service. A object is returned after the operation is complete. The object includes a sequence of objects that, in turn, contain a sequence of or instances that represent the changes persisted or attempted. When an entity is created or modified in the data service, the includes a reference to the updated entity, including any server-generated property values, such as the generated `ProductID` value in the previous example. The client library automatically updates the .NET Framework object to have these new values. - - For successful insert and update operations, the state property of the or object associated with the operation is set to and the new values are merged by using . When an insert, update, or delete operation fails in the data service, the entity state remains the same as it was before was called, and the property of the is set to an that contains information about the error. For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md). - -### Setting the HTTP Method for Updates - - By default, the .NET Framework client library sends updates to existing entities as MERGE requests. A MERGE request updates selected properties of the entity; however the client always includes all properties in the MERGE request, even properties that have not changed. The OData protocol also supports sending PUT requests to update entities. In a PUT request, an existing entity is essentially replaced with a new instance of the entity with property values from the client. To use PUT requests, set the flag on the enumeration when calling . - -> [!NOTE] -> A PUT request will behave differently than a MERGE request when the client does not know about all properties of the entity. This might occur when projecting an entity type into a new type on the client. It might also occur when new properties have been added to the entity in the service data model and the property on the is set to `true` to ignore such client mapping errors. In these cases, a PUT request will reset any properties that are unknown to the client to their default values. - -### POST Tunneling - - By default, the client library sends create, read, update, and delete requests to an OData service by using the corresponding HTTP methods of POST, GET, PUT/MERGE/PATCH, and DELETE. This upholds the basic principles of Representational State Transfer (REST). However, not every Web server implementation supports the full set of HTTP methods. In some cases, the supported methods might be restricted to just GET and POST. This can happen when an intermediary, like a firewall, blocks requests with certain methods. Because the GET and POST methods are most often supported, OData prescribes a way to execute any unsupported HTTP methods by using a POST request. Known as *method tunneling* or *POST tunneling*, this enables a client to send a POST request with the actual method specified in the custom `X-HTTP-Method` header. To enable POST tunneling for requests, set the property on the instance to `true`. - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [Updating the Data Service](updating-the-data-service-wcf-data-services.md) -- [Asynchronous Operations](asynchronous-operations-wcf-data-services.md) -- [Batching Operations](batching-operations-wcf-data-services.md) diff --git a/docs/framework/data/wcf/media/wcf-data-service-item-template.png b/docs/framework/data/wcf/media/wcf-data-service-item-template.png deleted file mode 100644 index db28963ad62c8..0000000000000 Binary files a/docs/framework/data/wcf/media/wcf-data-service-item-template.png and /dev/null differ diff --git a/docs/framework/data/wcf/media/wcf-data-services-overview/windows-communication-foundation-data-services-architecture.gif b/docs/framework/data/wcf/media/wcf-data-services-overview/windows-communication-foundation-data-services-architecture.gif deleted file mode 100644 index bebcbc014338a..0000000000000 Binary files a/docs/framework/data/wcf/media/wcf-data-services-overview/windows-communication-foundation-data-services-architecture.gif and /dev/null differ diff --git a/docs/framework/data/wcf/number-of-entities-returned-by-a-query-wcf.md b/docs/framework/data/wcf/number-of-entities-returned-by-a-query-wcf.md deleted file mode 100644 index 2b0901761d4b0..0000000000000 --- a/docs/framework/data/wcf/number-of-entities-returned-by-a-query-wcf.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: "Learn more about: How to: Determine the Number of Entities Returned by a Query (WCF Data Services)" -title: "How to: Determine the Number of Entities Returned by a Query (WCF Data Services)" -ms.date: "03/30/2017" -ms.topic: how-to -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, row count" -ms.assetid: 03d41a82-df95-40ac-8439-a6c327d37ba8 ---- -# How to: Determine the Number of Entities Returned by a Query (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -With WCF Data Services, you can determine the number of entities that are in the entity set specified by a query URI. This count can be included either along with the query result or as an integer value. For more information, see [Querying the Data Service](querying-the-data-service-wcf-data-services.md). - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). - -## Example - - This example executes a query after calling the method. The property returns the number of entities in the `Customers` entity set. - - [!code-csharp[Astoria Northwind Client#CountAllCustomers](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#countallcustomers)] - [!code-vb[Astoria Northwind Client#CountAllCustomers](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#countallcustomers)] - -## Example - - This example calls the method to return only an integer value that is the number of entities in the `Customers` entity set. - - [!code-csharp[Astoria Northwind Client#CountAllCustomersValueOnly](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#countallcustomersvalueonly)] - [!code-vb[Astoria Northwind Client#CountAllCustomersValueOnly](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#countallcustomersvalueonly)] - -## See also - -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/object-materialization-wcf-data-services.md b/docs/framework/data/wcf/object-materialization-wcf-data-services.md deleted file mode 100644 index 8ec6133ca8ea4..0000000000000 --- a/docs/framework/data/wcf/object-materialization-wcf-data-services.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -description: "Learn more about: Object Materialization (WCF Data Services)" -title: "Object Materialization (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, client library" - - "WCF Data Services, querying" -ms.assetid: f0dbf7b0-0292-4e31-9ae4-b98288336dc1 ---- -# Object Materialization (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -When you use the **Add Service Reference** dialog to consume an Open Data Protocol (OData) feed in a .NET Framework-based client application, equivalent data classes are generated for each entity type in the data model exposed by the feed. For more information, see [Generating the Data Service Client Library](generating-the-data-service-client-library-wcf-data-services.md). Entity data that is returned by a query is materialized into an instance of one of these generated client data service classes. For information about merge options and identity resolution for tracked objects, see [Managing the Data Service Context](managing-the-data-service-context-wcf-data-services.md). - -WCF Data Services also enables you to define your own client data service classes rather than using the tool-generated data classes. This enables you to use your own data classes, also known as "plain-old CLR object" (POCO) data classes. When using these types of custom data classes, you should attribute the data class with either or and ensure that type names on the client match type names in the data model of the data service. - -After the library receives the query response message, it materializes the returned data from the OData feed into instances of client data service classes that are of the type of the query. The general process for materializing these objects is as follows: - -1. The client library reads the serialized type from the `entry` element in the response message feed and attempts to create a new instance of the correct type, in one of the following ways: - - - When the type declared in the feed has the same name as the type of the , a new instance of this type is created by using the empty constructor. - - - When the type declared in the feed has the same name as a type that is derived from the type of the , a new instance of this derived type is created by using the empty constructor. - - - When the type declared in the feed cannot be matched to the type of the or any derived types, a new instance of the queried type is created by using the empty constructor. - - - When the property is set, the supplied delegate is called to override the default name-based type mapping and a new instance of the type returned by the is created instead. If this delegate returns a null value, a new instance of the queried type is created instead. It may be required to override the default name-based type name mapping to support inheritance scenarios. - -2. The client library reads the URI value from the `id` element of the `entry`, which is the identity value of the entity. Unless a value of is used, the identity value is used to track the object in the . The identity value is also used to guarantee that only a single entity instance is created, even when an entity is returned multiple times in the query response. - -3. The client library reads properties from the feed entry and set the corresponding properties on the newly created object. When an object that has the same identity value already occurs in the , the properties are set based on the setting of the . The response might contain property values for which a corresponding property does not occur in the client type. When this occurs, the action depends on the value of the property of the . When this property is set to `true`, the missing property is ignored. Otherwise, an error is raised. Properties are set as follows: - - - Scalar properties are set to the corresponding value in the entry in the response message. - - - Complex properties are set to a new complex type instance, which are set with the properties of the complex type from the response. - - - Navigation properties that return a collection of related entities are set to a new or existing instance of , where `T` is the type of the related entity. This collection is empty unless the related objects have been loaded into the . For more information, see [Loading Deferred Content](loading-deferred-content-wcf-data-services.md). - - > [!NOTE] - > When the generated client data classes support data binding, navigation properties return instances of the class instead. For more information, see [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md). - -4. The event is raised. - -5. The client library attaches the object to the . The object is not attached when the is . - -## See also - -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) -- [Query Projections](query-projections-wcf-data-services.md) diff --git a/docs/framework/data/wcf/query-projections-wcf-data-services.md b/docs/framework/data/wcf/query-projections-wcf-data-services.md deleted file mode 100644 index e0bc4eaddaeef..0000000000000 --- a/docs/framework/data/wcf/query-projections-wcf-data-services.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -description: "Learn more about: Query Projections (WCF Data Services)" -title: "Query Projections (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "projection [WCF Data Services]" - - "WCF Data Services, projection" - - "query projection [WCF Data Services]" - - "WCF Data Services, querying" -ms.assetid: a09f4985-9f0d-48c8-b183-83d67a3dfe5f ---- - -# Query Projections (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -Projection provides a mechanism in the Open Data Protocol (OData) to reduce the amount of data in the feed returned by a query by specifying that only certain properties of an entity are returned in the response. For more information, see section 4.8. Select System Query Option ($select) in [URI Conventions (OData Version 2.0)](https://www.odata.org/documentation/odata-version-2-0/uri-conventions/). - -This topic describes how to define a query projection, what the requirements are for entity and non-entity types, making updates to projected results, creating projected types, and lists some projection considerations. - -## Defining a Query Projection - -You can add a projection clause to a query either by using the `$select` query option in a URI or by using the [select](../../../csharp/language-reference/keywords/select-clause.md) clause ([Select](../../../visual-basic/language-reference/queries/select-clause.md) in Visual Basic) in a LINQ query. Returned entity data can be projected into either entity types or non-entity types on the client. Examples in this topic demonstrate how to use the `select` clause in a LINQ query. - -> [!IMPORTANT] -> Data loss might occur in the data service when you save updates that were made to projected types. For more information, see [Projection Considerations](#considerations). - -## Requirements for Entity and Non-Entity Types - -Entity types must have one or more identity properties that make up the entity key. Entity types are defined on clients in one of the following ways: - -- By applying the or to the type. - -- When the type has a property named `ID`. - -- When the type has a property named *type*`ID`, where *type* is the name of the type. - -By default, when you project query results into a type defined at the client, the properties requested in the projection must exist in the client type. However, when you specify a value of `true` for the property of the , properties specified in the projection are not required to occur in the client type. - -### Making Updates to Projected Results - -When you project query results into entity types on the client, the can track those objects with updates to be sent back to the data service when the method is called. However, updates that are made to data projected into non-entity types on the client cannot be sent back to the data service. This is because without a key to identify the entity instance, the data service cannot update the correct entity in the data source. Non-entity types are not attached to the . - -When one or more properties of an entity type defined in the data service do not occur in the client type into which the entity is projected, inserts of new entities will not contain these missing properties. In this case, updates that are made to existing entities will **also** not include these missing properties. When a value exists for such a property, the update resets it to the default value for the property, as defined in the data source. - -### Creating Projected Types - -The following example uses an anonymous LINQ query that projects the address-related properties of the `Customers` type into a new `CustomerAddress` type, which is defined on the client and is attributed as an entity type: - -[!code-csharp[Astoria Northwind Client#SelectCustomerAddressSpecific](~/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#selectcustomeraddressspecific)] -[!code-vb[Astoria Northwind Client#SelectCustomerAddressSpecific](~/samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#selectcustomeraddressspecific)] - -In this example, the object initializer pattern is used to create a new instance of the `CustomerAddress` type instead of calling a constructor. Constructors are not supported when projecting into entity types, but they can be used when projecting into non-entity and anonymous types. Because `CustomerAddress` is an entity type, changes can be made and sent back to the data service. - -Also, the data from the `Customer` type is projected into an instance of the `CustomerAddress` entity type instead of an anonymous type. Projection into anonymous types is supported, but the data is read-only because anonymous types are treated as non-entity types. - -The settings of the are used for identity resolution during query projection. This means that if an instance of the `Customer` type already exists in the , an instance of `CustomerAddress` with the same identity will follow the identity resolution rules set by the - -The following describes the behaviors when projecting results into entity and non-entity types: - -**Creating a new projected instance by using initializers** - -- Example: - - [!code-csharp[Astoria Northwind Client#ProjectWithInitializer](~/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#projectwithinitializer)] - [!code-vb[Astoria Northwind Client#ProjectWithInitializer](~/samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#projectwithinitializer)] - -- Entity type: Supported - -- Non-entity type: Supported - -**Creating a new projected instance by using constructors** - -- Example: - - [!code-csharp[Astoria Northwind Client#ProjectWithConstructor](~/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#projectwithconstructor)] - [!code-vb[Astoria Northwind Client#ProjectWithConstructor](~/samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#projectwithconstructor)] - -- Entity type: A is raised. - -- Non-entity type: Supported - -**Using projection to transform a property value** - -- Example: - - [!code-csharp[Astoria Northwind Client#ProjectWithTransform](~/samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#projectwithtransform)] - [!code-vb[Astoria Northwind Client#ProjectWithTransform](~/samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#projectwithtransform)] - -- Entity type: This transformation is not supported for entity types because it can lead to confusion and potentially overwriting the data in the data source that belongs to another entity. A is raised. - -- Non-entity type: Supported - - - -## Projection Considerations - -The following additional considerations apply when defining a query projection. - -- When you define custom feeds for the Atom format, you must make sure that all entity properties that have custom mappings defined are included in the projection. When a mapped entity property is not included in the projection, data loss might occur. For more information, see [Feed Customization](feed-customization-wcf-data-services.md). - -- When inserts are made to a projected type that does not contain all of the properties of the entity in the data model of the data service, the properties not included in the projection at the client are set to their default values. - -- When updates are made to a projected type that does not contain all of the properties of the entity in the data model of the data service, existing values not included in the projection on the client will be overwritten with uninitialized default values. - -- When a projection includes a complex property, the entire complex object must be returned. - -- When a projection includes a navigation property, the related objects are loaded implicitly without having to call the method. The method is not supported for use in a projected query. - -- Query projections queries on the client are translated to use the `$select` query option in the request URI. When a query with projection is executed against a previous version of WCF Data Services that does not support the `$select` query option, an error is returned. This can also happen when the of the for the data service is set to a value of . For more information, see [Data Service Versioning](data-service-versioning-wcf-data-services.md). - -For more information, see [How to: Project Query Results](how-to-project-query-results-wcf-data-services.md). - -## See also - -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) diff --git a/docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md b/docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md deleted file mode 100644 index cf0a0637e4f17..0000000000000 --- a/docs/framework/data/wcf/querying-the-data-service-wcf-data-services.md +++ /dev/null @@ -1,153 +0,0 @@ ---- -description: "Learn more about: Querying the Data Service (WCF Data Services)" -title: "Querying the Data Service (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, client library" - - "WCF Data Services, querying" - - "WCF Data Services, accessing data" -ms.assetid: 823e9444-27aa-4f1f-be8e-0486d67f54c0 ---- -# Querying the Data Service (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -The WCF Data Services client library enables you to execute queries against a data service by using familiar .NET Framework programming patterns, including using language integrated query (LINQ). The client library translates a query, which is defined on the client as an instance of the class, into an HTTP GET request message. The library receives the response message and translates it into instances of client data service classes. These classes are tracked by the to which the belongs. - -## Data Service Queries - -The generic class represents a query that returns a collection of zero or more entity type instances. A data service query always belongs to an existing data service context. This context maintains the service URI and metadata information that is required to compose and execute the query. - -When you use the **Add Service Reference** dialog to add a data service to a .NET Framework-based client application, an entity container class is created that inherits from the class. This class includes properties that return typed instances. There is one property for each entity set that the data service exposes. These properties make it easier to create an instance of a typed . - -A query is executed in the following scenarios: - -- When results are enumerated implicitly, such as: - - - When a property on the that represents and entity set is enumerated, such as during a `foreach` (C#) or `For Each` (Visual Basic) loop. - - - When the query is assigned to a `List` collection. - -- When the or method is explicitly called. - -- When a LINQ query execution operator, such as or is called. - -The following query, when it is executed, returns all `Customers` entities in the Northwind data service: - -[!code-csharp[Astoria Northwind Client#GetAllCustomersSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#getallcustomersspecific)] -[!code-vb[Astoria Northwind Client#GetAllCustomersSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#getallcustomersspecific)] - -For more information, see [How to: Execute Data Service Queries](how-to-execute-data-service-queries-wcf-data-services.md). - -The WCF Data Services client supports queries for late-bound objects, such as when you use the *dynamic* type in C#. However, for performance reasons you should always compose strongly typed queries against the data service. The type and dynamic objects are not supported by the client. - -## LINQ Queries - -Because the class implements the interface defined by LINQ, the WCF Data Services client library is able to transform LINQ queries against entity set data into a URI that represents a query expression evaluated against a data service resource. The following example is a LINQ query that is equivalent to the previous that returns `Orders` that have a freight cost of more than $30 and orders the results by the freight cost: - -[!code-csharp[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addqueryoptionslinqspecific)] -[!code-vb[Astoria Northwind Client#AddQueryOptionsLinqSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addqueryoptionslinqspecific)] - -This LINQ query is translated into the following query URI that is executed against the Northwind-based [quickstart](quickstart-wcf-data-services.md) data service: - -```http -http://localhost:12345/Northwind.svc/Orders?Orderby=ShippedDate&?filter=Freight gt 30 -``` - -> [!NOTE] -> The set of queries expressible in the LINQ syntax is broader than those enabled in the representational state transfer (REST)-based URI syntax that is used by data services. A is raised when the query cannot be mapped to a URI in the target data service. - -For more information, see [LINQ Considerations](linq-considerations-wcf-data-services.md). - -## Adding Query Options - -Data service queries support all the query options that WCF Data Services provides. You call the method to append query options to a instance. returns a new instance that is equivalent to the original query but with the new query option set. The following query, when executed, returns `Orders` that are filtered by the `Freight` value and ordered by the `OrderID`, descending: - -[!code-csharp[Astoria Northwind Client#AddQueryOptionsSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addqueryoptionsspecific)] -[!code-vb[Astoria Northwind Client#AddQueryOptionsSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addqueryoptionsspecific)] - -You can use the `$orderby` query option to both order and filter a query based on a single property, as in the following example that filters and orders the returned `Orders` objects based on the value of the `Freight` property: - -[!code-csharp[Astoria Northwind Client#OrderWithFilter](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#orderwithfilter)] -[!code-vb[Astoria Northwind Client#OrderWithFilter](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#orderwithfilter)] - -You can call the method consecutively to construct complex query expressions. For more information, see [How to: Add Query Options to a Data Service Query](how-to-add-query-options-to-a-data-service-query-wcf-data-services.md). - -Query options give you another way to express the syntactic components of a LINQ query. For more information, see [LINQ Considerations](linq-considerations-wcf-data-services.md). - -> [!NOTE] -> The `$select` query option cannot be added to a query URI by using the method. We recommend that you use the LINQ method to have the client generate the `$select` query option in the request URI. - - - -## Client versus Server Execution - -The client executes a query in two parts. Whenever possible, expressions in a query are first evaluated on the client, and then a URI-based query is generated and sent to the data service for evaluation against data in the service. Consider the following LINQ query: - -[!code-csharp[Astoria Northwind Client#LinqQueryClientEvalSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#linqqueryclientevalspecific)] -[!code-vb[Astoria Northwind Client#LinqQueryClientEvalSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#linqqueryclientevalspecific)] - -In this example, the expression `(basePrice – (basePrice * discount))` is evaluated on the client. Because of this, the actual query URI `http://localhost:12345/northwind.svc/Products()?$filter=(UnitPrice gt 90.00M) and substringof('bike',ProductName)` that is sent to the data service contains the already calculated decimal value of `90` in the filter clause. The other parts of the filtering expression, including the substring expression, are evaluated by the data service. Expressions that are evaluated on the client follow common language runtime (CLR) semantics, while expressions sent to the data service rely on the data service implementation of the OData Protocol. You should also be aware of scenarios where this separate evaluation may cause unexpected results, such as when both the client and service perform time-based evaluations in different time zones. - -## Query Responses - -When executed, the returns an of the requested entity type. This query result can be cast to a object, as in the following example: - -[!code-csharp[Astoria Northwind Client#GetResponseSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#getresponsespecific)] -[!code-vb[Astoria Northwind Client#GetResponseSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#getresponsespecific)] - -The entity type instances that represent entities in the data service are created on the client by a process called object materialization. For more information, see [Object Materialization](object-materialization-wcf-data-services.md). The object implements to provide access to the results of the query. - -The also has the following members that enable you to access additional information about a query result: - -- - gets an error thrown by the operation, if any has occurred. - -- - contains the collection of HTTP response headers associated with the query response. - -- - gets the original that generated the . - -- - gets the HTTP response code for the query response. - -- - gets the total number of entities in the entity set when the method was called on the . - -- - returns a object that contains the URI of the next page of results. - -By default, WCF Data Services only returns data that is explicitly selected by the query URI. This gives you the option to explicitly load additional data from the data service when it is needed. A request is sent to the data service each time you explicitly load data from the data service. Data that can be explicitly loaded includes related entities, paged response data, and binary data streams. - -> [!NOTE] -> Because a data service may return a paged response, we recommend that your application use the programming pattern to handle a paged data service response. For more information, see [Loading Deferred Content](loading-deferred-content-wcf-data-services.md). - -The amount of data returned by a query can also be reduced by specifying that only certain properties of an entity are returned in the response. For more information, see [Query Projections](query-projections-wcf-data-services.md). - -## Getting a Count of the Total Number of Entities in the Set - -In some scenarios, it is helpful to know the total number of entities in an entity set and not merely the number returned by the query. Call the method on the to request that this total count of entities in the set be included with the query result. In this case, the property of the returned returns the total number of entities in the set. - -You can also get only the total count of entities in the set either as an or as a value by calling the or methods respectively. When these methods are called, a is not returned; only the count value is returned. For more information, see [How to: Determine the Number of Entities Returned by a Query](number-of-entities-returned-by-a-query-wcf.md). - -## In This Section - -- [Query Projections](query-projections-wcf-data-services.md) - -- [Object Materialization](object-materialization-wcf-data-services.md) - -- [LINQ Considerations](linq-considerations-wcf-data-services.md) - -- [How to: Execute Data Service Queries](how-to-execute-data-service-queries-wcf-data-services.md) - -- [How to: Add Query Options to a Data Service Query](how-to-add-query-options-to-a-data-service-query-wcf-data-services.md) - -- [How to: Determine the Number of Entities Returned by a Query](number-of-entities-returned-by-a-query-wcf.md) - -- [How to: Specify Client Credentials for a Data Service Request](specify-client-creds-for-a-data-service-request-wcf.md) - -- [How to: Set Headers in the Client Request](how-to-set-headers-in-the-client-request-wcf-data-services.md) - -- [How to: Project Query Results](how-to-project-query-results-wcf-data-services.md) - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/quickstart-wcf-data-services.md b/docs/framework/data/wcf/quickstart-wcf-data-services.md deleted file mode 100644 index 6dabb8e71c863..0000000000000 --- a/docs/framework/data/wcf/quickstart-wcf-data-services.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -description: "Learn more about: Quickstart (WCF Data Services)" -title: "Quickstart (WCF Data Services)" -ms.date: 08/24/2018 -helpviewer_keywords: - - "WCF Data Services, quick-start example" - - "WCF Data Services, Entity Data Model (EDM) service" -ms.assetid: 7b18ca1e-d4d6-4c7a-afb9-ce3cebb98a8d -recommendations: false ---- -# Quickstart (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -This quickstart helps you become familiar with WCF Data Services and the Open Data Protocol (OData) through a series of tasks that support the topics in [Getting Started](getting-started-with-wcf-data-services.md). - -## What you'll learn - -The first task in this quickstart shows how to create a data service to expose an OData feed from the Northwind sample database. In later topics, you will access the OData feed by using a Web browser, and also create a Windows Presentation Foundation (WPF) client application that consumes the OData feed by using client libraries. - -## Prerequisites - -To complete this quickstart, install the following components: - -- Visual Studio - -- An instance of SQL Server. This includes SQL Server Express, which is included in a default installation of Visual Studio 2015, or as part of the **Data storage and processing** workload in Visual Studio 2017 or later. - -- The Northwind sample database. To install the database, run the Transact-SQL script from [Northwind and pubs sample databases for Microsoft SQL Server](https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/northwind-pubs). - -## WCF data services quickstart tasks - - [Create the Data Service](creating-the-data-service.md) - - Define the ASP.NET application, define the data model, create the data service, and enable access to resources. - - [Access the Service from a Web Browser](accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md) - - Start the service from Visual Studio and access the service by submitting HTTP GET requests through a Web browser to the exposed feed. - - [Create the .NET Framework Client Application](creating-the-dotnet-client-application-wcf-data-services-quickstart.md) - - Create a WPF app to consume the OData feed, bind data to Windows controls, change data in the bound controls, and then send the changes back to the data service. - -> [!NOTE] -> Project files from a completed version of the quickstart can be downloaded from [GitHub](https://github.com/microsoftarchive/msdn-code-gallery-community-s-z/tree/master/WCF%20Data%20Services%20Quickstart%20(OData%20Service%20and%20WPF%20Client)). - -## Next steps - -> [!div class="nextstepaction"] -> [Start the quickstart](creating-the-data-service.md) - -## See also - -- [ADO.NET Entity Framework](../adonet/ef/index.md) diff --git a/docs/framework/data/wcf/reflection-provider-wcf-data-services.md b/docs/framework/data/wcf/reflection-provider-wcf-data-services.md deleted file mode 100644 index 45eee5dae442c..0000000000000 --- a/docs/framework/data/wcf/reflection-provider-wcf-data-services.md +++ /dev/null @@ -1,102 +0,0 @@ ---- -description: "Learn more about: Reflection Provider (WCF Data Services)" -title: "Reflection Provider (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, providers" -ms.assetid: ef5ba300-6d7c-455e-a7bd-d0cc6d211ad4 ---- -# Reflection Provider (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -In addition to exposing data from a data model through the Entity Framework, WCF Data Services can expose data that is not strictly defined in an entity-based model. The reflection provider exposes data in classes that return types that implement the interface. WCF Data Services uses reflection to infer a data model for these classes and can translate address-based queries against resources into language integrated query (LINQ)-based queries against the exposed types. - -> [!NOTE] -> You can use the method to return an interface from any class that implements the interface. This enables most generic collection types to be used as a data source for your data service. - -The reflection provider supports type hierarchies. For more information, see [How to: Create a Data Service Using the Reflection Provider](create-a-data-service-using-rp-wcf-data-services.md). - -## Inferring the Data Model - -When you create the data service, the provider infers the data model by using reflection. The following list shows how the reflection provider infers the data model: - -- Entity container - the class that exposes the data as properties that return an instance. When you address a reflection-based data model, the entity container represents the root of the service. Only one entity container class is supported for a given namespace. - -- Entity sets - properties that return instances are treated as entity sets. Entity sets are addressed directly as resources in the query. Only one property on the entity container can return an instance of a given type. - -- Entity types - the type `T` of the that the entity set returns. Classes that are part of an inheritance hierarchy are translated by the reflection provider into an equivalent entity type hierarchy. - -- Entity keys - each data class that is an entity type must have a key property. This property is attributed with the attribute (`[DataServiceKeyAttribute]`). - - > [!NOTE] - > You should only apply the attribute to a property that can be used to uniquely identify an instance of the entity type. This attribute is ignored when applied to a navigation property. - -- Entity type properties - other than the entity key, the reflection provider treats the accessible, non-indexer properties of a class that is an entity type as follows: - - - If the property returns a primitive type, then the property is assumed to be a property of an entity type. - - - If the property returns a type that is also an entity type, then the property is assumed to be a navigation property that represents the "one" end of a many-to-one or one-to-one relationship. - - - If the property returns an of an entity type, then the property is assumed to be a navigation property that represents the "many" end of a one-to-many or many-to-many relationship. - - - If the return type of the property is a value type, then the property represents a complex type. - -> [!NOTE] -> Unlike a data model that is based on the entity-relational model, models that are based on the reflection provider do not understand relational data. You should use the Entity Framework to expose relational data through WCF Data Services. - -## Data Type Mapping - -When a data model is inferred from .NET Framework classes, the primitive types in the data model are mapped to .NET Framework data types as follows: - -|.NET Framework data type|Data model type| -|------------------------------|---------------------| -| `[]`|`Edm.Binary`| -||`Edm.Boolean`| -||`Edm.Byte`| -||`Edm.DateTime`| -||`Edm.Decimal`| -||`Edm.Double`| -||`Edm.Guid`| -||`Edm.Int16`| -||`Edm.Int32`| -||`Edm.Int64`| -||`Edm.SByte`| -||`Edm.Single`| -||`Edm.String`| - -> [!NOTE] -> .NET Framework nullable value types are mapped to the same data model types as the corresponding value types that cannot be assigned a null. - -## Enabling Updates in the Data Model - -To allow updates to data that is exposed through this kind of data model, the reflection provider defines an interface. This interface instructs the data service on how to persist updates to the exposed types. To enable updates to resources that are defined by the data model, the entity container class must implement the interface. For an example of an implementation of the interface, see [How to: Create a Data Service Using a LINQ to SQL Data Source](create-a-data-service-using-linq-to-sql-wcf.md). - -The interface requires that the following members be implemented so that updates can be propagated to the data source by using the reflection provider: - -|Member|Description| -|------------|-----------------| -||Provides the functionality to add an object to a collection of related objects that are accessed from a navigation property.| -||Provides the functionality that cancels pending changes to the data.| -||Provides the functionality to create a new resource in the specified container.| -||Provides the functionality to delete a resource.| -||Provides the functionality to retrieve a resource that is identified by a specific query and type name.| -||Provides the functionality to return the value of a property of a resource.| -||Provides the functionality to remove an object to a collection of related objects accessed from a navigation property.| -||Provides the functionality to update a specified resource.| -||Provides the functionality to return the resource that is represented by a specific object instance.| -||Provides the functionality to save all pending changes.| -||Provides the functionality to set a related object reference by using a navigation property.| -||Provides the functionality to set the value of the property of a resource.| - -## Handling Concurrency - -WCF Data Services supports an optimistic concurrency model by enabling you to define a concurrency token for an entity. This concurrency token, which includes one or more properties of the entity, is used by the data service to determine whether a change has occurred in the data that is being requested, updated, or deleted. When token values obtained from the eTag in the request differ from the current values of the entity, an exception is raised by the data service. The is applied to an entity type to define a concurrency token in the reflection provider. The concurrency token cannot include a key property or a navigation property. For more information, see [Updating the Data Service](updating-the-data-service-wcf-data-services.md). - -## Using LINQ to SQL with the Reflection Provider - -Because the Entity Framework is natively supported by default, it is the recommended data provider for using relational data with WCF Data Services. However, you can use the reflection provider to use LINQ to SQL classes with a data service. The result sets that are returned by methods on the generated by the LINQ to SQL Object Relational Designer (O/R Designer) implement the interface. This enables the reflection provider to access these methods and return entity data from SQL Server by using the generated LINQ to SQL classes. However, because LINQ to SQL does not implement the interface, you need to add a partial class that extends the existing partial class to add the implementation. For more information, see [How to: Create a Data Service Using a LINQ to SQL Data Source](create-a-data-service-using-linq-to-sql-wcf.md). - -## See also - -- [Data Services Providers](data-services-providers-wcf-data-services.md) diff --git a/docs/framework/data/wcf/securing-wcf-data-services.md b/docs/framework/data/wcf/securing-wcf-data-services.md deleted file mode 100644 index 312c557defc66..0000000000000 --- a/docs/framework/data/wcf/securing-wcf-data-services.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -description: "Learn more about: Securing WCF Data Services" -title: "Securing WCF Data Services" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "securing application [WCF Data Services]" - - "WCF Data Services, security" -ms.assetid: 99fc2baa-a040-4549-bc4d-f683d60298af ---- -# Securing WCF Data Services - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -This article describes security considerations that are specific to developing, deploying, and running WCF Data Services and applications that access services that support the Open Data Protocol (OData). You should also follow recommendations for creating secure .NET Framework applications. - -When planning how to secure a WCF Data Services-based OData service, you must address both authentication, the process of discovering and verifying the identity of a principal, and authorization, the process of determining whether an authenticated principal is allowed to access the requested resources. Also consider whether to encrypt the message by using SSL. - -## Authenticating Client Requests - -WCF Data Services does not implement any kind of authentication of its own, but rather relies on the authentication provisions of the data service host. This means that the service assumes that any request that it receives has already been authenticated by the network host and that the host has correctly identified the principle for the request appropriately via the interfaces provided by WCF Data Services. These authentication options and approaches are detailed in the multipart [OData and Authentication series](https://devblogs.microsoft.com/odata/?s=%22OData+and+authentication%22). - -### Authentication Options for a WCF Data Service - - The following table lists some of the authentication mechanisms that are available to help you authenticate requests to a WCF Data Service. - -|Authentication Options|Description| -|----------------------------|-----------------| -|Anonymous authentication|When HTTP anonymous authentication is enabled, any principle is able to connect to the data service. Credentials are not required for anonymous access. Use this option only when you want to allow anyone to access the data service.| -|Basic and digest authentication|Credentials consisting of a user name and password are required for authentication. Supports authentication of non-Windows clients. **Security Note:** Basic authentication credentials (user name and password) are sent in the clear and can be intercepted. Digest authentication sends a hash based-on the supplied credentials, which makes it more secure than basic authentication. Both are susceptible to man-in-the-middle attacks. When using these authentication methods, you should consider encrypting communication between client and the data service by using the Secure Sockets Layer (SSL).

Microsoft Internet Information Services (IIS) provides an implementation of both basic and digest authentication for HTTP requests in an ASP.NET application. This Windows Authentication Provider implementation enables a .NET Framework client application to supply credentials in the HTTP header of the request to the data service to seamlessly negotiate authentication of a Windows user. For more information, see [Digest Authentication Technical Reference](/previous-versions/windows/it-pro/windows-server-2003/cc782794(v=ws.10)).

When you want to have your data service use basic authentication based on some custom authentication service and not Windows credentials, you must implement a custom ADP.NET HTTP Module for authentication.

For an example of how to use a custom basic authentication scheme with WCF Data Services, see the blog post [OData and Authentication – Part 6 – Custom Basic Authentication](https://devblogs.microsoft.com/odata/odata-and-authentication-part-6-custom-basic-authentication/).| -|Windows authentication|Windows-based credentials are exchanged by using NTLM or Kerberos. This mechanism is more secure than basic or digest authentication, but it requires that the client be a Windows-based application. IIS also provides an implementation of Windows authentication for HTTP requests in an ASP.NET application. For more information, see [ASP.NET Forms Authentication Overview](/previous-versions/aspnet/7t6b43z4(v=vs.100)).

For an example of how to use Windows authentication with WCF Data Services, see the blog post [OData and Authentication – Part 2 – Windows Authentication](https://devblogs.microsoft.com/odata/odata-and-authentication-part-2-windows-authentication/).| -|ASP.NET forms authentication|Forms authentication lets you authenticate users by using your own code and then maintain an authentication token in a cookie or in the page URL. You authenticate the user name and password of your users using a login form that you create. Unauthenticated requests are redirected to a login page, where the user provides credentials and submits the form. If the application authenticates the request, the system issues a ticket that contains a key for reestablishing the identity for subsequent requests. For more information, see [Forms Authentication Provider](/previous-versions/aspnet/9wff0kyh(v=vs.100)). **Security Note:** By default, the cookie that contains the forms authentication ticket is not secured when you use forms authentication in a ASP.NET Web application. You should consider requiring SSL to protect both the authentication ticket and the initial login credentials.

For an example of how to use forms authentication with WCF Data Services, see the blog post [OData and Authentication – Part 7 – Forms Authentication](https://devblogs.microsoft.com/odata/odata-and-authentication-part-7-forms-authentication/).| -|Claims-based authentication|In claims-based authentication, the data service relies on a trusted "third-party" identity provider service to authenticate the user. The identity provider positively authenticates the user that is requesting access to data service resources and issues a token that grants access to the requested resources. This token is then presented to the data service, which then grants access to the user based on the trust relationship with the identity service that issued the access token.

The benefit of using a claims-based authentication provider is that they can be used to authenticate various types of clients across trust domains. By employing such a third-party provider, a data service can offload the requirements of maintaining and authenticating users. OAuth 2.0 is a claims-based authentication protocol that is supported by Azure AppFabric Access Control for federated authorization as a service. This protocol supports REST-based services. For an example of how to use OAuth 2.0 with WCF Data Services, see the blog post [OData and Authentication – Part 8 – OAuth WRAP](https://devblogs.microsoft.com/odata/odata-and-authentication-part-8-oauth-wrap/).| - - - -### Authentication in the Client Library - - By default, the WCF Data Services client library does not supply credentials when making a request to an OData service. When login credentials are required by the data service to authenticate a user, these credentials can be supplied in a accessed from the property of the , as in the following example: - -```csharp -// Set the client authentication credentials. -context.Credentials = - new NetworkCredential(userName, password, domain); -``` - -```vb -' Set the client authentication credentials. -context.Credentials = _ - New NetworkCredential(userName, password, domain) -``` - - For more information, see [How to: Specify Client Credentials for a Data Service Request](specify-client-creds-for-a-data-service-request-wcf.md). - - When the data service requires login credentials that cannot be specified by using a object, such as a claims-based token or cookie, you must manually set headers in the HTTP request, usually the `Authorization` and `Cookie` headers. For more information about this kind of authentication scenario, see the blog post [ -OData and Authentication – Part 3 – ClientSide Hooks](https://devblogs.microsoft.com/odata/odata-and-authentication-part-3-clientside-hooks/). For an example of how to set HTTP headers in a request message, see [How to: Set Headers in the Client Request](how-to-set-headers-in-the-client-request-wcf-data-services.md). - -## Impersonation - - Generally, the data service accesses required resources, such as files on the server or a database, by using the credentials of the worker process that is hosting the data service. When using impersonation, ASP.NET applications can execute with the Windows identity (user account) of the user making the request. Impersonation is commonly used in applications that rely on IIS to authenticate the user, and the credentials of this principle are used to access the required resources. For more information, see [ASP.NET Impersonation](/previous-versions/aspnet/xh507fc5(v=vs.100)). - -## Configuring Data Service Authorization - - Authorization is the granting of access to application resources to a principle or process that is identified based on a previously successful authentication. As a general practice, you should only grant sufficient rights to users of the data service to perform the operations required by client applications. - -### Restrict Access to Data Service Resources - - By default, WCF Data Services enables you to grant common read and write access against data service resources (entity set and service operations) to any user that is able to access the data service. Rules that define read and write access can be defined separately for each entity set exposed by the data service, as well as to any service operations. We recommend limiting both read and write access to only the resources required by the client application. For more information, see [Minimum Resource Access Requirements](configuring-the-data-service-wcf-data-services.md#accessRequirements). - -### Implement Role-Based Interceptors - - Interceptors enable you to intercept requests against data service resources before they are acted on by the data service. For more information, see [Interceptors](interceptors-wcf-data-services.md). Interceptors enable you to make authorization decisions based the authenticated user that is making the request. For an example of how to restrict access to data service resources based on an authenticated user identity, see [How to: Intercept Data Service Messages](how-to-intercept-data-service-messages-wcf-data-services.md). - -### Restrict Access to the Persisted Data Store and Local Resources - - The accounts that are used to access the persisted store should be granted only enough rights in a database or the file system to support the requirements of the data service. When anonymous authentication is used, this is the account used to run the hosting application. For more information, see [How to: Develop a WCF Data Service Running on IIS](how-to-develop-a-wcf-data-service-running-on-iis.md). When impersonation is used, authenticated users must be granted access to these resources, usually as part of a Windows group. - -## Other Security Considerations - -### Secure the Data in the Payload - -OData is based on the HTTP protocol. In an HTTP message, the header may contain valuable user credentials, depending on the authentication implemented by the data service. The message body may also contain valuable customer data that must be protected. In both of these cases, we recommend that you use SSL to protect this information over the wire. - -### Ignored Message Headers and Cookies - - HTTP request headers, other than those that declare content types and resource locations, are ignored and are never set by the data service. - - Cookies can be used as part of an authentication scheme, such as with ASP.NET Forms Authentication. However, any HTTP cookies set on an incoming request are ignored by WCF DataServices. The host of a data service may process the cookie, but the WCF Data Services runtime never analyzes or returns cookies. The WCF Data Services client library also does not process cookies sent in the response. - -### Custom Hosting Requirements - - By default, WCF Data Services is created as an ASP.NET application hosted in IIS. This enables the data service to leverage the secure behaviors of this platform. You can define WCF Data Services that are hosted by a custom host. For more information, see [Hosting the Data Service](hosting-the-data-service-wcf-data-services.md). The components and platform hosting a data service must ensure the following security behaviors to prevent attacks on the data service: - -- Limit the length of the URI accepted in a data service request for all possible operations. - -- Limit the size of both incoming and outgoing HTTP messages. - -- Limit the total number of outstanding requests at any given time. - -- Limit the size of HTTP headers and their values, and provide WCF Data Services access to header data. - -- Detect and counter known attacks, such as TCP SYN and message replay attacks. - -### Values Are Not Further Encoded - - Property values sent to the data service are not further encoded by the WCF Data Services runtime. For example, when a string property of an entity contains formatted HTML content, the tags are not HTML encoded by the data service. The data service also does not further encode property values in the response. The client library also does not perform any additional encoding. - -### Considerations for Client Applications - - The following security considerations apply to applications that use the WCF Data Services client to access OData services: - -- The client library assumes that the protocols used to access the data service provide an appropriate level of security. - -- The client library uses all the default values for timeouts and parsing options of the underlying platform-provided transport stacks. - -- The client library does not read any settings from application configuration files. - -- The client library does not implement any cross domain access mechanisms. Instead, it relies on the mechanisms provided by the underlying HTTP stack. - -- The client library has no user interface elements, and it never tries to display or render the data that it receives or sends. - -- We recommend that client applications always validate user input as well as data accepted from untrusted services. - -## See also - -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/service-operations-wcf-data-services.md b/docs/framework/data/wcf/service-operations-wcf-data-services.md deleted file mode 100644 index 84510e7a8cde6..0000000000000 --- a/docs/framework/data/wcf/service-operations-wcf-data-services.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -description: "Learn more about: Service Operations (WCF Data Services)" -title: "Service Operations (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "service operations [WCF Data Services]" - - "WCF Data Services, service operations" -ms.assetid: 583a690a-e60f-4990-8991-d6efce069d76 ---- -# Service Operations (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services enables you to define service operations on a data service to expose methods on the server. Like other data service resources, service operations are addressed by URIs. Service operations enable you to expose business logic in a data service, such as to implement validation logic, to apply role-based security, or to expose specialized querying capabilities. Service operations are methods added to the data service class that derives from . Like all other data service resources, you can supply parameters to the service operation method. For example, the following service operation URI (based on the [quickstart](quickstart-wcf-data-services.md) data service) passes the value `London` to the `city` parameter: - -```http -http://localhost:12345/Northwind.svc/GetOrdersByCity?city='London' -``` - -The definition for this service operation is as follows: - -[!code-csharp[Astoria Northwind Service#ServiceOperationDef](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#serviceoperationdef)] -[!code-vb[Astoria Northwind Service#ServiceOperationDef](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#serviceoperationdef)] - -You can use the of the to directly access the data source that the data service is using. For more information, see [How to: Define a Service Operation](how-to-define-a-service-operation-wcf-data-services.md). - -For information on how to call a service operation from a .NET Framework client application, see [Calling Service Operations](calling-service-operations-wcf-data-services.md). - -## Service Operation Requirements - -The following requirements apply when defining service operations on the data service. If a method does not meet these requirements, it will not be exposed as a service operation for the data service. - -- The operation must be a public instance method that is a member of the data service class. - -- The operation method may only accept input parameters. Data sent in the message body cannot be accessed by the data service. - -- If parameters are defined, the type of each parameter must be a primitive type. Any data of a non-primitive type must be serialized and passed into a string parameter. - -- The method must return one of the following: - - - `void` (`Nothing` in Visual Basic) - - - - - - - - - An entity type in the data model that the data service exposes. - - - A primitive class such as integer or string. - -- In order to support query options such as sorting, paging, and filtering, service operation methods should return . Requests to service operations that include query options are rejected for operations that only return . - -- In order to support accessing related entities by using navigation properties, the service operation must return . - -- The method must be annotated with the `[WebGet]` or `[WebInvoke]` attribute. - - - `[WebGet]` enables the method to be invoked by using a GET request. - - - `[WebInvoke(Method = "POST")]` enables the method to be invoked by using a POST request. Other methods are not supported. - -- A service operation may be annotated with the that specifies that the return value from the method is a single entity rather than a collection of entities. This distinction dictates the resulting serialization of the response and the manner in which additional navigation property traversals are represented in the URI. For example, when using AtomPub serialization, a single resource type instance is represented as an entry element and a set of instances as a feed element. - -## Addressing Service Operations - -You can address service operations by placing the name of the method in the first path segment of a URI. As an example, the following URI accesses a `GetOrdersByState` operation that returns an collection of `Orders` objects. - -```http -http://localhost:12345/Northwind.svc/GetOrdersByState?state='CA'&includeItems=true -``` - -When calling a service operation, parameters are supplied as query options. The previous service operation accepts both a string parameter `state` and a Boolean parameter `includeItems` that indicates whether to include related `Order_Detail` objects in the response. - -The following are valid return types for a service operation: - -|Valid Return Types|URI Rules| -|------------------------|---------------| -|`void` (`Nothing` in Visual Basic)

-or-

Entity types

-or-

Primitive types|The URI must be a single path segment that is the name of the service operation. Query options are not allowed.| -||The URI must be a single path segment that is the name of the service operation. Because the result type is not an type, query options are not allowed.| -||Query path segments in addition to the path that is the name of the service operation are allowed. Query options are also allowed.| - -Additional path segments or query options may be added to the URI depending on the return type of the service operation. For example, the following URI accesses a `GetOrdersByCity` operation that returns an collection of `Orders` objects, ordered by `RequiredDate` in descending order, along with the related `Order_Details` objects: - -```http -http://localhost:12345/Northwind.svc/GetOrdersByCity?city='London'&$expand=Order_Details&$orderby=RequiredDate desc -``` - -## Service Operations Access Control - -Service-wide visibility of service operations is controlled by the method on the class in much the same way that entity set visibility is controlled by using the method. For example, the following line of code in the data service definition enables access to the `CustomersByCity` service operation. - -[!code-csharp[Astoria Northwind Service#ServiceOperationConfig](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#serviceoperationconfig)] -[!code-vb[Astoria Northwind Service#ServiceOperationConfig](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#serviceoperationconfig)] - -> [!NOTE] -> If a service operation has a return type that has been hidden by restricting access on the underlying entity sets, then the service operation will not be available to client applications. - -For more information, see [How to: Define a Service Operation](how-to-define-a-service-operation-wcf-data-services.md). - -## Raising Exceptions - -We recommend that you use the class whenever you raise an exception in the data service execution. This is because the data service runtime knows how to map properties of this exception object correctly to the HTTP response message. When you raise a in a service operation, the returned exception is wrapped in a . To return the base without the enclosing , you must override the method in the , extract the from the , and return it as the top-level error, as in the following example: - -[!code-csharp[Astoria Northwind Service#HandleExceptions](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_service/cs/northwind2.svc.cs#handleexceptions)] -[!code-vb[Astoria Northwind Service#HandleExceptions](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_service/vb/northwind2.svc.vb#handleexceptions)] - -## See also - -- [Interceptors](interceptors-wcf-data-services.md) diff --git a/docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md b/docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md deleted file mode 100644 index f8379e1292c5e..0000000000000 --- a/docs/framework/data/wcf/specify-client-creds-for-a-data-service-request-wcf.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -description: "Learn more about: How to: Specify Client Credentials for a Data Service Request (WCF Data Services)" -title: "How to: Specify Client Credentials for a Data Service Request (WCF Data Services)" -ms.date: "03/30/2017" -ms.topic: how-to -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, customizing requests" -ms.assetid: 1632f9af-e45f-4363-9222-03823daa8e28 ---- -# How to: Specify Client Credentials for a Data Service Request (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -By default, the client library does not supply credentials when sending a request to an OData service. However, you can specify that credentials be sent to authenticate requests to the data service by supplying a for the property of the . For more information, see [Securing WCF Data Services](securing-wcf-data-services.md). The example in this topic shows how to explicitly provide credentials that are used by the WCF Data Services client when requesting data from the data service. - - The example in this topic uses the Northwind sample data service and autogenerated client data service classes. This service and the client data classes are created when you complete the [WCF Data Services quickstart](quickstart-wcf-data-services.md). You can also use the [Northwind sample data service](https://services.odata.org/Northwind/Northwind.svc/) that is published on the OData Web site; this sample data service is read-only and attempting to save changes returns an error. The sample data services on the OData Web site allow anonymous authentication. - -## Example - - The following example is from the code-behind page for an Extensible Application Markup Language (XAML) file that is the main page of the Windows Presentation Framework application. This example displays a `LoginWindow` instance to collect authentication credentials from the user, and then uses these credentials when making a request to the data service. - - [!code-csharp[Astoria Northwind Client#ClientCredentials](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/clientcredentials.xaml.cs#clientcredentials)] - [!code-vb[Astoria Northwind Client#ClientCredentials](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/clientcredentials.xaml.vb#clientcredentials)] - -## Example - - The following XAML defines the main page of the WPF application. - - [!code-xaml[Astoria Northwind Client#ClientCredentialsXaml](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/clientcredentials.xaml#clientcredentialsxaml)] - -## Example - - The following example is from the code-behind page for the window that is used to collect the authentication credentials from the user before making a request to the data service. - - [!code-csharp[Astoria Northwind Client#ClientCredentialsLogin](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/clientcredentialslogin.xaml.cs#clientcredentialslogin)] - [!code-vb[Astoria Northwind Client#ClientCredentialsLogin](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/clientcredentialslogin.xaml.vb#clientcredentialslogin)] - -## Example - - The following XAML defines the login of the WPF application. - - [!code-xaml[Astoria Northwind Client#ClientCredentialsLoginXaml](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/clientcredentialslogin.xaml#clientcredentialsloginxaml)] - -## .NET Framework Security - - The following security considerations apply to the example in this topic: - -- To verify that the credentials supplied in this sample work, the Northwind data service must use an authentication scheme other than anonymous access. Otherwise, the Web site hosting the data service will not request credentials. - -- User credentials should only be requested during execution and should not be cached. Credentials must always be stored securely. - -- Data sent with Basic and Digest Authentication is not encrypted, so the data can be seen by an adversary. Additionally, basic authentication credentials (user name and password) are sent in cleartext and can be intercepted. - - For more information, see [Securing WCF Data Services](securing-wcf-data-services.md). - -## See also - -- [Securing WCF Data Services](securing-wcf-data-services.md) -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/streaming-provider-wcf-data-services.md b/docs/framework/data/wcf/streaming-provider-wcf-data-services.md deleted file mode 100644 index 07f5c1f8180dc..0000000000000 --- a/docs/framework/data/wcf/streaming-provider-wcf-data-services.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -description: "Learn more about: Streaming Provider (WCF Data Services)" -title: "Streaming Provider (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, providers" - - "WCF Data Services, binary data" - - "streaming data provider [WCF Data Services]" - - "WCF Data Services, streams" -ms.assetid: f0978fe4-5f9f-42aa-a5c2-df395d7c9495 ---- -# Streaming Provider (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -A data service can expose large object binary data. This binary data might represent video and audio streams, images, document files, or other types of binary media. When an entity in the data model includes one or more binary properties, the data service returns this binary data encoded as base-64 inside the entry in the response feed. Because loading and serializing large binary data in this manner can affect performance, the Open Data Protocol (OData) defines a mechanism for retrieving binary data independent of the entity to which it belongs. This is accomplished by separating the binary data from the entity into one or more data streams. - -- Media resource - binary data that belongs to an entity, such as a video, audio, image, or other type of media resource stream. - -- Media link entry - an entity that has a reference to a related media resource stream. - -With WCF Data Services, you define a binary resource stream by implementing a streaming data provider. The streaming provider implementation supplies the data service with the media resource stream associated with a specific entity as an object. This implementation enables the data service to accept and return media resources over HTTP as binary data streams of a specified MIME type. - -Configuring a data service to support the streaming of binary data requires the following steps: - -1. Attribute one or more entities in the data model as a media link entry. These entities should not include the binary data to be streamed. Any binary properties of an entity are always returned in the entry as base-64 encoded binary. - -2. Implement the T:System.Data.Services.Providers.IDataServiceStreamProvider interface. - -3. Define a data service that implements the interface. The data service uses the implementation to access the streaming data provider implementation. This method returns the appropriate streaming provider implementation. - -4. Enable large message streams in the Web application configuration. - -5. Enable access to binary resources on the server or in a data source. - -The examples in this topic are based on a sample streaming photo service, which is discussed in depth in the post [Data Services Streaming Provider Series: Implementing a Streaming Provider (Part 1)](/archive/blogs/astoriateam/data-services-streaming-provider-series-implementing-a-streaming-provider-part-1). The source code for the Streaming Photo Data Service sample is available on [GitHub](https://github.com/microsoftarchive/msdn-code-gallery-community-s-z/tree/master/Streaming%20Photo%20OData%20Service%20Sample). - -## Defining a Media Link Entry in the Data Model - -The data source provider determines the way that an entity is defined as a media link entry in the data model. - -**Entity Framework Provider** - -To indicate that an entity is a media link entry, add the `HasStream` attribute to the entity type definition in the conceptual model, as in the following example: - -[!code-xml[Astoria Photo Streaming Service#HasStream](../../../../samples/snippets/xml/VS_Snippets_Misc/astoria_photo_streaming_service/xml/photodata.edmx#hasstream)] - -You must also add the namespace `xmlns:m=http://schemas.microsoft.com/ado/2007/08/dataservices/metadata` either to the entity or to the root of the .edmx or .csdl file that defines the data model. - -For an example of a data service that uses the Entity Framework provider and exposes a media resource, see the post [Data Services Streaming Provider Series: Implementing a Streaming Provider (Part 1)](/archive/blogs/astoriateam/data-services-streaming-provider-series-implementing-a-streaming-provider-part-1). - -**Reflection Provider** - -To indicate that an entity is a media link entry, add the to the class that defines the entity type in the reflection provider. - -**Custom Data Service Provider** - -When using custom service providers, you implement the interface to define the metadata for your data service. For more information, see [Custom Data Service Providers](custom-data-service-providers-wcf-data-services.md). You indicate that a binary resource stream belongs to a by setting the property to `true` on the that represents the entity type, which is a media link entry. - -## Implementing the IDataServiceStreamProvider Interface - -To create a data service that supports binary data streams, you must implement the interface. This implementation enables the data service to return binary data as a stream to the client and consume binary data as a stream sent from the client. The data service creates an instance of this interface whenever it needs to access binary data as a stream. The interface specifies the following members: - -|Member name|Description| -|-----------------|-----------------| -||This method is invoked by the data service to delete the corresponding media resource when its media link entry is deleted. When you implement , this method contains the code that deletes the media resource associated with the supplied media link entry.| -||This method is invoked by the data service to return a media resource as a stream. When you implement , this method contains the code that provides a stream that is used by the data service to the return media resource that is associated with the provided media link entry.| -||This method is invoked by the data service to return the URI that is used to request the media resource for the media link entry. This value is used to create the `src` attribute in the content element of the media link entry and that is used to request the data stream. When this method returns `null`, the data service automatically determines the URI. Use this method when you need to provide clients with direct access to binary data without using the steam provider.| -||This method is invoked by the data service to return the Content-Type value of the media resource that is associated with the specified media link entry.| -||This method is invoked by the data service to return the eTag of the data stream that is associated with the specified entity. This method is used when you manage concurrency for the binary data. When this method returns null, the data service does not track concurrency.| -||This method is invoked by the data service to obtain the stream that is used when receiving the stream sent from the client. When you implement , you must return a writable stream to which the data service writes received stream data.| -||Returns a namespace-qualified type name that represents the type that the data service runtime must create for the media link entry that is associated with the data stream for the media resource that is being inserted.| - -## Creating the Streaming Data Service - -To provide the WCF Data Services runtime with access to the implementation, the data service that you create must also implement the interface. The following example shows how to implement the method to return an instance of the `PhotoServiceStreamProvider` class that implements . - -[!code-csharp[Astoria Photo Streaming Service#PhotoServiceStreamingProvider](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_service/cs/photodata.svc.cs#photoservicestreamingprovider)] -[!code-vb[Astoria Photo Streaming Service#PhotoServiceStreamingProvider](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_photo_streaming_service/vb/photodata.svc.vb#photoservicestreamingprovider)] - -For general information about how to create a data service, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md). - -## Enabling Large Binary Streams in the Hosting Environment - -When you create a data service in an ASP.NET Web application, Windows Communication Foundation (WCF) is used to provide the HTTP protocol implementation. By default, WCF limits the size of HTTP messages to only 65 KB. To be able to stream large binary data to and from the data service, you must also configure the Web application to enable large binary files and to use streams for transfer. To do this, add the following in the `` element of the application's Web.config file: - -> [!NOTE] -> You must use a transfer mode to ensure that the binary data in both the request and response messages are streamed and not buffered by WCF. - -For more information, see [Streaming Message Transfer](../../wcf/feature-details/streaming-message-transfer.md) and [Transport Quotas](../../wcf/feature-details/transport-quotas.md). - -By default, Internet Information Services (IIS) also limits the size of requests to 4 MB. To enable your data service to receive streams larger than 4 MB when running on IIS, you must also set the `maxRequestLength` attribute of the [httpRuntime Element (ASP.NET Settings Schema)](/previous-versions/dotnet/netframework-4.0/e1f13641(v=vs.100)) in the `` configuration section, as shown in the following example: - -## Using Data Streams in a Client Application - -The WCF Data Services client library enables you to both retrieve and update these exposed resources as binary streams on the client. For more information, see [Working with Binary Data](working-with-binary-data-wcf-data-services.md). - -## Considerations for Working with a Streaming Provider - -The following are things to consider when you implement a streaming provider and when you access media resources from a data service. - -- MERGE requests are not supported for media resources. Use a PUT request to change the media resource of an existing entity. - -- A POST request cannot be used to create a new media link entry. Instead, you must issue a POST request to create a new media resource, and the data service creates a new media link entry with default values. This new entity can be updated by a subsequent MERGE or PUT request. You may also consider caching the entity and make updates in the disposer, such as setting the property value to the value of the Slug header in the POST request. - -- When a POST request is received, the data service calls to create the media resource before it calls to create the media link entry. - -- An implementation of should not return a object. When you use this kind of stream, memory resource issues will occur when the service receives very large data streams. - -- The following are things to consider when storing media resources in a database: - - - A binary property that is a media resource should not be included in the data model. All properties exposed in a data model are returned in the entry in a response feed. - - - To improve performance with a large binary stream, we recommend that you create a custom stream class to store binary data in the database. This class is returned by your implementation and sends the binary data to the database in chunks. For a SQL Server database, we recommend that you use a FILESTREAM to stream data into the database when the binary data is larger than 1 MB. - - - Ensure that your database is designed to store the binary large streams that are to be received by your data service. - - - When a client sends a POST request to insert a media link entry with a media resource in a single request, is called to obtain the stream before the data service inserts the new entity into the database. A streaming provider implementation must be able to handle this data service behavior. Consider using a separate data table to store the binary data or store the data stream in a file until after the entity has been inserted into the database. - -- When you implement the , , or methods, you must use the eTag and Content-Type values that are supplied as method parameters. Do not set eTag or Content-Type headers in your provider implementation. - -- By default, the client sends large binary streams by using a chunked HTTP Transfer-Encoding. Because the ASP.NET Development Server does not support this kind of encoding, you cannot use this Web server to host a streaming data service that must accept large binary streams. For more information on ASP.NET Development Server, see [Web Servers in Visual Studio for ASP.NET Web Projects](/previous-versions/aspnet/58wxa9w5(v=vs.120)). - - - -## Versioning Requirements - -The streaming provider has the following OData protocol versioning requirements: - -- The streaming provider requires that the data service support version 2.0 of the OData protocol and later versions. - -For more information, see [Data Service Versioning](data-service-versioning-wcf-data-services.md). - -## See also - -- [Data Services Providers](data-services-providers-wcf-data-services.md) -- [Custom Data Service Providers](custom-data-service-providers-wcf-data-services.md) -- [Working with Binary Data](working-with-binary-data-wcf-data-services.md) diff --git a/docs/framework/data/wcf/toc.yml b/docs/framework/data/wcf/toc.yml deleted file mode 100644 index df31a7fbb52a8..0000000000000 --- a/docs/framework/data/wcf/toc.yml +++ /dev/null @@ -1,164 +0,0 @@ -- name: WCF Data Services 4.5 - href: index.md - items: - - name: Overview - href: wcf-data-services-overview.md - - name: Getting Started - href: getting-started-with-wcf-data-services.md - items: - - name: Exposing Your Data as a Service - href: exposing-your-data-as-a-service-wcf-data-services.md - - name: Accessing Data Service Resources - href: accessing-data-service-resources-wcf-data-services.md - - name: Using a Data Service in a Client Application - href: using-a-data-service-in-a-client-application-wcf-data-services.md - - name: Quickstart - href: quickstart-wcf-data-services.md - items: - - name: Creating the Data Service - href: creating-the-data-service.md - - name: Accessing the Service from a Web Browser - href: accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md - - name: Creating the .NET Framework Client Application - href: creating-the-dotnet-client-application-wcf-data-services-quickstart.md - - name: Application Scenarios - href: application-scenarios-wcf-data-services.md - - name: Resources - href: wcf-data-services-resources.md - - name: Defining WCF Data Services - href: defining-wcf-data-services.md - items: - - name: Configuring the Data Service - href: configuring-the-data-service-wcf-data-services.md - items: - - name: "How to: Develop a WCF Data Service Running on IIS" - href: how-to-develop-a-wcf-data-service-running-on-iis.md - - name: "How to: Enable Access to the Data Service" - href: how-to-enable-access-to-the-data-service-wcf-data-services.md - - name: "How to: Enable Paging of Data Service Results" - href: how-to-enable-paging-of-data-service-results-wcf-data-services.md - - name: Data Services Providers - href: data-services-providers-wcf-data-services.md - items: - - name: Entity Framework Provider - href: entity-framework-provider-wcf-data-services.md - items: - - name: "How to: Create a Data Service Using an ADO.NET Entity Framework Data Source" - href: create-a-data-service-using-an-adonet-ef-data-wcf.md - - name: Reflection Provider - href: reflection-provider-wcf-data-services.md - items: - - name: "How to: Create a Data Service Using the Reflection Provider" - href: create-a-data-service-using-rp-wcf-data-services.md - - name: "How to: Create a Data Service Using a LINQ to SQL Data Source" - href: create-a-data-service-using-linq-to-sql-wcf.md - - name: Custom Data Service Providers - href: custom-data-service-providers-wcf-data-services.md - - name: Streaming Provider - href: streaming-provider-wcf-data-services.md - - name: Service Operations - href: service-operations-wcf-data-services.md - items: - - name: "How to: Define a Service Operation" - href: how-to-define-a-service-operation-wcf-data-services.md - - name: Feed Customization - href: feed-customization-wcf-data-services.md - items: - - name: "How to: Customize Feeds with the Entity Framework Provider" - href: how-to-customize-feeds-with-ef-provider-wcf-data-services.md - - name: "How to: Customize Feeds with the Reflection Provider" - href: how-to-customize-feeds-with-the-reflection-provider-wcf-data-services.md - - name: Interceptors - href: interceptors-wcf-data-services.md - items: - - name: "How to: Intercept Data Service Messages" - href: how-to-intercept-data-service-messages-wcf-data-services.md - - name: Developing and Deploying WCF Data Services - href: developing-and-deploying-wcf-data-services.md - - name: Securing WCF Data Services - href: securing-wcf-data-services.md - - name: Hosting the Data Service - href: hosting-the-data-service-wcf-data-services.md - - name: Data Service Versioning - href: data-service-versioning-wcf-data-services.md - - name: WCF Data Services Protocol Implementation Details - href: wcf-data-services-protocol-implementation-details.md - - name: Using actions to implement server-side behavior - href: using-actions-to-implement-server-side-behavior.md - - name: WCF Data Services Client Library - href: wcf-data-services-client-library.md - items: - - name: Generating the Data Service Client Library - href: generating-the-data-service-client-library-wcf-data-services.md - items: - - name: WCF Data Service Client Utility (DataSvcUtil.exe) - href: wcf-data-service-client-utility-datasvcutil-exe.md - - name: "How to: Add a Data Service Reference" - href: how-to-add-a-data-service-reference-wcf-data-services.md - - name: "How to: Manually Generate Client Data Service Classes" - href: how-to-manually-generate-client-data-service-classes-wcf-data-services.md - - name: Querying the Data Service - href: querying-the-data-service-wcf-data-services.md - items: - - name: Query Projections - href: query-projections-wcf-data-services.md - items: - - name: "How to: Project Query Results" - href: how-to-project-query-results-wcf-data-services.md - - name: LINQ Considerations - href: linq-considerations-wcf-data-services.md - - name: Object Materialization - href: object-materialization-wcf-data-services.md - - name: "How to: Execute Data Service Queries" - href: how-to-execute-data-service-queries-wcf-data-services.md - - name: "How to: Add Query Options to a Data Service Query" - href: how-to-add-query-options-to-a-data-service-query-wcf-data-services.md - - name: "How to: Determine the Number of Entities Returned by a Query" - href: number-of-entities-returned-by-a-query-wcf.md - - name: "How to: Specify Client Credentials for a Data Service Request" - href: specify-client-creds-for-a-data-service-request-wcf.md - - name: "How to: Set Headers in the Client Request" - href: how-to-set-headers-in-the-client-request-wcf-data-services.md - - name: Loading Deferred Content - href: loading-deferred-content-wcf-data-services.md - items: - - name: "How to: Load Related Entities" - href: how-to-load-related-entities-wcf-data-services.md - - name: "How to: Load Paged Results" - href: how-to-load-paged-results-wcf-data-services.md - - name: Updating the Data Service - href: updating-the-data-service-wcf-data-services.md - items: - - name: "How to: Add, Modify, and Delete Entities" - href: how-to-add-modify-and-delete-entities-wcf-data-services.md - - name: "How to: Define Entity Relationships" - href: how-to-define-entity-relationships-wcf-data-services.md - - name: "How to: Attach an Existing Entity to the DataServiceContext" - href: attach-an-existing-entity-to-dc-wcf-data.md - - name: Asynchronous Operations - href: asynchronous-operations-wcf-data-services.md - items: - - name: "How to: Execute Asynchronous Data Service Queries" - href: how-to-execute-asynchronous-data-service-queries-wcf-data-services.md - - name: "How to: Create an Asynchronous Windows Presentation Framework Application" - href: create-an-asynchronous-wpf-application-wcf-data-services.md - - name: Batching Operations - href: batching-operations-wcf-data-services.md - items: - - name: "How to: Execute Queries in a Batch" - href: how-to-execute-queries-in-a-batch-wcf-data-services.md - - name: Binding Data to Controls - href: binding-data-to-controls-wcf-data-services.md - items: - - name: "How to: Bind Data to Windows Presentation Foundation Elements" - href: bind-data-to-wpf-elements-wcf-data-services.md - - name: "How to: Bind Data Using a Project Data Source" - href: how-to-bind-data-using-a-project-data-source-wcf-data-services.md - - name: "How to: Customize Data Binding Behaviors" - href: how-to-customize-data-binding-behaviors-wcf-data-services.md - - name: Calling Service Operations - href: calling-service-operations-wcf-data-services.md - - name: Managing the Data Service Context - href: managing-the-data-service-context-wcf-data-services.md - - name: Working with Binary Data - href: working-with-binary-data-wcf-data-services.md diff --git a/docs/framework/data/wcf/updating-the-data-service-wcf-data-services.md b/docs/framework/data/wcf/updating-the-data-service-wcf-data-services.md deleted file mode 100644 index 55b0ee926a5fb..0000000000000 --- a/docs/framework/data/wcf/updating-the-data-service-wcf-data-services.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -description: "Learn more about: Updating the Data Service (WCF Data Services)" -title: "Updating the Data Service (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, changing data" - - "WCF Data Services, client library" -ms.assetid: 00d993be-ffed-4dea-baf7-6eea982cdb54 ---- -# Updating the Data Service (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -When you use the WCF Data Services client library to consume an Open Data Protocol (OData) feed, the library translates the entries in the feed into instances of client data service classes. These data service classes are tracked by using the to which the belongs. The client tracks changes to entities that you report by using methods on . These methods enable the client to track added and deleted entities and also changes that you make to property values or to relationships between entity instances. Those tracked changes are sent back to the data service as REST-based operations when you call the method. - -> [!NOTE] -> When you use an instance of to bind data to controls, changes made to data in the bound control are automatically reported to the . For more information, see [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md). - -## Adding, Modifying, and Changing Entities - - When you use the **Add Service Reference** dialog in Visual Studio to add a reference to an OData feed, the resulting client data service classes each have a static *Create* method that takes one parameter for each non-nullable entity property. You can use this method to create instances of entity type classes, as in the following example: - - [!code-csharp[Astoria Northwind Client#CreateNewProduct](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#createnewproduct)] - [!code-vb[Astoria Northwind Client#CreateNewProduct](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#createnewproduct)] - - To add an entity instance, call the appropriate *AddTo* method on the class generated by the **Add Service Reference** dialog box, as in the following example: - - [!code-csharp[Astoria Northwind Client#AddProductSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addproductspecific)] - [!code-vb[Astoria Northwind Client#AddProductSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addproductspecific)] - - This adds the object to the context and into the correct entity set. You can also call , but you must instead supply the entity set name. If the added entity has one or more relationships to other entities, you can either use the method or use one of the previous methods and also explicitly define those links. These operations are discussed later in this topic. - - To modify an existing entity instance, first query for that entity, make the desired changes to its properties, and then call the method on the to indicate to the client library that it needs to send an update for that object, as shown in the following example: - - [!code-csharp[Astoria Northwind Client#ModifyCustomerSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#modifycustomerspecific)] - [!code-vb[Astoria Northwind Client#ModifyCustomerSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#modifycustomerspecific)] - - To delete an entity instance, call the method on the , as shown in the following example: - - [!code-csharp[Astoria Northwind Client#DeleteProductSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#deleteproductspecific)] - [!code-vb[Astoria Northwind Client#DeleteProductSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#deleteproductspecific)] - - For more information, see [How to: Add, Modify, and Delete Entities](how-to-add-modify-and-delete-entities-wcf-data-services.md). - -## Attaching Entities - - The client library enables you to save updates that you made to an entity without first executing a query to load the entity into the . Use the method to attach an existing object to a specific entity set in the . You can then modify the object and save the changes to the data service. In the following example, a customer object that has been changed is attached to the context and then is called to mark the attached object as before is called: - - [!code-csharp[Astoria Northwind Client#AttachObjectSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#attachobjectspecific)] - [!code-vb[Astoria Northwind Client#AttachObjectSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#attachobjectspecific)] - - The following considerations apply when attaching objects: - -- An object is attached in the state. - -- When an object is attached, objects that are related to the attached object are not also attached. - -- An object cannot be attached if the entity is already being tracked by the context. - -- The method overload that takes an `etag` parameter is used when you attach an entity object that was received along with an eTag value. This eTag value is then used to check for concurrency when changes to the attached object are saved. - - For more information, see [How to: Attach an Existing Entity to the DataServiceContext](attach-an-existing-entity-to-dc-wcf-data.md). - -## Creating and Modifying Relationship Links - - When you add a new entity by using either the method or the appropriate *AddTo* method of the class that the **Add Service Reference** dialog generates, any relationships between the new entity and related entities are not automatically defined. - - You can create and change relationships between entity instances and have the client library reflect those changes in the data service. Relationships between entities are defined as associations in the model, and the tracks each relationship as a link object in the context. WCF Data Services provides the following methods on the class to create, modify, and delete these links: - -|Method|Description| -|------------|-----------------| -||Creates a new link between two related entity objects. Calling this method is equivalent to calling and to both create the new object and define the relationship to an existing object.| -||Creates a new link between two related entity objects.| -||Updates an existing link between two related entity objects. is also used to delete links with a cardinality of zero-or-one-to-one (`0..1:1`) and one-to-one (`1:1`). You can do this by setting the related object to `null`.| -||Marks a link that the context is tracking for deletion when the method is called. Use this method when you delete a related object or change a relationship by first deleting the link to an existing object and then adding a link to the new related object.| -||Notifies the context of an existing link between two entity objects. The context assumes that this relationship already exists in the data service and does not try to create the link when you call the method. Use this method when you attach objects to a context and need to also attach the link between the two. If you are defining a new relationship, you should instead use .| -||Stops tracking the specified link in the context. This method is used to delete one-to-many (`*:*`) relationships. For relationship links with a cardinality of one, you must instead use .| - - The following example shows how to use the method to add a new `Order_Detail` that is related to an existing `Orders` entity. Because the new `Order_Details` object is now tracked by the , the relationship of the added `Order_Details` object to the existing `Products` entity is defined by calling the method: - - [!code-csharp[Astoria Northwind Client#AddOrderDetailToOrderSpecific](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#addorderdetailtoorderspecific)] - [!code-vb[Astoria Northwind Client#AddOrderDetailToOrderSpecific](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#addorderdetailtoorderspecific)] - - While the method defines links that must be created in the data service, to have these links reflected in the objects that are in the context, you must also set the navigation properties on the objects themselves. In the previous example, you should set the navigation properties as follows: - - [!code-csharp[Astoria Northwind Client#SetNavProps](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_northwind_client/cs/source.cs#setnavprops)] - [!code-vb[Astoria Northwind Client#SetNavProps](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_northwind_client/vb/source.vb#setnavprops)] - - For more information, see [How to: Define Entity Relationships](how-to-define-entity-relationships-wcf-data-services.md). - -## Saving Changes - - Changes are tracked in the instance but not sent to the server immediately. After you are finished with the required changes for a specified activity, call to submit all the changes to the data service. For more information, see [Managing the Data Service Context](managing-the-data-service-context-wcf-data-services.md). You can also save changes asynchronously by using the and methods. For more information, see [Asynchronous Operations](asynchronous-operations-wcf-data-services.md). - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [Querying the Data Service](querying-the-data-service-wcf-data-services.md) -- [Asynchronous Operations](asynchronous-operations-wcf-data-services.md) -- [Batching Operations](batching-operations-wcf-data-services.md) -- [Object Materialization](object-materialization-wcf-data-services.md) -- [Managing the Data Service Context](managing-the-data-service-context-wcf-data-services.md) diff --git a/docs/framework/data/wcf/using-a-data-service-in-a-client-application-wcf-data-services.md b/docs/framework/data/wcf/using-a-data-service-in-a-client-application-wcf-data-services.md deleted file mode 100644 index 99c244ee3f3ef..0000000000000 --- a/docs/framework/data/wcf/using-a-data-service-in-a-client-application-wcf-data-services.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -description: "Learn more about: Using a Data Service in a Client Application (WCF Data Services)" -title: "Using a Data Service in a Client Application (WCF Data Services)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, client library" - - "WCF Data Services, getting started" -ms.assetid: 90872d0c-e989-4490-b3e9-54afb10d33d4 ---- -# Using a Data Service in a Client Application (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -You can access a service that exposes an Open Data Protocol (OData) feed by supplying a URI to a Web browser. The URI provides the address of a resource, and request messages are sent to these addresses to access or change the underlying data that the resource represents. The browser issues an HTTP GET command and returns the requested resource as an OData feed. For more information, see [Accessing the Service from a Web Browser](accessing-the-service-from-a-web-browser-wcf-data-services-quickstart.md). - - Although a Web browser may be useful for testing that an OData service returns the expected data, production OData services that enable you to also create, update, and delete data are generally accessed by application code or scripting languages in a Web page. This topic provides an overview of how to access OData feeds from a client application. - -## Accessing and Changing Data Using REST Semantics - - OData helps guarantee interoperability between services that expose OData feeds and applications that consume OData feeds. Applications access and change data in an OData-based service by sending request messages of a specific HTTP action and with a URI that addresses an entity resource against which the action should be performed. When entity data must be supplied, it is supplied as a specifically encoded payload in the body of the message. - -### HTTP Actions - - OData supports the following HTTP actions to perform create, read, update, and delete operations on the entity data that the addressed resource represents: - -- **HTTP GET** - This is the default action when a resource is accessed from a browser. No payload is supplied in the request message, and a response method with a payload that contains the requested data is returned. - -- **HTTP POST** - Inserts new entity data into the supplied resource. Data to be inserted is supplied in the payload of the request message. The payload of the response message contains the data for the newly created entity. This includes any autogenerated key values. The header also contains the URI that addresses the new entity resource. - -- **HTTP DELETE** - Deletes the entity data that the specified resource represents. A payload is not present in the request or response messages. - -- **HTTP PUT** - Replaces existing entity data at the requested resource with new data that is supplied in the payload of the request message. - -- **HTTP MERGE** - Because of inefficiencies in executing a delete followed by an insert in the data source just to change entity data, OData introduces a new HTTP MERGE action. The payload of the request message contains the properties that must be changed on the addressed entity resource. Because HTTP MERGE is not defined in the HTTP specification, it may require additional processing to route a HTTP MERGE request through non-OData aware servers. - - For more information, see [OData: Operations](https://www.odata.org/documentation/odata-version-2-0/operations/). - -### Payload Formats - - For an HTTP PUT, HTTP POST, or HTTP MERGE request, the payload of a request message contains the entity data that you send to the data service. The contents of the payload depend on the data format of the message. The HTTP responses to all actions except DELETE also contain such a payload. OData supports the following payload formats for accessing and changing data with the service: - -- **Atom** - An XML-based message encoding that is defined by OData as an extension to the Atom Publishing Protocol (AtomPub) to enable data exchange over HTTP for Web feeds, podcasts, wikis, and XML-based Internet functionality. For more information, see [OData: Atom Format](https://www.odata.org/documentation/odata-version-2-0/atom-format/). - -- **JSON** - JavaScript Object Notation (JSON) is a lightweight data interchange format that is based on a subset of the JavaScript Programming Language. For more information, see [OData: JSON Format](https://www.odata.org/documentation/odata-version-2-0/json-format/). - - The message format of the payload is requested in the header of the HTTP request message. For more information, see [OData: Operations](https://www.odata.org/documentation/odata-version-2-0/operations/). - -## Accessing and Changing Data Using Client Libraries - - WCF Data Services includes client libraries that enable you to more easily consume an OData feed from .NET Framework and Silverlight-based client applications. These libraries simplify sending and receiving HTTP messages. They also translate the message payload into CLR objects that represent entity data. The client libraries feature the two core classes and . These classes enable you to query a data service and then work with the returned entity data as CLR objects. For more information, see [WCF Data Services Client Library](wcf-data-services-client-library.md) and [WCF Data Services (Silverlight)](/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc838234(v=vs.95)). - - You can use the **Add Service Reference** dialog in Visual Studio to add a reference to a data service. This tool requests the service metadata from a referenced data service and generates the that represents a data service, as well as generates the client data service classes that represent entities. For more information, see [Generating the Data Service Client Library](generating-the-data-service-client-library-wcf-data-services.md). - - There are programming libraries available that you can use to consume an OData feed in other kinds of client applications. For more information on OData SDK, see [OData SDK - Sample Code](https://www.odata.org/ecosystem/#sdk). - -## See also - -- [Accessing Data Service Resources](accessing-data-service-resources-wcf-data-services.md) -- [Quickstart](quickstart-wcf-data-services.md) diff --git a/docs/framework/data/wcf/using-actions-to-implement-server-side-behavior.md b/docs/framework/data/wcf/using-actions-to-implement-server-side-behavior.md deleted file mode 100644 index e0e324e6f95da..0000000000000 --- a/docs/framework/data/wcf/using-actions-to-implement-server-side-behavior.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -description: "Learn more about: Using actions to implement server-side behavior" -title: "Using actions to implement server-side behavior" -ms.date: "03/30/2017" -ms.assetid: 11a372db-7168-498b-80d2-9419ff557ba5 ---- -# Using actions to implement server-side behavior - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -OData Actions provide a way to implement a behavior that acts upon a resource retrieved from an OData service. For example consider a digital movie as a resource, there are many things you may do with a digital movie: check-out, rate/comment, or check-in. These are all examples of Actions that may be implemented by a WCF Data Service that manages digital movies. Actions are described in an OData response that contains a resource on which the Action can be invoked. When a user requests a resource that represents a digital movie the response returned from the WCF Data Service contains information about the Actions that are available for that resource. The availability of an Action can depend on the state of the data service or resource. For example once a digital movie is checked out it cannot be checked out by another user. Clients can invoke an action simply by specifying a URL. For example, `http://MyServer/MovieService.svc/Movies(6)` would identify a specific digital movie and `http://MyServer/MovieService.svc/Movies(6)/Checkout` would invoke the action on the specific movie. Actions allow you to expose you service model without exposing your data model. Continuing with the movie service example, you may wish to allow a user to rate a movie, but not directly expose the rating data as a resource. You could implement a Rate Action to allow the user to rate a movie but not directly access the rating data as a resource. - -## Implementing an action - - To implement a service action you must implement the , [IDataServiceActionProvider](/previous-versions/dotnet/wcf-data-services/hh859915(v=vs.103)), and [IDataServiceInvokable](/previous-versions/dotnet/wcf-data-services/hh859893(v=vs.103)) interfaces. allows WCF Data Services to get your implementation of [IDataServiceActionProvider](/previous-versions/dotnet/wcf-data-services/hh859915(v=vs.103)). [IDataServiceActionProvider](/previous-versions/dotnet/wcf-data-services/hh859915(v=vs.103)) allows WCF Data Services to create, find, describe and invoke service actions. [IDataServiceInvokable](/previous-versions/dotnet/wcf-data-services/hh859893(v=vs.103)) allows you to invoke the code that implements the service actions’ behavior and get the results, if any. Keep in mind that WCF Data Services are Per-Call WCF Services, a new instance of the service will be created each time the service is called. Make sure no unnecessary work is done when the service is created. - -### IServiceProvider - - contains a method called . This method is called by WCF Data Services to retrieve a number of service providers, including metadata service providers and data service action providers. When asked for a data service action provider, return your [IDataServiceActionProvider](/previous-versions/dotnet/wcf-data-services/hh859915(v=vs.103)) implementation. - -### IDataServiceActionProvider - - [IDataServiceActionProvider](/previous-versions/dotnet/wcf-data-services/hh859915(v=vs.103)) contains methods that allow you to retrieve information about the available actions. When you implement [IDataServiceActionProvider](/previous-versions/dotnet/wcf-data-services/hh859915(v=vs.103)) you are augmenting the metadata for your service which is defined by your service’s implementation of [IDataServiceActionProvider](/previous-versions/dotnet/wcf-data-services/hh859915(v=vs.103)) with Actions and handling dispatch to those actions as appropriate. - -#### AdvertiseServiceAction - - The [AdvertiseServiceAction method](/previous-versions/dotnet/wcf-data-services/hh859971(v=vs.103)) is called to determine what actions are available for the specified resource. This method is only called for actions that are not always available. It is used to check if the action should be included in the OData response based upon the state of the resource being requested or the state of the service. How this check is accomplished is completely up to you. If it is an expensive to calculate availability and the current resource is in a feed, it is acceptable to skip the check and advertise the action. The `inFeed` parameter is set to `true` if the current resource being returned is part of a feed. - -#### CreateInvokable - - [CreateInvokable](/previous-versions/dotnet/wcf-data-services/hh859940(v=vs.103)) is called to create a [IDataServiceInvokable](/previous-versions/dotnet/wcf-data-services/hh859893(v=vs.103)) that contains a delegate that encapsulates the code that implements the action’s behavior. This creates the [IDataServiceInvokable](/previous-versions/dotnet/wcf-data-services/hh859893(v=vs.103)) instance but does not invoke the action. WCF Data Service Actions have side effects and need to work in conjunction with the Update Provider to save those changes to disk. The [IDataServiceInvokable.Invoke](/previous-versions/dotnet/wcf-data-services/hh859924(v=vs.103)) method is called from the Update Provider’s SaveChanges() method is called. - -#### GetServiceActions - - This method returns a collection of [ServiceAction](/previous-versions/dotnet/wcf-data-services/hh544089(v=vs.103)) instances that represent all of the actions a WCF Data Service exposes. [ServiceAction](/previous-versions/dotnet/wcf-data-services/hh544089(v=vs.103)) is the metadata representation of an Action and includes information like the Action name, its parameters, and its return type. - -#### GetServiceActionsByBindingParameterType - - This method returns a collection of all [ServiceAction](/previous-versions/dotnet/wcf-data-services/hh544089(v=vs.103)) instances that can be bound to the specified binding parameter type. In other words, all [ServiceAction](/previous-versions/dotnet/wcf-data-services/hh544089(v=vs.103))s that can act on the specified resource type (also called binding parameter type).This is used when the service returns a resource in order to include information about Actions that can be invoked against that resource. This method should only return actions that can bind to the exact binding parameter type (no derived types). This method is called once per request per type encountered and the result is cached by WCF Data Services. - -#### TryResolveServiceAction - - This method searches for a specified [ServiceAction](/previous-versions/dotnet/wcf-data-services/hh544089(v=vs.103)) and returns `true` if the [ServiceAction](/previous-versions/dotnet/wcf-data-services/hh544089(v=vs.103)) is found. If found, the [ServiceAction](/previous-versions/dotnet/wcf-data-services/hh544089(v=vs.103)) is returned in the `serviceAction` `out` parameter. - -### IDataServiceInvokable - - This interface provides a way to execute a WCF Data Service Action. When implementing IDataServiceInvokable you are responsible for 3 things: - -1. Capturing and potentially marshaling the parameters - -2. Dispatching the parameters to the code that actually implements the Action when Invoke() is called - -3. Storing any results from Invoke() so they can be retrieved using GetResult() - - The parameters may be passed as tokens. This is because it is possible to write a Data Service Provider that works with tokens that represent resources, if this is the case you may need to convert (marshal) these tokens into actual resources before dispatching to the actual action. After the parameter has been marshaled, it must be in an editable state so that any changes to the resource that occur when the action is invoked will be saved and written to disk. - - This interface requires two methods: Invoke and GetResult. Invoke invokes the delegate that implements the action’s behavior and GetResult returns the result of the action. - -## Invoking a WCF Data Service Action - - Actions are invoked using an HTTP POST request. The URL specifies the resource followed by the action name. Parameters are passed in the body of the request. For example if there was a service called MovieService which exposed an action called Rate. You could use the following URL to invoke the Rate action on a specific movie: - - `http://MovieServer/MovieService.svc/Movies(1)/Rate` - - Movies(1) specifies the movie you wish to rate and Rate specifies the Rate action. The actual value of the rating will be in the body of the HTTP request as shown in the following example: - -```http -POST http://MovieServer/MoviesService.svc/Movies(1)/Rate HTTP/1.1 -Content-Type: application/json -Content-Length: 20 -Host: localhost:15238 -{ - "rating": 4 -} -``` - -> [!WARNING] -> The above sample code will work only with WCF Data Services 5.2 and later which has support for JSON light. If using an earlier version of WCF Data Services, you must specify the json verbose content-type as follows: `application/json;odata=verbose`. - - Alternatively you can invoke an action using the WCF Data Services Client as shown in the following code snippet. - -```csharp -MoviesModel context = new MoviesModel (new Uri("http://MyServer/MoviesService.svc/")); -//... -context.Execute(new Uri("http://MyServer/MoviesService.svc/Movies(1)/Rate"), "POST", new BodyOperationParameter("rating",4) ); -``` - - In the code snippet above, the `MoviesModel` class was generated by using Visual Studio to Add Service Reference to a WCF Data Service. - -## See also - -- [WCF Data Services 4.5](index.md) -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [Developing and Deploying WCF Data Services](developing-and-deploying-wcf-data-services.md) -- [Custom Data Service Providers](custom-data-service-providers-wcf-data-services.md) diff --git a/docs/framework/data/wcf/wcf-data-service-client-utility-datasvcutil-exe.md b/docs/framework/data/wcf/wcf-data-service-client-utility-datasvcutil-exe.md deleted file mode 100644 index d0590b723b09d..0000000000000 --- a/docs/framework/data/wcf/wcf-data-service-client-utility-datasvcutil-exe.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -description: "Learn more about: WCF Data Service Client Utility (DataSvcUtil.exe)" -title: "WCF Data Service Client Utility (DataSvcUtil.exe)" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, generating client data classes" - - "WCF Data Services, client library" - - "WCF Data Services, consuming" -ms.assetid: 9d0af606-929b-4c03-b307-3ef5f705afce ---- -# WCF Data Service Client Utility (DataSvcUtil.exe) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -DataSvcUtil.exe is a command-line tool provided by WCF Data Services that consumes an Open Data Protocol (OData) feed and generates the client data service classes that are needed to access a data service from a .NET Framework client application. This utility can generate data classes by using the following metadata sources: - -- The root URI of a data service. The utility requests the service metadata document, which describes the data model exposed by the data service. For more information, see [AtomPub (RFC5023)](https://tools.ietf.org/html/rfc5023#section-8). - -- A data model file (.csdl) defined by using the conceptual schema definition language (CSDL), as defined in the [\[MC-CSDL\]: Conceptual Schema Definition File Format](/openspecs/windows_protocols/mc-csdl/c03ad8c3-e8b7-4306-af96-a9e52bb3df12) specification. - -- An .edmx file created by using the Entity Data Model tools that are provided with the Entity Framework. For more information, see the [\[MC-EDMX\]: Entity Data Model for Data Services Packaging Format](/openspecs/windows_protocols/mc-edmx/5dff5e25-56a1-408b-9d44-bff6634c7d16) specification. - -For more information, see [How to: Manually Generate Client Data Service Classes](how-to-manually-generate-client-data-service-classes-wcf-data-services.md). - -The DataSvcUtil.exe tool is installed in the .NET Framework directory. In many cases, this is located in *C:\Windows\Microsoft.NET\Framework\v4.0*. For 64-bit systems, this is located in *C:\Windows\Microsoft.NET\Framework64\v4.0*. You can also access the DataSvcUtil.exe tool from Developer Command Prompt for Visual Studio. - -## Syntax - -```console -datasvcutil /out:file [/in:file | /uri:serviceuri] [/dataservicecollection] [/language:devlang] [/nologo] [/version:ver] [/help] -``` - -## Parameters - -|Option|Description| -|------------|-----------------| -|`/dataservicecollection`|Specifies that the code required to bind objects to controls is also generated.| -|`/help`

-or-

`/?`|Displays command syntax and options for the tool.| -|`/in:` *\*|Specifies the .csdl or .edmx file or a directory where the file is located.| -|`/language:`[VB|CSharp]|Specifies the language for the generated source code files. The language defaults to C#.| -|`/nologo`|Suppresses the copyright message from displaying.| -|`/out:` *\*|Specifies the name of the source code file that contains the generated client data service classes.| -|`/uri:` *\*|The URI of the OData feed.| -|`/version:`[1.0|2.0]|Specifies the highest accepted version of OData. The version is determined based on the `DataServiceVersion` attribute of the DataService element in the returned data service metadata. For more information, see [Data Service Versioning](data-service-versioning-wcf-data-services.md). When you specify the `/dataservicecollection` parameter, you must also specify `/version:2.0` to enable data binding.| - -## See also - -- [Generating the Data Service Client Library](generating-the-data-service-client-library-wcf-data-services.md) -- [How to: Add a Data Service Reference](how-to-add-a-data-service-reference-wcf-data-services.md) diff --git a/docs/framework/data/wcf/wcf-data-services-client-library.md b/docs/framework/data/wcf/wcf-data-services-client-library.md deleted file mode 100644 index b1233d2466d93..0000000000000 --- a/docs/framework/data/wcf/wcf-data-services-client-library.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: "WCF Data Services Client Library" -description: Learn how to use WCF Data Services client libraries to access and change data from a .NET Framework client application. -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, client library" - - "DataServiceQuery class, about DataServiceQuery class" - - "DataServiceContext class, about DataServiceContext class" -ms.assetid: 21075e50-8917-413e-a8ea-35a0f6e65aa5 ---- -# WCF Data Services Client Library - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -Any application can interact with an Open Data Protocol (OData)-based data service if it can send an HTTP request and process the OData feed that a data service returns. This interoperability enables you to access OData-based services from a broad range of Web-enabled applications. WCF Data Services includes client libraries that provide a richer programming experience when you consume OData feeds from .NET Framework or Silverlight-based applications. - - The two main classes of the client library are the class and the class. The class encapsulates operations that are supported against a specified data service. Although OData services are stateless, the context is not. Therefore, you can use the class to maintain state on the client between interactions with the data service in order to support features such as change management. This class also manages identities and tracks changes. The class represents a query against a specific entity set. - - This section describes how to use client libraries to access and change data from a .NET Framework client application. For more information about how to use the WCF Data Services client library with a Silverlight-based application, see [WCF Data Services (Silverlight)](/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc838234(v=vs.95)). Other client libraries are available that enable you to consume an OData feed in other kinds of applications. For more information on OData SDK, see [OData SDK - Sample Code](https://www.odata.org/ecosystem/#sdk). - -## In This Section - - [Generating the Data Service Client Library](generating-the-data-service-client-library-wcf-data-services.md) - Describes how to generate a client library and client data service classes that are based on OData feeds. - - [Querying the Data Service](querying-the-data-service-wcf-data-services.md) - Describes how to query a data service from a .NET Framework-based application by using client libraries. - - [Loading Deferred Content](loading-deferred-content-wcf-data-services.md) - Describes how to load additional content not included in the initial query response. - - [Updating the Data Service](updating-the-data-service-wcf-data-services.md) - Describes how to create, modify, and delete entities and relationships by using the client libraries. - - [Asynchronous Operations](asynchronous-operations-wcf-data-services.md) - Describes the facilities provided by the client libraries for working with a data service in an asynchronous manner. - - [Batching Operations](batching-operations-wcf-data-services.md) - Describes how to send multiple requests to the data service in a single batch by using the client libraries. - - [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md) - Describes how to bind controls to a OData feed returned by a data service. - - [Calling Service Operations](calling-service-operations-wcf-data-services.md) - Describes how to use the client library to call service operations. - - [Managing the Data Service Context](managing-the-data-service-context-wcf-data-services.md) - Describes options for managing the behavior of the client library. - - [Working with Binary Data](working-with-binary-data-wcf-data-services.md) - Describes how to access and change binary data returned by the data service as a data stream. - -## See also - -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [Getting Started](getting-started-with-wcf-data-services.md) diff --git a/docs/framework/data/wcf/wcf-data-services-overview.md b/docs/framework/data/wcf/wcf-data-services-overview.md deleted file mode 100644 index e5810f10c234e..0000000000000 --- a/docs/framework/data/wcf/wcf-data-services-overview.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -description: "Learn more about: WCF Data Services Overview" -title: "WCF Data Services Overview" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services" - - "WCF Data Services, about" -ms.assetid: 7924cf94-c9a6-4015-afc9-f5d22b1743bb ---- -# WCF Data Services Overview - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -## Overview - -WCF Data Services enables creation and consumption of data services for the Web or an intranet by using the Open Data Protocol (OData). OData enables you to expose your data as resources that are addressable by URIs. This enables you to access and change data by using the semantics of representational state transfer (REST), specifically the standard HTTP verbs of GET, PUT, POST, and DELETE. This topic provides an overview of both the patterns and practices defined by OData and also the facilities provided by WCF Data Services to take advantage of OData in .NET Framework-based applications. - -## Address Data as Resources - - OData exposes data as resources that are addressable by URIs. The resource paths are constructed based on the entity-relationship conventions of the Entity Data Model. In this model, entities represent operational units of data in an application domain, such as customers, orders, items, and products. For more information, see [Entity Data Model](../adonet/entity-data-model.md). - - In OData, you address entity resources as an entity set that contains instances of entity types. For example, the URI `https://services.odata.org/Northwind/Northwind.svc/Customers('ALFKI')/Orders` returns all of the orders from the `Northwind` data service that are related to the customer with a `CustomerID` value of `ALFKI.` - - Query expressions enable you to perform traditional query operations against resources, such as filtering, sorting, and paging. For example, the URI `https://services.odata.org/Northwind/Northwind.svc/Customers('ALFKI')/Orders?$filter=Freight gt 50` filters the resources to return only the orders with a freight cost of more than $50. For more information, see [Accessing Data Service Resources](accessing-data-service-resources-wcf-data-services.md). - -## Interoperable Data Access - - OData builds on standard Internet protocols to make data services interoperable with applications that do not use the .NET Framework. Because you can use standard URIs to address data, your application can access and change data by using the semantics of representational state transfer (REST), specifically the standard HTTP verbs of GET, PUT, POST, and DELETE. This enables you to access these services from any client that can parse and access data that is transmitted over standard HTTP protocols. - -OData defines a set of extensions to the Atom Publishing Protocol (AtomPub). It supports HTTP requests and responses in more than one data format to accommodate various client applications and platforms. An OData feed can represent data in Atom, JavaScript Object Notation (JSON), and as plain XML. While Atom is the default format, the format of the feed is specified in the header of the HTTP request. For more information, see [OData: Atom Format](https://www.odata.org/documentation/odata-version-2-0/atom-format/) and [OData: JSON Format](https://www.odata.org/documentation/odata-version-2-0/json-format/). - - When publishing data as an OData feed, WCF Data Services relies on other existing Internet facilities for such operations as caching and authentication. To accomplish this, WCF Data Services integrates with existing hosting applications and services, such as ASP.NET, Windows Communication Foundation (WCF), and Internet Information Services (IIS). - -## Storage Independence - - Although resources are addressed based on an entity-relationship model, WCF Data Services expose OData feeds regardless of the underlying data source. After WCF Data Services accepts an HTTP request for a resource that a URI identifies, the request is deserialized and a representation of that request is passed to an WCF Data Services provider. This provider translates the request into a data source-specific format and executes the request on the underlying data source. WCF Data Services achieves storage independence by separating the conceptual model that addresses resources prescribed by OData from the specific schema of the underlying data source. - - WCF Data Services integrates with the ADO.NET Entity Framework to enable you to create data services that expose relational data. You can use the Entity Data Model tools to create a data model that contains addressable resources as entities and at the same time define the mapping between this model and the tables in the underlying database. For more information, see [Entity Framework Provider](entity-framework-provider-wcf-data-services.md). - - WCF Data Services also enables you to create data services that expose any data structures that return an implementation of the interface. This enables you to create data services that expose data from .NET Framework types. Create, update, and delete operations are supported when you also implement the interface. For more information, see [Reflection Provider](reflection-provider-wcf-data-services.md). - - For an illustration of how WCF Data Services integrates with these data providers, see the architectural diagram later in this topic. - -## Custom Business Logic - - WCF Data Services makes it easy to add custom business logic to a data service through service operations and interceptors. Service operations are methods defined on the server that are addressable by URIs in the same form as data resources. Service operations can also use query expression syntax to filter, order, and page data returned by an operation. For example, the URI `http://localhost:12345/Northwind.svc/GetOrdersByCity?city='London'&$orderby=OrderDate&$top=10&$skip=10` represents a call to a service operation named `GetOrdersByCity` on the Northwind data service that returns orders for customers from London, with paged results sorted by `OrderDate`. For more information, see [Service Operations](service-operations-wcf-data-services.md). - - Interceptors enable custom application logic to be integrated in the processing of request or response messages by a data service. Interceptors are called when a query, insert, update, or delete action occurs on the specified entity set. An interceptor then may alter the data, enforce authorization policy, or even terminate the operation. Interceptor methods must be explicitly registered for a given entity set that is exposed by a data service. For more information, see [Interceptors](interceptors-wcf-data-services.md). - -## Client Libraries - - OData defines a set of uniform patterns for interacting with data services. This provides an opportunity to create reusable components that are based on these services, such as client-side libraries that make it easier to consume data services. - - WCF Data Services includes client libraries for both .NET Framework-based and Silverlight-based client applications. These client libraries enable you to interact with data services by using .NET Framework objects. They also support object-based queries and LINQ queries, loading related objects, change tracking, and identity resolution. For more information, see [WCF Data Services Client Library](wcf-data-services-client-library.md). - - In addition to the OData client libraries included with the .NET Framework and with Silverlight, there are other client libraries that enable you to consume an OData feed in client applications, such as PHP, AJAX, and Java applications. For more information on OData SDK, see [OData SDK - Sample Code](https://www.odata.org/ecosystem/#sdk). - -## Architecture Overview - - The following diagram illustrates the WCF Data Services architecture for exposing OData feeds and using these feeds in OData-enabled client libraries: - - ![Screenshot showing a WCF Data Services architecture diagram.](./media/wcf-data-services-overview/windows-communication-foundation-data-services-architecture.gif) - -## See also - -- [WCF Data Services 4.5](index.md) -- [Getting Started](getting-started-with-wcf-data-services.md) -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [Accessing Data Service Resources (WCF Data Services)](/previous-versions/dotnet/netframework-4.0/dd728283(v=vs.100)) -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [Representational State Transfer (REST)](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm) diff --git a/docs/framework/data/wcf/wcf-data-services-protocol-implementation-details.md b/docs/framework/data/wcf/wcf-data-services-protocol-implementation-details.md deleted file mode 100644 index 2a1da8eb3fa5e..0000000000000 --- a/docs/framework/data/wcf/wcf-data-services-protocol-implementation-details.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -description: "Learn more about: WCF Data Services Protocol Implementation Details" -title: "WCF Data Services Protocol Implementation Details" -ms.date: "03/30/2017" -ms.assetid: 712d689b-fada-4cbb-bcdb-d65a3ef83b4c ---- -# WCF Data Services Protocol Implementation Details - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -## OData Protocol Implementation Details - -The Open Data Protocol (OData) requires that a data service that implements the protocol provide a certain minimum set of functionalities. These functionalities are described in the protocol documents in terms of "should" and "must". Other optional functionality is described in terms of "may". This article describes these optional functionalities that are not currently implemented by WCF Data Services. - -### Support for the $format Query Option - - The OData protocol supports both JavaScript Notation (JSON) and Atom feeds, and OData provides the `$format` system query option to allow a client to request the format of the response feed. This system query option, if supported by the data service, must override the value of the Accept header of the request. WCF Data Services supports returning both JSON and Atom feeds. However, the default implementation does not support the `$format` query option and uses only the value of the Accept header to determine the format of the response. There are cases when your data service may need to support the `$format` query option, such as when clients cannot set the Accept header. To support these scenarios, you must extend your data service to handle this option in the URI. - -## WCF Data Services Behaviors - - The following WCF Data Services behaviors are not explicitly defined by the OData protocol: - -### Default Sorting Behavior - - When a query request that is sent to the data service includes a `$top` or `$skip` system query option and does not include the `$orderby` system query option, the returned feed is sorted by the key properties, in ascending order. This is because ordering is required to ensure the correct paging of results. To do this, the data service adds an ordering expression to the query. This behavior also occurs when server-driven paging is enabled in the data service. For more information, see [Configuring the Data Service](configuring-the-data-service-wcf-data-services.md).To control the ordering of the returned feed, you should include `$orderby` in the query URI. - -## See also - -- [Defining WCF Data Services](defining-wcf-data-services.md) -- [WCF Data Services Client Library](wcf-data-services-client-library.md) diff --git a/docs/framework/data/wcf/wcf-data-services-resources.md b/docs/framework/data/wcf/wcf-data-services-resources.md deleted file mode 100644 index c61b7b739af77..0000000000000 --- a/docs/framework/data/wcf/wcf-data-services-resources.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -description: "Learn more about: WCF Data Services Resources" -title: "WCF Data Services Resources" -ms.date: "03/30/2017" -helpviewer_keywords: - - "WCF Data Services, learn more" -ms.assetid: e63a9baf-699c-42e2-b11f-fba57bcc14df ---- -# WCF Data Services Resources - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -WCF Data Services introductory topics can be found in the following locations. Many of these topics also contain links to related topics that contain more detailed information. - - [Overview](wcf-data-services-overview.md) - Provides an overview of the features and functionality available in WCF Data Services. - - [Getting Started](../adonet/ef/getting-started.md) - Describes how to design and access a data service by using WCF Data Services, as illustrated by the [quickstart](quickstart-wcf-data-services.md). - - [Application Scenarios](application-scenarios-wcf-data-services.md) - Provides a task-based approach to creating WCF Data Services and applications that access Open Data Protocol (OData) feeds. - - [.NET Glossary](../../../standard/glossary.md) - Includes terms used in WCF Data Services and OData documentation. - -## External Resources - - The following external resources provide additional information and support for creating WCF Data Services applications that expose and consume OData feeds. - - [WCF Data Services Forum](https://social.msdn.microsoft.com/Forums/en-US/home?forum=adodotnetdataservices) - Data programming support for WCF Data Services developers. - - [WCF Data Services Team Blog](/archive/blogs/astoriateam/) - Blog that contains updates and discussion of WCF Data Services features and functionality. - - [OData website](https://www.odata.org/) - The primary source of information about OData. - - [OData SDK - Sample Code](https://www.odata.org/ecosystem/#sdk) - Contains sample services, samples, and programming libraries that enable you to work with OData feeds. - - [OData Blog](https://www.odata.org/blog/) - Blog that contains discussions about OData programming. - - [Overview: WCF Data Services](/previous-versions/visualstudio/visual-studio-2008/cc956153(v=msdn.10)) - A white paper that provides more high-level information about the benefits of WCF Data Services. - - [Using Microsoft WCF Data Services](/previous-versions/visualstudio/visual-studio-2008/cc907912(v=msdn.10)) - A white paper that provides additional information and examples for creating data services and accessing data services in client applications. - - [The Entity-Relationship Model: Toward a Unified View of Data](https://dl.acm.org/doi/10.1145/320434.320440) by Peter Pin-Shan Chen, Massachusetts Institute of Technology - Describes the basis for the entity-relational model that is implemented by WCF Data Services. Written in 1976, this is one of the most frequently cited papers in the computer field. - -## See also - -- [Getting Started](getting-started-with-wcf-data-services.md) diff --git a/docs/framework/data/wcf/working-with-binary-data-wcf-data-services.md b/docs/framework/data/wcf/working-with-binary-data-wcf-data-services.md deleted file mode 100644 index eb67395bdce8c..0000000000000 --- a/docs/framework/data/wcf/working-with-binary-data-wcf-data-services.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -description: "Learn more about: Working with Binary Data (WCF Data Services)" -title: "Working with Binary Data (WCF Data Services)" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "WCF Data Services, binary data" - - "WCF Data Services, streams" -ms.assetid: aeccc45c-d5c5-4671-ad63-a492ac8043ac ---- -# Working with Binary Data (WCF Data Services) - -[!INCLUDE [wcf-deprecated](~/includes/wcf-deprecated.md)] - -The WCF Data Services client library enables you to retrieve and update binary data from an Open Data Protocol (OData) feed in one of the following ways: - -- As a primitive type property of an entity. This is the recommended method for working with small binary data objects that can be easily loaded into memory. In this case, the binary property is an entity property exposed by the data model, and the data service serializes the binary data as base-64 binary encoded XML in the response message. - -- As a separate binary resource stream. This is the recommended method for accessing and changing binary large object (BLOB) data that may represent a photo, video, or any other type of binary encoded data. - -WCF Data Services implements the streaming of binary data by using HTTP as defined in the OData. In this mechanism, binary data is treated as a media resource that is separate from but related to an entity, which is called a media link entry. For more information, see [Streaming Provider](streaming-provider-wcf-data-services.md). - -> [!TIP] -> For a step-by-step example of how to create a Windows Presentation Foundation (WPF) client application that downloads binary image files from an OData service that stores photos, see the post [Data Services Streaming Provider Series-Part 2: Accessing a Media Resource Stream from the Client](/archive/blogs/astoriateam/data-services-streaming-provider-series-part-2-accessing-a-media-resource-stream-from-the-client). To download the sample code for the stream photo data service featured in the blog post, see the [Streaming Photo Data Service Sample](https://github.com/microsoftarchive/msdn-code-gallery-community-s-z/tree/master/Streaming%20Photo%20OData%20Service%20Sample) in GitHub. - -## Entity Metadata - -An entity that has a related media resource stream is indicated in the data service metadata by the `HasStream` attribute applied to an entity type that is the media link entry. In the following example, the `PhotoInfo` entity is a media link entry that has a related media resource, indicated by the `HasStream` attribute. - -[!code-xml[Astoria Photo Streaming Service#HasStream](../../../../samples/snippets/xml/VS_Snippets_Misc/astoria_photo_streaming_service/xml/photodata.edmx#hasstream)] - -The remaining examples in this topic show how to access and change the media resource stream. For a complete example of how to consume a media resource stream in a .NET Framework client application by using the WCF Data Services client library, see the post [Accessing a Media Resource Stream from the Client](/archive/blogs/astoriateam/data-services-streaming-provider-series-part-2-accessing-a-media-resource-stream-from-the-client). - -## Accessing the Binary Resource Stream - -The WCF Data Services client library provides methods for accessing binary resource streams from an OData-based data service. When downloading a media resource, you can either use the URI of the media resource or you can get a binary stream that contains the media resource data itself. You can also upload media resource data as a binary stream. - -> [!TIP] -> For a step-by-step example of how to create a Windows Presentation Foundation (WPF) client application that downloads binary image files from an OData service that stores photos, see the post [Data Services Streaming Provider Series-Part 2: Accessing a Media Resource Stream from the Client](/archive/blogs/astoriateam/data-services-streaming-provider-series-part-2-accessing-a-media-resource-stream-from-the-client). To download the sample code for the stream photo data service featured in the blog post, see the [Streaming Photo Data Service Sample](https://github.com/microsoftarchive/msdn-code-gallery-community-s-z/tree/master/Streaming%20Photo%20OData%20Service%20Sample) in GitHub. - -### Getting the URI of the Binary Stream - -When retrieving certain types of media resources, such as images and other media files, it is often easier to use the URI of the media resource in your application than handling the binary data stream itself. To get the URI of a resource stream associated with a give media link entry, you must call the method on the instance that is tracking the entity. The following example shows how to call the method to get the URI of a media resource stream that is used to create a new image on the client: - -[!code-csharp[Astoria Photo Streaming Client#GetReadStreamUri](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photowindow.xaml.cs#getreadstreamuri)] -[!code-vb[Astoria Photo Streaming Client#GetReadStreamUri](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_photo_streaming_client/vb/photowindow.xaml.vb#getreadstreamuri)] - -### Downloading the Binary Resource Stream - -When retrieving a binary resource stream, you must call the method on the instance that is tracking the media link entry. This method sends a request to the data service that returns a object, which has a reference to the stream that contains the resource. Use this method when your application requires the binary resource as a . The following example shows how to call the method to retrieve a stream that is used to create a new image on the client: - -[!code-csharp[Astoria Streaming Client#GetReadStreamClient](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_streaming_client/cs/customerphotowindow.xaml.cs#getreadstreamclient)] -[!code-vb[Astoria Streaming Client#GetReadStreamClient](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_streaming_client/vb/customerphotowindow.xaml.vb#getreadstreamclient)] - -> [!NOTE] -> The Content-Length header in the response message that contains the binary steam is not set by the data service. This value may not reflect the actual length of the binary data stream. - -### Uploading a Media Resource as a Stream - -To insert or update a media resource, call the method on the instance that is tracking the entity. This method sends a request to the data service that contains the media resource read from the supplied stream. The following example shows how to call the method to send an image to the data service: - -[!code-csharp[Astoria Photo Streaming Client#SetSaveStream](../../../../samples/snippets/csharp/VS_Snippets_Misc/astoria_photo_streaming_client/cs/photodetailswindow.xaml.cs#setsavestream)] -[!code-vb[Astoria Photo Streaming Client#SetSaveStream](../../../../samples/snippets/visualbasic/VS_Snippets_Misc/astoria_photo_streaming_client/vb/photodetailswindow.xaml.vb#setsavestream)] - -In this example, the method is called by supplying a value of `true` for the `closeStream` parameter. This guarantees that the closes the stream after the binary data is uploaded to the data service. - -> [!NOTE] -> When you call , the stream is not sent to the data service until is called. - -## See also - -- [WCF Data Services Client Library](wcf-data-services-client-library.md) -- [Binding Data to Controls](binding-data-to-controls-wcf-data-services.md) diff --git a/docs/framework/deployment/deployment-guide-for-developers.md b/docs/framework/deployment/deployment-guide-for-developers.md index a6572f0a9cfac..9bdf671334b33 100644 --- a/docs/framework/deployment/deployment-guide-for-developers.md +++ b/docs/framework/deployment/deployment-guide-for-developers.md @@ -28,7 +28,7 @@ You can download the redistributable packages and language packs for .NET Framew Important notes: -- Versions of the .NET Framework from .NET Framework 4.5.1 through [!INCLUDE[net_current](../../../includes/net-current-version.md)] are in-place updates to .NET Framework 4.5, which means they use the same runtime version, but the assembly versions are updated and include new types and members. +- Versions of .NET Framework from .NET Framework 4.5.1 through [!INCLUDE[net_current](../../../includes/net-current-version.md)] are in-place updates to .NET Framework 4.5, which means they use the same runtime version, but the assembly versions are updated and include new types and members. - .NET Framework 4.5 and later versions are built incrementally on .NET Framework 4. When you install .NET Framework 4.5 or later versions on a system that has .NET Framework 4 installed, the version 4 assemblies are replaced with newer versions. @@ -36,7 +36,7 @@ You can download the redistributable packages and language packs for .NET Framew - You must have administrator privileges to install .NET Framework 4.5 or later versions. -- .NET Framework 4.5 is included in Windows 8 and Windows Server 2012, so you don't have to deploy it with your app on those operating systems. Similarly, .NET Framework 4.5.1 is included in Windows 8.1 and Windows Server 2012 R2. .NET Framework 4.5.2 isn't included in any operating systems. .NET Framework 4.6 is included in Windows 10, .NET Framework 4.6.1 is included in Windows 10 November Update, and .NET Framework 4.6.2 is included in Windows 10 Anniversary Update. .NET Framework 4.7 is included in Windows 10 Creators Update, .NET Framework 4.7.1 is included in Windows 10 Fall Creators Update, and .NET Framework 4.7.2 is included in Windows 10 October 2018 Update and Windows 10 April 2018 Update. .NET Framework 4.8 is included in Windows 10 May 2019 Update and all later Windows 10 updates. For a full list of hardware and software requirements, see [System Requirements](../get-started/system-requirements.md). +- .NET Framework 4.5 is included in Windows 8 and Windows Server 2012, so you don't have to deploy it with your app on those operating systems. Similarly, .NET Framework 4.5.1 is included in Windows 8.1 and Windows Server 2012 R2. .NET Framework 4.5.2 isn't included in any operating systems. .NET Framework 4.6 is included in Windows 10, .NET Framework 4.6.1 is included in Windows 10 November Update, and .NET Framework 4.6.2 is included in Windows 10 Anniversary Update. .NET Framework 4.7 is included in Windows 10 Creators Update, .NET Framework 4.7.1 is included in Windows 10 Fall Creators Update, and .NET Framework 4.7.2 is included in Windows 10 October 2018 Update and Windows 10 April 2018 Update. .NET Framework 4.8 is included in Windows 10 May 2019 Update and all later Windows 10 updates. For a full list of hardware and software requirements, see [System Requirements](../get-started/system-requirements.md). - Starting with .NET Framework 4.5, your users can view a list of running .NET Framework apps during setup and close them easily. This may help avoid system restarts caused by .NET Framework installations. See [Reducing System Restarts](reducing-system-restarts.md). @@ -58,7 +58,7 @@ When you're ready to publish your app to a web server or other centralized locat ## Redistributable packages -The .NET Framework is available in two redistributable packages: web installer (bootstrapper) and offline installer (stand-alone redistributable). All .NET Framework downloads are hosted on the [Download .NET Framework page](https://dotnet.microsoft.com/download/dotnet-framework/). The following table compares the two packages: +.NET Framework is available in two redistributable packages: web installer (bootstrapper) and offline installer (stand-alone redistributable). All .NET Framework downloads are hosted on the [Download .NET Framework page](https://dotnet.microsoft.com/download/dotnet-framework/). The following table compares the two packages: ||Web installer|Offline installer| |-|-------------------|-----------------------| @@ -73,9 +73,9 @@ The .NET Framework is available in two redistributable packages: web installer ( ## Deployment methods - Four deployment methods are available: +Four deployment methods are available: -- You can set a dependency on the .NET Framework. You can specify the .NET Framework as a prerequisite in your app's installation, using one of these methods: +- You can set a dependency on .NET Framework. You can specify .NET Framework as a prerequisite in your app's installation, using one of these methods: - Use [ClickOnce deployment](#clickonce-deployment) (available with Visual Studio) @@ -85,7 +85,7 @@ The .NET Framework is available in two redistributable packages: web installer ( - Use the [Windows Installer XML (WiX) toolset](#wix) -- You can ask your users to [install the .NET Framework manually](#installing_manually). +- You can ask your users to [install .NET Framework manually](#installing_manually). - You can chain (include) the .NET Framework setup process in your app's setup, and decide how you want to handle the .NET Framework installation experience: @@ -95,15 +95,15 @@ The .NET Framework is available in two redistributable packages: web installer ( These deployment methods are discussed in detail in the following sections. -## Setting a dependency on the .NET Framework +## Set a dependency on .NET Framework -If you use ClickOnce, InstallAware, InstallShield, or WiX to deploy your app, you can add a dependency on the .NET Framework so it can be installed as part of your app. +If you use ClickOnce, InstallAware, InstallShield, or WiX to deploy your app, you can add a dependency on .NET Framework so it can be installed as part of your app. ### ClickOnce deployment ClickOnce deployment is available for projects that are created with Visual Basic and Visual C#, but it is not available for Visual C++. -In Visual Studio, to choose ClickOnce deployment and add a dependency on the .NET Framework: +In Visual Studio, to choose ClickOnce deployment and add a dependency on .NET Framework: 1. Open the app project you want to publish. @@ -115,7 +115,7 @@ In Visual Studio, to choose ClickOnce deployment and add a dependency on the .NE 5. In the **Prerequisites** dialog box, make sure that the **Create setup program to install prerequisite components** check box is selected. -6. In the prerequisites list, locate and select the version of the .NET Framework that you've used to build your project. +6. In the prerequisites list, locate and select the version of .NET Framework that you've used to build your project. 7. Choose an option to specify the source location for the prerequisites, and then choose **OK**. @@ -143,11 +143,11 @@ The Windows Installer XML (WiX) toolset builds Windows installation packages fro ## Install .NET Framework manually -In some situations, it might be impractical to automatically install the .NET Framework with your app. In that case, you can have users install the .NET Framework themselves. The redistributable package is available in [two packages](#redistributable-packages). In your setup process, provide instructions for how users should locate and install the .NET Framework. +In some situations, it might be impractical to automatically install .NET Framework with your app. In that case, you can have users install .NET Framework themselves. The redistributable package is available in [two packages](#redistributable-packages). In your setup process, provide instructions for how users should locate and install .NET Framework. -## Chaining the .NET Framework installation to your app's setup +## Chain the .NET Framework installation to your app's setup If you're creating a custom setup program for your app, you can chain (include) the .NET Framework setup process in your app's setup process. Chaining provides two UI options for the .NET Framework installation: @@ -207,7 +207,7 @@ If you have a custom setup package, you may want to silently launch and track th > [!IMPORTANT] > In determining whether the correct version of the .NET Framework is already installed, you should check whether your target version *or* a later version is installed, not whether your target version is installed. In other words, you should evaluate whether the release key you retrieve from the registry is greater than or equal to the release key of your target version, *not* whether it equals the release key of your target version. -- [Detect](#detecting-the-language-packs) whether the language packs are already installed on the user’s computer. +- [Detect](#detect-language-packs) whether the language packs are already installed on the user’s computer. - If you want to control the deployment, silently launch and track the .NET Framework setup process (see [How to: Get Progress from the .NET Framework 4.5 Installer](how-to-get-progress-from-the-dotnet-installer.md)). @@ -219,12 +219,12 @@ If you have a custom setup package, you may want to silently launch and track th -### Detecting the .NET Framework +### Detect .NET Framework -The .NET Framework installer writes registry keys when installation is successful. You can test whether .NET Framework 4.5 or later is installed by checking the `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full` folder in the registry for a `DWORD` value named `Release`. (Note that "NET Framework Setup" doesn't begin with a period.) The existence of this key indicates that .NET Framework 4.5 or a later version has been installed on that computer. The value of `Release` indicates which version of the .NET Framework is installed. +The .NET Framework installer writes registry keys when installation is successful. You can test whether .NET Framework 4.5 or later is installed by checking the `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full` folder in the registry for a `DWORD` value named `Release`. (Note that "NET Framework Setup" doesn't begin with a period.) The existence of this key indicates that .NET Framework 4.5 or a later version has been installed on that computer. The value of `Release` indicates which version of .NET Framework is installed. > [!IMPORTANT] -> You should check for a value **greater than or equal to** the release keyword value when attempting to detect whether a specific version is present. +> Check for a value **greater than or equal to** the release keyword value when attempting to detect whether a specific version is present. [!INCLUDE[Release key values note](~/includes/version-keys-note.md)] @@ -250,7 +250,7 @@ The .NET Framework installer writes registry keys when installation is successfu |.NET Framework 4.5.1 installed on Windows 8, Windows 7|378758| |.NET Framework 4.5|378389| -### Detecting the language packs +### Detect language packs You can test whether a specific language pack is installed by checking the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\\*LCID* folder in the registry for a DWORD value named `Release`. (Note that "NET Framework Setup" doesn't begin with a period.) *LCID* specifies a locale identifier; see [supported languages](#supported-languages) for a list of these. @@ -268,7 +268,7 @@ To determine whether the final release version of a language pack is installed f ### Chaining the language packs to your app setup -The .NET Framework provides a set of stand-alone language pack executable files that contain localized resources for specific cultures. The language packs are available from the Download .NET Framework pages: +.NET Framework provides a set of stand-alone language pack executable files that contain localized resources for specific cultures. The language packs are available from the .NET Framework download pages: - [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48) - [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472) @@ -282,7 +282,7 @@ The .NET Framework provides a set of stand-alone language pack executable files - [.NET Framework 4.5](https://dotnet.microsoft.com/download/dotnet-framework/net45) > [!IMPORTANT] -> The language packs don't contain the .NET Framework components that are required to run an app; you must install the .NET Framework by using the web or offline installer before you install a language pack. +> The language packs don't contain the .NET Framework components that are required to run an app. You must install .NET Framework by using the web or offline installer before you install a language pack. Starting with .NET Framework 4.5.1, the package names take the form NDP<`version`>-KB<`number`>-x86-x64-AllOS-<`culture`>.exe, where `version` is the version number of the .NET Framework, `number` is a Microsoft Knowledge Base article number, and `culture` specifies a [country/region](#supported-languages). An example of one of these packages is `NDP452-KB2901907-x86-x64-AllOS-JPN.exe`. Package names are listed in the [Redistributable Packages](#redistributable-packages) section earlier in this article. @@ -327,7 +327,7 @@ See the following content: - [Windows Update Agent result codes](/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc720442(v=ws.10)) -## Uninstalling the .NET Framework +## Uninstall .NET Framework Starting with Windows 8, you can uninstall .NET Framework 4.5 or later versions by using **Turn Windows features on and off** in Control Panel. In older versions of Windows, you can uninstall .NET Framework 4.5 or later versions by using **Add or Remove Programs** in Control Panel. diff --git a/docs/framework/deployment/index.md b/docs/framework/deployment/index.md index 1a63ba6a3b542..f1fb0c3bceca1 100644 --- a/docs/framework/deployment/index.md +++ b/docs/framework/deployment/index.md @@ -149,7 +149,7 @@ The .NET Framework provides the following options for distributing applications: To determine where to deploy your application's assemblies so they can be found by the runtime, see [How the Runtime Locates Assemblies](how-the-runtime-locates-assemblies.md). -Security considerations can also affect how you deploy your application. Security permissions are granted to managed code according to where the code is located. Deploying an application or component to a location where it receives little trust, such as the Internet, limits what the application or component can do. For more information about deployment and security considerations, see [Code Access Security Basics](../misc/code-access-security-basics.md). +Security considerations can also affect how you deploy your application. Security permissions are granted to managed code according to where the code is located. Deploying an application or component to a location where it receives little trust, such as the Internet, limits what the application or component can do. For more information about deployment and security considerations, see [Code Access Security Basics](/previous-versions/dotnet/framework/code-access-security/code-access-security-basics). ## Related Topics diff --git a/docs/framework/develop-client-apps.md b/docs/framework/develop-client-apps.md index ebd5630a82294..3a12aeb903a50 100644 --- a/docs/framework/develop-client-apps.md +++ b/docs/framework/develop-client-apps.md @@ -33,7 +33,7 @@ Describes how to create UWP applications that you can make available to users th [.NET API for UWP apps](../../api/index.md?view=dotnet-uwp-10.0)\ Reference for .NET types that support UWP apps. -[Develop for Multiple Platforms](./cross-platform/index.md)\ +[Develop for Multiple Platforms](/previous-versions/dotnet/framework/cross-platform/index)\ Describes the different methods you can use .NET Framework to target multiple client app types. [Get Started with ASP.NET Web Sites](https://dotnet.microsoft.com/apps/aspnet/web-apps)\ diff --git a/docs/framework/development-guide.md b/docs/framework/development-guide.md index e8e2abe71d1d8..39e3755233be1 100644 --- a/docs/framework/development-guide.md +++ b/docs/framework/development-guide.md @@ -45,7 +45,7 @@ This section explains how to create, configure, debug, secure, and deploy your . [Debugging, Tracing, and Profiling](./debug-trace-profile/index.md) Explains how to test, optimize, and profile .NET Framework apps and the app environment. This section includes information for administrators as well as developers. - [Developing for Multiple Platforms](./cross-platform/index.md) + [Developing for Multiple Platforms](/previous-versions/dotnet/framework/cross-platform/index) Provides information about how you can use the .NET Framework to build assemblies that can be shared across multiple platforms and multiple devices such as phones, desktop, and web. [Deployment](./deployment/index.md) diff --git a/docs/framework/get-started/system-requirements.md b/docs/framework/get-started/system-requirements.md index f39cfabe9f304..2f5c36ad53dbb 100644 --- a/docs/framework/get-started/system-requirements.md +++ b/docs/framework/get-started/system-requirements.md @@ -64,7 +64,7 @@ For information on the support lifecycle of .NET Framework versions, see [Micros | Windows Vista SP2|32-bit and 64-bit | -- | .NET Framework 4

.NET Framework 4.5

.NET Framework 4.5.1

.NET Framework 4.5.2

.NET Framework 4.6 | | Windows XP |32-bit and 64-bit | -- | .NET Framework 4 | - **Notes:** +**Notes:** - On Windows 7 systems, .NET Framework requires Windows 7 SP1. If you're on Windows 7 and haven't yet installed Service Pack 1, you need to do so before installing the .NET Framework. diff --git a/docs/framework/install/guide-for-developers.md b/docs/framework/install/guide-for-developers.md index 1b902910adca8..0eef4b8dddfe0 100644 --- a/docs/framework/install/guide-for-developers.md +++ b/docs/framework/install/guide-for-developers.md @@ -9,25 +9,25 @@ helpviewer_keywords: - "installation [.NET Framework]" ms.assetid: daf9d9d5-84ac-4bd9-a864-27665ffd0f5c --- -# Install the .NET Framework for developers +# Install .NET Framework for developers -.NET is an integral part of many apps running on Windows and provides common functionality for those apps to run. For developers, the .NET Framework provides a comprehensive and consistent programming model for building apps that have visually stunning user experiences and seamless and secure communication. +.NET is an integral part of many apps running on Windows and provides common functionality for those apps to run. For developers, .NET Framework provides a comprehensive and consistent programming model for building apps that have visually stunning user experiences and seamless and secure communication. > [!NOTE] -> This topic is intended for **developers** who either want to install the .NET Framework on their own system or who want to install it with their applications. For **users** interested in installing the .NET Framework, see the individual topics that discuss installing the .NET Framework on specific operating systems, such as [Install the .NET Framework on Windows 10 and Windows Server 2016](on-windows-10.md). +> This article is intended for **developers** who either want to install .NET Framework on their own system or who want to install it with their applications. For **users** interested in installing .NET Framework, see the individual articles that discuss installing .NET Framework on specific operating systems, such as [Install .NET Framework on Windows 10 and Windows Server 2016](on-windows-10.md). -This article provides links for installing all versions of the .NET Framework from .NET Framework 4.5 to .NET Framework 4.8 on your computer. If you're a developer, you can also use these links to download and redistribute the .NET Framework with your apps. For information on deploying a version of the .NET Framework with your app, see [.NET Framework deployment guide for developers](../deployment/deployment-guide-for-developers.md). +This article provides links for installing all versions of .NET Framework from .NET Framework 4.5 to .NET Framework 4.8 on your computer. If you're a developer, you can also use these links to download and redistribute .NET Framework with your apps. For information on deploying a version of .NET Framework with your app, see [.NET Framework deployment guide for developers](../deployment/deployment-guide-for-developers.md). [!INCLUDE[net_retirement](../../../includes/net-framework-retired-versions.md)] [!INCLUDE[net-framework-4-versions](../../../includes/net-framework-4x-versions.md)] -For more information about versions of the .NET Framework and how to determine which versions are installed on a computer, see [Versions and Dependencies](../migration-guide/versions-and-dependencies.md) and [How to: Determine Which .NET Framework Versions Are Installed](../migration-guide/how-to-determine-which-versions-are-installed.md). +For more information about versions of .NET Framework and how to determine which versions are installed on a computer, see [Versions and Dependencies](../migration-guide/versions-and-dependencies.md) and [How to: Determine Which .NET Framework Versions Are Installed](../migration-guide/how-to-determine-which-versions-are-installed.md). > [!NOTE] -> For information on the .NET Framework 3.5, see [Install the .NET Framework 3.5 on Windows 10, Windows 8.1, and Windows 8](dotnet-35-windows-10.md). +> For information on .NET Framework 3.5, see [Install the .NET Framework 3.5 on Windows 10, Windows 8.1, and Windows 8](dotnet-35-windows-10.md). -Use the following table for quick links, or read further for details. To view the system requirements for the .NET Framework before installation, see [System Requirements](../get-started/system-requirements.md). For help with troubleshooting, see [Troubleshooting](troubleshoot-blocked-installations-and-uninstallations.md). +Use the following table for quick links, or read further for details. To view the system requirements for .NET Framework before installation, see [System Requirements](../get-started/system-requirements.md). For help with troubleshooting, see [Troubleshooting](troubleshoot-blocked-installations-and-uninstallations.md). | .NET Framework version | Installer (Developer Pack and Runtime) | Platform support | | ---------------------- | -------------------------------------- | ---------------- | @@ -42,6 +42,8 @@ Use the following table for quick links, or read further for details. To view th |**4.5.1** | [.NET Framework 4.5.1](https://dotnet.microsoft.com/download/dotnet-framework/net451) | **Included in:**

Windows 8.1
Windows Server 2012 R2
[Visual Studio 2013](https://my.visualstudio.com/Downloads?q=visual%20studio%202013)

**You can install on:**

Windows 8 and earlier
Windows Server 2012 and earlier
(for a full list, see [system requirements](../get-started/system-requirements.md))| |**4.5** | [.NET Framework 4.5](https://dotnet.microsoft.com/download/dotnet-framework/net45) | **Included in:**

Windows 8
Windows Server 2012
[Visual Studio 2012](https://my.visualstudio.com/Downloads?q=visual%20studio%202012)

**You can install on:**

Windows 7 and earlier
Windows Server 2008 SP2 and earlier
(for a full list, see [system requirements](../get-started/system-requirements.md))| +[!INCLUDE [net-framework-vs](../../../includes/net-framework-vs.md)] + You can install the **Developer Pack** for a specific version of the .NET Framework, if one is available, on all supported platforms. You can install the **Web or Offline installer** on: @@ -52,17 +54,17 @@ You can install the **Web or Offline installer** on: For a full list, see [System Requirements](../get-started/system-requirements.md). -For a general introduction to the .NET Framework for both users and developers, see [Getting Started](../get-started/index.md). For information about deploying the .NET Framework with your app, see the [deployment guide](../deployment/deployment-guide-for-developers.md). To read about the architecture and key features of the .NET Framework, see the [overview](../get-started/overview.md). +For a general introduction to .NET Framework for both users and developers, see [Getting Started](../get-started/index.md). For information about deploying .NET Framework with your app, see the [deployment guide](../deployment/deployment-guide-for-developers.md). To read about the architecture and key features of .NET Framework, see the [overview](../get-started/overview.md). ## Installation choices -Install a developer targeting pack to develop against the most recent version of the .NET Framework in Visual Studio or another development environment, or download the .NET Framework redistributable for distribution with your app or control. +Install a developer targeting pack to develop against the most recent version of .NET Framework in Visual Studio or another development environment, or download the .NET Framework redistributable for distribution with your app or control. ### To install the .NET Framework Developer Pack or Targeting Pack -A *targeting pack* lets your app target a specific version of the .NET Framework when developing in Visual Studio and some other development environments. A *developer pack* includes a specific version of the .NET Framework and its accompanying SDK along with its corresponding targeting pack. +A *targeting pack* lets your app target a specific version of .NET Framework when developing in Visual Studio and some other development environments. A *developer pack* includes a specific version of .NET Framework and its accompanying SDK along with its corresponding targeting pack. -The developer pack for .NET Framework 4.5.1 or 4.5.2, the targeting pack for .NET Framework 4.6, and the developer pack for .NET Framework 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, or 4.8 provides a particular .NET Framework's version of the reference assemblies, language packs, and IntelliSense files for use in an integrated development environment such as Visual Studio. If you are using Visual Studio, the developer pack or targeting pack also adds the installed version of the .NET Framework to the target choices when you create a new project. Choose one of the following: +The developer pack for .NET Framework 4.5.1 or 4.5.2, the targeting pack for .NET Framework 4.6, and the developer pack for .NET Framework 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, or 4.8 provides a particular .NET Framework's version of the reference assemblies, language packs, and IntelliSense files for use in an integrated development environment such as Visual Studio. If you're using Visual Studio, the developer pack or targeting pack also adds the installed version of .NET Framework to the target choices when you create a new project. Choose one of the following: - [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48) - [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472) @@ -74,17 +76,17 @@ The developer pack for .NET Framework 4.5.1 or 4.5.2, the targeting pack for .NE - [.NET Framework 4.5.2](https://dotnet.microsoft.com/download/dotnet-framework/net452) to install version 4.5.2 on Windows 8.1 or earlier, Visual Studio 2013, Visual Studio 2012, or other IDEs. - [.NET Framework 4.5.1](https://dotnet.microsoft.com/download/dotnet-framework/net451) to install version 4.5.1 on Visual Studio 2012 or other IDEs. -From the developer pack download page, choose **Download**. Next choose **Run** or **Save**, and follow the instructions when prompted. You can also install the developer pack or targeting pack for a specific version of the .NET Framework by selecting it from the optional components in the **.NET desktop development** workload in the Visual Studio Installer, as the following figure shows. +From the developer pack download page, choose **Download**. Next, choose **Run** or **Save**, and follow the instructions when prompted. You can also install the developer pack or targeting pack for a specific version of .NET Framework by selecting it from the optional components in the **.NET desktop development** workload in the Visual Studio Installer, as the following figure shows. ![Visual Studio Installer with the .NET desktop development workload](./media/visual-studio-installer.jpg) -When you target a particular version of the .NET Framework, your application is built by using the reference assemblies that are included with that version's developer pack. At runtime, assemblies are resolved from the Global Assembly Cache, and the reference assemblies are not used. +When you target a particular version of .NET Framework, your application is built by using the reference assemblies that are included with that version's developer pack. At runtime, assemblies are resolved from the Global Assembly Cache, and the reference assemblies are not used. -When building an application from Visual Studio or using MSBuild from the command line, MSBuild may display error MSB3644, "The reference assemblies for framework "*framework-version*" were not found." To address the error, download the developer pack or the targeting pack for that version of the .NET Framework. +When building an application from Visual Studio or using MSBuild from the command line, MSBuild may display error MSB3644, "The reference assemblies for framework "*framework-version*" were not found." To address the error, download the developer pack or the targeting pack for that version of .NET Framework. ### To install or download the .NET Framework redistributable -Installers download the .NET Framework components for an app or control that targets those versions of the .NET Framework. These components must be installed on each computer where the app or control runs. These installers are redistributable, so you can include them in the setup program for your app. +Installers download .NET Framework components for an app or control that targets those versions of .NET Framework. These components must be installed on each computer where the app or control runs. These installers are redistributable, so you can include them in the setup program for your app. The download page is provided in several languages, but most of the downloads are provided in English only. For additional language support, you must install a language pack. @@ -92,7 +94,7 @@ Two types of redistributable installers are available: - **Web installer** (web bootstrapper) downloads the required components and the language pack that matches the operating system of the installation computer from the web. This package is much smaller than the offline installer but requires a consistent Internet connection. You can download the [standalone language packs](#to-install-language-packs) to install additional language support. -- **Offline installer** (standalone redistributable) contains all the required components for installing the .NET Framework but doesn't contain language packs. This download is larger than the web installer. The offline installer doesn't require an Internet connection. After you run the offline installer, you can download the [standalone language packs](#to-install-language-packs) to install language support. Use the offline installer if you can't rely on having a consistent Internet connection. +- **Offline installer** (standalone redistributable) contains all the required components for installing .NET Framework but doesn't contain language packs. This download is larger than the web installer. The offline installer doesn't require an internet connection. After you run the offline installer, you can download the [standalone language packs](#to-install-language-packs) to install language support. Use the offline installer if you can't rely on having a consistent Internet connection. Both web and offline installers are designed for x86-based and x64-based computers (see [system requirements](../get-started/system-requirements.md)), but do not support Itanium-based computers. @@ -109,17 +111,17 @@ Both web and offline installers are designed for x86-based and x64-based compute - [.NET Framework 4.5.1](https://dotnet.microsoft.com/download/dotnet-framework/net451) - [.NET Framework 4.5](https://dotnet.microsoft.com/download/dotnet-framework/net45) -1. Select the language for the download page. This option does not download the localized resources of the .NET Framework; it only affects the text displayed on the download page. +1. Select the language for the download page. This option does not download the localized resources of .NET Framework; it only affects the text displayed on the download page. 1. Choose **Download**. 1. If prompted, select the download that matches your system architecture, and then choose **Next**. -1. When the download prompt appears do **ONE** of the following: +1. When the download prompt appears, do *one* of the following: - - If you want to install the .NET Framework on your computer, choose **Run**, and then follow the prompts on your screen. + - If you want to install .NET Framework on your computer, choose **Run**, and then follow the prompts on your screen. - - If you want to download the .NET Framework for redistribution, choose **Save**, and then follow the prompts on your screen. + - If you want to download .NET Framework for redistribution, choose **Save**, and then follow the prompts on your screen. 1. If you want to download resources for additional languages, follow the instructions in the next section to install one or more language packs. @@ -191,15 +193,15 @@ The following table lists the supported languages. ## Next steps -- If you're new to the .NET Framework, see the [overview](../get-started/overview.md) for an introduction to key concepts and components. +- If you're new to .NET Framework, see the [overview](../get-started/overview.md) for an introduction to key concepts and components. -- For new features and improvements in the .NET Framework 4.5 and all later versions, see [What's New](../whats-new/index.md). +- For new features and improvements in .NET Framework 4.5 and all later versions, see [What's New](../whats-new/index.md). -- For detailed information about deploying the .NET Framework with your app, see [Deployment Guide for Developers](../deployment/deployment-guide-for-developers.md). +- For detailed information about deploying .NET Framework with your app, see [Deployment Guide for Developers](../deployment/deployment-guide-for-developers.md). -- For changes that affect the deployment of the .NET Framework with your app, see [Reducing System Restarts During .NET Framework 4.5 Installations](../deployment/reducing-system-restarts.md). +- For changes that affect the deployment of .NET Framework with your app, see [Reducing System Restarts During .NET Framework 4.5 Installations](../deployment/reducing-system-restarts.md). -- For information about migrating your app from the .NET Framework 4 to .NET Framework 4.5 or later versions, see the [migration guide](../migration-guide/index.md). +- For information about migrating your app from .NET Framework 4 to .NET Framework 4.5 or later versions, see the [migration guide](../migration-guide/index.md). - See [.NET Framework Reference Source](https://referencesource.microsoft.com/) to browse through .NET Framework source code online. The reference source is also available on [GitHub](https://github.com/Microsoft/referencesource). You can [download the reference source](https://referencesource.microsoft.com/download.html) for offline viewing and step through the sources (including patches and updates) during debugging. For more information, see the blog entry [A new look for .NET Reference Source](https://devblogs.microsoft.com/dotnet/a-new-look-for-net-reference-source/). diff --git a/docs/framework/install/index.md b/docs/framework/install/index.md index 4328274859f05..72a15c7e5e605 100644 --- a/docs/framework/install/index.md +++ b/docs/framework/install/index.md @@ -14,12 +14,12 @@ You can install .NET Framework on various Windows versions. - [Windows 10 and Windows Server 2016](on-windows-10.md) - [Windows 8.1 and Windows Server 2012 R2](on-windows-8-1.md) - [Windows 8 and Windows Server 2012](on-windows-8.md) -- [Windows 7 and Windows Server 2008 R2](on-windows-7.md) -- [Windows Vista and Windows Server 2008](on-windows-vista.md) ## Unsupported Windows versions -- [Windows XP and Windows Server 2003](on-windows-xp.md) +- [Windows XP and Windows Server 2003](/previous-versions/dotnet/framework/install/on-windows-xp) +- [Windows 7 and Windows Server 2008 R2](/previous-versions/dotnet/framework/install/on-windows-7) +- [Windows Vista and Windows Server 2008](/previous-versions/dotnet/framework/install/on-windows-vista) ## See also diff --git a/docs/framework/install/on-windows-7.md b/docs/framework/install/on-windows-7.md deleted file mode 100644 index 10213fc18b8ab..0000000000000 --- a/docs/framework/install/on-windows-7.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: Install the .NET Framework on Windows 7 SP1 -description: Learn how to install the .NET Framework on Windows 7 SP1. -ms.date: 04/18/2019 ---- - -# Install the .NET Framework on Windows 7 SP1 and Windows Server 2008 R2 - -The .NET Framework is required to run many applications on Windows. You can use the following instructions to install it. You may have arrived on this page after trying to run an application and seeing the following dialog on your machine. - -![This application could not be started](./media/this-application-could-not-be-started.png) - -These instructions will help you install the .NET Framework versions you need. [.NET Framework 4.8](https://github.com/Microsoft/dotnet/tree/master/releases/net48) is the latest version. It is supported on Windows 7 SP1 and Windows Server 2008 R2 and is included with [Windows 10 May 2019 Update](https://support.microsoft.com/help/4028685/windows-10-get-the-update) and later versions. - -## .NET Framework 4.8 - -> [!div class="button"] -> [Download .NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48) - -[.NET Framework 4.8](https://github.com/Microsoft/dotnet/tree/master/releases/net48) can be used to run applications built for .NET Framework 4.0 or later. - -### Offline installer - -When doing an offline install for .NET Framework on Windows 7, you'll first need to make sure that the latest [Microsoft Root Certificate Authority 2011](https://www.microsoft.com/pkiops/Docs/Repository.htm) has been installed on the target machine. - -The _certmgr.exe_ tool can automate installing a certificate and is obtained from Visual Studio or the Windows SDK. The following command is used to install the certificate before running the .NET Framework installer: - -```console -certmgr.exe /add MicRooCerAut2011_2011_03_22.crt /s /r localMachine root -``` - -## .NET Framework 3.5 - -The [.NET Framework 3.5](https://dotnet.microsoft.com/download/dotnet-framework/net35-sp1) is included with Windows 7. - -The .NET Framework 3.5 supports apps built for .NET Framework 1.0 through 3.5. - -## Help - -You can [contact Microsoft for help](mailto:dotnet-install-help@service.microsoft.com?subject=Install-Help) if you cannot get the correct version of the .NET Framework installed. - -## See also - -- [Download the .NET Framework](https://dotnet.microsoft.com/download) -- [Troubleshoot blocked .NET Framework installations and uninstallations](troubleshoot-blocked-installations-and-uninstallations.md) -- [Install the .NET Framework for developers](guide-for-developers.md) diff --git a/docs/framework/install/on-windows-vista.md b/docs/framework/install/on-windows-vista.md deleted file mode 100644 index 92d3a91c88e92..0000000000000 --- a/docs/framework/install/on-windows-vista.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: Install the .NET Framework on Windows Vista -description: Learn how to install the .NET Framework on Windows Vista. -ms.date: 04/18/2019 ---- - -# Install the .NET Framework on Windows Vista and Windows Server 2008 - -The .NET Framework is required to run many applications on Windows. You can use the following instructions to install it. You may have arrived on this page after trying to run an application and seeing the following dialog on your machine. - -![This application could not be started](./media/this-application-could-not-be-started.png) - -These instructions will help you install the .NET Framework versions you need. The [.NET Framework 4.8](https://github.com/Microsoft/dotnet/tree/master/releases/net48) is the latest version. It is not supported on Windows Vista and Windows Server 2008. It is included with Windows 10 May 2019 Update [and later versions](https://support.microsoft.com/help/4028685/windows-10-get-the-update). - -## .NET Framework 4.6 - -The [.NET Framework 4.6](https://dotnet.microsoft.com/download/dotnet-framework/net46) is the latest supported .NET Framework version on Windows Vista and Windows Server 2008. - -The [.NET Framework 4.6](https://dotnet.microsoft.com/download/dotnet-framework/net46) supports applications built for .NET Framework 4.0 through 4.6. - -## .NET Framework 3.5 - -You can install the [.NET Framework 3.5](https://dotnet.microsoft.com/download/dotnet-framework/net35-sp1) on Windows Vista. - -The .NET Framework 3.5 supports apps built for .NET Framework 1.0 through 3.5. - -## See also - -- [Download the .NET Framework](https://dotnet.microsoft.com/download) -- [Troubleshoot blocked .NET Framework installations and uninstallations](troubleshoot-blocked-installations-and-uninstallations.md) -- [Install the .NET Framework for developers](guide-for-developers.md) diff --git a/docs/framework/install/on-windows-xp.md b/docs/framework/install/on-windows-xp.md deleted file mode 100644 index 76ab5c17d3f1b..0000000000000 --- a/docs/framework/install/on-windows-xp.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: Install the .NET Framework on Windows XP -description: Learn how to install the .NET Framework on Windows XP. -ms.date: 04/18/2019 ---- - -# Install the .NET Framework on Windows XP and Windows Server 2003 - -> [!NOTE] -> Windows XP is no longer supported by Microsoft. We recommend you upgrade to Windows 10, which is supported and includes the latest version of the .NET Framework. This document is provided solely as a helpful troubleshooting guide. - -The .NET Framework is required to run many applications on Windows. You can use the following instructions to install it. You may have arrived on this page after trying to run an application and seeing the following dialog on your machine. - -![This application could not be started](./media/this-application-could-not-be-started.png) - -These instructions will help you install the .NET Framework versions you need. The [.NET Framework 4.8](https://github.com/Microsoft/dotnet/tree/master/releases/net48) is the latest version. It is not supported on Windows XP and Windows Server 2003. It is included with Windows 10 May 2019 Update [and later versions](https://support.microsoft.com/help/4028685/windows-10-get-the-update). - -## .NET Framework 4.0.3 - -The [.NET Framework 4.0.3](https://www.microsoft.com/download/details.aspx?id=29053) is the latest supported .NET Framework version on Windows XP and Windows Server 2003. The .NET Framework 4.0.3 requires that the [.NET Framework 4](https://dotnet.microsoft.com/download/dotnet-framework/net40) is installed first. Both of these .NET Framework versions are no longer supported by Microsoft. - -## .NET Framework 4 - -You can install the [.NET Framework 4](https://dotnet.microsoft.com/download/dotnet-framework/net40) on Windows XP. It's no longer supported by Microsoft. - -## .NET Framework 3.5 - -You can install the [.NET Framework 3.5](https://dotnet.microsoft.com/download/dotnet-framework/net35-sp1) on Windows XP. - -The .NET Framework 3.5 can be used to run applications built for .NET Framework 1.0 through 3.5. - -## See also - -- [Download the .NET Framework](https://dotnet.microsoft.com/download) -- [Troubleshoot blocked .NET Framework installations and uninstallations](troubleshoot-blocked-installations-and-uninstallations.md) -- [Install the .NET Framework for developers](guide-for-developers.md) diff --git a/docs/framework/interop/how-to-create-com-wrappers.md b/docs/framework/interop/how-to-create-com-wrappers.md index c8496c9eefd06..08f1292593003 100644 --- a/docs/framework/interop/how-to-create-com-wrappers.md +++ b/docs/framework/interop/how-to-create-com-wrappers.md @@ -9,13 +9,13 @@ ms.assetid: bdf89bea-1623-45ee-a57b-cf7c90395efa --- # How to: Create COM Wrappers -You can create Component Object Model (COM) wrappers by using Visual Studio 2005 features or the .NET Framework tools Tlbimp.exe and Regasm.exe. Both methods generate two types of COM wrappers: +You can create Component Object Model (COM) wrappers by using Visual Studio features or the .NET Framework tools Tlbimp.exe and Regasm.exe. Both methods generate two types of COM wrappers: - A [Runtime Callable Wrapper](../../standard/native-interop/runtime-callable-wrapper.md) from a type library to run a COM object in managed code. - A [COM Callable Wrapper](../../standard/native-interop/com-callable-wrapper.md) with the required registry settings to run a managed object in a native application. -In Visual Studio 2005, you can add the COM wrapper as a reference to your project. +In Visual Studio, you can add the COM wrapper as a reference to your project. ## Wrap COM Objects in a Managed Application @@ -56,7 +56,7 @@ You can now write code to access the COM object. You can begin by declaring the 4. Select the **Register for COM interop** check box. - When you build the project, the assembly is automatically registered for COM interop. If you are building a native application in Visual Studio 2005, you can use the assembly by clicking **Add Reference** on the **Project** menu. + When you build the project, the assembly is automatically registered for COM interop. If you are building a native application in Visual Studio, you can use the assembly by clicking **Add Reference** on the **Project** menu. ### To create a COM callable wrapper using .NET Framework tools diff --git a/docs/framework/interop/how-to-migrate-managed-code-dcom-to-wcf.md b/docs/framework/interop/how-to-migrate-managed-code-dcom-to-wcf.md index b8c0656b8dd13..725ab83aa0360 100644 --- a/docs/framework/interop/how-to-migrate-managed-code-dcom-to-wcf.md +++ b/docs/framework/interop/how-to-migrate-managed-code-dcom-to-wcf.md @@ -80,7 +80,7 @@ public interface ICustomerManager Next you should create a data contract for the service, which will describe how the data will be exchanged between the service and its clients. Classes described in the data contract should be marked with the [] attribute. The individual properties or fields you want visible to both client and server should be marked with the [] attribute. If you want types derived from a class in the data contract to be allowed, you must identify them with the [] attribute. WCF will only serialize or deserialize types in the service interface and types identified as known types. If you attempt to use a type that is not a known type, an exception will occur. - For more information about data contracts, see [Data Contracts](../wcf/samples/data-contracts.md). + For more information about data contracts, see [Data Contracts](/previous-versions/dotnet/framework/wcf/samples/data-contracts). ```csharp [DataContract] diff --git a/docs/framework/mef/composition-analysis-tool-mefx.md b/docs/framework/mef/composition-analysis-tool-mefx.md deleted file mode 100644 index d8f1476ac28d8..0000000000000 --- a/docs/framework/mef/composition-analysis-tool-mefx.md +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: "Composition analysis tool (Mefx)" -description: Read about the composition analysis tool (Mefx), which analyzes DLL and EXE files that contain Managed Extensibility Framework (MEF) parts in .NET. -ms.date: 06/09/2021 -helpviewer_keywords: - - "Composition Analysis Tool [MEF]" - - "MEF, Composition Analysis Tool" - - "Mefx [MEF], Composition Analysis Tool" -ms.assetid: c48a7f93-83bb-4a06-aea0-d8e7bd1502ad ---- - -# Composition analysis tool (Mefx) - -The composition analysis tool (Mefx) is a command-line application that analyzes library (.dll) and application (.exe) files containing Managed Extensibility Framework (MEF) parts. The primary purpose of Mefx is to provide developers a way to diagnose composition failures in their MEF applications without the requirement to add cumbersome tracing code to the application itself. It can also be useful to help understand parts from a library provided by a third party. This topic describes how to use Mefx and provides a reference for its syntax. - - - -## Get Mefx - -Mefx is available on GitHub at [Managed Extensibility Framework](https://github.com/MicrosoftArchive/mef/releases/tag/4.0). Simply download and unzip the tool. - - - -## Basic syntax - -Mefx is invoked from the command line in the following format: - -```console -mefx [files and directories] [action] [options] -``` - -The first set of arguments specify the files and directories from which to load parts for analysis. Specify a file with the `/file:` switch, and a directory with the `/directory:` switch. You can specify multiple files or directories, as shown in the following example: - -```console -mefx /file:MyAddIn.dll /directory:Program\AddIns [action...] -``` - -> [!NOTE] -> Each .dll or .exe should only be loaded one time. If a file is loaded multiple times, the tool may return incorrect information. - -After the list of files and directories, you must specify a command, and any options for that command. - - - -## List available parts - -Use the `/parts` action to list all the parts declared in the files loaded. The result is a simple list of part names. - -```console -mefx /file:MyAddIn.dll /parts -MyAddIn.AddIn -MyAddIn.MemberPart -``` - -For more information about the parts, use the `/verbose` option. This will output more information for all available parts. To get more information about a single part, use the `/type` action instead of `/parts`. - -```console -mefx /file:MyAddIn.dll /type:MyAddIn.AddIn /verbose -[Part] MyAddIn.MemberPart from: AssemblyCatalog (Assembly=" MyAddIn, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") - [Export] MyAddIn.MemberPart (ContractName=" MyAddIn.MemberPart") -``` - - - -## List Imports and Exports - -The `/imports` and `/exports` actions will list all the imported parts and all the exported parts, respectively. You can also list the parts that import or export a particular type by using the `/importers` or `/exporters` actions. - -```console -mefx /file:MyAddIn.dll /importers:MyAddin.MemberPart -MyAddin.AddIn -``` - -You can also apply the `/verbose` option to these actions. - - - -## Find rejected parts - -Once it has loaded the available parts, Mefx uses the MEF composition engine to compose them. Parts that cannot be successfully composed are referred to as *rejected*. To list all the rejected parts, use the `/rejected` action. - -You can use the `/verbose` option with the `/rejected` action to print detailed information about rejected parts. In the following example, the `ClassLibrary1` DLL contains the `AddIn` part, which imports the `MemberPart` and `ChainOne` parts. `ChainOne` imports `ChainTwo`, but `ChainTwo` does not exist. This means that `ChainOne` is rejected, which causes `AddIn` to be rejected. - -```console -mefx /file:ClassLibrary1.dll /rejected /verbose -``` - -The following shows the complete output of the previous command: - -```output -[Part] ClassLibrary1.AddIn from: AssemblyCatalog (Assembly="ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") - [Export] ClassLibrary1.AddIn (ContractName="ClassLibrary1.AddIn") - [Import] ClassLibrary1.AddIn.memberPart (ContractName="ClassLibrary1.MemberPart") - [SatisfiedBy] ClassLibrary1.MemberPart (ContractName="ClassLibrary1.MemberPart") from: ClassLibrary1.MemberPart from: AssemblyCatalog (Assembly="ClassLibrar -y1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") - [Import] ClassLibrary1.AddIn.chain (ContractName="ClassLibrary1.ChainOne") - [Exception] System.ComponentModel.Composition.ImportCardinalityMismatchException: No valid exports were found that match the constraint '((exportDefinition.ContractName == "ClassLibrary1.ChainOne") AndAlso (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso "ClassLibrary1.ChainOne".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected. - at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition) - at Microsoft.ComponentModel.Composition.Diagnostics.CompositionInfo.AnalyzeImportDefinition(ExportProvider host, IEnumerable`1 availableParts, ImportDefinition id) - [Unsuitable] ClassLibrary1.ChainOne (ContractName="ClassLibrary1.ChainOne") -from: ClassLibrary1.ChainOne from: AssemblyCatalog (Assembly="ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") - [Because] PartDefinitionIsRejected, The part providing the export is rejected because of other issues. - -[Part] ClassLibrary1.ChainOne from: AssemblyCatalog (Assembly="ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null") - [Primary Rejection] - [Export] ClassLibrary1.ChainOne (ContractName="ClassLibrary1.ChainOne") - [Import] ClassLibrary1.ChainOne.chain (ContractName="ClassLibrary1.ChainTwo") - [Exception] System.ComponentModel.Composition.ImportCardinalityMismatchException: No valid exports were found that match the constraint '((exportDefinition.ContractName == "ClassLibrary1.ChainTwo") AndAlso (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso "ClassLibrary1.ChainTwo".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected. - at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition) - at Microsoft.ComponentModel.Composition.Diagnostics.CompositionInfo.AnalyzeImportDefinition(ExportProvider host, IEnumerable`1 availableParts, ImportDefinition id) -``` - -The interesting information is contained in the `[Exception]` and `[Unsuitable]` results. The `[Exception]` result provides information about why a part was rejected. The `[Unsuitable]` result indicates why an otherwise-matching part could not be used to fill an import; in this case, because that part was itself rejected for missing imports. - - - -## Analyze primary causes - -If several parts are linked in a long dependency chain, a problem involving a part near the bottom may cause the entire chain to be rejected. Diagnosing these problems can be difficult because the root cause of the failure is not always obvious. To help with the problem, you can use the `/causes` action, which attempts to find the root cause of any cascading rejection. - -Using the `/causes` action on the previous example would list only information for `ChainOne`, whose unfilled import is the root cause of the rejection of `AddIn`. The `/causes` action can be used in both normal and `/verbose` options. - -> [!NOTE] -> In most cases, Mefx will be able to diagnose the root cause of a cascading failure. However, in cases where parts are added programmatically to a container, cases involving hierarchical containers, or cases involving custom `ExportProvider` implementations, Mefx will not be able to diagnose the cause. In general, the previously described cases should be avoided where possible, as failures are generally difficult to diagnose. - - - -## Allow lists - -The `/whitelist` option enables you to specify a text file that lists parts that are expected to be rejected. Unexpected rejections will then be flagged. This can be useful when you analyze an incomplete library, or a sublibrary that's missing some dependencies. The `/whitelist` option can be applied to the `/rejected` or `/causes` actions. - -Consider a file named test.txt that contains the text "ClassLibrary1.ChainOne". If you run the `/rejected` action with the `/whitelist` option on the previous example, it produces the following output: - -```console -mefx /file:ClassLibrary1.dll /rejected /whitelist:test.txt -[Unexpected] ClassLibrary1.AddIn -ClassLibrary1.ChainOne -``` diff --git a/docs/framework/mef/mef-for-net-for-windows-store-apps.md b/docs/framework/mef/mef-for-net-for-windows-store-apps.md deleted file mode 100644 index 7b6d0edcff953..0000000000000 --- a/docs/framework/mef/mef-for-net-for-windows-store-apps.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "MEF for .NET - Windows Store Apps" -description: Review Managed Extensibility Framework (MEF) namespaces that contain types for developing extensible Windows 8.x Store apps. -ms.date: 06/09/2021 -ms.assetid: 7667770e-d163-4ad6-a303-085cf73db2f2 ---- - -# MEF for .NET - Windows Store Apps - - and its child namespaces contain types for developing extensible Windows 8.x Store apps with Managed Extensibility Framework (MEF). These namespaces are part of the .NET for Windows 8.x Store apps subset for the Windows 8 operating system. - -These namespaces are not part of the core class library distributed with the .NET Framework. To install these namespaces, open your project in Visual Studio, choose **Manage NuGet Packages** from the **Project** menu, and search online for the Microsoft.Composition package. - -- provides classes that constitute the core MEF for Windows 8.x Store apps. -- provides types that support using MEF with a convention-based configuration model. -- provides MEF types that are useful to developers of host applications. -- provides MEF types used internally by the composition engine. - -For more information about .NET for Windows 8.x Store apps and a list of namespaces and types that it contains, see [.NET for Windows Store apps overview](/previous-versions/br230302(v=vs.110)). - -## See also - -- [.NET for Windows Store apps overview](/previous-versions/br230302(v=vs.110)) -- [.NET for Windows Store apps – supported APIs](/previous-versions/br230232(v=vs.110)) -- [Managed Extensibility Framework (MEF)](index.md) diff --git a/docs/framework/mef/toc.yml b/docs/framework/mef/toc.yml index f4b1c98a70f67..9f794a13b0dcd 100644 --- a/docs/framework/mef/toc.yml +++ b/docs/framework/mef/toc.yml @@ -3,7 +3,3 @@ items: - name: Attributed programming model overview (MEF) href: attributed-programming-model-overview-mef.md - - name: Composition analysis tool (Mefx) - href: composition-analysis-tool-mefx.md - - name: MEF for .NET - Windows Store Apps - href: mef-for-net-for-windows-store-apps.md diff --git a/docs/framework/migration-guide/mitigation-product-versioning.md b/docs/framework/migration-guide/mitigation-product-versioning.md index 74707074163bf..5f96b70f89dc5 100644 --- a/docs/framework/migration-guide/mitigation-product-versioning.md +++ b/docs/framework/migration-guide/mitigation-product-versioning.md @@ -4,9 +4,9 @@ description: In this article, learn how .NET Framework 4.6 and later product ver ms.date: "03/30/2017" ms.assetid: 1c4de9d7-9aba-427a-8f38-0ab9bfb8f85e --- -# Mitigation: Product Versioning +# Mitigation: Product versioning -In the .NET Framework 4.6 and later, product versioning has changed from the previous releases of the .NET Framework (the .NET Framework 4, 4.5, 4.5.1, and 4.5.2). +In .NET Framework 4.6 and later versions, product versioning has changed from the previous releases of .NET Framework (.NET Framework 4, 4.5, 4.5.1, and 4.5.2). ## Product versioning changes diff --git a/docs/framework/migration-guide/net-framework-4-migration-issues.md b/docs/framework/migration-guide/net-framework-4-migration-issues.md index 08566807d6d98..f7d52de69a168 100644 --- a/docs/framework/migration-guide/net-framework-4-migration-issues.md +++ b/docs/framework/migration-guide/net-framework-4-migration-issues.md @@ -56,7 +56,7 @@ Assembly: System.Web (in System.Web.dll) | **Configuration files** | Corrections have been made in how .NET Framework accesses application configuration files. | If your application configuration file is named *application-name.config*, rename it to *application-name.exe.config*. For example, rename *MyApp.config* to *MyApp.exe.config*. | | **C# code compiler** | The `Compiler`, `CompilerError`, and `ErrorLevel` classes that were in the namespace are no longer available, and their assembly (cscompmgd.dll) is no longer included in .NET Framework. | Use the class and other classes in the namespace. For more information, see [Using the CodeDOM](/previous-versions/dotnet/netframework-4.0/y2k85ax6(v=vs.100)). | | **Hosting** (unmanaged API) | To improve hosting capabilities, some of the hosting activation APIs have been deprecated. In-process side-by-side execution features enable an application to load and start multiple versions of .NET Framework in the same process. For example, you can run applications that load add-ins (or components) that are based on .NET Framework 2.0 SP1 and add-ins that are based on .NET Framework 4 in the same process. Older components continue to use the older .NET Framework version, and new components use the new .NET Framework version. | Use the configurations described in [In-Process Side-by-Side Execution](../deployment/in-process-side-by-side-execution.md). | -| **New security model** | The code access security (CAS) policy has been turned off and replaced with a simplified model, as described in [Security Changes in .NET Framework 4](/previous-versions/dotnet/netframework-4.0/dd233103(v=vs.100)). | Modifications may be required if you depend on CAS in your applications. For more information, see [Code Access Security Policy Compatibility and Migration](../misc/code-access-security-policy-compatibility-and-migration.md). | +| **New security model** | The code access security (CAS) policy has been turned off and replaced with a simplified model, as described in [Security Changes in .NET Framework 4](/previous-versions/dotnet/netframework-4.0/dd233103(v=vs.100)). | Modifications may be required if you depend on CAS in your applications. For more information, see [Code Access Security Policy Compatibility and Migration](/previous-versions/dotnet/framework/code-access-security/code-access-security-policy-compatibility-and-migration). | ### Date and time diff --git a/docs/framework/migration-guide/versions-and-dependencies.md b/docs/framework/migration-guide/versions-and-dependencies.md index d33a56d9b0bbd..f6951c5863bba 100644 --- a/docs/framework/migration-guide/versions-and-dependencies.md +++ b/docs/framework/migration-guide/versions-and-dependencies.md @@ -156,6 +156,8 @@ The tables that follow summarize .NET Framework version history and correlate ea |**Windows Server versions**|✔️ 2012 R2

➕ 2012
➕ 2008 R2 SP1
➕ 2008 SP2| |**To determine installed .NET version**|Use `Release` DWORD:

- 378675 (Windows 8.1)
- 378758 (all other)

(See [instructions](how-to-determine-which-versions-are-installed.md))| +[!INCLUDE [net-framework-vs](../../../includes/net-framework-vs.md)] + ### .NET Framework 4.5 - [New features](../whats-new/index.md#whats-new-in-net-framework-45) @@ -169,6 +171,8 @@ The tables that follow summarize .NET Framework version history and correlate ea |**Windows Server versions**|✔️ 2012
➕ 2008 R2 SP1
➕ 2008 SP2| |**To determine installed .NET version**|Use `Release` DWORD 378389

(See [instructions](how-to-determine-which-versions-are-installed.md))| +[!INCLUDE [net-framework-vs](../../../includes/net-framework-vs.md)] + ### .NET Framework 4 [New features](/previous-versions/dotnet/netframework-4.0/ms171868(v=vs.100)) @@ -181,6 +185,8 @@ The tables that follow summarize .NET Framework version history and correlate ea |**Windows Server versions**|➕ 2008 R2 SP1
➕ 2008 SP2
➕ 2003| |**To determine installed .NET version**|See [instructions](how-to-determine-which-versions-are-installed.md)| +[!INCLUDE [net-framework-vs](../../../includes/net-framework-vs.md)] + ### .NET Framework 3.5 [New features](/previous-versions/visualstudio/visual-studio-2008/ms171868\(v=vs.90\)): @@ -289,6 +295,8 @@ Some changes in .NET Framework may require changes to your app code; see [Applic In addition, if your app targets version 2.0, 3.0, or 3.5, your users may be required to enable .NET Framework 3.5 on a Windows 8, Windows 8.1, or Windows 10 computer before they can run your app. For more information, see [Install the .NET Framework 3.5 on Windows 10, Windows 8.1, and Windows 8](../install/dotnet-35-windows-10.md). +[!INCLUDE [net-framework-vs](../../../includes/net-framework-vs.md)] + ## Next steps - If you're new to the .NET Framework, see the [overview](../get-started/overview.md) for an introduction to key concepts and features. diff --git a/docs/framework/misc/code-access-security-basics.md b/docs/framework/misc/code-access-security-basics.md deleted file mode 100644 index ad54b9e354b86..0000000000000 --- a/docs/framework/misc/code-access-security-basics.md +++ /dev/null @@ -1,165 +0,0 @@ ---- -title: "Code Access Security Basics" -description: "Learn code access security basics for apps targeting the CLR: type-safe code, imperative and declarative syntax, secure class libraries, and transparent code." -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "security [.NET Framework], code access security" -ms.assetid: 4eaa6535-d9fe-41a1-91d8-b437cfc16921 ---- - -# Code Access Security Basics - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -Every application that targets the common language runtime (that is, every managed application) must interact with the runtime's security system. When a managed application is loaded, its host automatically grants it a set of permissions. These permissions are determined by the host's local security settings or by the sandbox the application is in. Depending on these permissions, the application either runs properly or generates a security exception. - -The default host for desktop applications allows code to run in full trust. Therefore, if your application targets the desktop, it has an unrestricted permission set. Other hosts or sandboxes provide a limited permission set for applications. Because the permission set can change from host to host, you must design your application to use only the permissions that your target host allows. - -You must be familiar with the following code access security concepts in order to write effective applications that target the common language runtime: - -- **Type-safe code**: Type-safe code is code that accesses types only in well-defined, allowable ways. For example, given a valid object reference, type-safe code can access memory at fixed offsets that correspond to actual field members. If the code accesses memory at arbitrary offsets outside the range of memory that belongs to that object's publicly exposed fields, it is not type-safe. To enable code to benefit from code access security, you must use a compiler that generates verifiably type-safe code. For more information, see the [Writing Verifiably Type-Safe Code](#typesafe_code) section later in this topic. - -- **Imperative and declarative syntax**: Code that targets the common language runtime can interact with the security system by requesting permissions, demanding that callers have specified permissions, and overriding certain security settings (given enough privileges). You use two forms of syntax to programmatically interact with the .NET Framework security system: declarative syntax and imperative syntax. Declarative calls are performed using attributes; imperative calls are performed using new instances of classes within your code. Some calls can be performed only imperatively, others can be performed only declaratively, and some calls can be performed in either manner. - -- **Secure class libraries**: A secure class library uses security demands to ensure that the library's callers have permission to access the resources that the library exposes. For example, a secure class library might have a method for creating files that would demand that its callers have permissions to create files. The .NET Framework consists of secure class libraries. You should be aware of the permissions required to access any library that your code uses. For more information, see the [Using Secure Class Libraries](#secure_library) section later in this topic. - -- **Transparent code**: Starting with the .NET Framework 4, in addition to identifying specific permissions, you must also determine whether your code should run as security-transparent. Security-transparent code cannot call types or members that are identified as security-critical. This rule applies to full-trust applications as well as partially trusted applications. For more information, see [Security-Transparent Code](security-transparent-code.md). - - - -## Writing Verifiably Type-Safe Code - -Just-in-time (JIT) compilation performs a verification process that examines code and tries to determine whether the code is type-safe. Code that is proven during verification to be type-safe is called *verifiably type-safe code*. Code can be type-safe, yet might not be verifiably type-safe because of the limitations of the verification process or of the compiler. Not all languages are type-safe, and some language compilers, such as Microsoft Visual C++, cannot generate verifiably type-safe managed code. To determine whether the language compiler you use generates verifiably type-safe code, consult the compiler's documentation. If you use a language compiler that generates verifiably type-safe code only when you avoid certain language constructs, you might want to use the [PEVerify tool](../tools/peverify-exe-peverify-tool.md) to determine whether your code is verifiably type-safe. - -Code that is not verifiably type-safe can attempt to execute if security policy allows the code to bypass verification. However, because type safety is an essential part of the runtime's mechanism for isolating assemblies, security cannot be reliably enforced if code violates the rules of type safety. By default, code that is not type-safe is allowed to run only if it originates from the local computer. Therefore, mobile code should be type-safe. - - - -## Using Secure Class Libraries - -If your code requests and is granted the permissions required by the class library, it will be allowed to access the library and the resources that the library exposes will be protected from unauthorized access. If your code does not have the appropriate permissions, it will not be allowed to access the class library, and malicious code will not be able to use your code to indirectly access protected resources. Other code that calls your code must also have permission to access the library. If it does not, your code will be restricted from running as well. - -Code access security does not eliminate the possibility of human error in writing code. However, if your application uses secure class libraries to access protected resources, the security risk for application code is decreased, because class libraries are closely scrutinized for potential security problems. - -## Declarative Security - -Declarative security syntax uses [attributes](../../standard/attributes/index.md) to place security information into the [metadata](../../standard/metadata-and-self-describing-components.md) of your code. Attributes can be placed at the assembly, class, or member level, to indicate the type of request, demand, or override you want to use. Requests are used in applications that target the common language runtime to inform the runtime security system about the permissions that your application needs or does not want. Demands and overrides are used in libraries to help protect resources from callers or to override default security behavior. - -> [!NOTE] -> In the .NET Framework 4, there have been important changes to the .NET Framework security model and terminology. For more information about these changes, see [Security Changes](/previous-versions/dotnet/framework/security/security-changes). - -In order to use declarative security calls, you must initialize the state data of the permission object so that it represents the particular form of permission you need. Every built-in permission has an attribute that is passed a enumeration to describe the type of security operation you want to perform. However, permissions also accept their own parameters that are exclusive to them. - -The following code fragment shows declarative syntax for requesting that your code's callers have a custom permission called `MyPermission`. This permission is a hypothetical custom permission and does not exist in the .NET Framework. In this example, the declarative call is placed directly before the class definition, specifying that this permission be applied to the class level. The attribute is passed a **SecurityAction.Demand** structure to specify that callers must have this permission in order to run. - -```vb - Public Class MyClass1 - - Public Sub New() - 'The constructor is protected by the security call. - End Sub - - Public Sub MyMethod() - 'This method is protected by the security call. - End Sub - - Public Sub YourMethod() - 'This method is protected by the security call. - End Sub -End Class -``` - -```csharp -[MyPermission(SecurityAction.Demand, Unrestricted = true)] -public class MyClass -{ - public MyClass() - { - //The constructor is protected by the security call. - } - - public void MyMethod() - { - //This method is protected by the security call. - } - - public void YourMethod() - { - //This method is protected by the security call. - } -} -``` - -## Imperative Security - -Imperative security syntax issues a security call by creating a new instance of the permission object you want to invoke. You can use imperative syntax to perform demands and overrides, but not requests. - -Before you make the security call, you must initialize the state data of the permission object so that it represents the particular form of the permission you need. For example, when creating a object, you can use the constructor to initialize the **FileIOPermission** object so that it represents either unrestricted access to all files or no access to files. Or, you can use a different **FileIOPermission** object, passing parameters that indicate the type of access you want the object to represent (that is, read, append, or write) and what files you want the object to protect. - -In addition to using imperative security syntax to invoke a single security object, you can use it to initialize a group of permissions in a permission set. For example, this technique is the only way to reliably perform [assert](using-the-assert-method.md) calls on multiple permissions in one method. Use the and classes to create a group of permissions and then call the appropriate method to invoke the desired security call. - -You can use imperative syntax to perform demands and overrides, but not requests. You might use imperative syntax for demands and overrides instead of declarative syntax when information that you need in order to initialize the permission state becomes known only at run time. For example, if you want to ensure that callers have permission to read a certain file, but you do not know the name of that file until run time, use an imperative demand. You might also choose to use imperative checks instead of declarative checks when you need to determine at run time whether a condition holds and, based on the result of the test, make a security demand (or not). - -The following code fragment shows imperative syntax for requesting that your code's callers have a custom permission called `MyPermission`. This permission is a hypothetical custom permission and does not exist in the .NET Framework. A new instance of `MyPermission` is created in `MyMethod`, guarding only this method with the security call. - -```vb -Public Class MyClass1 - - Public Sub New() - - End Sub - - Public Sub MyMethod() - 'MyPermission is demanded using imperative syntax. - Dim Perm As New MyPermission() - Perm.Demand() - 'This method is protected by the security call. - End Sub - - Public Sub YourMethod() - 'YourMethod 'This method is not protected by the security call. - End Sub -End Class -``` - -```csharp -public class MyClass { - public MyClass(){ - - } - - public void MyMethod() { - //MyPermission is demanded using imperative syntax. - MyPermission Perm = new MyPermission(); - Perm.Demand(); - //This method is protected by the security call. - } - - public void YourMethod() { - //This method is not protected by the security call. - } -} -``` - -## Using Managed Wrapper Classes - -Most applications and components (except secure libraries) should not directly call unmanaged code. There are several reasons for this. If code calls unmanaged code directly, it will not be allowed to run in many circumstances because code must be granted a high level of trust to call native code. If policy is modified to allow such an application to run, it can significantly weaken the security of the system, leaving the application free to perform almost any operation. - -Additionally, code that has permission to access unmanaged code can probably perform almost any operation by calling into an unmanaged API. For example, code that has permission to call unmanaged code does not need to access a file; it can just call an unmanaged (Win32) file API directly, bypassing the managed file API that requires **FileIOPermission**. If managed code has permission to call into unmanaged code and does call directly into unmanaged code, the security system will be unable to reliably enforce security restrictions, since the runtime cannot enforce such restrictions on unmanaged code. - -If you want your application to perform an operation that requires accessing unmanaged code, it should do so through a trusted managed class that wraps the required functionality (if such a class exists). Do not create a wrapper class yourself if one already exists in a secure class library. The wrapper class, which must be granted a high degree of trust to be allowed to make the call into unmanaged code, is responsible for demanding that its callers have the appropriate permissions. If you use the wrapper class, your code only needs to request and be granted the permissions that the wrapper class demands. - -## See also - -- -- -- -- -- [Assert](using-the-assert-method.md) -- [Code Access Security](code-access-security.md) -- [Code Access Security Basics](code-access-security-basics.md) -- [Attributes](../../standard/attributes/index.md) -- [Metadata and Self-Describing Components](../../standard/metadata-and-self-describing-components.md) diff --git a/docs/framework/misc/code-access-security-policy-compatibility-and-migration.md b/docs/framework/misc/code-access-security-policy-compatibility-and-migration.md deleted file mode 100644 index 90b309682d993..0000000000000 --- a/docs/framework/misc/code-access-security-policy-compatibility-and-migration.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -title: "Code Access Security Policy Compatibility and Migration" -description: Read a summary and see links about code access security policy compatibility and migration in .NET Framework 4. -ms.date: "03/30/2017" -helpviewer_keywords: - - "policy migration, compatibility" - - "CLR policy migration" -ms.assetid: 19cb4d39-e38a-4262-b507-458915303115 ---- - -# Code Access Security Policy Compatibility and Migration - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -The policy portion of code access security (CAS) has been made obsolete in the .NET Framework 4. As a result, you may encounter compilation warnings and runtime exceptions if you call the obsolete policy types and members [explicitly](#explicit_use) or [implicitly](#implicit_use) (through other types and members). - -You can avoid the warnings and errors by either: - -- [Migrating](#migration) to the .NET Framework 4 replacements for the obsolete calls. - - \- or - - -- Using the [\ configuration element](../configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md) to opt into the legacy CAS policy behavior. - -This topic contains the following sections: - -- [Explicit Use](#explicit_use) - -- [Implicit Use](#implicit_use) - -- [Errors and Warnings](#errors_and_warnings) - -- [Migration: Replacement for Obsolete Calls](#migration) - -- [Compatibility: Using the CAS Policy Legacy Option](#compatibility) - - - -## Explicit Use - -Members that directly manipulate security policy or require CAS policy to sandbox are obsolete and will produce errors by default. - -Examples of these are: - -- - -- - -- - -- - -- - -- - -- - -- - -- - -- - - - -## Implicit Use - -Several assembly loading overloads produce errors because of their implicit use of CAS policy. These overloads take an parameter that is used to resolve CAS policy and provide a permission grant set for an assembly. - -Here are some examples. The obsolete overloads are those that take as a parameter: - -- - -- - -- - -- - -- - -- - -- - -- - -- - - - -## Errors and Warnings - -The obsolete types and members produce the following error messages when they are used. Note that the type itself is not obsolete. - -Compile-time warning: - -`warning CS0618: '' is obsolete: 'This method is obsolete and will be removed in a future release of the .NET Framework. Please use . See for more information.'` - -Run-time exception: - -: `This method uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the configuration switch. Please see for more information.` - - - -## Migration: Replacement for Obsolete Calls - -### Determining an Assembly’s Trust Level - -CAS policy is often used to determine an assembly’s or application domain’s permission grant set or trust level. The .NET Framework 4 exposes the following useful properties that do not need to resolve security policy: - -- - -- - -- - -- - -### Application Domain Sandboxing - -The method is typically used for sandboxing the assemblies in an application domain. The .NET Framework 4 exposes members that do not have to use for this purpose. For more information, see [How to: Run Partially Trusted Code in a Sandbox](how-to-run-partially-trusted-code-in-a-sandbox.md). - -### Determining a Safe or Reasonable Permission Set for Partially Trusted Code - -Hosts often need to determine the permissions that are appropriate for sandboxing hosted code. Before the .NET Framework 4, CAS policy provided a way to do this with the method. As a replacement, .NET Framework 4 provides the method, which returns a safe, standard permission set for the provided evidence. - -### Non-Sandboxing Scenarios: Overloads for Assembly Loads - -The reason for using an assembly load overload might be to use parameters that are not otherwise available, instead of sandboxing the assembly. Starting with the .NET Framework 4, assembly load overloads that do not require a object as a parameter, for example, , enable this scenario. - -If you want to sandbox an assembly, use the overload. - - - -## Compatibility: Using the CAS Policy Legacy Option - -The [\ configuration element](../configure-apps/file-schema/runtime/netfx40-legacysecuritypolicy-element.md) lets you specify that a process or library uses legacy CAS policy. When you enable this element, the policy and evidence overloads will work as they did in previous versions of the framework. - -> [!NOTE] -> CAS policy behavior is specified on a runtime version basis, so modifying CAS policy for one runtime version does not affect the CAS policy of another version. - -```xml - - - - - -``` - -## See also - -- [How to: Run Partially Trusted Code in a Sandbox](how-to-run-partially-trusted-code-in-a-sandbox.md) -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/code-access-security.md b/docs/framework/misc/code-access-security.md deleted file mode 100644 index d370ce88bf4c3..0000000000000 --- a/docs/framework/misc/code-access-security.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: "Code Access Security" -description: Learn about the code access security mechanism in .NET, which helps protect computer systems from malicious mobile code. -ms.date: "03/30/2017" -helpviewer_keywords: - - "named permission sets, code access security" - - "call stacks" - - "malicious code" - - "stack walk" - - "security [.NET Framework], code access security" - - "permissions [.NET Framework], code access security" - - "trusted code" - - "mobile code security" - - "unmanaged code, code access security" - - "granting permissions, code access security" - - "user authentication, code access security" - - "code access security" -ms.assetid: 859af632-c80d-4736-8d6f-1e01b09ce127 ---- -# Code Access Security - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -> [!NOTE] -> Because Code Access Security is deprecated, most modern code within the .NET ecosystem is not designed to operate within a partial trust environment. Applications that rely on CAS should not expect modern libraries to behave correctly within these environments, unless the library developer has taken explicit steps to ensure compatibility within the CAS sandbox. - - Today's highly connected computer systems are frequently exposed to code originating from various, possibly unknown sources. Code can be attached to email, contained in documents, or downloaded over the Internet. Unfortunately, many computer users have experienced firsthand the effects of malicious mobile code, including viruses and worms, which can damage or destroy data and cost time and money. - - Most common security mechanisms give rights to users based on their credentials (usually a password) and restrict resources (often directories and files) that the user is allowed to access. However, this approach fails to address several issues: users obtain code from many sources, some of which might be unreliable; code can contain bugs or vulnerabilities that enable it to be exploited by malicious code; and code sometimes does things that the user does not know it will do. As a result, computer systems can be damaged and private data can be leaked when cautious and trustworthy users run malicious or error-filled software. Most operating system security mechanisms require that every piece of code must be trusted in order to run, except perhaps for scripts on a Web page. Therefore, there is still a need for a widely applicable security mechanism that allows code originating from one computer system to execute with protection on another system, even when there is no trust relationship between the systems. - - The .NET Framework provides a security mechanism called code access security to help protect computer systems from malicious mobile code, to allow code from unknown origins to run with protection, and to help prevent trusted code from intentionally or accidentally compromising security. Code access security enables code to be trusted to varying degrees depending on where the code originates and on other aspects of the code's identity. Code access security also enforces the varying levels of trust on code, which minimizes the amount of code that must be fully trusted in order to run. Using code access security can reduce the likelihood that your code will be misused by malicious or error-filled code. It can reduce your liability, because you can specify the set of operations your code should be allowed to perform. Code access security can also help minimize the damage that can result from security vulnerabilities in your code. - -> [!NOTE] -> Major changes have been made to code access security in the .NET Framework 4. The most notable change has been [security transparency](security-transparent-code.md), but there are also other significant changes that affect code access security. For information about these changes, see [Security Changes](/previous-versions/dotnet/framework/security/security-changes). - - Code access security primarily affects library code and partially trusted applications. Library developers must protect their code from unauthorized access from partially trusted applications. Partially trusted applications are applications that are loaded from external sources such as the Internet. Applications that are installed on your desktop or on the local intranet run in full trust. Full-trust applications are not affected by code access security unless they are marked as [security-transparent](security-transparent-code.md), because they are fully trusted. The only limitation for full-trust applications is that applications that are marked with the attribute cannot call code that is marked with the attribute. Partially trusted applications must be run in a sandbox (for example, in Internet Explorer) so that code access security can be applied. If you download an application from the Internet and try to run it from your desktop, you will get a with the message: "An attempt was made to load an assembly from a network location, which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous." If you are sure that the application can be trusted, you can enable it to be run as full trust by using the [\ element](../configure-apps/file-schema/runtime/loadfromremotesources-element.md). For information about running an application in a sandbox, see [How to: Run Partially Trusted Code in a Sandbox](how-to-run-partially-trusted-code-in-a-sandbox.md). - - All managed code that targets the common language runtime receives the benefits of code access security, even if that code does not make a single code access security call. For more information, see [Code Access Security Basics](code-access-security-basics.md). - - - -## Key Functions of Code Access Security - - Code access security helps limit the access that code has to protected resources and operations. In the .NET Framework, code access security performs the following functions: - -- Defines permissions and permission sets that represent the right to access various system resources. - -- Enables code to demand that its callers have specific permissions. - -- Enables code to demand that its callers possess a digital signature, thus allowing only callers from a particular organization or site to call the protected code. - -- Enforces restrictions on code at run time by comparing the granted permissions of every caller on the call stack to the permissions that callers must have. - - - -## Walking the Call Stack - - To determine whether code is authorized to access a resource or perform an operation, the runtime's security system walks the call stack, comparing the granted permissions of each caller to the permission being demanded. If any caller in the call stack does not have the demanded permission, a security exception is thrown and access is refused. The stack walk is designed to help prevent luring attacks, in which less-trusted code calls highly trusted code and uses it to perform unauthorized actions. Demanding permissions of all callers at run time affects performance, but it is essential to help protect code from luring attacks by less-trusted code. To optimize performance, you can have your code perform fewer stack walks. However, be sure that you don't expose a security weakness whenever you do this. - - The following illustration shows the stack walk that results when a method in Assembly A4 demands that its callers have permission P. - - ![Code access security stack walk](media/slide-10a.gif "slide_10a") - - - -## Related articles - -|Title|Description| -|-----------|-----------------| -|[Code Access Security Basics](code-access-security-basics.md)|Describes code access security and its most common uses.| -|[Security-Transparent Code, Level 2](security-transparent-code-level-2.md)|Describes the security transparency model in the .NET Framework 4.| -|[Using Libraries from Partially Trusted Code](using-libraries-from-partially-trusted-code.md)|Describes how to enable libraries for use with unmanaged code and how to use libraries from unmanaged code.| -|[Key Security Concepts](../../standard/security/key-security-concepts.md)|Provides an overview of many of the key terms and concepts used in the .NET Framework security system.| -|[Role-Based Security](../../standard/security/role-based-security.md)|Describes how to incorporate security based on roles.| -|[Cryptographic Services](../../standard/security/cryptographic-services.md)|Describes how to incorporate cryptography into your applications.| diff --git a/docs/framework/misc/dangerous-permissions-and-policy-administration.md b/docs/framework/misc/dangerous-permissions-and-policy-administration.md deleted file mode 100644 index 12fe143ca07c3..0000000000000 --- a/docs/framework/misc/dangerous-permissions-and-policy-administration.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "Dangerous Permissions and Policy Administration" -description: See links to the various dangerous permissions in .NET. These permissions should be given only to trustworthy code, and only when necessary. -ms.date: "03/30/2017" -helpviewer_keywords: - - "permissions [.NET Framework], policy administration" - - "security [.NET Framework], dangerous permissions" - - "code security, dangerous permissions" - - "secure coding, dangerous permissions" - - "permissions [.NET Framework], dangerous" -ms.assetid: 1929e854-23a0-4bb1-94be-e8aa3b609e32 ---- -# Dangerous Permissions and Policy Administration - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -Several of the protected operations for which the .NET Framework provides permissions can potentially allow the security system to be circumvented. These dangerous permissions should be given only to trustworthy code, and then only as necessary. There is usually no defense against malicious code if it is granted these permissions. - -> [!NOTE] -> In the .NET Framework 4, there have been important changes to the .NET Framework security model and terminology. For more information about these changes, see [Security Changes](/previous-versions/dotnet/framework/security/security-changes). - - The dangerous permissions are explained in the following table. - -|Permission|Potential risk| -|----------------|--------------------| -||| -||Allows managed code to call into unmanaged code, which is often dangerous.| -||Without verification, the code can do anything.| -||Invalidated evidence can fool security policy.| -||The ability to modify security policy can disable security.| -||The use of serialization can circumvent accessibility mechanisms. For details, see [Security and Serialization](security-and-serialization.md).| -||The ability to set the current principal can trick role-based security.| -||Manipulation of threads is dangerous because of the security state associated with threads.| -||| -||Can use private members to defeat accessibility mechanisms.| - -## See also - -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/how-to-run-partially-trusted-code-in-a-sandbox.md b/docs/framework/misc/how-to-run-partially-trusted-code-in-a-sandbox.md deleted file mode 100644 index 75e76539a9f18..0000000000000 --- a/docs/framework/misc/how-to-run-partially-trusted-code-in-a-sandbox.md +++ /dev/null @@ -1,273 +0,0 @@ ---- -title: "How to: Run Partially Trusted Code in a Sandbox" -description: Discover how to run partially trusted code in a sandbox in .NET. The AppDomain class is an effective way of sandboxing managed applications. -ms.date: "03/30/2017" -helpviewer_keywords: - - "partially trusted code" - - "sandboxing" - - "partial trust" - - "restricted security environment" - - "code security, sandboxing" -ms.assetid: d1ad722b-5b49-4040-bff3-431b94bb8095 ---- -# How to: Run Partially Trusted Code in a Sandbox - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - - Sandboxing is the practice of running code in a restricted security environment, which limits the access permissions granted to the code. For example, if you have a managed library from a source you do not completely trust, you should not run it as fully trusted. Instead, you should place the code in a sandbox that limits its permissions to those that you expect it to need (for example, permission). - - You can also use sandboxing to test code you will be distributing that will run in partially trusted environments. - - An is an effective way of providing a sandbox for managed applications. Application domains that are used for running partially trusted code have permissions that define the protected resources that are available when running within that . Code that runs inside the is bound by the permissions associated with the and is allowed to access only the specified resources. The also includes a array that is used to identify assemblies that are to be loaded as fully trusted. This enables the creator of an to start a new sandboxed domain that allows specific helper assemblies to be fully trusted. Another option for loading assemblies as fully trusted is to place them in the global assembly cache; however, that will load assemblies as fully trusted in all application domains created on that computer. The list of strong names supports a per- decision that provides more restrictive determination. - - You can use the method overload to specify the permission set for applications that run in a sandbox. This overload enables you to specify the exact level of code access security you want. Assemblies that are loaded into an by using this overload can either have the specified grant set only, or can be fully trusted. The assembly is granted full trust if it is in the global assembly cache or listed in the `fullTrustAssemblies` (the ) array parameter. Only assemblies known to be fully trusted should be added to the `fullTrustAssemblies` list. - - The overload has the following signature: - -```csharp -AppDomain.CreateDomain( string friendlyName, - Evidence securityInfo, - AppDomainSetup info, - PermissionSet grantSet, - params StrongName[] fullTrustAssemblies); -``` - - The parameters for the method overload specify the name of the , the evidence for the , the object that identifies the application base for the sandbox, the permission set to use, and the strong names for fully trusted assemblies. - - For security reasons, the application base specified in the `info` parameter should not be the application base for the hosting application. - - For the `grantSet` parameter, you can specify either a permission set you have explicitly created, or a standard permission set created by the method. - - Unlike most loads, the evidence for the (which is provided by the `securityInfo` parameter) is not used to determine the grant set for the partially trusted assemblies. Instead, it is independently specified by the `grantSet` parameter. However, the evidence can be used for other purposes such as determining the isolated storage scope. - -### To run an application in a sandbox - -1. Create the permission set to be granted to the untrusted application. The minimum permission you can grant is permission. You can also grant additional permissions you think might be safe for untrusted code; for example, . The following code creates a new permission set with only permission. - - ```csharp - PermissionSet permSet = new PermissionSet(PermissionState.None); - permSet.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); - ``` - - Alternatively, you can use an existing named permission set, such as Internet. - - ```csharp - Evidence ev = new Evidence(); - ev.AddHostEvidence(new Zone(SecurityZone.Internet)); - PermissionSet internetPS = SecurityManager.GetStandardSandbox(ev); - ``` - - The method returns either an `Internet` permission set or a `LocalIntranet` permission set depending on the zone in the evidence. also constructs identity permissions for some of the evidence objects passed as references. - -2. Sign the assembly that contains the hosting class (named `Sandboxer` in this example) that calls the untrusted code. Add the used to sign the assembly to the array of the `fullTrustAssemblies` parameter of the call. The hosting class must run as fully trusted to enable the execution of the partial-trust code or to offer services to the partial-trust application. This is how you read the of an assembly: - - ```csharp - StrongName fullTrustAssembly = typeof(Sandboxer).Assembly.Evidence.GetHostEvidence(); - ``` - - .NET Framework assemblies such as mscorlib and System.dll do not have to be added to the full-trust list because they are loaded as fully trusted from the global assembly cache. - -3. Initialize the parameter of the method. With this parameter, you can control many of the settings of the new . The property is an important setting, and should be different from the property for the of the hosting application. If the settings are the same, the partial-trust application can get the hosting application to load (as fully trusted) an exception it defines, thus exploiting it. This is another reason why a catch (exception) is not recommended. Setting the application base of the host differently from the application base of the sandboxed application mitigates the risk of exploits. - - ```csharp - AppDomainSetup adSetup = new AppDomainSetup(); - adSetup.ApplicationBase = Path.GetFullPath(pathToUntrusted); - ``` - -4. Call the method overload to create the application domain using the parameters we have specified. - - The signature for this method is: - - ```csharp - public static AppDomain CreateDomain(string friendlyName, - Evidence securityInfo, AppDomainSetup info, PermissionSet grantSet, - params StrongName[] fullTrustAssemblies) - ``` - - Additional information: - - - This is the only overload of the method that takes a as a parameter, and thus the only overload that lets you load an application in a partial-trust setting. - - - The `evidence` parameter is not used to calculate a permission set; it is used for identification by other features of the .NET Framework. - - - Setting the property of the `info` parameter is mandatory for this overload. - - - The `fullTrustAssemblies` parameter has the `params` keyword, which means that it is not necessary to create a array. Passing 0, 1, or more strong names as parameters is allowed. - - - The code to create the application domain is: - - ```csharp - AppDomain newDomain = AppDomain.CreateDomain("Sandbox", null, adSetup, permSet, fullTrustAssembly); - ``` - -5. Load the code into the sandboxing that you created. This can be done in two ways: - - - Call the method for the assembly. - - - Use the method to create an instance of a class derived from in the new . - - The second method is preferable, because it makes it easier to pass parameters to the new instance. The method provides two important features: - - - You can use a code base that points to a location that does not contain your assembly. - - - You can do the creation under an for full-trust (), which enables you to create an instance of a critical class. (This happens whenever your assembly has no transparency markings and is loaded as fully trusted.) Therefore, you have to be careful to create only code that you trust with this function, and we recommend that you create only instances of fully trusted classes in the new application domain. - - ```csharp - ObjectHandle handle = Activator.CreateInstanceFrom( - newDomain, typeof(Sandboxer).Assembly.ManifestModule.FullyQualifiedName, - typeof(Sandboxer).FullName ); - ``` - - To create an instance of a class in a new domain, the class must extend the class. - - ```csharp - class Sandboxer:MarshalByRefObject - ``` - -6. Unwrap the new domain instance into a reference in this domain. This reference is used to execute the untrusted code. - - ```csharp - Sandboxer newDomainInstance = (Sandboxer) handle.Unwrap(); - ``` - -7. Call the `ExecuteUntrustedCode` method in the instance of the `Sandboxer` class you just created. - - ```csharp - newDomainInstance.ExecuteUntrustedCode(untrustedAssembly, untrustedClass, entryPoint, parameters); - ``` - - This call is executed in the sandboxed application domain, which has restricted permissions. - - ```csharp - public void ExecuteUntrustedCode(string assemblyName, string typeName, string entryPoint, Object[] parameters) - { - //Load the MethodInfo for a method in the new assembly. This might be a method you know, or - //you can use Assembly.EntryPoint to get to the entry point in an executable. - MethodInfo target = Assembly.Load(assemblyName).GetType(typeName).GetMethod(entryPoint); - try - { - // Invoke the method. - target.Invoke(null, parameters); - } - catch (Exception ex) - { - //When information is obtained from a SecurityException extra information is provided if it is - //accessed in full-trust. - new PermissionSet(PermissionState.Unrestricted).Assert(); - Console.WriteLine("SecurityException caught:\n{0}", ex.ToString()); - CodeAccessPermission.RevertAssert(); - Console.ReadLine(); - } - } - ``` - - is used to get a handle of a method in the partially trusted assembly. The handle can be used to execute code in a safe way with minimum permissions. - - In the previous code, note the for the full-trust permission before printing the . - - ```csharp - new PermissionSet(PermissionState.Unrestricted).Assert() - ``` - - The full-trust assert is used to obtain extended information from the . Without the , the method of will discover that there is partially trusted code on the stack and will restrict the information returned. This could cause security issues if the partial-trust code could read that information, but the risk is mitigated by not granting . The full-trust assert should be used sparingly and only when you are sure that you are not allowing partial-trust code to elevate to full trust. As a rule, do not call code you do not trust in the same function and after you called an assert for full trust. It is good practice to always revert the assert when you have finished using it. - -## Example - - The following example implements the procedure in the previous section. In the example, a project named `Sandboxer` in a Visual Studio solution also contains a project named `UntrustedCode`, which implements the class `UntrustedClass`. This scenario assumes that you have downloaded a library assembly containing a method that is expected to return `true` or `false` to indicate whether the number you provided is a Fibonacci number. Instead, the method attempts to read a file from your computer. The following example shows the untrusted code. - -```csharp -using System; -using System.IO; -namespace UntrustedCode -{ - public class UntrustedClass - { - // Pretend to be a method checking if a number is a Fibonacci - // but which actually attempts to read a file. - public static bool IsFibonacci(int number) - { - File.ReadAllText("C:\\Temp\\file.txt"); - return false; - } - } -} -``` - - The following example shows the `Sandboxer` application code that executes the untrusted code. - -```csharp -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Security; -using System.Security.Policy; -using System.Security.Permissions; -using System.Reflection; -using System.Runtime.Remoting; - -//The Sandboxer class needs to derive from MarshalByRefObject so that we can create it in another -// AppDomain and refer to it from the default AppDomain. -class Sandboxer : MarshalByRefObject -{ - const string pathToUntrusted = @"..\..\..\UntrustedCode\bin\Debug"; - const string untrustedAssembly = "UntrustedCode"; - const string untrustedClass = "UntrustedCode.UntrustedClass"; - const string entryPoint = "IsFibonacci"; - private static Object[] parameters = { 45 }; - static void Main() - { - //Setting the AppDomainSetup. It is very important to set the ApplicationBase to a folder - //other than the one in which the sandboxer resides. - AppDomainSetup adSetup = new AppDomainSetup(); - adSetup.ApplicationBase = Path.GetFullPath(pathToUntrusted); - - //Setting the permissions for the AppDomain. We give the permission to execute and to - //read/discover the location where the untrusted code is loaded. - PermissionSet permSet = new PermissionSet(PermissionState.None); - permSet.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution)); - - //We want the sandboxer assembly's strong name, so that we can add it to the full trust list. - StrongName fullTrustAssembly = typeof(Sandboxer).Assembly.Evidence.GetHostEvidence(); - - //Now we have everything we need to create the AppDomain, so let's create it. - AppDomain newDomain = AppDomain.CreateDomain("Sandbox", null, adSetup, permSet, fullTrustAssembly); - - //Use CreateInstanceFrom to load an instance of the Sandboxer class into the - //new AppDomain. - ObjectHandle handle = Activator.CreateInstanceFrom( - newDomain, typeof(Sandboxer).Assembly.ManifestModule.FullyQualifiedName, - typeof(Sandboxer).FullName - ); - //Unwrap the new domain instance into a reference in this domain and use it to execute the - //untrusted code. - Sandboxer newDomainInstance = (Sandboxer) handle.Unwrap(); - newDomainInstance.ExecuteUntrustedCode(untrustedAssembly, untrustedClass, entryPoint, parameters); - } - public void ExecuteUntrustedCode(string assemblyName, string typeName, string entryPoint, Object[] parameters) - { - //Load the MethodInfo for a method in the new Assembly. This might be a method you know, or - //you can use Assembly.EntryPoint to get to the main function in an executable. - MethodInfo target = Assembly.Load(assemblyName).GetType(typeName).GetMethod(entryPoint); - try - { - //Now invoke the method. - bool retVal = (bool)target.Invoke(null, parameters); - } - catch (Exception ex) - { - // When we print informations from a SecurityException extra information can be printed if we are - //calling it with a full-trust stack. - new PermissionSet(PermissionState.Unrestricted).Assert(); - Console.WriteLine("SecurityException caught:\n{0}", ex.ToString()); - CodeAccessPermission.RevertAssert(); - Console.ReadLine(); - } - } -} -``` - -## See also - -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/link-demands.md b/docs/framework/misc/link-demands.md deleted file mode 100644 index 624a9ba329851..0000000000000 --- a/docs/framework/misc/link-demands.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "Link Demands" -description: Read about link demands, which cause a security check during just-in-time (JIT) compilation, and examine only the immediate calling assembly of your code. -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "security [.NET Framework], demands" - - "demanded permissions" - - "permissions [.NET Framework], demands" - - "granting permissions, demands" - - "code access security, demands" - - "user demands for permission" - - "caller security checks" - - "link demands" -ms.assetid: a33fd5f9-2de9-4653-a4f0-d9df25082c4d ---- -# Link Demands - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - - A link demand causes a security check during just-in-time compilation and checks only the immediate calling assembly of your code. Linking occurs when your code is bound to a type reference, including function pointer references and method calls. If the calling assembly does not have sufficient permission to link to your code, the link is not allowed and a runtime exception is thrown when the code is loaded and run. Link demands can be overridden in classes that inherit from your code. - - A full stack walk is not performed with this type of demand and that your code is still susceptible to luring attacks. For example, if a method in assembly A is protected by a link demand, a direct caller in assembly B is evaluated based on the permissions of Assembly B. However, the link demand will not evaluate a method in assembly C if it indirectly calls the method in assembly A using the method in assembly B. The link demand specifies only the permissions direct callers in the immediate calling assembly must have to link to your code. It does not specify the permissions all callers must have to run your code. - - The , , and stack walk modifiers do not affect the evaluation of link demands. Because link demands do not perform a stack walk, the stack walk modifiers have no effect on link demands. - - If a method protected by a link demand is accessed through [Reflection](../reflection-and-codedom/reflection.md), then a link demand checks the immediate caller of the code accessed through reflection. This is true both for method discovery and for method invocation performed using reflection. For example, suppose code uses reflection to return a object representing a method protected by a link demand and then passes that **MethodInfo** object to some other code that uses the object to invoke the original method. In this case, the link demand check occurs twice: once for the code that returns the **MethodInfo** object and once for the code that invokes it. - -> [!NOTE] -> A link demand performed on a static class constructor does not protect the constructor because static constructors are called by the system, outside the application's code execution path. As a result, when a link demand is applied to an entire class, it cannot protect access to a static constructor, although it does protect the rest of the class. - - The following code fragment declaratively specifies that any code linking to the `ReadData` method must have the `CustomPermission` permission. This permission is a hypothetical custom permission and does not exist in the .NET Framework. The demand is made by passing a **SecurityAction.LinkDemand** flag to the `CustomPermissionAttribute`. - -```vb - _ -Public Shared Function ReadData() As String - ' Access a custom resource. -End Function -``` - -```csharp -[CustomPermissionAttribute(SecurityAction.LinkDemand)] -public static string ReadData() -{ - // Access a custom resource. -} -``` - -## See also - -- [Attributes](../../standard/attributes/index.md) -- [Code Access Security](code-access-security.md) diff --git a/docs/framework/misc/media/slide-10a.gif b/docs/framework/misc/media/slide-10a.gif deleted file mode 100644 index 5ce242c57d640..0000000000000 Binary files a/docs/framework/misc/media/slide-10a.gif and /dev/null differ diff --git a/docs/framework/misc/media/using-the-assert-method/assert-method-assemblies.gif b/docs/framework/misc/media/using-the-assert-method/assert-method-assemblies.gif deleted file mode 100644 index c23a230ded255..0000000000000 Binary files a/docs/framework/misc/media/using-the-assert-method/assert-method-assemblies.gif and /dev/null differ diff --git a/docs/framework/misc/securing-exception-handling.md b/docs/framework/misc/securing-exception-handling.md deleted file mode 100644 index 3e7975b5e3855..0000000000000 --- a/docs/framework/misc/securing-exception-handling.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -title: "Securing Exception Handling" -description: See how to make exception handling secure in .NET code. Review the order in which code runs if there are try, except, catch, and finally statements. -ms.date: "03/30/2017" -dev_langs: - - "cpp" -helpviewer_keywords: - - "code security, exception handling" - - "security [.NET Framework], exception handling" - - "secure coding, exception handling" - - "exception handling, security" -ms.assetid: 1f3da743-9742-47ff-96e6-d0dd1e9e1c19 ---- -# Securing Exception Handling - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -In Visual C++ and Visual Basic, a filter expression further up the stack runs before any `finally` statement. The **catch** block associated with that filter runs after the `finally` statement. For more information, see [Using User-Filtered Exceptions](../../standard/exceptions/using-user-filtered-exception-handlers.md). This section examines the security implications of this order. Consider the following pseudocode example that illustrates the order in which filter statements and `finally` statements run. - -```cpp -void Main() -{ - try - { - Sub(); - } - except (Filter()) - { - Console.WriteLine("catch"); - } -} -bool Filter () { - Console.WriteLine("filter"); - return true; -} -void Sub() -{ - try - { - Console.WriteLine("throw"); - throw new Exception(); - } - finally - { - Console.WriteLine("finally"); - } -} -``` - - This code prints the following. - -```output -Throw -Filter -Finally -Catch -``` - - The filter runs before the `finally` statement, so security issues can be introduced by anything that makes a state change where execution of other code could take advantage. For example: - -```cpp -try -{ - Alter_Security_State(); - // This means changing anything (state variables, - // switching unmanaged context, impersonation, and - // so on) that could be exploited if malicious - // code ran before state is restored. - Do_some_work(); -} -finally -{ - Restore_Security_State(); - // This simply restores the state change above. -} -``` - - This pseudocode allows a filter higher up the stack to run arbitrary code. Other examples of operations that would have a similar effect are temporary impersonation of another identity, setting an internal flag that bypasses some security check, or changing the culture associated with the thread. The recommended solution is to introduce an exception handler to isolate the code's changes to thread state from callers' filter blocks. However, it's important to properly introduce the exception handler or this problem won't be fixed. The following example switches the UI culture, but any kind of thread state change could be similarly exposed. - -```cpp -YourObject.YourMethod() -{ - CultureInfo saveCulture = Thread.CurrentThread.CurrentUICulture; - try { - Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE"); - // Do something that throws an exception. -} - finally { - Thread.CurrentThread.CurrentUICulture = saveCulture; - } -} -``` - -```vb -Public Class UserCode - Public Shared Sub Main() - Try - Dim obj As YourObject = new YourObject - obj.YourMethod() - Catch e As Exception When FilterFunc - Console.WriteLine("An error occurred: '{0}'", e) - Console.WriteLine("Current Culture: {0}", -Thread.CurrentThread.CurrentUICulture) - End Try - End Sub - - Public Function FilterFunc As Boolean - Console.WriteLine("Current Culture: {0}", Thread.CurrentThread.CurrentUICulture) - Return True - End Sub - -End Class -``` - - The correct fix in this case is to wrap the existing **try**/**finally** block in a **try**/**catch** block. Simply introducing a **catch-throw** clause into the existing **try**/**finally** block does not fix the problem, as shown in the following example. - -```cpp -YourObject.YourMethod() -{ - CultureInfo saveCulture = Thread.CurrentThread.CurrentUICulture; - - try - { - Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE"); - // Do something that throws an exception. - } - catch { throw; } - finally - { - Thread.CurrentThread.CurrentUICulture = saveCulture; - } -} -``` - - This does not fix the problem because the `finally` statement has not run before the `FilterFunc` gets control. - - The following example fixes the problem by ensuring that the `finally` clause has executed before offering an exception up the callers' exception filter blocks. - -```cpp -YourObject.YourMethod() -{ - CultureInfo saveCulture = Thread.CurrentThread.CurrentUICulture; - try - { - try - { - Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE"); - // Do something that throws an exception. - } - finally - { - Thread.CurrentThread.CurrentUICulture = saveCulture; - } - } - catch { throw; } -} -``` - -## See also - -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/securing-method-access.md b/docs/framework/misc/securing-method-access.md deleted file mode 100644 index ad7b5c51f38e2..0000000000000 --- a/docs/framework/misc/securing-method-access.md +++ /dev/null @@ -1,240 +0,0 @@ ---- -title: "Securing Method Access" -description: Learn how to make method access secure for methods that aren't intended for public use but still need to be public. -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "code security, method access" - - "secure coding, method access" - - "security [.NET Framework], method access" - - "method access security" -ms.assetid: f7c2d6ec-3b18-4e0e-9991-acd97189d818 ---- -# Securing Method Access - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - - Some methods might not be suitable to allow arbitrary untrusted code to call. Such methods pose several risks: The method might provide some restricted information; it might believe any information passed to it; it might not do error checking on the parameters; or with the wrong parameters, it might malfunction or do something harmful. You should be aware of these cases and take action to help protect the method. - - In some cases, you might need to restrict methods that are not intended for public use but still must be public. For example, you might have an interface that needs to be called across your own DLLs and hence must be public, but you do not want to expose it publicly to prevent customers from using it or to prevent malicious code from exploiting the entry point into your component. Another common reason to restrict a method not intended for public use (but that must be public) is to avoid having to document and support what might be an internal interface. - - Managed code offers several ways to restrict method access: - -- Limit the scope of accessibility to the class, assembly, or derived classes, if they can be trusted. This is the simplest way to limit method access. In general, derived classes can be less trustworthy than the class they derive from, though in some cases they share the parent class's identity. In particular, do not infer trust from the keyword `protected`, which is not necessarily used in the security context. - -- Limit the method access to callers of a specified identity--essentially, any particular [evidence](/previous-versions/dotnet/netframework-4.0/7y5x1hcd(v=vs.100)) (strong name, publisher, zone, and so on) you choose. - -- Limit the method access to callers having whatever permissions you select. - - Similarly, declarative security allows you to control inheritance of classes. You can use **InheritanceDemand** to do the following: - -- Require derived classes to have a specified identity or permission. - -- Require derived classes that override specific methods to have a specified identity or permission. - - The following example shows how to help protect a public class for limited access by requiring that callers be signed with a particular strong name. This example uses the with a **Demand** for the strong name. For task-based information on how to sign an assembly with a strong name, see [Creating and Using Strong-Named Assemblies](../../standard/assembly/create-use-strong-named.md). - -```vb - _ -Public Class Class1 -End Class -``` - -```csharp -[StrongNameIdentityPermissionAttribute(SecurityAction.Demand, PublicKey="…hex…", Name="App1", Version="0.0.0.0")] -public class Class1 -{ - -} -``` - -## Excluding Classes and Members from Use by Untrusted Code - - Use the declarations shown in this section to prevent specific classes and methods, as well as properties and events, from being used by partially trusted code. By applying these declarations to a class, you apply the protection to all its methods, properties, and events. However, field access is not affected by declarative security. Note also that link demands help protect against only the immediate callers and might still be subject to luring attacks. - -> [!NOTE] -> A new transparency model has been introduced in the .NET Framework 4. The [Security-Transparent Code, Level 2](security-transparent-code-level-2.md) model identifies secure code with the attribute. Security-critical code requires both callers and inheritors to be fully trusted. Assemblies that are running under the code access security rules from earlier .NET Framework versions can call level 2 assemblies. In this case, the security-critical attributes will be treated as link demands for full trust. - - In strong-named assemblies, a [LinkDemand](link-demands.md) is applied to all publicly accessible methods, properties, and events therein to restrict their use to fully trusted callers. To disable this feature, you must apply the attribute. Thus, explicitly marking classes to exclude untrusted callers is necessary only for unsigned assemblies or assemblies with this attribute; you can use these declarations to mark a subset of types therein that are not intended for untrusted callers. - - The following examples show how to prevent classes and members from being used by untrusted code. - - For public nonsealed classes: - -```vb - _ -Public Class CanDeriveFromMe -End Class -``` - -```csharp -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] -public class CanDeriveFromMe -{ -} -``` - - For public sealed classes: - -```vb - _ -NotInheritable Public Class CannotDeriveFromMe -End Class -``` - -```csharp -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] -public sealed class CannotDeriveFromMe -{ -} -``` - - For public abstract classes: - -```vb - _ -MustInherit Public Class CannotCreateInstanceOfMe_CanCastToMe -End Class -``` - -```csharp -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] -public abstract class CannotCreateInstanceOfMe_CanCastToMe {} -``` - - For public virtual functions: - -```vb -Class Base1 - _ - Public Overridable Sub CanOverrideOrCallMe() - End Sub 'CanOverrideOrCallMe -End Class 'Base1 -``` - -```csharp -class Base1 -{ -[System.Security.Permissions.PermissionSetAttribute( -System.Security.Permissions.SecurityAction.InheritanceDemand, Name="FullTrust")] -[System.Security.Permissions.PermissionSetAttribute( -System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] - public virtual void CanOverrideOrCallMe() {} -} -``` - - For public abstract functions: - -```vb -MustInherit Class Base2 - _ - Public Sub MustOverrideMe() - End Sub -End Class 'Base2 -``` - -```csharp -abstract class Base2 { -[System.Security.Permissions.PermissionSetAttribute( -System.Security.Permissions.SecurityAction.InheritanceDemand, Name = "FullTrust")] -[System.Security.Permissions.PermissionSetAttribute( -System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")] -public abstract void MustOverrideMe(); -} -``` - - For public override functions where the base class does not demand full trust: - -```vb -Class Derived - Inherits Base1 - _ - Public Overrides Sub CanOverrideOrCallMe() - MyBase.CanOverrideOrCallMe() - End Sub 'CanOverrideOrCallMe -End Class 'Derived -``` - -```csharp -class Derived : Base1 -{ -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] - public override void CanOverrideOrCallMe() - { - base.CanOverrideOrCallMe(); - } -} -``` - - For public override functions where the base class demands full trust: - -```vb -Class Derived - Inherits Base1 - _ - Public Overrides Sub CanOverrideOrCallMe() - MyBase.CanOverrideOrCallMe() - End Sub 'CanOverrideOrCallMe -End Class 'Derived -``` - -```csharp -class Derived : Base1 -{ -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] - public override void CanOverrideOrCallMe() - { - base.CanOverrideOrCallMe(); - } -} -``` - - For public interfaces: - -```vb -Public Interface ICanCastToMe - _ - Sub CanImplementMe() -End Interface 'ICanCastToMe - _ -Class Implemented - Implements ICanCastToMe - Public Sub CanImplementMe() - End Sub 'CanImplementMe -``` - -```csharp -public interface ICanCastToMe -{ -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")] -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name = "FullTrust")] -void CanImplementMe(); -} -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name = "FullTrust")] -[System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name = "FullTrust")] -class Implemented : ICanCastToMe -{ - public void CanImplementMe() - { - } -} -``` - -## Virtual Internal Overrides or Overloads Overridable Friend - -> [!NOTE] -> This section warns about a security issue when declaring a method as both `virtual` and `internal` (`Overloads` `Overridable` `Friend` in Visual Basic). This warning applies only to the .NET Framework versions 1.0 and 1.1, it does not apply to later versions. - - In the .NET Framework versions 1.0 and 1.1, you must be aware of a nuance of the type system accessibility when confirming that your code is unavailable to other assemblies. A method that is declared **virtual** and **internal** (**Overloads Overridable Friend** in Visual Basic) can override the parent class's vtable entry and can be used only from within the same assembly because it is internal. However, the accessibility for overriding is determined by the **virtual** keyword, and this can be overridden from another assembly as long as that code has access to the class itself. If the possibility of an override presents a problem, use declarative security to fix it, or remove the **virtual** keyword if it is not strictly required. - - Even if a language compiler prevents these overrides with a compilation error, it is possible for code written with other compilers to override. - -## See also - -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/securing-wrapper-code.md b/docs/framework/misc/securing-wrapper-code.md deleted file mode 100644 index 0301aa2d77167..0000000000000 --- a/docs/framework/misc/securing-wrapper-code.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -title: "Securing Wrapper Code" -description: Review how to secure wrapper code, which can open a unique set of security weaknesses, especially if the wrapper has higher trust than the code that uses it. -ms.date: "03/30/2017" -helpviewer_keywords: - - "security [.NET Framework], wrapper code" - - "wrapper code, securing" - - "secure coding, wrapper code" - - "code security, wrapper code" -ms.assetid: 1df6c516-5bba-48bd-b450-1070e04b7389 ---- -# Securing Wrapper Code - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - - Wrapper code, especially where the wrapper has higher trust than code that uses it, can open a unique set of security weaknesses. Anything done on behalf of a caller, where the caller's limited permissions are not included in the appropriate security check, is a potential weakness to be exploited. - - Never enable something through the wrapper that the caller could not do itself. This is a special danger when doing something that involves a limited security check, as opposed to a full stack walk demand. When single-level checks are involved, interposing the wrapper code between the real caller and the API element in question can easily cause the security check to succeed when it should not, thereby weakening security. - -## Delegates - - Delegate security differs between versions of the .NET Framework. This section describes the different delegate behaviors and associated security considerations. - -### In version 1.0 and 1.1 of the .NET Framework - - Version 1.0 and 1.1 of the .NET Framework perform the following security actions against a delegate creator and a delegate caller. - -- When a delegate is created, security link demands on the delegate target method are performed against the grant set of the delegate creator. Failure to satisfy the security action results in a . - -- When the delegate is invoked, any existing security demands on the delegate caller are performed. - - Whenever your code takes a from less-trusted code that might call it, make sure that you are not enabling the less-trusted code to escalate its permissions. If you take a delegate and use it later, the code that created the delegate is not on the call stack and its permissions will not be tested if code in or under the delegate attempts a protected operation. If your code and the caller code have higher privileges than the creator, the creator can orchestrate the call path without being part of the call stack. - -### In version 2.0 and later versions of the .NET Framework - - Unlike previous versions, version 2.0 and later versions of the .NET Framework performs security action against the delegate creator when the delegate is created and called. - -- When a delegate is created, security link demands on the delegate target method are performed against the grant set of the delegate creator. Failure to satisfy the security action results in a . - -- The delegate creator's grant set is also captured during delegate creation and stored with the delegate. - -- When the delegate is invoked, the delegate creator's captured grant set is first evaluated against any demands in the current context if the delegate creator and caller belong to different assemblies. Next, any existing security demands on the delegate caller are performed. - -## Link demands and wrappers - - A special protection case with link demands has been strengthened in the security infrastructure, but it is still a source of possible weakness in your code. - - If fully trusted code calls a property, event, or method protected by a [LinkDemand](link-demands.md), the call succeeds if the **LinkDemand** permission check for the caller is satisfied. Additionally, if the fully trusted code exposes a class that takes the name of a property and calls its **get** accessor using reflection, that call to the **get** accessor succeeds even though the user code does not have the right to access this property. This is because the **LinkDemand** checks only the immediate caller, which is the fully trusted code. In essence, the fully trusted code is making a privileged call on behalf of user code without making sure that the user code has the right to make that call. - - To help prevent such security holes, the common language runtime extends the check into a full stack-walking demand on any indirect call to a method, constructor, property, or event protected by a **LinkDemand**. This protection incurs some performance costs and changes the semantics of the security check; the full stack-walk demand might fail where the faster, one-level check would have passed. - -## Assembly loading wrappers - - Several methods used to load managed code, including , load assemblies with the evidence of the caller. If you wrap any of these methods, the security system could use your code's permission grant, instead of the permissions of the caller to your wrapper, to load the assemblies. Don't allow less-trusted code to load code that is granted higher permissions than those of the caller to your wrapper. - - Any code that has full trust or significantly higher trust than a potential caller (including an Internet-permissions-level caller) could weaken security in this way. If your code has a public method that takes a byte array and passes it to **Assembly.Load**, thereby creating an assembly on the caller's behalf, it might break security. - - This issue applies to the following API elements: - -- - -- - -- - -- - -## Demand vs. LinkDemand - - Declarative security offers two kinds of security checks that are similar but perform different checks. It's good to understand both forms, because the wrong choice can result in weak security or performance loss. - - Declarative security offers the following security checks: - -- specifies the code access security stack walk. All callers on the stack must have the specified permission or identity to pass. **Demand** occurs on every call because the stack might contain different callers. If you call a method repeatedly, this security check occurs each time. **Demand** is good protection against luring attacks; unauthorized code trying to get through it will be detected. - -- [LinkDemand](link-demands.md) happens at just-in-time (JIT) compilation time and checks only the immediate caller. This security check does not check the caller's caller. Once this check passes, there is no additional security overhead no matter how many times the caller might call. However, there is also no protection from luring attacks. With **LinkDemand**, any code that passes the test and can reference your code can potentially break security by allowing malicious code to call using the authorized code. Therefore, do not use **LinkDemand** unless all the possible weaknesses can be thoroughly avoided. - - > [!NOTE] - > In the .NET Framework 4, link demands have been replaced by the attribute in assemblies. The is equivalent to a link demand for full trust; however, it also affects inheritance rules. For more information about this change, see [Security-Transparent Code, Level 2](security-transparent-code-level-2.md). - - The extra precautions required when using **LinkDemand** must be programmed individually; the security system can help with enforcement. Any mistake opens a security weakness. All authorized code that uses your code must be responsible for implementing additional security by doing the following: - -- Restricting the calling code's access to the class or assembly. - -- Placing the same security checks on the calling code that appear on the code being called and obligating its callers to do so. For example, if you write code that calls a method that is protected with a **LinkDemand** for the with the flag specified, your method should also make a **LinkDemand** (or **Demand**, which is stronger) for this permission. The exception is if your code uses the **LinkDemand**-protected method in a limited way that you decide is safe, given other security protection mechanisms (such as demands) in your code. In this exceptional case, the caller takes responsibility in weakening the security protection on the underlying code. - -- Ensuring that your code's callers cannot trick your code into calling the protected code on their behalf. In other words, callers cannot force the authorized code to pass specific parameters to the protected code, or to get results back from it. - -### Interfaces and Link Demands - - If a virtual method, property, or event with **LinkDemand** overrides a base class method, the base class method must also have the same **LinkDemand** for the overridden method in order to be effective. It is possible for malicious code to cast back to the base type and call the base class method. Also note that link demands can be added implicitly to assemblies that do not have the assembly-level attribute. - - It is a good practice to protect method implementations with link demands when interface methods also have link demands. Note the following about using link demands with interfaces: - -- If you place a **LinkDemand** on a public method of a class that implements an interface method, the **LinkDemand** will not be enforced if you then cast to the interface and call the method. In this case, because you linked against the interface, only the **LinkDemand** on the interface is honored. - - Review the following items for security issues: - -- Explicit link demands on interface methods. Make sure these link demands offer the expected protection. Determine whether malicious code can use a cast to get around the link demands as described previously. - -- Virtual methods with link demands applied. - -- Types and the interfaces they implement. These should use link demands consistently. - -## See also - -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/security-and-public-read-only-array-fields.md b/docs/framework/misc/security-and-public-read-only-array-fields.md deleted file mode 100644 index 83e0a582cfb54..0000000000000 --- a/docs/framework/misc/security-and-public-read-only-array-fields.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "Security and Public Read-only Array Fields" -description: Read why you should avoid using public read-only array fields to define the boundary behavior or security of your applications. -ms.date: "03/30/2017" -helpviewer_keywords: - - "security [.NET Framework], public read-only array fields" -ms.assetid: 3df28dee-2a9f-40ff-9852-bfdbe59c27f3 ---- -# Security and Public Read-only Array Fields - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -Never use read-only public array fields from managed libraries to define the boundary behavior or security of your applications because read-only public array fields can be modified. - -## Remarks - -Some .NET classes include read-only public fields that contain platform-specific boundary parameters. For example, the field is an array that describes the characters that are not allowed in a file path string. Many similar fields are present throughout .NET. - - The values of public read-only fields like can be modified by your code or code that shares your code’s application domain. You should not use read-only public array fields like this to define the boundary behavior of your applications. If you do, malicious code can alter the boundary definitions and use your code in unexpected ways. - - In version 2.0 and later of the .NET Framework, you should use methods that return a new array instead of using public array fields. For example, instead of using the field, you should use the method. - - Note that the .NET Framework types do not use the public fields to define boundary types internally. Instead, the .NET Framework uses separate private fields. Changing the values of these public fields does not alter the behavior of .NET Framework types. - -## See also - -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/security-and-remoting-considerations.md b/docs/framework/misc/security-and-remoting-considerations.md deleted file mode 100644 index 13abbe2d25d78..0000000000000 --- a/docs/framework/misc/security-and-remoting-considerations.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: "Security and Remoting Considerations" -description: Learn about security considerations in regard to remoting, which lets you set up transparent calling between application domains, processes, or computers. -ms.date: "03/30/2017" -helpviewer_keywords: - - "code security, remoting" - - "remoting, security" - - "security [.NET Framework], remoting" - - "secure coding, remoting" -ms.assetid: 125d2ab8-55a4-4e5f-af36-a7d401a37ab0 ---- -# Security and Remoting Considerations - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -Remoting allows you to set up transparent calling between application domains, processes, or computers. However, the code access security stack walk cannot cross process or machine boundaries (it does apply between application domains of the same process). - - Any class that is remotable (derived from a class) needs to take responsibility for security. Either the code should be used only in closed environments where the calling code can be implicitly trusted, or remoting calls should be designed so that they do not subject protected code to outside entry that could be used maliciously. - - Generally, you should never expose methods, properties, or events that are protected by declarative [LinkDemand](link-demands.md) and security checks. With remoting, these checks are not enforced. Other security checks, such as , [Assert](using-the-assert-method.md), and so on, work between application domains within a process but do not work in cross-process or cross-machine scenarios. - -## Protected objects - - Some objects hold security state in themselves. These objects should not be passed to untrusted code, which would then acquire security authorization beyond its own permissions. - - One example is creating a object. The is demanded at the time of creation and, if it succeeds, the file object is returned. However, if this object reference is passed to code without file permissions, the object will be able to read and write to this particular file. - - The simplest defense for such an object is to demand the same **FileIOPermission** of any code that seeks to get the object reference through a public API element. - -## Application domain crossing issues - - To isolate code in managed hosting environments, it is common to generate multiple child application domains with explicit policy reducing the permission levels for various assemblies. However, the policy for those assemblies remains unchanged in the default application domain. If one of the child application domains can force the default application domain to load an assembly, the effect of code isolation is lost and types in the forcibly loaded assembly will be able to run code at a higher level of trust. - - An application domain can force another application domain to load an assembly and run code contained therein by calling a proxy to an object hosted in the other application domain. To obtain a cross-application-domain proxy, the application domain hosting the object must distribute one through a method call parameter or return value. Or, if the application domain was just created, the creator has a proxy to the object by default. Thus, to avoid breaking code isolation, an application domain with a higher level of trust should not distribute references to marshaled-by-reference objects (instances of classes derived from ) in its domain to application domains with lower levels of trust. - - Usually, the default application domain creates the child application domains with a control object in each one. The control object manages the new application domain and occasionally takes orders from the default application domain, but it cannot actually contact the domain directly. Occasionally, the default application domain calls its proxy to the control object. However, there might be cases in which it is necessary for the control object to call back to the default application domain. In these cases, the default application domain passes a marshal-by-reference callback object to the constructor of the control object. It is the responsibility of the control object to protect this proxy. If the control object placed the proxy on a public static field of a public class or otherwise publicly exposed the proxy, a dangerous mechanism for other code to call back into the default application domain would be opened up. For this reason, control objects are always implicitly trusted to keep the proxy private. - -## See also - -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/security-and-serialization.md b/docs/framework/misc/security-and-serialization.md deleted file mode 100644 index a00d04a9dff19..0000000000000 --- a/docs/framework/misc/security-and-serialization.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "Security and Serialization" -description: Read about security and serialization. Use SecurityPermission with the SerializationFormatter flag specified to see or modify object instance data. -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "code security, serialization" - - "serialization, security" - - "secure coding, serialization" - - "security [.NET Framework], serialization" -ms.assetid: b921bc94-bd3a-4c91-9ede-2c8d4f78ea9a ---- -# Security and serialization - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -Because serialization can allow other code to see or modify object instance data that would otherwise be inaccessible, a special permission is required of code performing serialization: with the flag specified. Under default policy, this permission is not given to Internet-downloaded or intranet code; only code on the local computer is granted this permission. - - Normally, all fields of an object instance are serialized, meaning that data is represented in the serialized data for the instance. It is possible for code that can interpret the format to determine what the data values are, independent of the accessibility of the member. Similarly, deserialization extracts data from the serialized representation and sets object state directly, again irrespective of accessibility rules. - - Any object that could contain security-sensitive data should be made nonserializable, if possible. If it must be serializable, try to make specific fields that hold sensitive data nonserializable. If those fields cannot be made nonserializable, the sensitive data will be exposed to any code that has permission to serialize. Make sure that no malicious code can get this permission. - - The interface is intended for use only by the serialization infrastructure. However, if unprotected, it can potentially release sensitive information. If you provide custom serialization by implementing **ISerializable**, make sure you take the following precautions: - -- The method should be explicitly secured either by demanding the **SecurityPermission** with **SerializationFormatter** permission specified or by making sure that no sensitive information is released with the method output. For example: - - ```vb - Public Overrides _ - Sub GetObjectData(info As SerializationInfo, context As StreamingContext) - End Sub - ``` - - ```csharp - [SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter - =true)] - public override void GetObjectData(SerializationInfo info, - StreamingContext context) - { - } - ``` - -- The special constructor used for serialization should also perform thorough input validation and should be either protected or private to help protect against misuse by malicious code. It should enforce the same security checks and permissions required to obtain an instance of such a class by any other means, such as explicitly creating the class or indirectly creating it through some kind of factory. - -## See also - -- [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md) diff --git a/docs/framework/misc/security-transparent-code-level-1.md b/docs/framework/misc/security-transparent-code-level-1.md deleted file mode 100644 index 00ba987eeaa3b..0000000000000 --- a/docs/framework/misc/security-transparent-code-level-1.md +++ /dev/null @@ -1,137 +0,0 @@ ---- -title: "Security-Transparent Code, Level 1" -description: Review the Level 1 transparency code model, transparency attributes, and security transparency examples. -ms.date: "03/30/2017" -helpviewer_keywords: - - "transparent" - - "SecurityTreatAsSafeAttribute" - - "SecurityTransparentAttribute" - - "SecurityCriticalAttribute" - - "security-transparent code" - - "security [.NET Framework], security-transparent code" -ms.assetid: 5fd8f46d-3961-46a7-84af-2eb1f48e75cf ---- -# Security-Transparent Code, Level 1 - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - - Transparency helps developers write more secure .NET Framework libraries that expose functionality to partially trusted code. Level 1 transparency was introduced in the .NET Framework version 2.0 and was primarily used only within Microsoft. Starting with the .NET Framework 4, you can use [level 2 transparency](security-transparent-code-level-2.md). However, level 1 transparency has been retained so that you can identify legacy code that must run with the earlier security rules. - -> [!IMPORTANT] -> You should specify level 1 transparency for compatibility only; that is, specify level 1 only for code that was developed with the .NET Framework 3.5 or earlier that uses the or does not use the transparency model. For example, use level 1 transparency for .NET Framework 2.0 assemblies that allow calls from partially trusted callers (APTCA). For code that is developed for the .NET Framework 4, always use level 2 transparency. - - This topic contains the following sections: - -- [The Level 1 Transparency Model](#the_level_1_transparency_model) - -- [Transparency Attributes](#transparency_attributes) - -- [Security Transparency Examples](#security_transparency_examples) - - - -## The Level 1 Transparency Model - - When you use Level 1 transparency, you are using a security model that separates code into security-transparent, security-safe-critical, and security-critical methods. - - You can mark a whole assembly, some classes in an assembly, or some methods in a class as security-transparent. Security-transparent code cannot elevate privileges. This restriction has three consequences: - -- Security-transparent code cannot perform actions. - -- Any link demand that would be satisfied by security-transparent code becomes a full demand. - -- Any unsafe (unverifiable) code that must execute in security-transparent code causes a full demand for the security permission. - - These rules are enforced during execution by the common language runtime (CLR). Security-transparent code passes all the security requirements of the code it calls back to its callers. Demands that flow through the security-transparent code cannot elevate privileges. If a low-trust application calls security-transparent code and causes a demand for high privilege, the demand will flow back to the low-trust code and fail. The security-transparent code cannot stop the demand because it cannot perform assert actions. The same security-transparent code called from full-trust code results in a successful demand. - - Security-critical is the opposite of security-transparent. Security-critical code executes with full trust and can perform all privileged operations. Security-safe-critical code is privileged code that has been through an extensive security audit to confirm that it does not allow partially trusted callers to use resources they do not have permission to access. - - You have to apply transparency explicitly. The majority of your code that handles data manipulation and logic can typically be marked as security-transparent, whereas the lesser amount of code that performs elevations of privileges is marked as security-critical or security-safe-critical. - -> [!IMPORTANT] -> Level 1 transparency is limited to assembly scope; it is not enforced between assemblies. Level 1 transparency was primarily used within Microsoft for security audit purposes. Security-critical types and members within a level 1 assembly can be accessed by security-transparent code in other assemblies. It is important that you perform link demands for full trust in all your level 1 security-critical types and members. Security-safe-critical types and members must also confirm that callers have permissions for protected resources that are accessed by the type or member. - - For backward compatibility with earlier versions of the .NET Framework, all members that are not annotated with transparency attributes are considered to be security-safe-critical. All types that are not annotated are considered to be transparent. There are no static analysis rules to validate transparency. Therefore, you may need to debug transparency errors at run time. - - - -## Transparency Attributes - - The following table describes the three attributes that you use to annotate your code for transparency. - -|Attribute|Description| -|---------------|-----------------| -||Allowed only at the assembly level. Identifies all types and members in the assembly as security-transparent. The assembly cannot contain any security-critical code.| -||When used at the assembly level without the property, identifies all code in the assembly as security-transparent by default, but indicates that the assembly may contain security-critical code.

When used at the class level, identifies the class or method as security-critical, but not the members of the class. To make all the members security-critical, set the property to .

When used at the member level, the attribute applies only to that member.

The class or member identified as security-critical can perform elevations of privilege. **Important:** In level 1 transparency, security-critical types and members are treated as security-safe-critical when they are called from outside the assembly. You should protect security-critical types and members with a link demand for full trust to avoid unauthorized elevation of privilege.| -||Identifies security-critical code that can be accessed by security-transparent code in the assembly. Otherwise, security-transparent code cannot access private or internal security-critical members in the same assembly. Doing so would influence security-critical code and make unexpected elevations of privilege possible. Security-safe-critical code should undergo a rigorous security audit. **Note:** Security-safe-critical types and members must validate the permissions of callers to determine whether the caller has authority to access protected resources.| - - The attribute enables security-transparent code to access security-critical members in the same assembly. Consider the security-transparent and security-critical code in your assembly as separated into two assemblies. The security-transparent code would not be able to see the private or internal members of the security-critical code. Additionally, the security-critical code is generally audited for access to its public interface. You would not expect a private or internal state to be accessible outside the assembly; you would want to keep the state isolated. The attribute maintains the isolation of state between security-transparent and security-critical code while providing the ability to override the isolation when it is necessary. Security-transparent code cannot access private or internal security-critical code unless those members have been marked with . Before applying the , audit that member as if it were publicly exposed. - -### Assembly-wide Annotation - - The following table describes the effects of using security attributes at the assembly level. - -|Assembly attribute|Assembly state| -|------------------------|--------------------| -|No attribute on a partially trusted assembly|All types and members are transparent.| -|No attribute on a fully trusted assembly (in the global assembly cache or identified as full trust in the `AppDomain`)|All types are transparent and all members are security-safe-critical.| -|`SecurityTransparent`|All types and members are transparent.| -|`SecurityCritical(SecurityCriticalScope.Everything)`|All types and members are security-critical.| -|`SecurityCritical`|All code defaults to transparent. However, individual types and members can have other attributes.| - - - -## Security Transparency Examples - - To use the .NET Framework 2.0 transparency rules (level 1 transparency), use the following assembly annotation: - -```csharp -[assembly: SecurityRules(SecurityRuleSet.Level1)] -``` - - If you want to make a whole assembly transparent to indicate that the assembly does not contain any critical code and does not elevate privileges in any way, you can explicitly add transparency to the assembly with the following attribute: - -```csharp -[assembly: SecurityTransparent] -``` - - If you want to mix critical and transparent code in the same assembly, start by marking the assembly with the attribute to indicate that the assembly can contain critical code, as follows: - -```csharp -[assembly: SecurityCritical] -``` - - If you want to perform security-critical actions, you must explicitly mark the code that will perform the critical action with another attribute, as shown in the following code example: - -```csharp -[assembly: SecurityCritical] -public class A -{ - [SecurityCritical] - private void Critical() - { - // critical - } - - public int SomeProperty - { - get {/* transparent */ } - set {/* transparent */ } - } -} -public class B -{ - internal string SomeOtherProperty - { - get { /* transparent */ } - set { /* transparent */ } - } -} -``` - - The previous code is transparent except for the `Critical` method, which is explicitly marked as security-critical. Transparency is the default setting, even with the assembly-level attribute. - -## See also - -- [Security-Transparent Code, Level 2](security-transparent-code-level-2.md) -- [Security Changes](/previous-versions/dotnet/framework/security/security-changes) diff --git a/docs/framework/misc/security-transparent-code-level-2.md b/docs/framework/misc/security-transparent-code-level-2.md deleted file mode 100644 index 32b6c40da176b..0000000000000 --- a/docs/framework/misc/security-transparent-code-level-2.md +++ /dev/null @@ -1,178 +0,0 @@ ---- -title: "Security-Transparent Code, Level 2" -description: Understand Level 2 transparent code. See usage examples and behaviors, override patterns, inheritance rules, and more. -ms.date: "03/30/2017" -helpviewer_keywords: - - "transparency" - - "level 2 transparency" - - "security-transparent code" - - "security-critical code" -ms.assetid: 4d05610a-0da6-4f08-acea-d54c9d6143c0 ---- -# Security-Transparent Code, Level 2 - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -Level 2 transparency was introduced in the .NET Framework 4. The three tenets of this model are transparent code, security-safe-critical code, and security-critical code. - -- Transparent code, including code that is running as full trust, can call other transparent code or security-safe-critical code only. It can only perform actions allowed by the domain’s partial trust permission set (if one exists). Transparent code cannot do the following: - - - Perform an or elevation of privilege. - - - Contain unsafe or unverifiable code. - - - Directly call critical code. - - - Call native code or code with the attribute. - - - Call a member that is protected by a . - - - Inherit from critical types. - - In addition, transparent methods cannot override critical virtual methods or implement critical interface methods. - -- Safe-critical code is fully trusted but is callable by transparent code. It exposes a limited surface area of full-trust code; correctness and security verifications happen in safe-critical code. - -- Security-critical code can call any code and is fully trusted, but it cannot be called by transparent code. - -## Usage Examples and Behaviors - -To specify .NET Framework 4 rules (level 2 transparency), use the following annotation for an assembly: - -```csharp -[assembly: SecurityRules(SecurityRuleSet.Level2)] -``` - -To lock into the .NET Framework 2.0 rules (level 1 transparency), use the following annotation: - -```csharp -[assembly: SecurityRules(SecurityRuleSet.Level1)] -``` - -If you do not annotate an assembly, the .NET Framework 4 rules are used by default. However, the recommended best practice is to use the attribute instead of depending on the default. - -### Assembly-wide Annotation - -The following rules apply to the use of attributes at the assembly level: - -- No attributes: If you do not specify any attributes, the runtime interprets all code as security-critical, except where being security-critical violates an inheritance rule (for example, when overriding or implementing a transparent virtual or interface method). In those cases, the methods are safe-critical. Specifying no attribute causes the common language runtime to determine the transparency rules for you. - -- `SecurityTransparent`: All code is transparent; the entire assembly will not do anything privileged or unsafe. - -- `SecurityCritical`: All code that is introduced by types in this assembly is critical; all other code is transparent. This scenario is similar to not specifying any attributes; however, the common language runtime does not automatically determine the transparency rules. For example, if you override a virtual or abstract method or implement an interface method, by default, that method is transparent. You must explicitly annotate the method as `SecurityCritical` or `SecuritySafeCritical`; otherwise, a will be thrown at load time. This rule also applies when both the base class and the derived class are in the same assembly. - -- `AllowPartiallyTrustedCallers` (level 2 only): All code defaults to transparent. However, individual types and members can have other attributes. - -The following table compares the assembly level behavior for Level 2 with Level 1. - -|Assembly attribute|Level 2|Level 1| -|------------------------|-------------|-------------| -|No attribute on a partially trusted assembly|Types and members are by default transparent, but can be security-critical or security-safe-critical.|All types and members are transparent.| -|No attribute|Specifying no attribute causes the common language runtime to determine the transparency rules for you. All types and members are security-critical, except where being security-critical violates an inheritance rule.|On a fully trusted assembly (in the global assembly cache or identified as full trust in the `AppDomain`) all types are transparent and all members are security-safe-critical.| -|`SecurityTransparent`|All types and members are transparent.|All types and members are transparent.| -|`SecurityCritical(SecurityCriticalScope.Everything)`|Not applicable.|All types and members are security-critical.| -|`SecurityCritical`|All code that is introduced by types in this assembly is critical; all other code is transparent. If you override a virtual or abstract method or implement an interface method, you must explicitly annotate the method as `SecurityCritical` or `SecuritySafeCritical`.|All code defaults to transparent. However, individual types and members can have other attributes.| - -### Type and Member Annotation - -The security attributes that are applied to a type also apply to the members that are introduced by the type. However, they do not apply to virtual or abstract overrides of the base class or interface implementations. The following rules apply to the use of attributes at the type and member level: - -- `SecurityCritical`: The type or member is critical and can be called only by full-trust code. Methods that are introduced in a security-critical type are critical. - - > [!IMPORTANT] - > Virtual and abstract methods that are introduced in base classes or interfaces, and overridden or implemented in a security-critical class are transparent by default. They must be identified as either `SecuritySafeCritical` or `SecurityCritical`. - -- `SecuritySafeCritical`: The type or member is safe-critical. However, the type or member can be called from transparent (partially trusted) code and is as capable as any other critical code. The code must be audited for security. - -## Override Patterns - -The following table shows the method overrides allowed for level 2 transparency. - -|Base virtual/interface member|Override/interface| -|------------------------------------|-------------------------| -|`Transparent`|`Transparent`| -|`Transparent`|`SafeCritical`| -|`SafeCritical`|`Transparent`| -|`SafeCritical`|`SafeCritical`| -|`Critical`|`Critical`| - -## Inheritance Rules - -In this section, the following order is assigned to `Transparent`, `Critical`, and `SafeCritical` code based on access and capabilities: - -`Transparent` < `SafeCritical` < `Critical` - -- Rules for types: Going from left to right, access becomes more restrictive. Derived types must be at least as restrictive as the base type. - -- Rules for methods: Derived methods cannot change accessibility from the base method. For default behavior, all derived methods that are not annotated are `Transparent`. Derivatives of critical types cause an exception to be thrown if the overridden method is not explicitly annotated as `SecurityCritical`. - -The following table shows the allowed type inheritance patterns. - -|Base class|Derived class can be| -|----------------|--------------------------| -|`Transparent`|`Transparent`| -|`Transparent`|`SafeCritical`| -|`Transparent`|`Critical`| -|`SafeCritical`|`SafeCritical`| -|`SafeCritical`|`Critical`| -|`Critical`|`Critical`| - -The following table shows the disallowed type inheritance patterns. - -|Base class|Derived class cannot be| -|----------------|-----------------------------| -|`SafeCritical`|`Transparent`| -|`Critical`|`Transparent`| -|`Critical`|`SafeCritical`| - -The following table shows the allowed method inheritance patterns. - -|Base method|Derived method can be| -|-----------------|---------------------------| -|`Transparent`|`Transparent`| -|`Transparent`|`SafeCritical`| -|`SafeCritical`|`Transparent`| -|`SafeCritical`|`SafeCritical`| -|`Critical`|`Critical`| - -The following table shows the disallowed method inheritance patterns. - -|Base method|Derived method cannot be| -|-----------------|------------------------------| -|`Transparent`|`Critical`| -|`SafeCritical`|`Critical`| -|`Critical`|`Transparent`| -|`Critical`|`SafeCritical`| - -> [!NOTE] -> These inheritance rules apply to level 2 types and members. Types in level 1 assemblies can inherit from level 2 security-critical types and members. Therefore, level 2 types and members must have separate inheritance demands for level 1 inheritors. - -## Additional Information and Rules - -### LinkDemand Support - -The level 2 transparency model replaces the with the attribute. In legacy (level 1) code, a is automatically treated as a . - -### Reflection - -Invoking a critical method or reading a critical field triggers a demand for full trust (just as if you were invoking a private method or field). Therefore, full-trust code can invoke a critical method, whereas partial-trust code cannot. - -The following properties have been added to the namespace to determine whether the type, method, or field is `SecurityCritical`, `SecuritySafeCritical`, or `SecurityTransparent`: , , and . Use these properties to determine transparency by using reflection instead of checking for the presence of the attribute. The transparency rules are complex, and checking for the attribute may not be sufficient. - -> [!NOTE] -> A `SafeCritical` method returns `true` for both and , because `SafeCritical` is indeed critical (it has the same capabilities as critical code, but it can be called from transparent code). - -Dynamic methods inherit the transparency of the modules they are attached to; they do not inherit the transparency of the type (if they are attached to a type). - -### Skip Verification in Full Trust - -You can skip verification for fully trusted transparent assemblies by setting the property to `true` in the attribute: - -`[assembly: SecurityRules(SecurityRuleSet.Level2, SkipVerificationInFullTrust = true)]` - -The property is `false` by default, so the property must be set to `true` to skip verification. This should be done for optimization purposes only. You should ensure that the transparent code in the assembly is verifiable by using the `transparent` option in the [PEVerify tool](../tools/peverify-exe-peverify-tool.md). - -## See also - -- [Security-Transparent Code, Level 1](security-transparent-code-level-1.md) -- [Security Changes](/previous-versions/dotnet/framework/security/security-changes) diff --git a/docs/framework/misc/security-transparent-code.md b/docs/framework/misc/security-transparent-code.md deleted file mode 100644 index a261b8a7e3f34..0000000000000 --- a/docs/framework/misc/security-transparent-code.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: "Security-Transparent Code" -description: Understand the purpose of the transparent code model, how to specify the transparency level, and transparency enforcement in security. -ms.date: "03/30/2017" -helpviewer_keywords: - - "transparent code" - - "security-transparent code" -ms.assetid: 4f3dd841-82f7-4659-aab0-6d2db2166c65 ---- -# Security-Transparent Code - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -Security involves three interacting pieces: sandboxing, permissions, and enforcement. Sandboxing refers to the practice of creating isolated domains where some code is treated as fully trusted and other code is restricted to the permissions in the grant set for the sandbox. The application code that runs within the grant set of the sandbox is considered to be transparent; that is, it cannot perform any operations that can affect security. The grant set for the sandbox is determined by evidence ( class). Evidence identifies what specific permissions are required by sandboxes, and what kinds of sandboxes can be created. Enforcement refers to allowing transparent code to execute only within its grant set. - -> [!IMPORTANT] -> Security policy was a key element in previous versions of the .NET Framework. Starting with the .NET Framework 4, security policy is obsolete. The elimination of security policy is separate from security transparency. For information about the effects of this change, see [Code Access Security Policy Compatibility and Migration](code-access-security-policy-compatibility-and-migration.md). - -## Purpose of the Transparency Model - -Transparency is an enforcement mechanism that separates code that runs as part of the application from code that runs as part of the infrastructure. Transparency draws a barrier between code that can do privileged things (critical code), such as calling native code, and code that cannot (transparent code). Transparent code can execute commands within the bounds of the permission set it is operating in, but cannot execute, derive from, or contain critical code. - -The primary goal of transparency enforcement is to provide a simple, effective mechanism for isolating different groups of code based on privilege. Within the context of the sandboxing model, these privilege groups are either fully trusted (that is, not restricted) or partially trusted (that is, restricted to the permission set granted to the sandbox). - -> [!IMPORTANT] -> The transparency model transcends code access security. Transparency is enforced by the just-in-time compiler and remains in effect regardless of the grant set for an assembly, including full trust. - -Transparency was introduced in the .NET Framework version 2.0 to simplify the security model, and to make it easier to write and deploy secure libraries and applications. Transparent code is also used in Microsoft Silverlight, to simplify the development of partially trusted applications. - -> [!NOTE] -> When you develop a partially trusted application, you have to be aware of the permission requirements for your target hosts. You can develop an application that uses resources that are not allowed by some hosts. This application will compile without error, but will fail when it is loaded into the hosted environment. If you have developed your application using Visual Studio, you can enable debugging in partial trust or in a restricted permission set from the development environment. For more information, see [How to: Debug a ClickOnce Application with Restricted Permissions](/visualstudio/deployment/how-to-debug-a-clickonce-application-with-restricted-permissions). The Calculate Permissions feature provided for ClickOnce applications is also available for any partially trusted application. - -## Specifying the Transparency Level - -The assembly-level attribute explicitly selects the rules that the assembly will follow. The rules are organized under a numeric level system, where higher levels mean tighter enforcement of security rules. - -The levels are as follows: - -- Level 2 () – the .NET Framework 4 transparency rules. - -- Level 1 () – the .NET Framework 2.0 transparency rules. - -The primary difference between the two transparency levels is that level 1 does not enforce transparency rules for calls from outside the assembly and is intended only for compatibility. - -> [!IMPORTANT] -> You should specify level 1 transparency for compatibility only; that is, specify level 1 only for code that was developed with the .NET Framework 3.5 or earlier that uses the attribute or does not use the transparency model. For example, use level 1 transparency for .NET Framework 2.0 assemblies that allow calls from partially trusted callers (APTCA). For code that is developed for the .NET Framework 4, always use level 2 transparency. - -### Level 2 Transparency - -Level 2 transparency was introduced in the .NET Framework 4. The three tenets of this model are transparent code, security-safe-critical code, and security-critical code. - -- Transparent code, regardless of the permissions it is granted (including full trust), can call only other transparent code or security-safe-critical code. If the code is partially trusted, it can only perform actions that are allowed by the domain’s permission set. Transparent code cannot do the following: - - - Perform an operation or elevation of privilege. - - - Contain unsafe or unverifiable code. - - - Directly call critical code. - - - Call native code or code that has the attribute. - - - Call a member that is protected by a . - - - Inherit from critical types. - - In addition, transparent methods cannot override critical virtual methods or implement critical interface methods. - -- Security-safe-critical code is fully trusted but is callable by transparent code. It exposes a limited surface area of full-trust code. Correctness and security verifications happen in safe-critical code. - -- Security-critical code can call any code and is fully trusted, but it cannot be called by transparent code. - -### Level 1 Transparency - -The level 1 transparency model was introduced in the .NET Framework version 2.0 to enable developers to reduce the amount of code that is subject to a security audit. Although level 1 transparency was publicly available in version 2.0, it was primarily used only within Microsoft for security auditing purposes. Through annotations, developers are able to declare which types and members can perform security elevations and other trusted actions (security-critical) and which cannot (security-transparent). Code that is identified as transparent does not require a high degree of security auditing. Level 1 transparency states that the transparency enforcement is limited to within the assembly. In other words, any public types or members that are identified as security-critical are security-critical only within the assembly. If you want to enforce security for those types and members when they are called from outside the assembly, you must use link demands for full trust. If you do not, publicly visible security-critical types and members are treated as security-safe-critical and can be called by partially trusted code outside the assembly. - -The level 1 transparency model has the following limitations: - -- Security-critical types and members that are public are accessible from security-transparent code. - -- The transparency annotations are enforced only within an assembly. - -- Security-critical types and members must use link demands to enforce security for calls from outside the assembly. - -- Inheritance rules are not enforced. - -- The potential exists for transparent code to do harmful things when run in full trust. - -## Transparency Enforcement - -Transparency rules are not enforced until transparency is calculated. At that time, an is thrown if a transparency rule is violated. The time that transparency is calculated depends on multiple factors and cannot be predicted. It is calculated as late as possible. In the .NET Framework 4, assembly-level transparency calculation occurs sooner than it does in the .NET Framework 2.0. The only guarantee is that transparency calculation will occur by the time it is needed. This is similar to how the just-in-time (JIT) compiler can change the point when a method is compiled and any errors in that method are detected. Transparency calculation is invisible if your code does not have any transparency errors. - -## See also - -- [Security-Transparent Code, Level 1](security-transparent-code-level-1.md) -- [Security-Transparent Code, Level 2](security-transparent-code-level-2.md) diff --git a/docs/framework/misc/using-libraries-from-partially-trusted-code.md b/docs/framework/misc/using-libraries-from-partially-trusted-code.md deleted file mode 100644 index 85e7651582edd..0000000000000 --- a/docs/framework/misc/using-libraries-from-partially-trusted-code.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "Using Libraries from Partially Trusted Code" -description: Know how to use libraries from partially trusted code. Use the AllowPartiallyTrustedCallersAttribute attribute to call shared managed libraries. -ms.date: "03/30/2017" -helpviewer_keywords: - - "security [.NET Framework], partially trusted code" - - "partially trusted code" - - "partial trust" - - "AllowPartiallyTrustedCallersAttribute attribute" - - "code access security, partially trusted code" - - "APTCA" -ms.assetid: dd66cd4c-b087-415f-9c3e-94e3a1835f74 ---- -# Using Libraries from Partially Trusted Code - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - -> [!NOTE] -> This topic addresses the behavior of strong-named assemblies and applies only to [Level 1](security-transparent-code-level-1.md) assemblies. [Security-Transparent Code, Level 2](security-transparent-code-level-2.md) assemblies in the .NET Framework 4 or later are not affected by strong names. For more information about changes to the security system, see [Security Changes](/previous-versions/dotnet/framework/security/security-changes). - - Applications that receive less than full trust from their host or sandbox are not allowed to call shared managed libraries unless the library writer specifically allows them to through the use of the attribute. Therefore, application writers must be aware that some libraries will not be available to them from a partially trusted context. By default, all code that executes in a partial-trust [sandbox](how-to-run-partially-trusted-code-in-a-sandbox.md) and is not in the list of full-trust assemblies is partially trusted. If you do not expect your code to be executed from a partially trusted context or to be called by partially trusted code, you do not have to be concerned about the information in this section. However, if you write code that must interact with partially trusted code or operate from a partially trusted context, you should consider the following factors: - -- Libraries must be signed with a strong name in order to be shared by multiple applications. Strong names allow your code to be placed in the global assembly cache or added to the full-trust list of a sandboxing , and allow consumers to verify that a particular piece of mobile code actually originates from you. - -- By default, strong-named [Level 1](security-transparent-code-level-1.md) shared libraries perform an implicit [LinkDemand](link-demands.md) for full trust automatically, without the library writer having to do anything. - -- If a caller does not have full trust but still tries to call such a library, the runtime throws a and the caller is not allowed to link to the library. - -- In order to disable the automatic **LinkDemand** and prevent the exception from being thrown, you can place the **AllowPartiallyTrustedCallersAttribute** attribute on the assembly scope of a shared library. This attribute allows your libraries to be called from partially trusted managed code. - -- Partially trusted code that is granted access to a library with this attribute is still subject to further restrictions defined by the . - -- There is no programmatic way for partially trusted code to call a library that does not have the **AllowPartiallyTrustedCallersAttribute** attribute. - - Libraries that are private to a specific application do not require a strong name or the **AllowPartiallyTrustedCallersAttribute** attribute and cannot be referenced by potentially malicious code outside the application. Such code is protected against intentional or unintentional misuse by partially trusted mobile code without the developer having to do anything extra. - - You should consider explicitly enabling use by partially trusted code for the following types of code: - -- Code that has been diligently tested for security vulnerabilities and is in compliance with the guidelines described in [Secure Coding Guidelines](../../standard/security/secure-coding-guidelines.md). - -- Strong-named code libraries that are specifically written for partially trusted scenarios. - -- Any components (whether partially or fully trusted) signed with a strong name that will be called by code that is downloaded from the Internet. - -> [!NOTE] -> Some classes in the .NET Framework class library do not have the **AllowPartiallyTrustedCallersAttribute** attribute and cannot be called by partially trusted code. - -## See also - -- [Code Access Security](code-access-security.md) diff --git a/docs/framework/misc/using-the-assert-method.md b/docs/framework/misc/using-the-assert-method.md deleted file mode 100644 index 4d8b2ea4e2cdd..0000000000000 --- a/docs/framework/misc/using-the-assert-method.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -title: "Using the Assert Method" -description: See how you can use the Assert method to enable your code (and downstream callers' code) to do things your code has permission for but not its callers. -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "granting permissions, overriding security checks" - - "code access security, overriding security checks" - - "overriding security checks" - - "security [.NET Framework], overriding security checks" - - "security [.NET Framework], assertions" - - "asserted permissions" - - "Assert method" - - "caller security checks" - - "permissions [.NET Framework], overriding security checks" - - "permissions [.NET Framework], assertions" -ms.assetid: 1e40f4d3-fb7d-4f19-b334-b6076d469ea9 ---- -# Using the Assert Method - -[!INCLUDE[net_security_note](../../../includes/net-security-note-md.md)] - - is a method that can be called on code access permission classes and on the class. You can use **Assert** to enable your code (and downstream callers) to perform actions that your code has permission to do but its callers might not have permission to do. A security assertion changes the normal process that the runtime performs during a security check. When you assert a permission, it tells the security system not to check the callers of your code for the asserted permission. - -> [!CAUTION] -> Use assertions carefully because they can open security holes and undermine the runtime's mechanism for enforcing security restrictions. - - Assertions are useful in situations in which a library calls into unmanaged code or makes a call that requires a permission that is not obviously related to the library's intended use. For example, all managed code that calls into unmanaged code must have **SecurityPermission** with the **UnmanagedCode** flag specified. Code that does not originate from the local computer, such as code that is downloaded from the local intranet, will not be granted this permission by default. Therefore, in order for code that is downloaded from the local intranet to be able to call a library that uses unmanaged code, it must have the permission asserted by the library. Additionally, some libraries might make calls that are unseen to callers and require special permissions. - - You can also use assertions in situations in which your code accesses a resource in a way that is completely hidden from callers. For example, suppose your library acquires information from a database, but in the process also reads information from the computer registry. Because developers using your library do not have access to your source, they have no way of knowing that their code requires **RegistryPermission** in order to use your code. In this case, if you decide that it is not reasonable or necessary to require that callers of your code have permission to access the registry, you can assert permission for reading the registry. In this situation, it is appropriate for the library to assert the permission so that callers without **RegistryPermission** can use the library. - - The assertion affects the stack walk only if the asserted permission and a permission demanded by a downstream caller are of the same type and if the demanded permission is a subset of the asserted permission. For example, if you assert **FileIOPermission** to read all files on the C drive, and a downstream demand is made for **FileIOPermission** to read files in C:\Temp, the assertion could affect the stack walk; however, if the demand was for **FileIOPermission** to write to the C drive, the assertion would have no effect. - - To perform assertions, your code must be granted both the permission you are asserting and the that represents the right to make assertions. Although you could assert a permission that your code has not been granted, the assertion would be pointless because the security check would fail before the assertion could cause it to succeed. - - The following illustration shows what happens when you use **Assert**. Assume that the following statements are true about assemblies A, B, C, E, and F, and two permissions, P1 and P1A: - -- P1A represents the right to read .txt files on the C drive. - -- P1 represents the right to read all files on the C drive. - -- P1A and P1 are both **FileIOPermission** types, and P1A is a subset of P1. - -- Assemblies E and F have been granted P1A permission. - -- Assembly C has been granted P1 permission. - -- Assemblies A and B have been granted neither P1 nor P1A permissions. - -- Method A is contained in assembly A, method B is contained in assembly B, and so on. - - ![Diagram that shows the Assert method assemblies.](./media/using-the-assert-method/assert-method-assemblies.gif) - - In this scenario, method A calls B, B calls C, C calls E, and E calls F. Method C asserts permission to read files on the C drive (permission P1), and method E demands permission to read .txt files on the C drive (permission P1A). When the demand in F is encountered at run time, a stack walk is performed to check the permissions of all callers of F, starting with E. E has been granted P1A permission, so the stack walk proceeds to examine the permissions of C, where C's assertion is discovered. Because the demanded permission (P1A) is a subset of the asserted permission (P1), the stack walk stops and the security check automatically succeeds. It does not matter that assemblies A and B have not been granted permission P1A. By asserting P1, method C ensures that its callers can access the resource protected by P1, even if the callers have not been granted permission to access that resource. - - If you design a class library and a class accesses a protected resource, you should, in most cases, make a security demand requiring that the callers of the class have the appropriate permission. If the class then performs an operation for which you know most of its callers will not have permission, and if you are willing to take the responsibility for letting these callers call your code, you can assert the permission by calling the **Assert** method on a permission object that represents the operation the code is performing. Using **Assert** in this way lets callers that normally could not do so call your code. Therefore, if you assert a permission, you should be sure to perform appropriate security checks beforehand to prevent your component from being misused. - - For example, suppose your highly trusted library class has a method that deletes files. It accesses the file by calling an unmanaged Win32 function. A caller invokes your code's **Delete** method, passing in the name of the file to be deleted, C:\Test.txt. Within the **Delete** method, your code creates a object representing write access to C:\Test.txt. (Write access is required to delete a file.) Your code then invokes an imperative security check by calling the **FileIOPermission** object's **Demand** method. If one of the callers in the call stack does not have this permission, a is thrown. If no exception is thrown, you know that all callers have the right to access C:\Test.txt. Because you believe that most of your callers will not have permission to access unmanaged code, your code then creates a object that represents the right to call unmanaged code and calls the object's **Assert** method. Finally, it calls the unmanaged Win32 function to delete C:\Text.txt and returns control to the caller. - -> [!CAUTION] -> You must be sure that your code does not use assertions in situations where your code can be used by other code to access a resource that is protected by the permission you are asserting. For example, in code that writes to a file whose name is specified by the caller as a parameter, you would not assert the **FileIOPermission** for writing to files because your code would be open to misuse by a third party. - - When you use the imperative security syntax, calling the **Assert** method on multiple permissions in the same method causes a security exception to be thrown. Instead, you should create a **PermissionSet** object, pass it the individual permissions you want to invoke, and then call the **Assert** method on the **PermissionSet** object. You can call the **Assert** method more than once when you use the declarative security syntax. - - The following example shows declarative syntax for overriding security checks using the **Assert** method. Notice that the **FileIOPermissionAttribute** syntax takes two values: a enumeration and the location of the file or directory to which permission is to be granted. The call to **Assert** causes demands for access to `C:\Log.txt` to succeed, even though callers are not checked for permission to access the file. - -```vb -Option Explicit -Option Strict - -Imports System -Imports System.IO -Imports System.Security.Permissions - -Namespace LogUtil - Public Class Log - Public Sub New() - - End Sub - - Public Sub - MakeLog() - Dim TextStream As New StreamWriter("C:\Log.txt") - TextStream.WriteLine("This Log was created on {0}", DateTime.Now) ' - TextStream.Close() - End Sub - End Class -End Namespace -``` - -```csharp -namespace LogUtil -{ - using System; - using System.IO; - using System.Security.Permissions; - - public class Log - { - public Log() - { - } - [FileIOPermission(SecurityAction.Assert, All = @"C:\Log.txt")] - public void MakeLog() - { - StreamWriter TextStream = new StreamWriter(@"C:\Log.txt"); - TextStream.WriteLine("This Log was created on {0}", DateTime.Now); - TextStream.Close(); - } - } -} -``` - - The following code fragments show imperative syntax for overriding security checks using the **Assert** method. In this example, an instance of the **FileIOPermission** object is declared. Its constructor is passed **FileIOPermissionAccess.AllAccess** to define the type of access allowed, followed by a string describing the file's location. Once the **FileIOPermission** object is defined, you only need to call its **Assert** method to override the security check. - -```vb -Option Explicit -Option Strict -Imports System -Imports System.IO -Imports System.Security.Permissions -Namespace LogUtil - Public Class Log - Public Sub New() - End Sub 'New - - Public Sub MakeLog() - Dim FilePermission As New FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\Log.txt") - FilePermission.Assert() - Dim TextStream As New StreamWriter("C:\Log.txt") - TextStream.WriteLine("This Log was created on {0}", DateTime.Now) - TextStream.Close() - End Sub - End Class -End Namespace -``` - -```csharp -namespace LogUtil -{ - using System; - using System.IO; - using System.Security.Permissions; - - public class Log - { - public Log() - { - } - public void MakeLog() - { - FileIOPermission FilePermission = new FileIOPermission(FileIOPermissionAccess.AllAccess,@"C:\Log.txt"); - FilePermission.Assert(); - StreamWriter TextStream = new StreamWriter(@"C:\Log.txt"); - TextStream.WriteLine("This Log was created on {0}", DateTime.Now); - TextStream.Close(); - } - } -} -``` - -## See also - -- -- -- -- -- [Attributes](../../standard/attributes/index.md) -- [Code Access Security](code-access-security.md) diff --git a/docs/framework/performance/writing-large-responsive-apps.md b/docs/framework/performance/writing-large-responsive-apps.md index 904bb3c1f94a9..ef970a1c7ed71 100644 --- a/docs/framework/performance/writing-large-responsive-apps.md +++ b/docs/framework/performance/writing-large-responsive-apps.md @@ -40,7 +40,7 @@ The .NET Framework is highly productive for building apps. Powerful and safe lan Good tools let you drill quickly into the biggest performance issues (CPU, memory, or disk) and help you locate the code that causes those bottlenecks. Microsoft ships a variety of performance tools such as [Visual Studio Profiler](/visualstudio/profiling/beginners-guide-to-performance-profiling) and [PerfView](https://www.microsoft.com/download/details.aspx?id=28567). - PerfView is a free and amazingly powerful tool that helps you focus on deep issues such as disk I/O, GC events, and memory. You can capture performance-related [Event Tracing for Windows](../wcf/samples/etw-tracing.md) (ETW) events and view easily per app, per process, per stack, and per thread information. PerfView shows you how much and what kind of memory your app allocates, and which functions or call stacks contribute how much to the memory allocations. For details, see the rich help topics, demos, and videos included with the tool (such as the [PerfView tutorials](https://channel9.msdn.com/Series/PerfView-Tutorial) on Channel 9). + PerfView is a free and amazingly powerful tool that helps you focus on deep issues such as disk I/O, GC events, and memory. You can capture performance-related [Event Tracing for Windows](/previous-versions/dotnet/framework/wcf/samples/etw-tracing) (ETW) events and view easily per app, per process, per stack, and per thread information. PerfView shows you how much and what kind of memory your app allocates, and which functions or call stacks contribute how much to the memory allocations. For details, see the rich help topics, demos, and videos included with the tool (such as the [PerfView tutorials](https://channel9.msdn.com/Series/PerfView-Tutorial) on Channel 9). ### Fact 4: It’s all about allocations diff --git a/docs/framework/reflection-and-codedom/security-considerations-for-reflection.md b/docs/framework/reflection-and-codedom/security-considerations-for-reflection.md index 2463c2491b066..872cbe933f408 100644 --- a/docs/framework/reflection-and-codedom/security-considerations-for-reflection.md +++ b/docs/framework/reflection-and-codedom/security-considerations-for-reflection.md @@ -111,7 +111,7 @@ Avoid writing public members that take param - - - [Security Changes](/previous-versions/dotnet/framework/security/security-changes) -- [Code Access Security](../misc/code-access-security.md) +- [Code Access Security](/previous-versions/dotnet/framework/code-access-security/code-access-security) - [Security Issues in Reflection Emit](security-issues-in-reflection-emit.md) - [Viewing Type Information](viewing-type-information.md) - [Applying Attributes](../../standard/attributes/applying-attributes.md) diff --git a/docs/framework/reflection-and-codedom/walkthrough-emitting-code-in-partial-trust-scenarios.md b/docs/framework/reflection-and-codedom/walkthrough-emitting-code-in-partial-trust-scenarios.md index c34aee9e84529..4eedde05c615c 100644 --- a/docs/framework/reflection-and-codedom/walkthrough-emitting-code-in-partial-trust-scenarios.md +++ b/docs/framework/reflection-and-codedom/walkthrough-emitting-code-in-partial-trust-scenarios.md @@ -28,7 +28,7 @@ This walkthrough illustrates the following tasks: - [Setting up a simple sandbox for testing partially trusted code](#Setting_up). > [!IMPORTANT] - > This is a simple way to experiment with code in partial trust. To run code that actually comes from untrusted locations, see [How to: Run Partially Trusted Code in a Sandbox](../misc/how-to-run-partially-trusted-code-in-a-sandbox.md). + > This is a simple way to experiment with code in partial trust. To run code that actually comes from untrusted locations, see [How to: Run Partially Trusted Code in a Sandbox](/previous-versions/dotnet/framework/code-access-security/how-to-run-partially-trusted-code-in-a-sandbox). - [Running code in partially trusted application domains](#Running_code). @@ -64,7 +64,7 @@ The following procedure creates a sandboxed application domain that runs your co 2. Create an object to initialize the application domain with an application path. > [!IMPORTANT] - > For simplicity, this code example uses the current folder. To run code that actually comes from the Internet, use a separate folder for the untrusted code, as described in [How to: Run Partially Trusted Code in a Sandbox](../misc/how-to-run-partially-trusted-code-in-a-sandbox.md). + > For simplicity, this code example uses the current folder. To run code that actually comes from the Internet, use a separate folder for the untrusted code, as described in [How to: Run Partially Trusted Code in a Sandbox](/previous-versions/dotnet/framework/code-access-security/how-to-run-partially-trusted-code-in-a-sandbox). [!code-csharp[HowToEmitCodeInPartialTrust#3](../../../samples/snippets/csharp/VS_Snippets_CLR/HowToEmitCodeInPartialTrust/cs/source.cs#3)] [!code-vb[HowToEmitCodeInPartialTrust#3](../../../samples/snippets/visualbasic/VS_Snippets_CLR/HowToEmitCodeInPartialTrust/vb/source.vb#3)] @@ -219,4 +219,4 @@ This comparison shows how diff --git a/docs/framework/tools/peverify-exe-peverify-tool.md b/docs/framework/tools/peverify-exe-peverify-tool.md index 5fc50d21f5f3c..ddedcf27ceb63 100644 --- a/docs/framework/tools/peverify-exe-peverify-tool.md +++ b/docs/framework/tools/peverify-exe-peverify-tool.md @@ -117,6 +117,6 @@ peverify myAssembly.exe /break=100 /ignore@ignoreErrors.rsp ## See also - [Tools](index.md) -- [Writing Verifiably Type-Safe Code](../misc/code-access-security-basics.md#typesafe_code) +- [Writing Verifiably Type-Safe Code](/previous-versions/dotnet/framework/code-access-security/code-access-security-basics#typesafe_code) - [Type Safety and Security](../../standard/security/key-security-concepts.md#type-safety-and-security) - [Developer command-line shells](/visualstudio/ide/reference/command-prompt-powershell) diff --git a/docs/framework/tools/regsvcs-exe-net-services-installation-tool.md b/docs/framework/tools/regsvcs-exe-net-services-installation-tool.md index ee95c082fb5b6..d8e0b2a613b8a 100644 --- a/docs/framework/tools/regsvcs-exe-net-services-installation-tool.md +++ b/docs/framework/tools/regsvcs-exe-net-services-installation-tool.md @@ -62,7 +62,7 @@ The .NET Services Installation tool performs the following actions: Regsvcs.exe requires a source assembly file specified by *assemblyFile.dll*. This assembly must be signed with a strong name. For more information on strong name signing, see [Signing an Assembly with a Strong Name](../../standard/assembly/sign-strong-name.md). The names of the target application and the type library file are optional. The *applicationName* argument can be generated from the source assembly file and will be created by Regsvcs.exe, if it does not already exist. The *typelibraryfile* argument can specify a type library name. If you do not specify a type library name, Regsvcs.exe uses the assembly name as the default. - When Regsvcs.exe registers a component's methods, it is subject to the [demands](/previous-versions/dotnet/netframework-4.0/9kc0c6st(v=vs.100)) and [link demands](../misc/link-demands.md) on those methods. Because the tool executes in a fully-trusted environment, most demands for a permission succeed. However, Regsvcs.exe cannot register components with methods protected by a demand or link demand for the or the . + When Regsvcs.exe registers a component's methods, it is subject to the [demands](/previous-versions/dotnet/netframework-4.0/9kc0c6st(v=vs.100)) and [link demands](/previous-versions/dotnet/framework/code-access-security/link-demands) on those methods. Because the tool executes in a fully-trusted environment, most demands for a permission succeed. However, Regsvcs.exe cannot register components with methods protected by a demand or link demand for the or the . You must have administrative privileges on the local computer to use Regsvcs.exe. diff --git a/docs/framework/tools/winmdexp-exe-windows-runtime-metadata-export-tool.md b/docs/framework/tools/winmdexp-exe-windows-runtime-metadata-export-tool.md index 91c8bab817773..0f1160414e102 100644 --- a/docs/framework/tools/winmdexp-exe-windows-runtime-metadata-export-tool.md +++ b/docs/framework/tools/winmdexp-exe-windows-runtime-metadata-export-tool.md @@ -9,7 +9,7 @@ ms.assetid: d2ce0683-343d-403e-bb8d-209186f7a19d --- # Winmdexp.exe (Windows Runtime Metadata Export Tool) -The Windows Runtime Metadata Export Tool (Winmdexp.exe) transforms a .NET Framework module into a file that contains Windows Runtime metadata. Although .NET Framework assemblies and Windows Runtime metadata files use the same physical format, there are differences in the content of the metadata tables, which means that .NET Framework assemblies are not automatically usable as Windows Runtime Components. The process of turning a .NET Framework module into a Windows Runtime component is referred to as *exporting*. In the .NET Framework 4.5 and .NET Framework 4.5.1, the resulting Windows metadata (.winmd) file contains both metadata and implementation. +The Windows Runtime Metadata Export Tool (Winmdexp.exe) transforms a .NET Framework module into a file that contains Windows Runtime metadata. Although .NET Framework assemblies and Windows Runtime metadata files use the same physical format, there are differences in the content of the metadata tables, which means that .NET Framework assemblies are not automatically usable as Windows Runtime Components. The process of turning a .NET Framework module into a Windows Runtime component is referred to as *exporting*. In .NET Framework 4.5 and 4.5.1, the resulting Windows metadata (.winmd) file contains both metadata and implementation. When you use the **Windows Runtime Component** template, which is located under **Windows Store** for C# and Visual Basic in Visual Studio 2013 or Visual Studio 2012, the compiler target is a .winmdobj file, and a subsequent build step calls Winmdexp.exe to export the .winmdobj file to a .winmd file. This is the recommended way to build a Windows Runtime component. Use Winmdexp.exe directly when you want more control over the build process than Visual Studio provides. @@ -43,11 +43,11 @@ winmdexp [options] winmdmodule Winmdexp.exe is not designed to convert an arbitrary .NET Framework assembly to a .winmd file. It requires a module that is compiled with the `/target:winmdobj` option, and additional restrictions apply. The most important of these restrictions is that all types that are exposed in the API surface of the assembly must be Windows Runtime types. For more information, see the "Declaring types in Windows Runtime Components" section of the article [Creating Windows Runtime Components in C# and Visual Basic](/previous-versions/br230301(v=vs.110)). - When you write a Windows 8.x Store app or a Windows Runtime component with C# or Visual Basic, the .NET Framework provides support to make programming with the Windows Runtime more natural. This is discussed in the article [.NET Framework Support for Windows Store Apps and Windows Runtime](../cross-platform/support-for-windows-store-apps-and-windows-runtime.md). In the process, some commonly used Windows Runtime types are mapped to .NET Framework types. Winmdexp.exe reverses this process and produces an API surface that uses the corresponding Windows Runtime types. For example, types that are constructed from the interface map to types that are constructed from the Windows Runtime interface. + When you write a Windows 8.x Store app or a Windows Runtime component with C# or Visual Basic, the .NET Framework provides support to make programming with the Windows Runtime more natural. This is discussed in the article [.NET Framework Support for Windows Store Apps and Windows Runtime](/previous-versions/dotnet/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime). In the process, some commonly used Windows Runtime types are mapped to .NET Framework types. Winmdexp.exe reverses this process and produces an API surface that uses the corresponding Windows Runtime types. For example, types that are constructed from the interface map to types that are constructed from the Windows Runtime interface. ## See also -- [.NET Framework Support for Windows Store Apps and Windows Runtime](../cross-platform/support-for-windows-store-apps-and-windows-runtime.md) +- [.NET Framework Support for Windows Store Apps and Windows Runtime](/previous-versions/dotnet/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime) - [Creating Windows Runtime Components in C# and Visual Basic](/previous-versions/br230301(v=vs.110)) - [Winmdexp.exe Error Messages](winmdexp-exe-error-messages.md) - [Build, Deployment, and Configuration Tools (.NET Framework)](/previous-versions/dotnet/netframework-4.0/dd233108(v=vs.100)) diff --git a/docs/framework/unmanaged-api/fusion/getassemblyidentityfromfile-function.md b/docs/framework/unmanaged-api/fusion/getassemblyidentityfromfile-function.md index ad80ca922d2f9..3e8d5788d5970 100644 --- a/docs/framework/unmanaged-api/fusion/getassemblyidentityfromfile-function.md +++ b/docs/framework/unmanaged-api/fusion/getassemblyidentityfromfile-function.md @@ -2,55 +2,61 @@ description: "Learn more about: GetAssemblyIdentityFromFile Function" title: "GetAssemblyIdentityFromFile Function" ms.date: "03/30/2017" -api_name: +api_name: - "GetAssemblyIdentityFromFile" -api_location: +api_location: - "fusion.dll" - "clr.dll" - "mscorwks.dll" -api_type: +api_type: - "COM" -f1_keywords: +f1_keywords: - "GetAssemblyIdentityFromFile" -helpviewer_keywords: +helpviewer_keywords: - "GetAssemblyIdentityFromFile function [.NET Framework fusion]" ms.assetid: 2c32da53-76c7-4048-84d0-d05207333004 -topic_type: +topic_type: - "apiref" --- # GetAssemblyIdentityFromFile Function -Gets a pointer to an `IUnknown` object with the specified `IID` in the assembly at the specified file path. - -## Syntax - -```cpp -HRESULT GetAssemblyIdentityFromFile ( - [in] LPCWSTR pwzFilePath, - [in] REFIID riid, - [out] IUnknown **ppIdentity - ); -``` - -## Parameters - - `pwzFilePath` - [in] A valid path to the requested assembly. - - `riid` - [in] The `IID` of the interface to return. - - `ppIdentity` - [out] The returned interface pointer. - -## Requirements - - **Platforms:** See [System Requirements](../../get-started/system-requirements.md). - - **Header:** Fusion.h - - **.NET Framework Versions:** [!INCLUDE[net_current_v20plus](../../../../includes/net-current-v20plus-md.md)] - +Gets a pointer to an `IUnknown` object with the specified `IID` in the assembly at the specified file path. + +## Syntax + +```cpp +HRESULT GetAssemblyIdentityFromFile ( + [in] LPCWSTR pwzFilePath, + [in] REFIID riid, + [out] IUnknown **ppIdentity + ); +``` + +## Parameters + + `pwzFilePath` + [in] A valid path to the requested assembly. + + `riid` + [in] The `IID` of the interface to return. + + `ppIdentity` + [out] The returned interface pointer. + +## Requirements + +**Platforms:** See [System Requirements](../../get-started/system-requirements.md). + +**Header:** Fusion.h + +**Library:** + +- Fusion.dll +- Clr.dll +- MSCorWks.dll + +**.NET Framework Versions:** [!INCLUDE[net_current_v20plus](../../../../includes/net-current-v20plus-md.md)] + ## See also - [IUnknown](/cpp/atl/iunknown) diff --git a/docs/framework/unmanaged-api/profiling/clr-profilers-and-windows-store-apps.md b/docs/framework/unmanaged-api/profiling/clr-profilers-and-windows-store-apps.md index f1ffb37927463..d25a7d917cbcd 100644 --- a/docs/framework/unmanaged-api/profiling/clr-profilers-and-windows-store-apps.md +++ b/docs/framework/unmanaged-api/profiling/clr-profilers-and-windows-store-apps.md @@ -352,7 +352,7 @@ Your Profiler DLL can distinguish WinMD files from other modules by calling the ### Reading metadata from WinMDs -WinMD files, like regular modules, contain metadata that can be read via the [Metadata APIs](../metadata/index.md). However, the CLR maps Windows Runtime types to .NET Framework types when it reads WinMD files so that developers who program in managed code and consume the WinMD file can have a more natural programming experience. For some examples of these mappings, see [.NET Framework Support for Windows Store Apps and Windows Runtime](../../cross-platform/support-for-windows-store-apps-and-windows-runtime.md). +WinMD files, like regular modules, contain metadata that can be read via the [Metadata APIs](../metadata/index.md). However, the CLR maps Windows Runtime types to .NET Framework types when it reads WinMD files so that developers who program in managed code and consume the WinMD file can have a more natural programming experience. For some examples of these mappings, see [.NET Framework Support for Windows Store Apps and Windows Runtime](/previous-versions/dotnet/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime). So which view will your profiler get when it uses the metadata APIs: the raw Windows Runtime view, or the mapped .NET Framework view? The answer: it’s up to you. @@ -402,7 +402,7 @@ It is possible to use the CLR Profiling API to analyze managed code running insi **The CLR's interaction with the Windows Runtime** -- [.NET Framework Support for Windows Store Apps and Windows Runtime](../../cross-platform/support-for-windows-store-apps-and-windows-runtime.md) +- [.NET Framework Support for Windows Store Apps and Windows Runtime](/previous-versions/dotnet/framework/cross-platform/support-for-windows-store-apps-and-windows-runtime) **Windows Store apps** diff --git a/docs/framework/wcf/add-service-reference-in-a-portable-subset-project.md b/docs/framework/wcf/add-service-reference-in-a-portable-subset-project.md index 3b36e1b42966c..9d166e0029de8 100644 --- a/docs/framework/wcf/add-service-reference-in-a-portable-subset-project.md +++ b/docs/framework/wcf/add-service-reference-in-a-portable-subset-project.md @@ -43,4 +43,4 @@ Portable subset projects enable .NET assembly programmers to maintain a single s ## See also - [Accessing Services Using a WCF Client](accessing-services-using-a-wcf-client.md) -- [Portable Class Library](../cross-platform/portable-class-library.md) +- [Portable Class Library](/previous-versions/dotnet/framework/cross-platform/portable-class-library) diff --git a/docs/framework/wcf/basic-wcf-programming.md b/docs/framework/wcf/basic-wcf-programming.md index 70775f3065e0f..25eb54fb5bfb9 100644 --- a/docs/framework/wcf/basic-wcf-programming.md +++ b/docs/framework/wcf/basic-wcf-programming.md @@ -52,7 +52,7 @@ This section presents the fundamentals for creating Windows Communication Founda - [Getting Started Tutorial](getting-started-tutorial.md) - [Guidelines and Best Practices](guidelines-and-best-practices.md) - [Windows Communication Foundation Tools](tools.md) -- [Windows Communication Foundation (WCF) samples](./samples/index.md) -- [Getting Started](./samples/getting-started-sample.md) -- [IIS Hosting Using Inline Code](./samples/iis-hosting-using-inline-code.md) -- [Self-Host](./samples/self-host.md) +- [Windows Communication Foundation (WCF) samples](/previous-versions/dotnet/framework/wcf/samples/index) +- [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample) +- [IIS Hosting Using Inline Code](/previous-versions/dotnet/framework/wcf/samples/iis-hosting-using-inline-code) +- [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) diff --git a/docs/framework/wcf/conceptual-overview.md b/docs/framework/wcf/conceptual-overview.md index ff116317786e8..d7d8ce5f87453 100644 --- a/docs/framework/wcf/conceptual-overview.md +++ b/docs/framework/wcf/conceptual-overview.md @@ -30,6 +30,6 @@ This topic summarizes information about the Windows Communication Foundation (WC - [Basic WCF Programming](basic-wcf-programming.md) - [Guidelines and Best Practices](guidelines-and-best-practices.md) -- [Windows Communication Foundation Samples](./samples/index.md) +- [Windows Communication Foundation Samples](/previous-versions/dotnet/framework/wcf/samples/index) - [Tools](./diagnostics/exceptions-reference/tools.md) - [General Reference](general-reference.md) diff --git a/docs/framework/wcf/configuring-bindings-for-wcf-services.md b/docs/framework/wcf/configuring-bindings-for-wcf-services.md index 8e69a1efd05d2..5ba344253e542 100644 --- a/docs/framework/wcf/configuring-bindings-for-wcf-services.md +++ b/docs/framework/wcf/configuring-bindings-for-wcf-services.md @@ -32,7 +32,7 @@ When creating an application, you often want to defer decisions to the administr ### ServiceModel Elements - You can use the section bounded by the `system.ServiceModel` element to configure a service type with one or more endpoints, as well as settings for a service. Each endpoint can then be configured with an address, a contract, and a binding. For more information about endpoints, see [Endpoint Creation Overview](endpoint-creation-overview.md). If no endpoints are specified, the runtime adds default endpoints. For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](./samples/simplified-configuration-for-wcf-services.md). + You can use the section bounded by the `system.ServiceModel` element to configure a service type with one or more endpoints, as well as settings for a service. Each endpoint can then be configured with an address, a contract, and a binding. For more information about endpoints, see [Endpoint Creation Overview](endpoint-creation-overview.md). If no endpoints are specified, the runtime adds default endpoints. For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). A binding specifies transports (HTTP, TCP, pipes, Message Queuing) and protocols (Security, Reliability, Transaction flows) and consists of binding elements, each of which specifies an aspect of how an endpoint communicates with the world. diff --git a/docs/framework/wcf/configuring-services-using-configuration-files.md b/docs/framework/wcf/configuring-services-using-configuration-files.md index d7cacf0b90554..9a6cc7c2b82d0 100644 --- a/docs/framework/wcf/configuring-services-using-configuration-files.md +++ b/docs/framework/wcf/configuring-services-using-configuration-files.md @@ -12,7 +12,7 @@ Configuring a Windows Communication Foundation (WCF) service with a configuratio A WCF service is configurable using the .NET Framework configuration technology. Most commonly, XML elements are added to the Web.config file for an Internet Information Services (IIS) site that hosts a WCF service. The elements allow you to change details such as the endpoint addresses (the actual addresses used to communicate with the service) on a machine-by-machine basis. In addition, WCF includes several system-provided elements that allow you to quickly select the most basic features for a service. Starting with .NET Framework 4, WCF comes with a new default configuration model that simplifies WCF configuration requirements. If you do not provide any WCF configuration for a particular service, the runtime automatically configures your service with some standard endpoints and default binding/behavior. In practice, writing configuration is a major part of programming WCF applications. - For more information, see [Configuring Bindings for Services](configuring-bindings-for-wcf-services.md). For a list of the most commonly used elements, see [System-Provided Bindings](system-provided-bindings.md). For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](./samples/simplified-configuration-for-wcf-services.md). + For more information, see [Configuring Bindings for Services](configuring-bindings-for-wcf-services.md). For a list of the most commonly used elements, see [System-Provided Bindings](system-provided-bindings.md). For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). > [!IMPORTANT] > When deploying side by side scenarios where two different versions of a service are deployed, it is necessary to specify partial names of assemblies referenced in configuration files. This is because the configuration file is shared across all versions of a service and they could be running under different versions of the .NET Framework. diff --git a/docs/framework/wcf/configuring-wcf-services-in-code.md b/docs/framework/wcf/configuring-wcf-services-in-code.md index 8f40b5bdccf89..ce5e46f841e90 100644 --- a/docs/framework/wcf/configuring-wcf-services-in-code.md +++ b/docs/framework/wcf/configuring-wcf-services-in-code.md @@ -95,7 +95,7 @@ public class Service1 : IService1 - [Configuring Services Using Configuration Files](configuring-services-using-configuration-files.md) - [Configuring Client Behaviors](configuring-client-behaviors.md) - [Simplified Configuration](simplified-configuration.md) -- [Configuration](./samples/configuration-sample.md) +- [Configuration](/previous-versions/dotnet/framework/wcf/samples/configuration-sample) - [Configuration-Based Activation in IIS and WAS](./feature-details/configuration-based-activation-in-iis-and-was.md) - [Configuration and Metadata Support](./extending/configuration-and-metadata-support.md) - [Configuration](./diagnostics/exceptions-reference/configuration.md) diff --git a/docs/framework/wcf/designing-service-contracts.md b/docs/framework/wcf/designing-service-contracts.md index 028126edfde5c..b3e5338738b7f 100644 --- a/docs/framework/wcf/designing-service-contracts.md +++ b/docs/framework/wcf/designing-service-contracts.md @@ -147,7 +147,7 @@ Sub Hello (ByVal greeting As String) To implement a duplex pattern, you must create a second interface that contains the method declarations that are called on the client. - For an example of creating a service, and a client that accesses that service, see [How to: Create a Duplex Contract](./feature-details/how-to-create-a-duplex-contract.md) and [How to: Access Services with a Duplex Contract](./feature-details/how-to-access-services-with-a-duplex-contract.md). For a working sample, see [Duplex](./samples/duplex.md). For more information about issues using duplex contracts, see [Duplex Services](./feature-details/duplex-services.md). + For an example of creating a service, and a client that accesses that service, see [How to: Create a Duplex Contract](./feature-details/how-to-create-a-duplex-contract.md) and [How to: Access Services with a Duplex Contract](./feature-details/how-to-access-services-with-a-duplex-contract.md). For a working sample, see [Duplex](/previous-versions/dotnet/framework/wcf/samples/duplex). For more information about issues using duplex contracts, see [Duplex Services](./feature-details/duplex-services.md). > [!CAUTION] > When a service receives a duplex message, it looks at the `ReplyTo` element in that incoming message to determine where to send the reply. If the channel that is used to receive the message is not secured, then an untrusted client could send a malicious message with a target machine's `ReplyTo`, leading to a denial of service (DOS) of that target machine. diff --git a/docs/framework/wcf/diagnostics/etw/determining-service-operation-duration.md b/docs/framework/wcf/diagnostics/etw/determining-service-operation-duration.md index d604c814f4381..e645ed70d01bd 100644 --- a/docs/framework/wcf/diagnostics/etw/determining-service-operation-duration.md +++ b/docs/framework/wcf/diagnostics/etw/determining-service-operation-duration.md @@ -14,7 +14,7 @@ If analytic tracing is enabled in a Windows Communication Foundation (WCF) appli 2. If you haven’t enabled analytic tracing, expand **Applications and Services Logs**, **Microsoft**, **Windows**, **Application Server-Applications**. Select **View**, **Show Analytic and Debug Logs**. Right-click **Analytic** and select **Enable Log**. Leave Event Viewer open so that traces can be viewed after the service operation is run. -3. Next, open a WCF application that includes a service project and a client project that interacts with that service. You can create such an application by following the [Getting Started Tutorial](../../getting-started-tutorial.md). If you have the WCF samples installed, you can open the [Getting Started](../../samples/getting-started-sample.md), which contains the completed project created in the tutorial. +3. Next, open a WCF application that includes a service project and a client project that interacts with that service. You can create such an application by following the [Getting Started Tutorial](../../getting-started-tutorial.md). If you have the WCF samples installed, you can open the [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample), which contains the completed project created in the tutorial. 4. Execute the server application by pressing **F5**. Execute the client application by right-clicking on the **Client** project and selecting **Debug**, **Start New Instance**. diff --git a/docs/framework/wcf/diagnostics/etw/dynamically-enabling-analytic-tracing.md b/docs/framework/wcf/diagnostics/etw/dynamically-enabling-analytic-tracing.md index 1f9f424b9609b..9bd04e5a74972 100644 --- a/docs/framework/wcf/diagnostics/etw/dynamically-enabling-analytic-tracing.md +++ b/docs/framework/wcf/diagnostics/etw/dynamically-enabling-analytic-tracing.md @@ -12,7 +12,7 @@ Using tools that ship with the Windows operating system, you can enable or disab - **Logman** – A command line tool for configuring, controlling, and querying tracing data. For more information, see [Logman Create Trace](/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc788036(v=ws.10)) and [Logman Update Trace](/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc788128(v=ws.10)). -- **EventViewer** - Windows graphical management tool for viewing the results of tracing. For more information, see [WCF Services and Event Tracing for Windows](../../samples/wcf-services-and-event-tracing-for-windows.md) and [Event Viewer](/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc766042(v=ws.11)). +- **EventViewer** - Windows graphical management tool for viewing the results of tracing. For more information, see [WCF Services and Event Tracing for Windows](/previous-versions/dotnet/framework/wcf/samples/wcf-services-and-event-tracing-for-windows) and [Event Viewer](/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc766042(v=ws.11)). - **Perfmon** – Windows graphical management tool that uses counters to monitor tracing counters and the effects of tracing on performance. For more information, see [Create a Data Collector Set Manually](/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc766404(v=ws.11)). @@ -39,4 +39,4 @@ Using tools that ship with the Windows operating system, you can enable or disab ## See also -- [WCF Services and Event Tracing for Windows](../../samples/wcf-services-and-event-tracing-for-windows.md) +- [WCF Services and Event Tracing for Windows](/previous-versions/dotnet/framework/wcf/samples/wcf-services-and-event-tracing-for-windows) diff --git a/docs/framework/wcf/diagnostics/etw/index.md b/docs/framework/wcf/diagnostics/etw/index.md index 3ea5214064ff5..fdaf3f034f66b 100644 --- a/docs/framework/wcf/diagnostics/etw/index.md +++ b/docs/framework/wcf/diagnostics/etw/index.md @@ -2,7 +2,7 @@ description: "Learn more about: Analytic Tracing with ETW" title: "Analytic Tracing with ETW" ms.date: "03/30/2017" -helpviewer_keywords: +helpviewer_keywords: - "diagnostics [WCF], analytic tracing" - "administration [WCF], analytic tracing" - "analytic tracing [WCF]" @@ -10,23 +10,23 @@ ms.assetid: 1d518e47-a38d-41e8-93d7-8c3b361f6a56 --- # Analytic Tracing with ETW -Windows Communication Foundation (WCF) analytic tracing offers a way to capture diagnostic information during the execution of a WCF service. WCF analytic tracing events are emitted at key points in the WCF stack to allow troubleshooting of WCF services in a production environment. Analytic tracing for WCF services has minimal impact on the performance of a product server that hosts [!INCLUDE[netfx_current_long](../../../../../includes/netfx-current-long-md.md)] WCF services as these events are very efficiently emitted to an Event Tracing for Windows (ETW) session. - -## In This Section - - [Analytic Tracing Overview](analytic-tracing-overview.md) - Discusses how WCF analytic tracing works in [!INCLUDE[netfx_current_long](../../../../../includes/netfx-current-long-md.md)]. - - [Dynamically Enabling Analytic Tracing](dynamically-enabling-analytic-tracing.md) - Discusses how to enable or disable tracing dynamically using ETW. - - [Configuring Message Flow Tracing](configuring-message-flow-tracing.md) - Describes how to configure message flow tracing. - - [Analytic Trace Event Reference](analytic-trace-event-reference.md) - Shows a table of event IDs with their event levels, event messages and keywords. - +Windows Communication Foundation (WCF) analytic tracing offers a way to capture diagnostic information during the execution of a WCF service. WCF analytic tracing events are emitted at key points in the WCF stack to allow troubleshooting of WCF services in a production environment. Analytic tracing for WCF services has minimal impact on the performance of a product server that hosts [!INCLUDE[netfx_current_long](../../../../../includes/netfx-current-long-md.md)] WCF services as these events are very efficiently emitted to an Event Tracing for Windows (ETW) session. + +## In This Section + + [Analytic Tracing Overview](analytic-tracing-overview.md) + Discusses how WCF analytic tracing works in [!INCLUDE[netfx_current_long](../../../../../includes/netfx-current-long-md.md)]. + + [Dynamically Enabling Analytic Tracing](dynamically-enabling-analytic-tracing.md) + Discusses how to enable or disable tracing dynamically using ETW. + + [Configuring Message Flow Tracing](configuring-message-flow-tracing.md) + Describes how to configure message flow tracing. + + [Analytic Trace Event Reference](analytic-trace-event-reference.md) + Shows a table of event IDs with their event levels, event messages and keywords. + ## See also -- [WCF Services and Event Tracing for Windows](../../samples/wcf-services-and-event-tracing-for-windows.md) -- [Tracking Events into Event Tracing in Windows](../../../windows-workflow-foundation/samples/tracking-events-into-event-tracing-in-windows.md) +- [WCF Services and Event Tracing for Windows](/previous-versions/dotnet/framework/wcf/samples/wcf-services-and-event-tracing-for-windows) +- [Tracking Events into Event Tracing in Windows](/previous-versions/dotnet/framework/windows-workflow-foundation/samples/tracking-events-into-event-tracing-in-windows) diff --git a/docs/framework/wcf/diagnostics/message-flow-overview.md b/docs/framework/wcf/diagnostics/message-flow-overview.md index 00c7a00e32920..4947b03e2f485 100644 --- a/docs/framework/wcf/diagnostics/message-flow-overview.md +++ b/docs/framework/wcf/diagnostics/message-flow-overview.md @@ -22,7 +22,7 @@ In a distributed system containing interconnected services, it is necessary to d 2. If you haven’t enabled analytic tracing, expand **Applications and Services Logs**, **Microsoft**, **Windows**, **Application Server-Applications**. Select **View**, **Show Analytic and Debug Logs**. Right-click **Analytic** and select **Enable Log**. Leave Event Viewer open so that traces can be viewed. -3. Open the sample created in the [Getting Started Tutorial](../getting-started-tutorial.md) in Visual Studio 2012. Note that you must run Visual Studio 2012 as an administrator so that the service can be created. If you have the WCF samples installed, you can open the [Getting Started](../samples/getting-started-sample.md), which contains the completed project created in the tutorial. +3. Open the sample created in the [Getting Started Tutorial](../getting-started-tutorial.md) in Visual Studio 2012. Note that you must run Visual Studio 2012 as an administrator so that the service can be created. If you have the WCF samples installed, you can open the [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample), which contains the completed project created in the tutorial. 4. Right-click the **Service** project and select **Add**, **New Item**. Select **Application Configuration File** and click **OK**. diff --git a/docs/framework/wcf/diagnostics/tracing/configuring-tracing.md b/docs/framework/wcf/diagnostics/tracing/configuring-tracing.md index da49c4f906ee9..442da6fd7a95a 100644 --- a/docs/framework/wcf/diagnostics/tracing/configuring-tracing.md +++ b/docs/framework/wcf/diagnostics/tracing/configuring-tracing.md @@ -131,7 +131,7 @@ This topic describes how you can enable tracing, configure trace sources to emit ``` - For more information about creating user-defined trace sources, see [Extending Tracing](../../samples/extending-tracing.md). + For more information about creating user-defined trace sources, see [Extending Tracing](/previous-versions/dotnet/framework/wcf/samples/extending-tracing). ## Configuring Trace Listeners to Consume Traces diff --git a/docs/framework/wcf/diagnostics/tracing/emitting-user-code-traces.md b/docs/framework/wcf/diagnostics/tracing/emitting-user-code-traces.md index 00de950849d7c..2947d005bb693 100644 --- a/docs/framework/wcf/diagnostics/tracing/emitting-user-code-traces.md +++ b/docs/framework/wcf/diagnostics/tracing/emitting-user-code-traces.md @@ -8,7 +8,7 @@ ms.assetid: fa54186a-8ffa-4332-b0e7-63867126fd49 In addition to enabling tracing in configuration to collect instrumentation data generated by Windows Communication Foundation (WCF), you can also emit traces programmatically in user code. In this way, you can proactively create instrumentation data that you can peruse later for diagnostic purpose. This topic discusses how you can do this. -In addition, the [Extending Tracing](../../samples/extending-tracing.md) sample includes all the code demonstrated in the following sections. +In addition, the [Extending Tracing](/previous-versions/dotnet/framework/wcf/samples/extending-tracing) sample includes all the code demonstrated in the following sections. ## Creating a Trace Source @@ -104,11 +104,11 @@ ts.TraceEvent(TraceEventType.Warning, 0, "Throwing exception " + "exceptionMessa ## Viewing User Traces in the Service Trace Viewer Tool -This section contains screenshots of traces generated by running the [Extending Tracing](../../samples/extending-tracing.md) sample, when viewed using the [Service Trace Viewer Tool (SvcTraceViewer.exe)](../../service-trace-viewer-tool-svctraceviewer-exe.md). +This section contains screenshots of traces generated by running the [Extending Tracing](/previous-versions/dotnet/framework/wcf/samples/extending-tracing) sample, when viewed using the [Service Trace Viewer Tool (SvcTraceViewer.exe)](../../service-trace-viewer-tool-svctraceviewer-exe.md). In the following diagram, the "Add request" activity created previously is selected on the left panel. It is listed with three other Math operation activities (Divide, Subtract, Multiply) that constitute the application client program. The user code has defined one new activity for each operation to isolate potential error occurrences in different requests. -To demonstrate the use of transfers in the [Extending Tracing](../../samples/extending-tracing.md) sample, a Calculator activity that encapsulates the four operation requests is also created. For each request, there is a transfer back and forth from the Calculator activity to the request activity (trace is highlighted in the upper right panel in the figure). +To demonstrate the use of transfers in the [Extending Tracing](/previous-versions/dotnet/framework/wcf/samples/extending-tracing) sample, a Calculator activity that encapsulates the four operation requests is also created. For each request, there is a transfer back and forth from the Calculator activity to the request activity (trace is highlighted in the upper right panel in the figure). When you select an activity on the left panel, the traces included by this activity are shown on the upper right panel. If `propagateActivity` is `true` at every endpoint in the request path, traces in the request activity are from all processes that participate in the request. In this example, you can see traces from both the client and service in the 4th column in the panel. @@ -147,4 +147,4 @@ Defining activities and propagating the activity ID enables us to perform direct ## See also -- [Extending Tracing](../../samples/extending-tracing.md) +- [Extending Tracing](/previous-versions/dotnet/framework/wcf/samples/extending-tracing) diff --git a/docs/framework/wcf/diagnostics/tracing/security-concerns-and-useful-tips-for-tracing.md b/docs/framework/wcf/diagnostics/tracing/security-concerns-and-useful-tips-for-tracing.md index 0d423b97a2a4a..ca5810872a56e 100644 --- a/docs/framework/wcf/diagnostics/tracing/security-concerns-and-useful-tips-for-tracing.md +++ b/docs/framework/wcf/diagnostics/tracing/security-concerns-and-useful-tips-for-tracing.md @@ -82,7 +82,7 @@ This topic describes how you can protect sensitive information from being expose The changes are effective only when the application starts or restarts. An event is logged at startup when both attributes are set to `true`. An event is also logged if `logKnownPii` is set to `true` but `enableLoggingKnownPii` is `false`. - For more information on PII logging, see [PII Security Lockdown](../../samples/pii-security-lockdown.md) sample. + For more information on PII logging, see [PII Security Lockdown](/previous-versions/dotnet/framework/wcf/samples/pii-security-lockdown) sample. The machine administrator and application deployer should exercise extreme caution when using these two switches. If PII logging is enabled, security keys and PII are logged. If it is disabled, sensitive and application-specific data is still logged in message headers and bodies. For a more thorough discussion on privacy and protecting PII from being exposed, see [User Privacy](/previous-versions/dotnet/articles/aa480490(v=msdn.10)). diff --git a/docs/framework/wcf/diagnostics/tracing/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting.md b/docs/framework/wcf/diagnostics/tracing/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting.md index 3a27a7edc7f2e..a7cfb1b199203 100644 --- a/docs/framework/wcf/diagnostics/tracing/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting.md +++ b/docs/framework/wcf/diagnostics/tracing/using-service-trace-viewer-for-viewing-correlated-traces-and-troubleshooting.md @@ -12,7 +12,7 @@ This topic describes the format of trace data, how to view it, and approaches th 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)](../../service-trace-viewer-tool-svctraceviewer-exe.md). -This topic contains screenshots of traces generated by running the [Tracing and Message Logging](../../samples/tracing-and-message-logging.md) sample, when viewed using the [Service Trace Viewer Tool (SvcTraceViewer.exe)](../../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. +This topic contains screenshots of traces generated by running the [Tracing and Message Logging](/previous-versions/dotnet/framework/wcf/samples/tracing-and-message-logging) sample, when viewed using the [Service Trace Viewer Tool (SvcTraceViewer.exe)](../../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 @@ -110,7 +110,7 @@ An activity is a logical unit of processing that groups all traces related to th 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](../../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: +In the following screenshot, extracted from the [Tracing and Message Logging](/previous-versions/dotnet/framework/wcf/samples/tracing-and-message-logging) 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). diff --git a/docs/framework/wcf/endpoint-creation-overview.md b/docs/framework/wcf/endpoint-creation-overview.md index 52bcef0b628d4..c1a74113d1952 100644 --- a/docs/framework/wcf/endpoint-creation-overview.md +++ b/docs/framework/wcf/endpoint-creation-overview.md @@ -196,7 +196,7 @@ Dim echoUri As Uri = New Uri("http://localhost:8000/") serviceHost.Open() ``` - If endpoints are explicitly provided, the default endpoints can still be added by calling on the before calling . For more information about default endpoints, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](./samples/simplified-configuration-for-wcf-services.md). + If endpoints are explicitly provided, the default endpoints can still be added by calling on the before calling . For more information about default endpoints, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). ## See also diff --git a/docs/framework/wcf/extending/client-channel-factories-and-channels.md b/docs/framework/wcf/extending/client-channel-factories-and-channels.md index b0b646755345d..75a5d5752db28 100644 --- a/docs/framework/wcf/extending/client-channel-factories-and-channels.md +++ b/docs/framework/wcf/extending/client-channel-factories-and-channels.md @@ -27,7 +27,7 @@ A channel factory creates channels. - The class implements . It takes care of basic state management. - The following discussion is based upon the [Transport: UDP](../samples/transport-udp.md) sample. + The following discussion is based upon the [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp) sample. ### Creating a Channel Factory diff --git a/docs/framework/wcf/extending/configuration-and-metadata-support.md b/docs/framework/wcf/extending/configuration-and-metadata-support.md index acc575cd268a8..ea691c2ec1951 100644 --- a/docs/framework/wcf/extending/configuration-and-metadata-support.md +++ b/docs/framework/wcf/extending/configuration-and-metadata-support.md @@ -26,11 +26,11 @@ This topic describes how to enable configuration and metadata support for bindin To enable configuration file support for a channel, you must implement two configuration sections, , which enables configuration support for binding elements, and the and , which enable configuration support for bindings. - An easier way to do this is to use the [ConfigurationCodeGenerator](../samples/configurationcodegenerator.md) sample tool to generate configuration code for your bindings and binding elements. + An easier way to do this is to use the [ConfigurationCodeGenerator](/previous-versions/dotnet/framework/wcf/samples/configurationcodegenerator) sample tool to generate configuration code for your bindings and binding elements. ### Extending BindingElementExtensionElement - The following example code is taken from the [Transport: UDP](../samples/transport-udp.md) sample. The `UdpTransportElement` is a that exposes `UdpTransportBindingElement` to the configuration system. With a few basic overrides, the sample defines the configuration section name, the type of the binding element and how to create the binding element. Users can then register the extension section in a configuration file as follows. + The following example code is taken from the [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp) sample. The `UdpTransportElement` is a that exposes `UdpTransportBindingElement` to the configuration system. With a few basic overrides, the sample defines the configuration section name, the type of the binding element and how to create the binding element. Users can then register the extension section in a configuration file as follows. ```xml @@ -123,7 +123,7 @@ protected override void OnApplyConfiguration(string configurationName) ### Adding WSDL Support - The transport binding element in a binding is responsible for exporting and importing addressing information in metadata. When using a SOAP binding, the transport binding element should also export a correct transport URI in metadata. The following example code is taken from the [Transport: UDP](../samples/transport-udp.md) sample. + The transport binding element in a binding is responsible for exporting and importing addressing information in metadata. When using a SOAP binding, the transport binding element should also export a correct transport URI in metadata. The following example code is taken from the [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp) sample. #### WSDL Export @@ -183,7 +183,7 @@ if (transportBindingElement is UdpTransportBindingElement) ### Adding Policy Support - The custom binding element can export policy assertions in the WSDL binding for a service endpoint to express the capabilities of that binding element. The following example code is taken from the [Transport: UDP](../samples/transport-udp.md) sample. + The custom binding element can export policy assertions in the WSDL binding for a service endpoint to express the capabilities of that binding element. The following example code is taken from the [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp) sample. #### Policy Export diff --git a/docs/framework/wcf/extending/creating-a-bindingelement.md b/docs/framework/wcf/extending/creating-a-bindingelement.md index d9ac1f68b49ee..4ce355aa30882 100644 --- a/docs/framework/wcf/extending/creating-a-bindingelement.md +++ b/docs/framework/wcf/extending/creating-a-bindingelement.md @@ -24,7 +24,7 @@ Bindings and binding elements (objects that extend has a similar implementation for creating `ChunkingChannelListener` and passing it the inner channel listener. - As another example using a transport channel, the [Transport: UDP](../samples/transport-udp.md) sample provides the following override. + As another example using a transport channel, the [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp) sample provides the following override. In the sample, the binding element is `UdpTransportBindingElement`, which derives from . It overrides the following methods to build the factories associated with the channel. @@ -76,4 +76,4 @@ public IChannelListener BuildChannelListener(BindingContext - - [Developing Channels](developing-channels.md) -- [Transport: UDP](../samples/transport-udp.md) +- [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp) diff --git a/docs/framework/wcf/extending/creating-user-defined-bindings.md b/docs/framework/wcf/extending/creating-user-defined-bindings.md index 78dab9063cdc4..74ac35a23af4b 100644 --- a/docs/framework/wcf/extending/creating-user-defined-bindings.md +++ b/docs/framework/wcf/extending/creating-user-defined-bindings.md @@ -54,7 +54,7 @@ Binding customBinding = new CustomBinding( ); ``` - How you write your new binding element depends on its exact functionality. One of the samples, [Transport: UDP](../samples/transport-udp.md), provides a detailed description of how to implement one kind of binding element. + How you write your new binding element depends on its exact functionality. One of the samples, [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp), provides a detailed description of how to implement one kind of binding element. ## Creating a New Binding diff --git a/docs/framework/wcf/extending/custom-bindings.md b/docs/framework/wcf/extending/custom-bindings.md index c1963bf337168..e55b2d603e15f 100644 --- a/docs/framework/wcf/extending/custom-bindings.md +++ b/docs/framework/wcf/extending/custom-bindings.md @@ -76,4 +76,4 @@ In addition, you can define your own binding elements and insert them between an - [System-Provided Bindings](../system-provided-bindings.md) - [How to: Customize a System-Provided Binding](how-to-customize-a-system-provided-binding.md) - [\](../../configure-apps/file-schema/wcf/custombinding.md) -- [Custom Binding](../samples/custom-binding.md) +- [Custom Binding](/previous-versions/dotnet/framework/wcf/samples/custom-binding) diff --git a/docs/framework/wcf/extending/custom-encoders.md b/docs/framework/wcf/extending/custom-encoders.md index 484d84ff6a927..902388f2991b3 100644 --- a/docs/framework/wcf/extending/custom-encoders.md +++ b/docs/framework/wcf/extending/custom-encoders.md @@ -92,7 +92,7 @@ This topic discusses how to create custom encoders. Then connect your custom to the binding element stack used to configure the service or client by overriding the method to return an instance of this factory. - There are two samples provided with WCF that illustrate this process with sample code: [Custom Message Encoder: Custom Text Encoder](../samples/custom-message-encoder-custom-text-encoder.md) and [Custom Message Encoder: Compression Encoder](../samples/custom-message-encoder-compression-encoder.md). + There are two samples provided with WCF that illustrate this process with sample code: [Custom Message Encoder: Custom Text Encoder](/previous-versions/dotnet/framework/wcf/samples/custom-message-encoder-custom-text-encoder) and [Custom Message Encoder: Compression Encoder](/previous-versions/dotnet/framework/wcf/samples/custom-message-encoder-compression-encoder). ## See also diff --git a/docs/framework/wcf/extending/developing-channels.md b/docs/framework/wcf/extending/developing-channels.md index f8fee73367910..d8c3ae7f6bf28 100644 --- a/docs/framework/wcf/extending/developing-channels.md +++ b/docs/framework/wcf/extending/developing-channels.md @@ -6,7 +6,7 @@ ms.assetid: 0513af9f-a0c2-457b-9a50-5b6bfee48513 --- # Developing Channels -To develop a protocol or transport channel that can be used with the Windows Communication Foundation (WCF) application layer requires several steps. This topic describes those steps and points you to specific topics for more information. To understand the channel model and the various types that are mentioned in this topic, see [Channel Model Overview](channel-model-overview.md). For a complete transport channel sample, see [Transport: UDP](../samples/transport-udp.md). +To develop a protocol or transport channel that can be used with the Windows Communication Foundation (WCF) application layer requires several steps. This topic describes those steps and points you to specific topics for more information. To understand the channel model and the various types that are mentioned in this topic, see [Channel Model Overview](channel-model-overview.md). For a complete transport channel sample, see [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp). ## The Channel Development Task List diff --git a/docs/framework/wcf/extending/exporting-custom-metadata-for-a-wcf-extension.md b/docs/framework/wcf/extending/exporting-custom-metadata-for-a-wcf-extension.md index 20b7efe6ac4c5..72b001b5dcec9 100644 --- a/docs/framework/wcf/extending/exporting-custom-metadata-for-a-wcf-extension.md +++ b/docs/framework/wcf/extending/exporting-custom-metadata-for-a-wcf-extension.md @@ -32,7 +32,7 @@ In Windows Communication Foundation (WCF), metadata export is the process of des The method is called on all implementations within the instance that is being exported. The method is called on all implementations with the instance that is being exported. - For more information, see [How to: Export Custom WSDL](how-to-export-custom-wsdl.md) and the sample [Custom WSDL Publication](../samples/custom-wsdl-publication.md). + For more information, see [How to: Export Custom WSDL](how-to-export-custom-wsdl.md) and the sample [Custom WSDL Publication](/previous-versions/dotnet/framework/wcf/samples/custom-wsdl-publication). ## Exporting Custom Policy Assertions diff --git a/docs/framework/wcf/extending/extending-clients.md b/docs/framework/wcf/extending/extending-clients.md index 7a034860ed6b5..9639db0e810a5 100644 --- a/docs/framework/wcf/extending/extending-clients.md +++ b/docs/framework/wcf/extending/extending-clients.md @@ -34,7 +34,7 @@ In a calling application, the service model layer is responsible for translating - Custom Data Model. A user may want to have a data or serialization model other than those supported by default in WCF (namely, , , and objects). This can be done by implementing the message formatter interfaces. For more information, see and the property. -- Custom Parameter Validation. A user may want to enforce that typed parameters are valid (as opposed to XML). This can be done using the parameter inspector interfaces. For an example, see [How to: Inspect or Modify Parameters](how-to-inspect-or-modify-parameters.md) or [Client Validation](../samples/client-validation.md). +- Custom Parameter Validation. A user may want to enforce that typed parameters are valid (as opposed to XML). This can be done using the parameter inspector interfaces. For an example, see [How to: Inspect or Modify Parameters](how-to-inspect-or-modify-parameters.md) or [Client Validation](/previous-versions/dotnet/framework/wcf/samples/client-validation). ### Using the ClientRuntime Class diff --git a/docs/framework/wcf/extending/extending-dispatchers.md b/docs/framework/wcf/extending/extending-dispatchers.md index b88467561db66..7201770ae345d 100644 --- a/docs/framework/wcf/extending/extending-dispatchers.md +++ b/docs/framework/wcf/extending/extending-dispatchers.md @@ -40,25 +40,25 @@ Use the to acquire the There a number of reasons to extend the dispatcher: -- Custom Message Validation. Users can enforce that a message is valid for a certain schema. This can be done by implementing the message interceptor interfaces. For an example, see [Message Inspectors](../samples/message-inspectors.md). +- Custom Message Validation. Users can enforce that a message is valid for a certain schema. This can be done by implementing the message interceptor interfaces. For an example, see [Message Inspectors](/previous-versions/dotnet/framework/wcf/samples/message-inspectors). - Custom Message Logging. Users can inspect and log some set of application messages that flow through an endpoint. This can also be accomplished with the message interceptor interfaces. - Custom Message Transformations. Users can apply certain transformations to the message in the runtime (for example, for versioning). This can be accomplished, again, with the message interceptor interfaces. -- Custom Data Model. Users can have a data serialization model other than those supported by default in WCF (namely, , , and raw messages). This can be done by implement the message formatter interfaces. For an example, see [Operation Formatter and Operation Selector](../samples/operation-formatter-and-operation-selector.md). +- Custom Data Model. Users can have a data serialization model other than those supported by default in WCF (namely, , , and raw messages). This can be done by implement the message formatter interfaces. For an example, see [Operation Formatter and Operation Selector](/previous-versions/dotnet/framework/wcf/samples/operation-formatter-and-operation-selector). - Custom Parameter Validation. Users can enforce that typed parameters are valid (as opposed to XML). This can be done using the parameter inspector interfaces. -- Custom Operation Dispatching. Users can implement dispatching on something other than action – for example, on the body element, or on a custom message property. This can be done using the interface. For an example, see [Operation Formatter and Operation Selector](../samples/operation-formatter-and-operation-selector.md). +- Custom Operation Dispatching. Users can implement dispatching on something other than action – for example, on the body element, or on a custom message property. This can be done using the interface. For an example, see [Operation Formatter and Operation Selector](/previous-versions/dotnet/framework/wcf/samples/operation-formatter-and-operation-selector). -- Object Pooling. Users can pool instances rather than allocating a new one for every call. This can be implemented using the instance provider interfaces. For an example, see [Pooling](../samples/pooling.md). +- Object Pooling. Users can pool instances rather than allocating a new one for every call. This can be implemented using the instance provider interfaces. For an example, see [Pooling](/previous-versions/dotnet/framework/wcf/samples/pooling). - Instance Leasing. Users can implement a leasing pattern for instance lifetime, similar to that of .NET Framework Remoting. This can be done using the instance context lifetime interfaces. - Custom Error Handling. Users can control how both local errors are processed and how faults are communicated back to clients. This can be implemented using the interfaces. -- Custom Authorization Behaviors. Users can implement custom access control by extending the Contract or Operation run-time pieces and adding security checks based upon the tokens present in the message. This can be accomplished using either the message interceptor or parameter interceptor interfaces. For examples, see [Security Extensibility](../samples/security-extensibility.md). +- Custom Authorization Behaviors. Users can implement custom access control by extending the Contract or Operation run-time pieces and adding security checks based upon the tokens present in the message. This can be accomplished using either the message interceptor or parameter interceptor interfaces. For examples, see [Security Extensibility](/previous-versions/dotnet/framework/wcf/samples/security-extensibility). > [!CAUTION] > Because altering security properties has the potential to compromise the security of WCF applications, it is strongly recommended that you undertake security-related modifications with care and test thoroughly prior to deployment. diff --git a/docs/framework/wcf/extending/how-to-configure-a-custom-ws-metadata-exchange-binding.md b/docs/framework/wcf/extending/how-to-configure-a-custom-ws-metadata-exchange-binding.md index 025b97fa01e90..02fc995602114 100644 --- a/docs/framework/wcf/extending/how-to-configure-a-custom-ws-metadata-exchange-binding.md +++ b/docs/framework/wcf/extending/how-to-configure-a-custom-ws-metadata-exchange-binding.md @@ -9,7 +9,7 @@ ms.assetid: cdba4d73-da64-4805-bc56-9822becfd1e4 --- # How to: Configure a Custom WS-Metadata Exchange Binding -This article explains how to configure a custom WS-Metadata exchange binding. Windows Communication Foundation (WCF) includes four system-defined metadata bindings, but you can publish metadata using any binding you want. This article shows you how to publish metadata using the `wsHttpBinding`. This binding gives you the option of exposing metadata in a secure way. The code in this article is based on the [Getting Started](../samples/getting-started-sample.md). +This article explains how to configure a custom WS-Metadata exchange binding. Windows Communication Foundation (WCF) includes four system-defined metadata bindings, but you can publish metadata using any binding you want. This article shows you how to publish metadata using the `wsHttpBinding`. This binding gives you the option of exposing metadata in a secure way. The code in this article is based on the [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample). ### Using a configuration file @@ -111,8 +111,8 @@ This article explains how to configure a custom WS-Metadata exchange binding. Wi ## See also -- [Metadata Publishing Behavior](../samples/metadata-publishing-behavior.md) -- [Retrieve Metadata](../samples/retrieve-metadata.md) +- [Metadata Publishing Behavior](/previous-versions/dotnet/framework/wcf/samples/metadata-publishing-behavior) +- [Retrieve Metadata](/previous-versions/dotnet/framework/wcf/samples/retrieve-metadata) - [Metadata](../feature-details/metadata.md) - [Publishing Metadata](../feature-details/publishing-metadata.md) - [Publishing Metadata Endpoints](../publishing-metadata-endpoints.md) diff --git a/docs/framework/wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service.md b/docs/framework/wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service.md index c38601ae0d18a..474ecc0a15bbf 100644 --- a/docs/framework/wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service.md +++ b/docs/framework/wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service.md @@ -109,7 +109,7 @@ Registration of the custom authorization manager for a service can be done in co ## Example -The following code example demonstrates a basic implementation of a class that includes overriding the method. The example code examines the for a custom claim and returns `true` when the resource for that custom claim matches the action value from the . For a more complete implementation of a class, see [Authorization Policy](../samples/authorization-policy.md). +The following code example demonstrates a basic implementation of a class that includes overriding the method. The example code examines the for a custom claim and returns `true` when the resource for that custom claim matches the action value from the . For a more complete implementation of a class, see [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy). [!code-csharp[c_CustomAuthMgr#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_customauthmgr/cs/c_customauthmgr.cs#2)] [!code-vb[c_CustomAuthMgr#2](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_customauthmgr/vb/c_customauthmgr.vb#2)] @@ -117,4 +117,4 @@ The following code example demonstrates a basic implementation of a -- [Authorization Policy](../samples/authorization-policy.md) +- [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy) diff --git a/docs/framework/wcf/extending/how-to-create-a-custom-authorization-policy.md b/docs/framework/wcf/extending/how-to-create-a-custom-authorization-policy.md index f8fe2e7be3913..a873a7d966e3c 100644 --- a/docs/framework/wcf/extending/how-to-create-a-custom-authorization-policy.md +++ b/docs/framework/wcf/extending/how-to-create-a-custom-authorization-policy.md @@ -77,4 +77,4 @@ The Identity Model infrastructure in Windows Communication Foundation (WCF) supp - - [How to: Compare Claims](how-to-compare-claims.md) - [How to: Create a Custom Authorization Manager for a Service](how-to-create-a-custom-authorization-manager-for-a-service.md) -- [Authorization Policy](../samples/authorization-policy.md) +- [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy) diff --git a/docs/framework/wcf/extending/how-to-create-a-custom-client-identity-verifier.md b/docs/framework/wcf/extending/how-to-create-a-custom-client-identity-verifier.md index b22c9ee991480..302b6f3b00891 100644 --- a/docs/framework/wcf/extending/how-to-create-a-custom-client-identity-verifier.md +++ b/docs/framework/wcf/extending/how-to-create-a-custom-client-identity-verifier.md @@ -2,87 +2,87 @@ description: "Learn more about: How to: Create a Custom Client Identity Verifier" title: "How to: Create a Custom Client Identity Verifier" ms.date: "03/30/2017" -dev_langs: +dev_langs: - "csharp" - "vb" ms.assetid: f2d34e43-fa8b-46d2-91cf-d2960e13e16b --- # How to: Create a Custom Client Identity Verifier -The *identity* feature of Windows Communication Foundation (WCF) enables a client to specify in advance the expected identity of the service. Whenever a server authenticates itself to the client, the identity is checked against the expected identity. (For an explanation of identity and how it works, see [Service Identity and Authentication](../feature-details/service-identity-and-authentication.md).) - - If needed, the verification can be customized using a custom identity verifier. For example, you can perform additional service identity verification checks. In this example, the custom identity verifier checks additional claims in the X.509 certificate returned from the server. For a sample application, see [Service Identity Sample](../samples/service-identity-sample.md). - -### To extend the EndpointIdentity class - -1. Define a new class that derives from the class. This example names the extension `OrgEndpointIdentity`. - -2. Add private members along with properties that will be used by the extended class to perform the identity check against claims in the security token returned from the service. This example defines one property: the `OrganizationClaim` property. - +The *identity* feature of Windows Communication Foundation (WCF) enables a client to specify in advance the expected identity of the service. Whenever a server authenticates itself to the client, the identity is checked against the expected identity. (For an explanation of identity and how it works, see [Service Identity and Authentication](../feature-details/service-identity-and-authentication.md).) + + If needed, the verification can be customized using a custom identity verifier. For example, you can perform additional service identity verification checks. In this example, the custom identity verifier checks additional claims in the X.509 certificate returned from the server. For a sample application, see [Service Identity Sample](/previous-versions/dotnet/framework/wcf/samples/service-identity-sample). + +### To extend the EndpointIdentity class + +1. Define a new class that derives from the class. This example names the extension `OrgEndpointIdentity`. + +2. Add private members along with properties that will be used by the extended class to perform the identity check against claims in the security token returned from the service. This example defines one property: the `OrganizationClaim` property. + [!code-csharp[c_HowToSetCustomClientIdentity#6](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs#6)] - [!code-vb[c_HowToSetCustomClientIdentity#6](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#6)] - -### To extend the IdentityVerifier class - -1. Define a new class that derives from . This example names the extension `CustomIdentityVerifier`. - + [!code-vb[c_HowToSetCustomClientIdentity#6](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#6)] + +### To extend the IdentityVerifier class + +1. Define a new class that derives from . This example names the extension `CustomIdentityVerifier`. + [!code-csharp[c_HowToSetCustomClientIdentity#7](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs#7)] - [!code-vb[c_HowToSetCustomClientIdentity#7](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#7)] - -2. Override the method. The method determines whether the identity check succeeded or failed. - -3. The `CheckAccess` method has two parameters. The first is an instance of the class. The second is an instance of the class. - - In the method implementation, examine the collection of claims returned by the property of the class, and perform authentication checks as required. This example begins by finding any claim that is of type "Distinguished Name" and then compares the name to the extension of the (`OrgEndpointIdentity`). - + [!code-vb[c_HowToSetCustomClientIdentity#7](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#7)] + +2. Override the method. The method determines whether the identity check succeeded or failed. + +3. The `CheckAccess` method has two parameters. The first is an instance of the class. The second is an instance of the class. + + In the method implementation, examine the collection of claims returned by the property of the class, and perform authentication checks as required. This example begins by finding any claim that is of type "Distinguished Name" and then compares the name to the extension of the (`OrgEndpointIdentity`). + [!code-csharp[c_HowToSetCustomClientIdentity#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs#1)] - [!code-vb[c_HowToSetCustomClientIdentity#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#1)] - -### To implement the TryGetIdentity method - -1. Implement the method, which determines whether an instance of the class can be returned by the client. The WCF infrastructure calls the implementation of the `TryGetIdentity` method first to retrieve the service's identity from the message. Next, the infrastructure calls the `CheckAccess` implementation with the returned `EndpointIdentity` and . - -2. In the `TryGetIdentity` method, put the following code: - + [!code-vb[c_HowToSetCustomClientIdentity#1](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#1)] + +### To implement the TryGetIdentity method + +1. Implement the method, which determines whether an instance of the class can be returned by the client. The WCF infrastructure calls the implementation of the `TryGetIdentity` method first to retrieve the service's identity from the message. Next, the infrastructure calls the `CheckAccess` implementation with the returned `EndpointIdentity` and . + +2. In the `TryGetIdentity` method, put the following code: + [!code-csharp[c_HowToSetCustomClientIdentity#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs#2)] - [!code-vb[c_HowToSetCustomClientIdentity#2](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#2)] - -### To implement a custom binding and set the custom IdentityVerifier - -1. Create a method that returns a object. This example begins creates an instance of the class and sets its security mode to , and its to . - -2. Create a using the method. - -3. Return the from the collection and cast it to a variable. - -4. Set the property of the class to a new instance of the `CustomIdentityVerifier` class created previously. - + [!code-vb[c_HowToSetCustomClientIdentity#2](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#2)] + +### To implement a custom binding and set the custom IdentityVerifier + +1. Create a method that returns a object. This example begins creates an instance of the class and sets its security mode to , and its to . + +2. Create a using the method. + +3. Return the from the collection and cast it to a variable. + +4. Set the property of the class to a new instance of the `CustomIdentityVerifier` class created previously. + [!code-csharp[c_HowToSetCustomClientIdentity#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs#3)] - [!code-vb[c_HowToSetCustomClientIdentity#3](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#3)] - -5. The custom binding that is returned is used to create an instance of the client and class. The client can then perform a custom identity verification check of the service as shown in the following code. - + [!code-vb[c_HowToSetCustomClientIdentity#3](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#3)] + +5. The custom binding that is returned is used to create an instance of the client and class. The client can then perform a custom identity verification check of the service as shown in the following code. + [!code-csharp[c_HowToSetCustomClientIdentity#4](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs#4)] - [!code-vb[c_HowToSetCustomClientIdentity#4](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#4)] - -## Example + [!code-vb[c_HowToSetCustomClientIdentity#4](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#4)] + +## Example 1 + + The following example shows a complete implementation of the class. - The following example shows a complete implementation of the class. - [!code-csharp[c_HowToSetCustomClientIdentity#5](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs#5)] - [!code-vb[c_HowToSetCustomClientIdentity#5](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#5)] - -## Example + [!code-vb[c_HowToSetCustomClientIdentity#5](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#5)] + +## Example 2 + + The following example shows a complete implementation of the class. - The following example shows a complete implementation of the class. - [!code-csharp[c_HowToSetCustomClientIdentity#6](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howtosetcustomclientidentity/cs/source.cs#6)] - [!code-vb[c_HowToSetCustomClientIdentity#6](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#6)] - + [!code-vb[c_HowToSetCustomClientIdentity#6](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howtosetcustomclientidentity/vb/source.vb#6)] + ## See also - - - -- [Service Identity Sample](../samples/service-identity-sample.md) -- [Authorization Policy](../samples/authorization-policy.md) +- [Service Identity Sample](/previous-versions/dotnet/framework/wcf/samples/service-identity-sample) +- [Authorization Policy](/previous-versions/dotnet/framework/wcf/samples/authorization-policy) diff --git a/docs/framework/wcf/extending/how-to-create-a-custom-token.md b/docs/framework/wcf/extending/how-to-create-a-custom-token.md index 9150c98d82e48..aaea6461fafc4 100644 --- a/docs/framework/wcf/extending/how-to-create-a-custom-token.md +++ b/docs/framework/wcf/extending/how-to-create-a-custom-token.md @@ -14,7 +14,7 @@ ms.assetid: 6d892973-1558-4115-a9e1-696777776125 --- # How to: Create a Custom Token -This topic shows how to create a custom security token using the class, and how to integrate it with a custom security token provider and authenticator. For a complete code example see the [Custom Token](../samples/custom-token.md) sample. +This topic shows how to create a custom security token using the class, and how to integrate it with a custom security token provider and authenticator. For a complete code example see the [Custom Token](/previous-versions/dotnet/framework/wcf/samples/custom-token) sample. A *security token* is essentially an XML element that is used by the Windows Communication Foundation (WCF) security framework to represent claims about a sender inside the SOAP message. WCF security provides various tokens for system-provided authentication modes. Examples include an X.509 certificate security token represented by the class or a Username security token represented by the class. @@ -143,7 +143,7 @@ This topic shows how to create a custom security token using the and inserting it into the client runtime. For more information, see [Extending Clients](extending-clients.md). The equivalent feature on the service is the . For a complete code example see the [Message Inspectors](../samples/message-inspectors.md) sample. +You can inspect or modify the incoming or outgoing messages across a WCF client by implementing a and inserting it into the client runtime. For more information, see [Extending Clients](extending-clients.md). The equivalent feature on the service is the . For a complete code example see the [Message Inspectors](/previous-versions/dotnet/framework/wcf/samples/message-inspectors) sample. ### To inspect or modify messages diff --git a/docs/framework/wcf/extending/how-to-lock-down-endpoints-in-the-enterprise.md b/docs/framework/wcf/extending/how-to-lock-down-endpoints-in-the-enterprise.md index 32ecc6bc649ae..eb47fbf4540fd 100644 --- a/docs/framework/wcf/extending/how-to-lock-down-endpoints-in-the-enterprise.md +++ b/docs/framework/wcf/extending/how-to-lock-down-endpoints-in-the-enterprise.md @@ -21,11 +21,11 @@ In this case, the validator is a client validator because this endpoint behavior ### To create the endpoint validator -1. Create an with the desired validation steps in the method. The following code provides an example. (The `InternetClientValidatorBehavior` is taken from the [Security Validation](../samples/security-validation.md) sample.) +1. Create an with the desired validation steps in the method. The following code provides an example. (The `InternetClientValidatorBehavior` is taken from the [Security Validation](/previous-versions/dotnet/framework/wcf/samples/security-validation) sample.) [!code-csharp[LockdownValidation#2](../../../../samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/internetclientvalidatorbehavior.cs#2)] -2. Create new that registers the endpoint validator created in step 1. The following code example shows this. (The original code for this example is in the [Security Validation](../samples/security-validation.md) sample.) +2. Create new that registers the endpoint validator created in step 1. The following code example shows this. (The original code for this example is in the [Security Validation](/previous-versions/dotnet/framework/wcf/samples/security-validation) sample.) [!code-csharp[LockdownValidation#3](../../../../samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/internetclientvalidatorelement.cs#3)] @@ -53,7 +53,7 @@ In this case, the validator is a client validator because this endpoint behavior ## Example -The following code example shows how to add a common behavior to the machine.config file and save a copy to the disk. The `InternetClientValidatorBehavior` is taken from the [Security Validation](../samples/security-validation.md) sample. +The following code example shows how to add a common behavior to the machine.config file and save a copy to the disk. The `InternetClientValidatorBehavior` is taken from the [Security Validation](/previous-versions/dotnet/framework/wcf/samples/security-validation) sample. [!code-csharp[LockdownValidation#1](../../../../samples/snippets/csharp/VS_Snippets_CFX/lockdownvalidation/cs/hostapplication.cs#1)] diff --git a/docs/framework/wcf/extending/how-to-retrieve-metadata-over-a-non-mex-binding.md b/docs/framework/wcf/extending/how-to-retrieve-metadata-over-a-non-mex-binding.md index 05432e6cbd70f..580d3284a3e76 100644 --- a/docs/framework/wcf/extending/how-to-retrieve-metadata-over-a-non-mex-binding.md +++ b/docs/framework/wcf/extending/how-to-retrieve-metadata-over-a-non-mex-binding.md @@ -6,7 +6,7 @@ ms.assetid: 2292e124-81b2-4317-b881-ce9c1ec66ecb --- # How to: Retrieve Metadata Over a non-MEX Binding -This topic describes how to retrieve metadata from a MEX endpoint over a non-MEX binding. The code in this sample is based on the [Custom Secure Metadata Endpoint](../samples/custom-secure-metadata-endpoint.md) sample. +This topic describes how to retrieve metadata from a MEX endpoint over a non-MEX binding. The code in this sample is based on the [Custom Secure Metadata Endpoint](/previous-versions/dotnet/framework/wcf/samples/custom-secure-metadata-endpoint) sample. ### To retrieve metadata over a non-MEX binding diff --git a/docs/framework/wcf/extending/overriding-the-identity-of-a-service-for-authentication.md b/docs/framework/wcf/extending/overriding-the-identity-of-a-service-for-authentication.md index 7e965c9e5c85f..6bf2fc922926f 100644 --- a/docs/framework/wcf/extending/overriding-the-identity-of-a-service-for-authentication.md +++ b/docs/framework/wcf/extending/overriding-the-identity-of-a-service-for-authentication.md @@ -13,7 +13,7 @@ Typically, you do not have to set the identity on a service because the selectio The following Web Services Description Language (WSDL) fragment shows the identity for the endpoint previously defined. In this example, the service is running as a self-hosted service under a particular user account (username@contoso.com) and therefore the user principal name (UPN) identity contains the account name. The UPN is also known as the user sign-in name in a Windows domain. - For a sample application that demonstrates identity setting, see [Service Identity Sample](../samples/service-identity-sample.md). For more information about service identity, see [Service Identity and Authentication](../feature-details/service-identity-and-authentication.md). + For a sample application that demonstrates identity setting, see [Service Identity Sample](/previous-versions/dotnet/framework/wcf/samples/service-identity-sample). For more information about service identity, see [Service Identity and Authentication](../feature-details/service-identity-and-authentication.md). ## Kerberos Authentication and Identity diff --git a/docs/framework/wcf/extending/publishing-and-retrieving-metadata-over-a-custom-binding.md b/docs/framework/wcf/extending/publishing-and-retrieving-metadata-over-a-custom-binding.md index 5870b5739f77f..38ee07529c796 100644 --- a/docs/framework/wcf/extending/publishing-and-retrieving-metadata-over-a-custom-binding.md +++ b/docs/framework/wcf/extending/publishing-and-retrieving-metadata-over-a-custom-binding.md @@ -24,7 +24,7 @@ The endpoint to require authentication and encryption. The sample [Custom Secure Metadata Endpoint](../samples/custom-secure-metadata-endpoint.md) demonstrates this scenario. + When publishing metadata over a custom binding, ensure that the binding provides the security support that your metadata requires. For example, to prevent information disclosure and ensure your client has the right to obtain the metadata, you can make your metadata and your application more secure by configuring your endpoint to require authentication and encryption. The sample [Custom Secure Metadata Endpoint](/previous-versions/dotnet/framework/wcf/samples/custom-secure-metadata-endpoint) demonstrates this scenario. ## See also diff --git a/docs/framework/wcf/extending/service-channel-listeners-and-channels.md b/docs/framework/wcf/extending/service-channel-listeners-and-channels.md index 1ecc02825207c..75ab25412746a 100644 --- a/docs/framework/wcf/extending/service-channel-listeners-and-channels.md +++ b/docs/framework/wcf/extending/service-channel-listeners-and-channels.md @@ -30,7 +30,7 @@ WCF provides base class helpers for this process. For a diagram of the channel h - The class implements . It takes care of basic state management. -The following discussion is based upon the [Transport: UDP](../samples/transport-udp.md) sample. +The following discussion is based upon the [Transport: UDP](/previous-versions/dotnet/framework/wcf/samples/transport-udp) sample. ## Creating a channel listener diff --git a/docs/framework/wcf/extending/specifying-a-custom-crypto-algorithm.md b/docs/framework/wcf/extending/specifying-a-custom-crypto-algorithm.md index 8a73165920409..a22de8c4ef58f 100644 --- a/docs/framework/wcf/extending/specifying-a-custom-crypto-algorithm.md +++ b/docs/framework/wcf/extending/specifying-a-custom-crypto-algorithm.md @@ -122,7 +122,7 @@ WSHttpBinding binding = new WSHttpBinding(); binding.Security.Message.AlgorithmSuite = new MyCustomAlgorithmSuite(); ``` - For a complete code example, see the [Cryptographic Agility in WCF Security](../samples/cryptographic-agility-in-wcf-security.md) sample. + For a complete code example, see the [Cryptographic Agility in WCF Security](/previous-versions/dotnet/framework/wcf/samples/cryptographic-agility-in-wcf-security) sample. ## See also diff --git a/docs/framework/wcf/feature-details/accessing-services-using-a-client.md b/docs/framework/wcf/feature-details/accessing-services-using-a-client.md index 3a3751d90e370..b52b960d83ec0 100644 --- a/docs/framework/wcf/feature-details/accessing-services-using-a-client.md +++ b/docs/framework/wcf/feature-details/accessing-services-using-a-client.md @@ -51,7 +51,7 @@ Client applications must create, configure, and use WCF client or channel object Handling exceptions in client applications is straightforward. If a channel is opened, used, and closed inside a try block, then the conversation has succeeded, unless an exception is thrown. Typically, if an exception is thrown the conversation is aborted. > [!NOTE] -> Use of the `using` statement (`Using` in Visual Basic) is not recommended. This is because the end of the `using` statement can cause exceptions that can mask other exceptions you may need to know about. For more information, see [Use Close and Abort to release WCF client resources](../samples/use-close-abort-release-wcf-client-resources.md). +> Use of the `using` statement (`Using` in Visual Basic) is not recommended. This is because the end of the `using` statement can cause exceptions that can mask other exceptions you may need to know about. For more information, see [Use Close and Abort to release WCF client resources](/previous-versions/dotnet/framework/wcf/samples/use-close-abort-release-wcf-client-resources). The following code example shows the recommended client pattern using a try/catch block and not the `using` statement. @@ -63,7 +63,7 @@ Client applications must create, configure, and use WCF client or channel object Datagram channels never fault even if exceptions occur when they are closed. In addition, non-duplex clients that fail to authenticate using a secure conversation typically throw a . However if the duplex client using a secure conversation fails to authenticate, the client receives a instead. - For more complete information about working with error information at the application level, see [Specifying and Handling Faults in Contracts and Services](../specifying-and-handling-faults-in-contracts-and-services.md). [Expected Exceptions](../samples/expected-exceptions.md) describes expected exceptions and shows how to handle them. For more information about how to handle errors when developing channels, see [Handling Exceptions and Faults](../extending/handling-exceptions-and-faults.md). + For more complete information about working with error information at the application level, see [Specifying and Handling Faults in Contracts and Services](../specifying-and-handling-faults-in-contracts-and-services.md). [Expected Exceptions](/previous-versions/dotnet/framework/wcf/samples/expected-exceptions) describes expected exceptions and shows how to handle them. For more information about how to handle errors when developing channels, see [Handling Exceptions and Faults](../extending/handling-exceptions-and-faults.md). ### Client Blocking and Performance diff --git a/docs/framework/wcf/feature-details/best-practices-for-queued-communication.md b/docs/framework/wcf/feature-details/best-practices-for-queued-communication.md index 98d4966161802..a3b5304ad615d 100644 --- a/docs/framework/wcf/feature-details/best-practices-for-queued-communication.md +++ b/docs/framework/wcf/feature-details/best-practices-for-queued-communication.md @@ -53,9 +53,9 @@ This topic provides recommended practices for queued communication in Windows Co - Transacted batching. Transacted batching ensures that many messages can be read in a single transaction. This optimizes transaction commits, increasing overall performance. The cost of batching is that if a failure occurs in a single message within a batch, then the entire batch is rolled back and the messages must be processed one at a time until it is safe to batch again. In most cases, poison messages are rare, so batching is the preferred way to increase system performance, particularly when you have other resource managers that participate in the transaction. For more information, see [Batching Messages in a Transaction](batching-messages-in-a-transaction.md). -- Concurrency. Concurrency increases throughput, but concurrency also affects contention to shared resources. For more information, see [Concurrency](../samples/concurrency.md). +- Concurrency. Concurrency increases throughput, but concurrency also affects contention to shared resources. For more information, see [Concurrency](/previous-versions/dotnet/framework/wcf/samples/concurrency). -- Throttling. For optimal performance, throttle the number of messages in the dispatcher pipeline. For an example of how to do this, see [Throttling](../samples/throttling.md). +- Throttling. For optimal performance, throttle the number of messages in the dispatcher pipeline. For an example of how to do this, see [Throttling](/previous-versions/dotnet/framework/wcf/samples/throttling). When using batching, be aware that concurrency and throttling translate to concurrent batches. diff --git a/docs/framework/wcf/feature-details/choosing-a-message-encoder.md b/docs/framework/wcf/feature-details/choosing-a-message-encoder.md index 1ea926f44a1f7..fb279c5697f55 100644 --- a/docs/framework/wcf/feature-details/choosing-a-message-encoder.md +++ b/docs/framework/wcf/feature-details/choosing-a-message-encoder.md @@ -30,7 +30,7 @@ This article discusses criteria for choosing among the message encoders that are |Factor|Description|Encoders that support this factor| |------------|-----------------|---------------------------------------| -|Supported Character Sets| and support only the UTF8 and UTF16 Unicode (*big-endian* and *little-endian*) encodings. If other encodings are required, such as UTF7 or ASCII, a custom encoder must be used. For a sample custom encoder, see [Custom Message Encoder](../samples/custom-message-encoder-custom-text-encoder.md).|Text| +|Supported Character Sets| and support only the UTF8 and UTF16 Unicode (*big-endian* and *little-endian*) encodings. If other encodings are required, such as UTF7 or ASCII, a custom encoder must be used. For a sample custom encoder, see [Custom Message Encoder](/previous-versions/dotnet/framework/wcf/samples/custom-message-encoder-custom-text-encoder).|Text| |Inspection|Inspection is the ability to examine messages during transmission. Text encodings, either with or without the use of SOAP, allow messages to be inspected and analyzed by many applications without the use of specialized tools. The use of transfer security, at either the message or transport level, affects your ability to inspect messages. Confidentiality protects a message from being examined and integrity protects a message from being modified.|Text| |Reliability|Reliability is the resiliency of an encoder to transmission errors. Reliability can also be provided at the message, transport, or application layer. All of the standard WCF encoders assume that another layer is providing reliability. The encoder has little ability to recover from a transmission error.|None| |Simplicity|Simplicity represents the ease with which you can create encoders and decoders for an encoding specification. Text encodings are particularly advantageous for simplicity, and the POX text encoding has the additional advantage of not requiring support for processing SOAP.|Text (POX)| diff --git a/docs/framework/wcf/feature-details/clients.md b/docs/framework/wcf/feature-details/clients.md index 5564517fa455e..c74817df9aabe 100644 --- a/docs/framework/wcf/feature-details/clients.md +++ b/docs/framework/wcf/feature-details/clients.md @@ -24,4 +24,4 @@ The topics in this section cover the client architecture, how to access a Window ## See also -- [Client Samples](../samples/client.md) +- [Client Samples](/previous-versions/dotnet/framework/wcf/samples/client) diff --git a/docs/framework/wcf/feature-details/configuring-iis-for-wcf.md b/docs/framework/wcf/feature-details/configuring-iis-for-wcf.md index d6e013bd828a5..ca79ec419cd5a 100644 --- a/docs/framework/wcf/feature-details/configuring-iis-for-wcf.md +++ b/docs/framework/wcf/feature-details/configuring-iis-for-wcf.md @@ -40,7 +40,7 @@ Internet Information Services (IIS) 7.0 has a modular design that allows you to You must install ASP.NET to make ASP.NET work on IIS 7.0. After checking **ASP.NET**, your screen should look like the following illustration. - ![Asp.NET required settings](media/wcfc-trunfeaturesonoroff3s.gif "wcfc_TrunFeaturesOnOrOFf3s") + ![ASP.NET required settings](media/wcfc-trunfeaturesonoroff3s.gif "wcfc_TrunFeaturesOnOrOFf3s") This is the minimal environment for both WCF and ASP.NET applications to work in IIS 7.0. diff --git a/docs/framework/wcf/feature-details/controlling-serialization-and-deserialization-with-serializationbinder.md b/docs/framework/wcf/feature-details/controlling-serialization-and-deserialization-with-serializationbinder.md index eebf6219c62be..b2a7b6d8def3e 100644 --- a/docs/framework/wcf/feature-details/controlling-serialization-and-deserialization-with-serializationbinder.md +++ b/docs/framework/wcf/feature-details/controlling-serialization-and-deserialization-with-serializationbinder.md @@ -9,7 +9,7 @@ ms.assetid: ba8dcecf-acc7-467c-939d-021bbac797d4 > [!WARNING] > is not secure and can ***not*** be made secure. For more information, see the [BinaryFormatter security guide](../../../standard/serialization/binaryformatter-security-guide.md). -During serialization, a formatter transmits the information required to create an instance of an object of the correct type and version. This information generally includes the full type name and assembly name of the object. By default, deserialization uses this information to create an instance of an identical object. Some users may need to control which class to serialize and deserialize, either because the original class may not exist on the machine performing deserialization, the original class has moved between assemblies, or a different version of the class is required on the server and client. For more information, see [Usage of Serialization Binder](../samples/usage-of-serialization-binder.md). +During serialization, a formatter transmits the information required to create an instance of an object of the correct type and version. This information generally includes the full type name and assembly name of the object. By default, deserialization uses this information to create an instance of an identical object. Some users may need to control which class to serialize and deserialize, either because the original class may not exist on the machine performing deserialization, the original class has moved between assemblies, or a different version of the class is required on the server and client. For more information, see [Usage of Serialization Binder](/previous-versions/dotnet/framework/wcf/samples/usage-of-serialization-binder). > [!WARNING] > This functionality is only available when using the or the . @@ -21,4 +21,4 @@ During serialization, a formatter transmits the information required to create a ## See also - [Serialization and Deserialization](serialization-and-deserialization.md) -- [Usage of Serialization Binder](../samples/usage-of-serialization-binder.md) +- [Usage of Serialization Binder](/previous-versions/dotnet/framework/wcf/samples/usage-of-serialization-binder) diff --git a/docs/framework/wcf/feature-details/creating-a-custom-header-that-is-signed-and-or-encrypted.md b/docs/framework/wcf/feature-details/creating-a-custom-header-that-is-signed-and-or-encrypted.md index 5742abf24671c..fb62328271ff1 100644 --- a/docs/framework/wcf/feature-details/creating-a-custom-header-that-is-signed-and-or-encrypted.md +++ b/docs/framework/wcf/feature-details/creating-a-custom-header-that-is-signed-and-or-encrypted.md @@ -55,6 +55,6 @@ public class MyMessageContract ## See also -- [Default Message Contract](../samples/default-message-contract.md) -- [Message Contracts](../samples/message-contracts.md) +- [Default Message Contract](/previous-versions/dotnet/framework/wcf/samples/default-message-contract) +- [Message Contracts](/previous-versions/dotnet/framework/wcf/samples/message-contracts) - [Using Message Contracts](using-message-contracts.md) diff --git a/docs/framework/wcf/feature-details/creating-wcf-ajax-services-without-aspnet.md b/docs/framework/wcf/feature-details/creating-wcf-ajax-services-without-aspnet.md index 14df2652b7497..e580caebd169b 100644 --- a/docs/framework/wcf/feature-details/creating-wcf-ajax-services-without-aspnet.md +++ b/docs/framework/wcf/feature-details/creating-wcf-ajax-services-without-aspnet.md @@ -56,7 +56,7 @@ Windows Communication Foundation (WCF) AJAX services can be accessed from any Ja ``` - For a working example, see the [AJAX Service with JSON and XML](../samples/ajax-service-with-json-and-xml-sample.md). + For a working example, see the [AJAX Service with JSON and XML](/previous-versions/dotnet/framework/wcf/samples/ajax-service-with-json-and-xml-sample). ## Creating an AJAX-Compatible Service Contract @@ -107,4 +107,4 @@ string[] GetCities(string firstLetters, int maxNumber); HTTP GET requests contain all the request parameters in the URL itself. - It is up to the user to decide how to create the HTTP request to the endpoint. Also, the user has full control over constructing the JSON that forms the body of the request. For an example of creating a request from JavaScript, see the [AJAX Service with JSON and XML](../samples/ajax-service-with-json-and-xml-sample.md). + It is up to the user to decide how to create the HTTP request to the endpoint. Also, the user has full control over constructing the JSON that forms the body of the request. For an example of creating a request from JavaScript, see the [AJAX Service with JSON and XML](/previous-versions/dotnet/framework/wcf/samples/ajax-service-with-json-and-xml-sample). diff --git a/docs/framework/wcf/feature-details/creating-wcf-services-for-aspnet-ajax.md b/docs/framework/wcf/feature-details/creating-wcf-services-for-aspnet-ajax.md index e66b434ebd3ff..a4be24b357d8a 100644 --- a/docs/framework/wcf/feature-details/creating-wcf-services-for-aspnet-ajax.md +++ b/docs/framework/wcf/feature-details/creating-wcf-services-for-aspnet-ajax.md @@ -51,7 +51,7 @@ The Web Programming Model described in the [WCF Web HTTP Programming Model Overv - To take advantage of ASP.NET features, for example, URL-based authentication and accessing the ASP.NET session information, you may want to enable the ASP.NET Compatibility Mode through configuration. -AJAX endpoints in WCF may even be consumed without the ASP.NET AJAX framework. Doing so requires an understanding of the support architecture of AJAX support in WCF. For a discussion of this architecture, see [WCF Web HTTP Programming Object Model](wcf-web-http-programming-object-model.md). For a code sample demonstrating this approach, see the [AJAX Service with JSON and XML](../samples/ajax-service-with-json-and-xml-sample.md). +AJAX endpoints in WCF may even be consumed without the ASP.NET AJAX framework. Doing so requires an understanding of the support architecture of AJAX support in WCF. For a discussion of this architecture, see [WCF Web HTTP Programming Object Model](wcf-web-http-programming-object-model.md). For a code sample demonstrating this approach, see the [AJAX Service with JSON and XML](/previous-versions/dotnet/framework/wcf/samples/ajax-service-with-json-and-xml-sample). ## See also diff --git a/docs/framework/wcf/feature-details/data-contract-known-types.md b/docs/framework/wcf/feature-details/data-contract-known-types.md index 23ecc31649a46..e9f3c47060498 100644 --- a/docs/framework/wcf/feature-details/data-contract-known-types.md +++ b/docs/framework/wcf/feature-details/data-contract-known-types.md @@ -13,7 +13,7 @@ ms.assetid: 1a0baea1-27b7-470d-9136-5bbad86c4337 --- # Data Contract Known Types -The class allows you to specify, in advance, the types that should be included for consideration during deserialization. For a working example, see the [Known Types](../samples/known-types.md) example. +The class allows you to specify, in advance, the types that should be included for consideration during deserialization. For a working example, see the [Known Types](/previous-versions/dotnet/framework/wcf/samples/known-types) example. Normally, when passing parameters and return values between a client and a service, both endpoints share all of the data contracts of the data to be transmitted. However, this is not the case in the following circumstances: @@ -180,6 +180,6 @@ The class allows you to s - - - -- [Known Types](../samples/known-types.md) +- [Known Types](/previous-versions/dotnet/framework/wcf/samples/known-types) - [Data Contract Equivalence](data-contract-equivalence.md) - [Designing Service Contracts](../designing-service-contracts.md) diff --git a/docs/framework/wcf/feature-details/delegation-and-impersonation-with-wcf.md b/docs/framework/wcf/feature-details/delegation-and-impersonation-with-wcf.md index 540ab78262224..f33af228c6748 100644 --- a/docs/framework/wcf/feature-details/delegation-and-impersonation-with-wcf.md +++ b/docs/framework/wcf/feature-details/delegation-and-impersonation-with-wcf.md @@ -12,7 +12,7 @@ ms.assetid: 110e60f7-5b03-4b69-b667-31721b8e3152 --- # Delegation and Impersonation with WCF -*Impersonation* is a common technique that services use to restrict client access to a service domain's resources. Service domain resources can either be machine resources, such as local files (impersonation), or a resource on another machine, such as a file share (delegation). For a sample application, see [Impersonating the Client](../samples/impersonating-the-client.md). For an example of how to use impersonation, see [How to: Impersonate a Client on a Service](../how-to-impersonate-a-client-on-a-service.md). +*Impersonation* is a common technique that services use to restrict client access to a service domain's resources. Service domain resources can either be machine resources, such as local files (impersonation), or a resource on another machine, such as a file share (delegation). For a sample application, see [Impersonating the Client](/previous-versions/dotnet/framework/wcf/samples/impersonating-the-client). For an example of how to use impersonation, see [How to: Impersonate a Client on a Service](../how-to-impersonate-a-client-on-a-service.md). > [!IMPORTANT] > Be aware that when impersonating a client on a service, the service runs with the client's credentials, which may have higher privileges than the server process. @@ -226,6 +226,6 @@ sh.Credentials.ClientCertificate.Authentication.MapClientCertificateToWindowsAcc - - - [Using Impersonation with Transport Security](using-impersonation-with-transport-security.md) -- [Impersonating the Client](../samples/impersonating-the-client.md) +- [Impersonating the Client](/previous-versions/dotnet/framework/wcf/samples/impersonating-the-client) - [How to: Impersonate a Client on a Service](../how-to-impersonate-a-client-on-a-service.md) - [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) diff --git a/docs/framework/wcf/feature-details/discovery-find-and-findcriteria.md b/docs/framework/wcf/feature-details/discovery-find-and-findcriteria.md index f82f91eb490a9..e5cbcd85dcd94 100644 --- a/docs/framework/wcf/feature-details/discovery-find-and-findcriteria.md +++ b/docs/framework/wcf/feature-details/discovery-find-and-findcriteria.md @@ -67,5 +67,5 @@ Console.WriteLine("Found {0} ICalculatorService endpoint(s).", findResponse.Endp - [WCF Discovery Overview](wcf-discovery-overview.md) - [Using the Discovery Client Channel](using-the-discovery-client-channel.md) -- [Discovery with Scopes](../samples/discovery-with-scopes-sample.md) -- [Basic](../samples/basic-sample.md) +- [Discovery with Scopes](/previous-versions/dotnet/framework/wcf/samples/discovery-with-scopes-sample) +- [Basic](/previous-versions/dotnet/framework/wcf/samples/basic-sample) diff --git a/docs/framework/wcf/feature-details/discoveryclient-and-dynamicendpoint.md b/docs/framework/wcf/feature-details/discoveryclient-and-dynamicendpoint.md index b91541ccc6302..645168759e4e8 100644 --- a/docs/framework/wcf/feature-details/discoveryclient-and-dynamicendpoint.md +++ b/docs/framework/wcf/feature-details/discoveryclient-and-dynamicendpoint.md @@ -105,5 +105,5 @@ Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); ## See also -- [Discovery with Scopes](../samples/discovery-with-scopes-sample.md) -- [Basic](../samples/basic-sample.md) +- [Discovery with Scopes](/previous-versions/dotnet/framework/wcf/samples/discovery-with-scopes-sample) +- [Basic](/previous-versions/dotnet/framework/wcf/samples/basic-sample) diff --git a/docs/framework/wcf/feature-details/duplex-services.md b/docs/framework/wcf/feature-details/duplex-services.md index 01c32b104e66d..436680d267187 100644 --- a/docs/framework/wcf/feature-details/duplex-services.md +++ b/docs/framework/wcf/feature-details/duplex-services.md @@ -86,6 +86,6 @@ The following sample code shows how to specify the client endpoint address in co ## See also -- [Duplex](../samples/duplex.md) +- [Duplex](/previous-versions/dotnet/framework/wcf/samples/duplex) - [Specifying Client Run-Time Behavior](../specifying-client-run-time-behavior.md) - [How to: Create a Channel Factory and Use it to Create and Manage Channels](how-to-create-a-channel-factory-and-use-it-to-create-and-manage-channels.md) diff --git a/docs/framework/wcf/feature-details/federation.md b/docs/framework/wcf/feature-details/federation.md index 8f56cada7f52a..d0fd063c83ce2 100644 --- a/docs/framework/wcf/feature-details/federation.md +++ b/docs/framework/wcf/feature-details/federation.md @@ -12,7 +12,7 @@ ms.assetid: 2f1e646f-8361-48d4-9d5d-1b961f31ede4 --- # Federation -This topic provides a brief overview of the concept of federated security. It also describes Windows Communication Foundation (WCF) support for deploying federated security architectures. For a sample application that demonstrates federation, see [Federation Sample](../samples/federation-sample.md). +This topic provides a brief overview of the concept of federated security. It also describes Windows Communication Foundation (WCF) support for deploying federated security architectures. For a sample application that demonstrates federation, see [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample). ## Definition of Federated Security diff --git a/docs/framework/wcf/feature-details/grouping-queued-messages-in-a-session.md b/docs/framework/wcf/feature-details/grouping-queued-messages-in-a-session.md index 94903ecc21255..0f77808d1a6ed 100644 --- a/docs/framework/wcf/feature-details/grouping-queued-messages-in-a-session.md +++ b/docs/framework/wcf/feature-details/grouping-queued-messages-in-a-session.md @@ -83,5 +83,5 @@ Windows Communication Foundation (WCF) provides a session that allows you to gro ## See also -- [Sessions and Queues](../samples/sessions-and-queues.md) +- [Sessions and Queues](/previous-versions/dotnet/framework/wcf/samples/sessions-and-queues) - [Queues Overview](queues-overview.md) diff --git a/docs/framework/wcf/feature-details/hosting-in-a-managed-application.md b/docs/framework/wcf/feature-details/hosting-in-a-managed-application.md index 1d17f87ea73e9..190789576845e 100644 --- a/docs/framework/wcf/feature-details/hosting-in-a-managed-application.md +++ b/docs/framework/wcf/feature-details/hosting-in-a-managed-application.md @@ -10,7 +10,7 @@ Windows Communication Foundation (WCF) services can be hosted in any .NET Framew To create a self-hosted service, create and open an instance of the , which starts a service listening for messages. For more information, see [How to: Host a WCF Service in a Managed Application](../how-to-host-a-wcf-service-in-a-managed-application.md). - For a complete example on how to define a contract, implement the contract, and host a service inside of a managed application see the [Getting Started Tutorial](../getting-started-tutorial.md) and the [Self-Host](../samples/self-host.md). + For a complete example on how to define a contract, implement the contract, and host a service inside of a managed application see the [Getting Started Tutorial](../getting-started-tutorial.md) and the [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host). The following sections describe common scenarios that use this hosting option. diff --git a/docs/framework/wcf/feature-details/hosting-in-a-windows-service-application.md b/docs/framework/wcf/feature-details/hosting-in-a-windows-service-application.md index c4d0ef663d7a4..b30ab804f045a 100644 --- a/docs/framework/wcf/feature-details/hosting-in-a-windows-service-application.md +++ b/docs/framework/wcf/feature-details/hosting-in-a-windows-service-application.md @@ -37,6 +37,6 @@ Windows services (formerly known as Windows NT services) provide a process model - - [Walkthrough: Creating a Windows Service Application in the Component Designer](https://go.microsoft.com/fwlink/?LinkId=94875) - [How to: Host a WCF Service in a Managed Windows Service](how-to-host-a-wcf-service-in-a-managed-windows-service.md) -- [Windows Service Host](../samples/windows-service-host.md) +- [Windows Service Host](/previous-versions/dotnet/framework/wcf/samples/windows-service-host) - [Service Application Programming Architecture](https://go.microsoft.com/fwlink/?LinkId=94876) - [Windows Server App Fabric Hosting Features](/previous-versions/appfabric/ee677189(v=azure.10)) diff --git a/docs/framework/wcf/feature-details/how-to-access-a-wse-3-0-service-with-a-wcf-client.md b/docs/framework/wcf/feature-details/how-to-access-a-wse-3-0-service-with-a-wcf-client.md index 1c96dc4d69732..7d51098fb7007 100644 --- a/docs/framework/wcf/feature-details/how-to-access-a-wse-3-0-service-with-a-wcf-client.md +++ b/docs/framework/wcf/feature-details/how-to-access-a-wse-3-0-service-with-a-wcf-client.md @@ -11,7 +11,7 @@ ms.assetid: 1f9bcd9b-8f8f-47fa-8f1e-0d47236eb800 Windows Communication Foundation (WCF) clients are wire-level compatible with Web Services Enhancements (WSE) 3.0 for Microsoft .NET services when WCF clients are configured to use the August 2004 version of the WS-Addressing specification. However, WSE 3.0 services do not support the metadata exchange (MEX) protocol, so when you use the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) to create a WCF client class, the security settings are not applied to the generated WCF client. Therefore, you must specify the security settings that the WSE 3.0 service requires after the WCF client is generated. - You can apply these security settings by using a custom binding to take into account the WSE 3.0 service's requirements and the interoperable requirements between a WSE 3.0 service and a WCF client. These interoperability requirements include the aforementioned use of the August 2004 WS-Addressing specification and the WSE 3.0default message protection of . The default message protection for WCF is . This topic details how to create a WCF binding that interoperates with a WSE 3.0 service. WCF also provides a sample that incorporates this binding. For more information about this sample, see [Interoperating with ASMX Web Services](../samples/interoperating-with-asmx-web-services.md). + You can apply these security settings by using a custom binding to take into account the WSE 3.0 service's requirements and the interoperable requirements between a WSE 3.0 service and a WCF client. These interoperability requirements include the aforementioned use of the August 2004 WS-Addressing specification and the WSE 3.0default message protection of . The default message protection for WCF is . This topic details how to create a WCF binding that interoperates with a WSE 3.0 service. WCF also provides a sample that incorporates this binding. For more information about this sample, see [Interoperating with ASMX Web Services](/previous-versions/dotnet/framework/wcf/samples/interoperating-with-asmx-web-services). ### To access a WSE 3.0 Web service with a WCF client diff --git a/docs/framework/wcf/feature-details/how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md b/docs/framework/wcf/feature-details/how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md index 28c82536f9628..c34905bd5eae9 100644 --- a/docs/framework/wcf/feature-details/how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md +++ b/docs/framework/wcf/feature-details/how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md @@ -10,7 +10,7 @@ Windows Communication Foundation (WCF) allows you to create a service that expos To create services with ASP.NET AJAX endpoints without configuration, the services must be hosted by Internet Information Services (IIS). To activate an ASP.NET AJAX endpoint using this approach, specify the as the Factory parameter in the [\@ServiceHost](../../configure-apps/file-schema/wcf-directive/servicehost.md) directive in the .svc file. This custom factory is the component that automatically configures an ASP.NET AJAX endpoint so that it can be called from JavaScript on a client Web site. - For a working example, see the [AJAX Service Without Configuration](../samples/ajax-service-without-configuration.md). + For a working example, see the [AJAX Service Without Configuration](/previous-versions/dotnet/framework/wcf/samples/ajax-service-without-configuration). For an outline of how to configure an ASP.NET AJAX endpoint using configuration elements, see [How to: Use Configuration to Add an ASP.NET AJAX Endpoint](how-to-use-configuration-to-add-an-aspnet-ajax-endpoint.md). @@ -70,7 +70,7 @@ Windows Communication Foundation (WCF) allows you to create a service that expos ### To call the service -1. The endpoint is configured at an empty address relative to the .svc file, so the service is now available and can be invoked by sending requests to service.svc/\ - for example, service.svc/Add for the `Add` operation. You can use it by entering the service URL into the Scripts collection of the ASP.NET AJAX Script Manager control. For an example, see the [AJAX Service Without Configuration](../samples/ajax-service-without-configuration.md). +1. The endpoint is configured at an empty address relative to the .svc file, so the service is now available and can be invoked by sending requests to service.svc/\ - for example, service.svc/Add for the `Add` operation. You can use it by entering the service URL into the Scripts collection of the ASP.NET AJAX Script Manager control. For an example, see the [AJAX Service Without Configuration](/previous-versions/dotnet/framework/wcf/samples/ajax-service-without-configuration). ## Example diff --git a/docs/framework/wcf/feature-details/how-to-authenticate-with-a-user-name-and-password.md b/docs/framework/wcf/feature-details/how-to-authenticate-with-a-user-name-and-password.md index 076f73c3497f9..8f742924985f8 100644 --- a/docs/framework/wcf/feature-details/how-to-authenticate-with-a-user-name-and-password.md +++ b/docs/framework/wcf/feature-details/how-to-authenticate-with-a-user-name-and-password.md @@ -8,7 +8,7 @@ ms.assetid: a5415be2-0ef3-464c-9f76-c255cb8165a4 --- # How to: Authenticate with a User Name and Password -This topic demonstrates how to enable a Windows Communication Foundation (WCF) service to authenticate a client with a Windows domain username and password. It assumes you have a working, self-hosted WCF service. For an example of creating a basic self-hosted WCF service see, [Getting Started Tutorial](../getting-started-tutorial.md). This topic assumes the service is configured in code. If you would like to see an example of configuring a similar service using a configuration file, see [Message Security User Name](../samples/message-security-user-name.md). +This topic demonstrates how to enable a Windows Communication Foundation (WCF) service to authenticate a client with a Windows domain username and password. It assumes you have a working, self-hosted WCF service. For an example of creating a basic self-hosted WCF service see, [Getting Started Tutorial](../getting-started-tutorial.md). This topic assumes the service is configured in code. If you would like to see an example of configuring a similar service using a configuration file, see [Message Security User Name](/previous-versions/dotnet/framework/wcf/samples/message-security-user-name). To configure a service to authenticate its clients using Windows Domain username and passwords use the and set its `Security.Mode` property to `Message`. In addition you must specify an X509 certificate that will be used to encrypt the username and password as they are sent from the client to the service. @@ -27,7 +27,7 @@ On the client, you must prompt the user for the username and password and specif // ... ``` -2. Specify the server certificate used to encrypt the username and password information sent over the wire. This code should immediately follow the code above. The following example uses the certificate that is created by the setup.bat file from the [Message Security User Name](../samples/message-security-user-name.md) sample: +2. Specify the server certificate used to encrypt the username and password information sent over the wire. This code should immediately follow the code above. The following example uses the certificate that is created by the setup.bat file from the [Message Security User Name](/previous-versions/dotnet/framework/wcf/samples/message-security-user-name) sample: ```csharp // ... diff --git a/docs/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl.md b/docs/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl.md index cf9fb5587ee29..10be0393574c8 100644 --- a/docs/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl.md +++ b/docs/framework/wcf/feature-details/how-to-configure-an-iis-hosted-wcf-service-with-ssl.md @@ -144,6 +144,6 @@ This topic describes how to set up an IIS-hosted WCF service to use HTTP transpo ## See also - [Hosting in Internet Information Services](hosting-in-internet-information-services.md) -- [Internet Information Service Hosting Instructions](../samples/internet-information-service-hosting-instructions.md) +- [Internet Information Service Hosting Instructions](/previous-versions/dotnet/framework/wcf/samples/internet-information-service-hosting-instructions) - [Internet Information Services Hosting Best Practices](internet-information-services-hosting-best-practices.md) -- [IIS Hosting Using Inline Code](../samples/iis-hosting-using-inline-code.md) +- [IIS Hosting Using Inline Code](/previous-versions/dotnet/framework/wcf/samples/iis-hosting-using-inline-code) diff --git a/docs/framework/wcf/feature-details/how-to-configure-credentials-on-a-federation-service.md b/docs/framework/wcf/feature-details/how-to-configure-credentials-on-a-federation-service.md index cfb884509e51e..addefaa1e65c2 100644 --- a/docs/framework/wcf/feature-details/how-to-configure-credentials-on-a-federation-service.md +++ b/docs/framework/wcf/feature-details/how-to-configure-credentials-on-a-federation-service.md @@ -72,7 +72,7 @@ In Windows Communication Foundation (WCF), creating a federated service consists - [Federation](federation.md) - [Federation and Trust](federation-and-trust.md) -- [Federation Sample](../samples/federation-sample.md) +- [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample) - [How to: Disable Secure Sessions on a WSFederationHttpBinding](how-to-disable-secure-sessions-on-a-wsfederationhttpbinding.md) - [How to: Create a WSFederationHttpBinding](how-to-create-a-wsfederationhttpbinding.md) - [How to: Create a Federated Client](how-to-create-a-federated-client.md) diff --git a/docs/framework/wcf/feature-details/how-to-configure-tracking-with-workflowservicehost.md b/docs/framework/wcf/feature-details/how-to-configure-tracking-with-workflowservicehost.md index 6f6873da1316b..ca570c4310e1d 100644 --- a/docs/framework/wcf/feature-details/how-to-configure-tracking-with-workflowservicehost.md +++ b/docs/framework/wcf/feature-details/how-to-configure-tracking-with-workflowservicehost.md @@ -66,6 +66,6 @@ This topic explains how to configure tracking for a [!INCLUDE[netfx_current_long ## See also -- [Simplified Configuration for WCF Services](../samples/simplified-configuration-for-wcf-services.md) +- [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services) - [Workflow Services](workflow-services.md) - [Tracking Profiles](../../windows-workflow-foundation/tracking-profiles.md) diff --git a/docs/framework/wcf/feature-details/how-to-control-service-instancing.md b/docs/framework/wcf/feature-details/how-to-control-service-instancing.md index ea841a9dec4a4..88475c6ef7118 100644 --- a/docs/framework/wcf/feature-details/how-to-control-service-instancing.md +++ b/docs/framework/wcf/feature-details/how-to-control-service-instancing.md @@ -9,7 +9,7 @@ ms.assetid: e0b12b34-8004-443a-a46d-83a5c00f2601 --- # How to: Control Service Instancing -Setting the instance mode of a service enables you to specify when a (and its associated user-defined service object) is created. See the enumeration for the possible modes. For more information about behaviors, see [Configuring and Extending the Runtime with Behaviors](../extending/configuring-and-extending-the-runtime-with-behaviors.md). For working examples, see [Behaviors](../samples/behaviors.md). +Setting the instance mode of a service enables you to specify when a (and its associated user-defined service object) is created. See the enumeration for the possible modes. For more information about behaviors, see [Configuring and Extending the Runtime with Behaviors](../extending/configuring-and-extending-the-runtime-with-behaviors.md). For working examples, see [Behaviors](/previous-versions/dotnet/framework/wcf/samples/behaviors). ### To control the service instance lifetime using code @@ -32,4 +32,4 @@ Setting the instance mode of a service enables you to specify when a - - -- [Service: Behaviors Samples](../samples/behaviors.md) +- [Service: Behaviors Samples](/previous-versions/dotnet/framework/wcf/samples/behaviors) diff --git a/docs/framework/wcf/feature-details/how-to-create-a-basic-data-contract-for-a-class-or-structure.md b/docs/framework/wcf/feature-details/how-to-create-a-basic-data-contract-for-a-class-or-structure.md index 889f7389db188..0054c87db6561 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-basic-data-contract-for-a-class-or-structure.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-basic-data-contract-for-a-class-or-structure.md @@ -15,7 +15,7 @@ ms.assetid: bc464889-3070-4a2f-91d2-e788a0f686a7 This topic shows the basic steps to create a data contract using a class or structure. For more information about data contracts and how they are used, see [Using Data Contracts](using-data-contracts.md). - For a tutorial that walks through the steps of creating a basic Windows Communication Foundation (WCF) service and client, see the [Getting Started Tutorial](../getting-started-tutorial.md). For a working sample application that consists of a basic service and client, see [Basic Data Contract](../samples/basic-data-contract.md). + For a tutorial that walks through the steps of creating a basic Windows Communication Foundation (WCF) service and client, see the [Getting Started Tutorial](../getting-started-tutorial.md). For a working sample application that consists of a basic service and client, see [Basic Data Contract](/previous-versions/dotnet/framework/wcf/samples/basic-data-contract). ### To create a basic data contract for a class or structure @@ -39,4 +39,4 @@ This topic shows the basic steps to create a data contract using a class or stru - - [Using Data Contracts](using-data-contracts.md) - [Getting Started Tutorial](../getting-started-tutorial.md) -- [Getting Started](../samples/getting-started-sample.md) +- [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample) diff --git a/docs/framework/wcf/feature-details/how-to-create-a-custom-reliable-session-binding-with-https.md b/docs/framework/wcf/feature-details/how-to-create-a-custom-reliable-session-binding-with-https.md index ecb50810f8f31..05fed7896491a 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-custom-reliable-session-binding-with-https.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-custom-reliable-session-binding-with-https.md @@ -11,7 +11,7 @@ This topic demonstrates the use of Secure Sockets Layer (SSL) transport security The key part of this procedure is that the **\** configuration element contain a `bindingConfiguration` attribute that references a custom binding configuration named `reliableSessionOverHttps`. The [**\**](../../configure-apps/file-schema/wcf/bindings.md) configuration element references this name to specify that a reliable session and the HTTPS transport are used by including **\** and **\** elements. -For the source copy of this example, see [Custom Binding Reliable Session over HTTPS](../samples/custom-binding-reliable-session-over-https.md). +For the source copy of this example, see [Custom Binding Reliable Session over HTTPS](/previous-versions/dotnet/framework/wcf/samples/custom-binding-reliable-session-over-https). ### Configure the service with a CustomBinding to use a reliable session with HTTPS diff --git a/docs/framework/wcf/feature-details/how-to-create-a-duplex-contract.md b/docs/framework/wcf/feature-details/how-to-create-a-duplex-contract.md index 3f83554c6b328..8ed57502242fc 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-duplex-contract.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-duplex-contract.md @@ -11,7 +11,7 @@ ms.assetid: 500a75b6-998a-47d5-8e3b-24e3aba2a434 --- # How to: Create a Duplex Contract -This topic shows the basic steps to create methods that use a duplex (two-way) contract. A duplex contract allows clients and servers to communicate with each other independently so that either can initiate calls to the other. The duplex contract is one of three message patterns available to Windows Communication Foundation (WCF) services. The other two message patterns are one-way and request-reply. A duplex contract consists of two one-way contracts between the client and the server and does not require that the method calls be correlated. Use this kind of contract when your service must query the client for more information or explicitly raise events on the client. For more information about creating a client application for a duplex contract, see [How to: Access Services with a Duplex Contract](how-to-access-services-with-a-duplex-contract.md). For a working sample, see the [Duplex](../samples/duplex.md) sample. +This topic shows the basic steps to create methods that use a duplex (two-way) contract. A duplex contract allows clients and servers to communicate with each other independently so that either can initiate calls to the other. The duplex contract is one of three message patterns available to Windows Communication Foundation (WCF) services. The other two message patterns are one-way and request-reply. A duplex contract consists of two one-way contracts between the client and the server and does not require that the method calls be correlated. Use this kind of contract when your service must query the client for more information or explicitly raise events on the client. For more information about creating a client application for a duplex contract, see [How to: Access Services with a Duplex Contract](how-to-access-services-with-a-duplex-contract.md). For a working sample, see the [Duplex](/previous-versions/dotnet/framework/wcf/samples/duplex) sample. ### To create a duplex contract @@ -69,7 +69,7 @@ This topic shows the basic steps to create methods that use a duplex (two-way) c - - - [How to: Access Services with a Duplex Contract](how-to-access-services-with-a-duplex-contract.md) -- [Duplex](../samples/duplex.md) +- [Duplex](/previous-versions/dotnet/framework/wcf/samples/duplex) - [Designing and Implementing Services](../designing-and-implementing-services.md) - [How to: Define a Service Contract](../how-to-define-a-wcf-service-contract.md) -- [Session](../samples/session.md) +- [Session](/previous-versions/dotnet/framework/wcf/samples/session) diff --git a/docs/framework/wcf/feature-details/how-to-create-a-federated-client.md b/docs/framework/wcf/feature-details/how-to-create-a-federated-client.md index 38be02de5050d..56b419993a883 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-federated-client.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-federated-client.md @@ -162,7 +162,7 @@ In Windows Communication Foundation (WCF), creating a client for a *federated se ## See also -- [Federation Sample](../samples/federation-sample.md) +- [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample) - [How to: Disable Secure Sessions on a WSFederationHttpBinding](how-to-disable-secure-sessions-on-a-wsfederationhttpbinding.md) - [How to: Create a WSFederationHttpBinding](how-to-create-a-wsfederationhttpbinding.md) - [How to: Configure Credentials on a Federation Service](how-to-configure-credentials-on-a-federation-service.md) diff --git a/docs/framework/wcf/feature-details/how-to-create-a-one-way-contract.md b/docs/framework/wcf/feature-details/how-to-create-a-one-way-contract.md index 4716bc870603f..3d91887119466 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-one-way-contract.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-one-way-contract.md @@ -11,7 +11,7 @@ ms.assetid: 85084cd9-31cc-4e95-b667-42ef01336622 This topic shows the basic steps to create methods that use a one-way contract. Such methods invoke operations on a Windows Communication Foundation (WCF) service from a client but do not expect a reply. This type of contract can be used, for example, to publish notifications to many subscribers. You can also use one-way contracts when creating a duplex (two-way) contract, which allows clients and servers to communicate with each other independently so that either can initiate calls to the other. This can allow, in particular, the server to make one-way calls to the client that the client can treat as events. For detailed information about specifying one-way methods, see the property and the class. - For more information about creating a client application for a duplex contract, see [How to: Access Services with One-Way and Request-Reply Contracts](how-to-access-wcf-services-with-one-way-and-request-reply-contracts.md). For a working sample, see the [One-Way](../samples/one-way.md) sample. + For more information about creating a client application for a duplex contract, see [How to: Access Services with One-Way and Request-Reply Contracts](how-to-access-wcf-services-with-one-way-and-request-reply-contracts.md). For a working sample, see the [One-Way](/previous-versions/dotnet/framework/wcf/samples/one-way) sample. ### To create a one-way contract @@ -34,5 +34,5 @@ This topic shows the basic steps to create methods that use a one-way contract. - - [Designing and Implementing Services](../designing-and-implementing-services.md) - [How to: Define a Service Contract](../how-to-define-a-wcf-service-contract.md) -- [Session](../samples/session.md) +- [Session](/previous-versions/dotnet/framework/wcf/samples/session) - [How to: Create a Duplex Contract](how-to-create-a-duplex-contract.md) diff --git a/docs/framework/wcf/feature-details/how-to-create-a-security-token-service.md b/docs/framework/wcf/feature-details/how-to-create-a-security-token-service.md index bb3035aeb6481..7eb26d725d366 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-security-token-service.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-security-token-service.md @@ -98,7 +98,7 @@ A security token service implements the protocol defined in the WS-Trust specifi [!code-csharp[c_CreateSTS#4](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_creatests/cs/source.cs#4)] [!code-vb[c_CreateSTS#4](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_creatests/vb/source.vb#4)] - For more information, see [Federation Sample](../samples/federation-sample.md). + For more information, see [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample). ## Creating Response Messages @@ -112,7 +112,7 @@ A security token service implements the protocol defined in the WS-Trust specifi [!code-csharp[c_CreateSTS#6](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_creatests/cs/source.cs#6)] [!code-vb[c_CreateSTS#6](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_creatests/vb/source.vb#6)] - For more information about how to construct the proof token when the client and the security token service both provide key material for the shared key, see [Federation Sample](../samples/federation-sample.md). + For more information about how to construct the proof token when the client and the security token service both provide key material for the shared key, see [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample). The issued token references are constructed by creating instances of the class. @@ -123,7 +123,7 @@ A security token service implements the protocol defined in the WS-Trust specifi ## Example - For full code for a security token service, see [Federation Sample](../samples/federation-sample.md). + For full code for a security token service, see [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample). ## See also @@ -134,4 +134,4 @@ A security token service implements the protocol defined in the WS-Trust specifi - - - -- [Federation Sample](../samples/federation-sample.md) +- [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample) diff --git a/docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-code.md b/docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-code.md index 0ed95235b29cb..787859eeb937c 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-code.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-code.md @@ -40,7 +40,7 @@ In this example, an `ICalculator` contract is defined for a calculator service, [!code-csharp[c_HowTo_CodeServiceBinding#7](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_codeservicebinding/cs/source.cs#7)] [!code-vb[c_HowTo_CodeServiceBinding#7](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_howto_codeservicebinding/vb/source.vb#7)] - For more information about default endpoints, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](../samples/simplified-configuration-for-wcf-services.md). + For more information about default endpoints, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). ## See also diff --git a/docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-configuration.md b/docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-configuration.md index 8bbdc97b0dac0..6f2ef01c82c98 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-configuration.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-service-endpoint-in-configuration.md @@ -6,142 +6,142 @@ ms.assetid: f474e25d-2a27-4f31-84c5-395c442b8e70 --- # How to: Create a Service Endpoint in Configuration -Endpoints provide clients with access to the functionality a Windows Communication Foundation (WCF) service offers. You can define one or more endpoints for a service by using a combination of relative and absolute endpoint addresses, or if you do not define any service endpoints, the runtime provides some by default for you. This topic shows how to add endpoints using a configuration file that contain both relative and absolute addresses. - -## Example - - The following service configuration specifies a base address and five endpoints. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## Example - - The base address is specified using the `add` element, under service/host/baseAddresses, as shown in the following sample. - -```xml +Endpoints provide clients with access to the functionality a Windows Communication Foundation (WCF) service offers. You can define one or more endpoints for a service by using a combination of relative and absolute endpoint addresses, or if you do not define any service endpoints, the runtime provides some by default for you. This topic shows how to add endpoints using a configuration file that contain both relative and absolute addresses. + +## Example 1 + + The following service configuration specifies a base address and five endpoints. + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +## Example 2 + + The base address is specified using the `add` element, under service/host/baseAddresses, as shown in the following sample. + +```xml - - - - - -``` - -## Example - - The first endpoint definition shown in the following sample specifies a relative address, which means the endpoint address is a combination of the base address and the relative address following the rules of Uniform Resource Identifier (URI) composition. The relative address is empty (""), so the endpoint address is the same as the base address. The actual endpoint address is `http://localhost:8000/servicemodelsamples/service`. - -```xml + name="Microsoft.ServiceModel.Samples.CalculatorService"> + + + + + +``` + +## Example 3 + + The first endpoint definition shown in the following sample specifies a relative address, which means the endpoint address is a combination of the base address and the relative address following the rules of Uniform Resource Identifier (URI) composition. The relative address is empty (""), so the endpoint address is the same as the base address. The actual endpoint address is `http://localhost:8000/servicemodelsamples/service`. + +```xml -``` - -## Example - - The second endpoint definition also specifies a relative address, as shown in the following sample configuration. The relative address, "test", is appended to the base address. The actual endpoint address is `http://localhost:8000/servicemodelsamples/service/test`. - -```xml - -``` - -## Example - - The third endpoint definition specifies an absolute address, as shown in the following sample configuration. The base address plays no role in the address. The actual endpoint address is `http://localhost:8001/hello/servicemodelsamples`. - -```xml - -``` - -## Example - - The fourth endpoint address specifies an absolute address and a different transport—TCP. The base address plays no role in the address. The actual endpoint address is net.tcp://localhost:9000/servicemodelsamples/service. - -```xml - -``` - -## Example - - To use the default endpoints provided by the runtime, do not specify any service endpoints in either the code or the configuration file. In this example, the runtime creates the default endpoints when the service is opened. For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](../samples/simplified-configuration-for-wcf-services.md). - -```xml - - - - - - - - - - - - - - - - - - - - - + binding="wsHttpBinding" + contract="Microsoft.ServiceModel.Samples.ICalculator" /> +``` + +## Example 4 + + The second endpoint definition also specifies a relative address, as shown in the following sample configuration. The relative address, "test", is appended to the base address. The actual endpoint address is `http://localhost:8000/servicemodelsamples/service/test`. + +```xml + +``` + +## Example 5 + + The third endpoint definition specifies an absolute address, as shown in the following sample configuration. The base address plays no role in the address. The actual endpoint address is `http://localhost:8001/hello/servicemodelsamples`. + +```xml + +``` + +## Example 6 + + The fourth endpoint address specifies an absolute address and a different transport—TCP. The base address plays no role in the address. The actual endpoint address is net.tcp://localhost:9000/servicemodelsamples/service. + +```xml + +``` + +## Example 7 + + To use the default endpoints provided by the runtime, do not specify any service endpoints in either the code or the configuration file. In this example, the runtime creates the default endpoints when the service is opened. For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). + +```xml + + + + + + + + + + + + + + + + + + + + + ``` diff --git a/docs/framework/wcf/feature-details/how-to-create-a-wsfederationhttpbinding.md b/docs/framework/wcf/feature-details/how-to-create-a-wsfederationhttpbinding.md index 5a7d582069ff9..af2b0996238ac 100644 --- a/docs/framework/wcf/feature-details/how-to-create-a-wsfederationhttpbinding.md +++ b/docs/framework/wcf/feature-details/how-to-create-a-wsfederationhttpbinding.md @@ -104,5 +104,5 @@ The following code sample shows code for setting up a `WSFederationHttpBinding` ## See also - [Federation](federation.md) -- [Federation Sample](../samples/federation-sample.md) +- [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample) - [How to: Disable Secure Sessions on a WSFederationHttpBinding](how-to-disable-secure-sessions-on-a-wsfederationhttpbinding.md) diff --git a/docs/framework/wcf/feature-details/how-to-dynamic-update.md b/docs/framework/wcf/feature-details/how-to-dynamic-update.md index 37b49cd341cab..7997907e85beb 100644 --- a/docs/framework/wcf/feature-details/how-to-dynamic-update.md +++ b/docs/framework/wcf/feature-details/how-to-dynamic-update.md @@ -6,295 +6,295 @@ ms.assetid: 9b8f6e0d-edab-4a7e-86e3-8c66bebc64bb --- # How To: Dynamic Update -This topic outlines the basic steps required to create and dynamically update the routing configuration. In this example, the initial routing configuration is obtained from the configuration file and routes all messages to the regularCalc calculator service; however, it is subsequently updated programmatically in order to change the destination endpoint the roundingCalc service. - +This topic outlines the basic steps required to create and dynamically update the routing configuration. In this example, the initial routing configuration is obtained from the configuration file and routes all messages to the regularCalc calculator service; however, it is subsequently updated programmatically in order to change the destination endpoint the roundingCalc service. + > [!NOTE] -> In many implementations, configuration will be fully dynamic and will not rely on a default configuration; however, there are some scenarios, such as the one in this topic, where it is desirable to have a default configuration state when the service starts. - +> In many implementations, configuration will be fully dynamic and will not rely on a default configuration; however, there are some scenarios, such as the one in this topic, where it is desirable to have a default configuration state when the service starts. + > [!NOTE] -> Dynamic updates occur only in memory, and do not result in the modification of configuration files. - - Both regularCalc and roundingCalc support the same operations of add, subtract, multiply and divide; however, roundingCalc rounds all calculations to the nearest integer value before returning. A configuration file is used to configure the service to route all messages to the regularCalc service. After the Routing Service has been started, is used to reconfigure the service to route messages to the roundingCalc service. - -### Implement Initial Configuration - -1. Create the basic Routing Service Configuration by specifying the service endpoints exposed by the service. The following example defines a single service endpoint, which will be used to receive messages. It also defines a client endpoint that will be used to send messages to the regularCalc. - - ```xml - - - - - - - - - - - - - - - - ``` - -2. Define the filter used to route messages to the destination endpoints. For this example, the MatchAll filter is used to route all messages to the regularCalcEndpoint defined previously. The following example defines the filter and filter table. - - ```xml - - - - - - - - - - - ``` - -3. To evaluate incoming messages against the filters contained in the filter table, you must associate the filter table with the service endpoints by using the routing behavior. The following example demonstrates associating "filterTable1" with the service endpoint. - - ```xml - - - - - - - - - ``` - -## Implement Dynamic Configuration - - Dynamic configuration of the Routing Service can only be performed in code by creating a new and using to replace the current configuration. For this example, the Routing Service is self-hosted within a console application. After the application has started, you can modify the routing configuration by entering ‘regular’ or ‘rounding’ at the console window to configure the destination endpoint that messages are routed to; regularCalc when ‘regular’ is entered, otherwise roundingCalc when ‘rounding’ is entered. - -1. The following using statements must be added in order to support the Routing Service. - - ```csharp - using System; - using System.Collections.Generic; - using System.ServiceModel; - using System.ServiceModel.Channels; - using System.ServiceModel.Description; - using System.ServiceModel.Dispatcher; - using System.ServiceModel.Routing; - ``` - -2. The following code is used to self-host the Routing Service as a console application. This initializes the Routing Service using the configuration described in the previous step, which is contained within the application configuration file. The while loop contains the code used to change the routing configuration. - - ```csharp - // Host the service within this EXE console application. - public static void Main() - { - // Create a ServiceHost for the CalculatorService type. - using (ServiceHost serviceHost = - new ServiceHost(typeof(RoutingService))) - { +> Dynamic updates occur only in memory, and do not result in the modification of configuration files. + + Both regularCalc and roundingCalc support the same operations of add, subtract, multiply and divide; however, roundingCalc rounds all calculations to the nearest integer value before returning. A configuration file is used to configure the service to route all messages to the regularCalc service. After the Routing Service has been started, is used to reconfigure the service to route messages to the roundingCalc service. + +### Implement Initial Configuration + +1. Create the basic Routing Service Configuration by specifying the service endpoints exposed by the service. The following example defines a single service endpoint, which will be used to receive messages. It also defines a client endpoint that will be used to send messages to the regularCalc. + + ```xml + + + + + + + + + + + + + + + + ``` + +2. Define the filter used to route messages to the destination endpoints. For this example, the MatchAll filter is used to route all messages to the regularCalcEndpoint defined previously. The following example defines the filter and filter table. + + ```xml + + + + + + + + + + + ``` + +3. To evaluate incoming messages against the filters contained in the filter table, you must associate the filter table with the service endpoints by using the routing behavior. The following example demonstrates associating "filterTable1" with the service endpoint. + + ```xml + + + + + + + + + ``` + +## Implement Dynamic Configuration + + Dynamic configuration of the Routing Service can only be performed in code by creating a new and using to replace the current configuration. For this example, the Routing Service is self-hosted within a console application. After the application has started, you can modify the routing configuration by entering ‘regular’ or ‘rounding’ at the console window to configure the destination endpoint that messages are routed to; regularCalc when ‘regular’ is entered, otherwise roundingCalc when ‘rounding’ is entered. + +1. The following using statements must be added in order to support the Routing Service. + + ```csharp + using System; + using System.Collections.Generic; + using System.ServiceModel; + using System.ServiceModel.Channels; + using System.ServiceModel.Description; + using System.ServiceModel.Dispatcher; + using System.ServiceModel.Routing; + ``` + +2. The following code is used to self-host the Routing Service as a console application. This initializes the Routing Service using the configuration described in the previous step, which is contained within the application configuration file. The while loop contains the code used to change the routing configuration. + + ```csharp + // Host the service within this EXE console application. + public static void Main() + { + // Create a ServiceHost for the CalculatorService type. + using (ServiceHost serviceHost = + new ServiceHost(typeof(RoutingService))) + { // Open the ServiceHost to create listeners - // and start listening for messages. - Console.WriteLine("The Routing Service configured, opening...."); - serviceHost.Open(); - Console.WriteLine("The Routing Service is now running."); - Console.WriteLine("Type 'quit' to terminate router."); - Console.WriteLine(" to change routing configuration."); - while (Console.ReadLine() != "quit") - { - .... - } - } - } - ``` - -3. To dynamically update the routing configuration, a new routing configuration must be created. This must contain all endpoints, filters and filter tables that are required for the new routing configuration, as it will completely replace the existing routing configuration. In order to use the new routing configuration, you must invoke and pass the new configuration. - - Add the following code to the while loop defined previously to allow the service to be reconfigured based on user input. - - ```csharp - Console.WriteLine("Enter 'regular' or 'rounding' to set the destination endpoint:"); - string destEndpoint = Console.ReadLine(); - // Create a new RoutingConfiguration - RoutingConfiguration rc = new RoutingConfiguration(); - // Determine the endpoint to configure for - switch (destEndpoint) - { - case "regular": - // Define the destination endpoint - ServiceEndpoint regularCalc = new ServiceEndpoint( - ContractDescription.GetContract(typeof(IRequestReplyRouter)), - new NetTcpBinding(), - new EndpointAddress("net.tcp://localhost:9090/servicemodelsamples/service/")); - // Create a MatchAll filter and add to the filter table - rc.FilterTable.Add(new MatchAllMessageFilter(), new List { regularCalc }); - // Use ApplyConfiguration to update the Routing Service - serviceHost.Extensions.Find().ApplyConfiguration(rc); - Console.WriteLine("Applied new routing configuration."); - break; - case "rounding": - // Define the destination endpoint - ServiceEndpoint roundingCalc = new ServiceEndpoint( - ContractDescription.GetContract(typeof(IRequestReplyRouter)), - new NetTcpBinding(), - new EndpointAddress("net.tcp://localhost:8080/servicemodelsamples/service/")); - // Create a MatchAll filter and add to the filter table - rc.FilterTable.Add(new MatchAllMessageFilter(), new List { roundingCalc }); - // Use ApplyConfiguration to update the Routing Service - serviceHost.Extensions.Find().ApplyConfiguration(rc); - Console.WriteLine("Applied new routing configuration."); - break; - default: - Console.WriteLine("Incorrect value entered, no change."); - break; - } - ``` - + // and start listening for messages. + Console.WriteLine("The Routing Service configured, opening...."); + serviceHost.Open(); + Console.WriteLine("The Routing Service is now running."); + Console.WriteLine("Type 'quit' to terminate router."); + Console.WriteLine(" to change routing configuration."); + while (Console.ReadLine() != "quit") + { + .... + } + } + } + ``` + +3. To dynamically update the routing configuration, a new routing configuration must be created. This must contain all endpoints, filters and filter tables that are required for the new routing configuration, as it will completely replace the existing routing configuration. In order to use the new routing configuration, you must invoke and pass the new configuration. + + Add the following code to the while loop defined previously to allow the service to be reconfigured based on user input. + + ```csharp + Console.WriteLine("Enter 'regular' or 'rounding' to set the destination endpoint:"); + string destEndpoint = Console.ReadLine(); + // Create a new RoutingConfiguration + RoutingConfiguration rc = new RoutingConfiguration(); + // Determine the endpoint to configure for + switch (destEndpoint) + { + case "regular": + // Define the destination endpoint + ServiceEndpoint regularCalc = new ServiceEndpoint( + ContractDescription.GetContract(typeof(IRequestReplyRouter)), + new NetTcpBinding(), + new EndpointAddress("net.tcp://localhost:9090/servicemodelsamples/service/")); + // Create a MatchAll filter and add to the filter table + rc.FilterTable.Add(new MatchAllMessageFilter(), new List { regularCalc }); + // Use ApplyConfiguration to update the Routing Service + serviceHost.Extensions.Find().ApplyConfiguration(rc); + Console.WriteLine("Applied new routing configuration."); + break; + case "rounding": + // Define the destination endpoint + ServiceEndpoint roundingCalc = new ServiceEndpoint( + ContractDescription.GetContract(typeof(IRequestReplyRouter)), + new NetTcpBinding(), + new EndpointAddress("net.tcp://localhost:8080/servicemodelsamples/service/")); + // Create a MatchAll filter and add to the filter table + rc.FilterTable.Add(new MatchAllMessageFilter(), new List { roundingCalc }); + // Use ApplyConfiguration to update the Routing Service + serviceHost.Extensions.Find().ApplyConfiguration(rc); + Console.WriteLine("Applied new routing configuration."); + break; + default: + Console.WriteLine("Incorrect value entered, no change."); + break; + } + ``` + > [!NOTE] > Since the method for providing a new RoutingConfiguration is contained in the RoutingExtension service extension, new RoutingConfiguration objects can be provided anywhere in the WCF extensibility model that has or can obtain a reference to the ServiceHost or ServiceExtensions (such as in another ServiceExtension). - -## Example + +## Example 1 The following is a complete listing of the console application used in this example: - + ```csharp -//----------------------------------------------------------------- -// Copyright (c) Microsoft Corporation. All Rights Reserved. -//----------------------------------------------------------------- - -using System; -using System.Collections.Generic; -using System.ServiceModel; -using System.ServiceModel.Channels; -using System.ServiceModel.Description; -using System.ServiceModel.Dispatcher; -using System.ServiceModel.Routing; - -namespace Microsoft.Samples.AdvancedFilters -{ - public class Router - { - // Host the service within this EXE console application. - public static void Main() +//----------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All Rights Reserved. +//----------------------------------------------------------------- + +using System; +using System.Collections.Generic; +using System.ServiceModel; +using System.ServiceModel.Channels; +using System.ServiceModel.Description; +using System.ServiceModel.Dispatcher; +using System.ServiceModel.Routing; + +namespace Microsoft.Samples.AdvancedFilters +{ + public class Router + { + // Host the service within this EXE console application. + public static void Main() { - // Create a ServiceHost for the CalculatorService type. - using (ServiceHost serviceHost = - new ServiceHost(typeof(RoutingService))) - { + // Create a ServiceHost for the CalculatorService type. + using (ServiceHost serviceHost = + new ServiceHost(typeof(RoutingService))) + { // Open the ServiceHost to create listeners - // and start listening for messages. - Console.WriteLine("The Routing Service configured, opening...."); - serviceHost.Open(); - Console.WriteLine("The Routing Service is now running."); - Console.WriteLine("Type 'quit' to terminate router."); - Console.WriteLine(" to change routing configuration."); - while (Console.ReadLine() != "quit") - { - Console.WriteLine("Enter 'regular' or 'rounding' to set the destination endpoint:"); - string destEndpoint = Console.ReadLine(); - // Create a new RoutingConfiguration - RoutingConfiguration rc = new RoutingConfiguration(); - // Determine the endpoint to configure for - switch (destEndpoint) - { - case "regular": - // Define the destination endpoint - ServiceEndpoint regularCalc = new ServiceEndpoint( - ContractDescription.GetContract(typeof(IRequestReplyRouter)), - new NetTcpBinding(), - new EndpointAddress("net.tcp://localhost:9090/servicemodelsamples/service/")); - // Create a MatchAll filter and add to the filter table - rc.FilterTable.Add(new MatchAllMessageFilter(), new List { regularCalc }); - // Use ApplyConfiguration to update the Routing Service - serviceHost.Extensions.Find().ApplyConfiguration(rc); - Console.WriteLine("Applied new routing configuration."); - break; - case "rounding": - // Define the destination endpoint - ServiceEndpoint roundingCalc = new ServiceEndpoint( - ContractDescription.GetContract(typeof(IRequestReplyRouter)), - new NetTcpBinding(), - new EndpointAddress("net.tcp://localhost:8080/servicemodelsamples/service/")); - // Create a MatchAll filter and add to the filter table - rc.FilterTable.Add(new MatchAllMessageFilter(), new List { roundingCalc }); - // Use ApplyConfiguration to update the Routing Service - serviceHost.Extensions.Find().ApplyConfiguration(rc); - Console.WriteLine("Applied new routing configuration."); - break; - default: - Console.WriteLine("Incorrect value entered, no change."); - break; - } - } - } - } - } -} -``` - -## Example + // and start listening for messages. + Console.WriteLine("The Routing Service configured, opening...."); + serviceHost.Open(); + Console.WriteLine("The Routing Service is now running."); + Console.WriteLine("Type 'quit' to terminate router."); + Console.WriteLine(" to change routing configuration."); + while (Console.ReadLine() != "quit") + { + Console.WriteLine("Enter 'regular' or 'rounding' to set the destination endpoint:"); + string destEndpoint = Console.ReadLine(); + // Create a new RoutingConfiguration + RoutingConfiguration rc = new RoutingConfiguration(); + // Determine the endpoint to configure for + switch (destEndpoint) + { + case "regular": + // Define the destination endpoint + ServiceEndpoint regularCalc = new ServiceEndpoint( + ContractDescription.GetContract(typeof(IRequestReplyRouter)), + new NetTcpBinding(), + new EndpointAddress("net.tcp://localhost:9090/servicemodelsamples/service/")); + // Create a MatchAll filter and add to the filter table + rc.FilterTable.Add(new MatchAllMessageFilter(), new List { regularCalc }); + // Use ApplyConfiguration to update the Routing Service + serviceHost.Extensions.Find().ApplyConfiguration(rc); + Console.WriteLine("Applied new routing configuration."); + break; + case "rounding": + // Define the destination endpoint + ServiceEndpoint roundingCalc = new ServiceEndpoint( + ContractDescription.GetContract(typeof(IRequestReplyRouter)), + new NetTcpBinding(), + new EndpointAddress("net.tcp://localhost:8080/servicemodelsamples/service/")); + // Create a MatchAll filter and add to the filter table + rc.FilterTable.Add(new MatchAllMessageFilter(), new List { roundingCalc }); + // Use ApplyConfiguration to update the Routing Service + serviceHost.Extensions.Find().ApplyConfiguration(rc); + Console.WriteLine("Applied new routing configuration."); + break; + default: + Console.WriteLine("Incorrect value entered, no change."); + break; + } + } + } + } + } +} +``` + +## Example 2 The following is a complete listing of the configuration file used in this example: - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + ## See also -- [Routing Services](../samples/routing-services.md) +- [Routing Services](/previous-versions/dotnet/framework/wcf/samples/routing-services) diff --git a/docs/framework/wcf/feature-details/how-to-enable-streaming.md b/docs/framework/wcf/feature-details/how-to-enable-streaming.md index 6747a545494ae..debc0f7be9b1b 100644 --- a/docs/framework/wcf/feature-details/how-to-enable-streaming.md +++ b/docs/framework/wcf/feature-details/how-to-enable-streaming.md @@ -73,4 +73,4 @@ Windows Communication Foundation (WCF) can send messages using either buffered o ## See also - [Large Data and Streaming](large-data-and-streaming.md) -- [Stream](../samples/stream.md) +- [Stream](/previous-versions/dotnet/framework/wcf/samples/stream) diff --git a/docs/framework/wcf/feature-details/how-to-enable-the-net-tcp-port-sharing-service.md b/docs/framework/wcf/feature-details/how-to-enable-the-net-tcp-port-sharing-service.md index 0ba7f95dd3d31..a32b845121253 100644 --- a/docs/framework/wcf/feature-details/how-to-enable-the-net-tcp-port-sharing-service.md +++ b/docs/framework/wcf/feature-details/how-to-enable-the-net-tcp-port-sharing-service.md @@ -13,7 +13,7 @@ Windows Communication Foundation (WCF) uses a Windows service called the Net.TCP After you enable the Net.TCP Port Sharing Service and start it manually, see [How to: Configure a WCF Service to Use Port Sharing](how-to-configure-a-wcf-service-to-use-port-sharing.md) for information about how to configure your service to use this service. - For a sample that uses net.tcp:// port sharing, see the [Net.TCP Port Sharing Sample](../samples/net-tcp-port-sharing-sample.md). + For a sample that uses net.tcp:// port sharing, see the [Net.TCP Port Sharing Sample](/previous-versions/dotnet/framework/wcf/samples/net-tcp-port-sharing-sample). ### To enable the Net.TCP Port Sharing Service using MMC diff --git a/docs/framework/wcf/feature-details/how-to-exchange-messages-with-wcf-endpoints-and-message-queuing-applications.md b/docs/framework/wcf/feature-details/how-to-exchange-messages-with-wcf-endpoints-and-message-queuing-applications.md index 6fd65a080f8b9..dd94838671c9b 100644 --- a/docs/framework/wcf/feature-details/how-to-exchange-messages-with-wcf-endpoints-and-message-queuing-applications.md +++ b/docs/framework/wcf/feature-details/how-to-exchange-messages-with-wcf-endpoints-and-message-queuing-applications.md @@ -13,9 +13,9 @@ You can integrate existing Message Queuing (MSMQ) applications with Windows Comm In this section, we explain how to use for queued communication between (1) a WCF client and an MSMQ application service written using System.Messaging and (2) an MSMQ application client and a WCF service. - For a complete sample that demonstrates how to call a MSMQ receiver application from a WCF client, see the [Windows Communication Foundation to Message Queuing](../samples/wcf-to-message-queuing.md) sample. + For a complete sample that demonstrates how to call a MSMQ receiver application from a WCF client, see the [Windows Communication Foundation to Message Queuing](/previous-versions/dotnet/framework/wcf/samples/wcf-to-message-queuing) sample. - For a complete sample that demonstrates how to call a WCF service from a MSMQ client, see the [Message Queuing to Windows Communication Foundation](../samples/message-queuing-to-wcf.md) sample. + For a complete sample that demonstrates how to call a WCF service from a MSMQ client, see the [Message Queuing to Windows Communication Foundation](/previous-versions/dotnet/framework/wcf/samples/message-queuing-to-wcf) sample. ### To create a WCF service that receives messages from a MSMQ client @@ -58,7 +58,7 @@ You can integrate existing Message Queuing (MSMQ) applications with Windows Comm - [Queues Overview](queues-overview.md) - [How to: Exchange Queued Messages with WCF Endpoints](how-to-exchange-queued-messages-with-wcf-endpoints.md) -- [Windows Communication Foundation to Message Queuing](../samples/wcf-to-message-queuing.md) -- [Installing Message Queuing (MSMQ)](../samples/installing-message-queuing-msmq.md) -- [Message Queuing to Windows Communication Foundation](../samples/message-queuing-to-wcf.md) -- [Message Security over Message Queuing](../samples/message-security-over-message-queuing.md) +- [Windows Communication Foundation to Message Queuing](/previous-versions/dotnet/framework/wcf/samples/wcf-to-message-queuing) +- [Installing Message Queuing (MSMQ)](/previous-versions/dotnet/framework/wcf/samples/installing-message-queuing-msmq) +- [Message Queuing to Windows Communication Foundation](/previous-versions/dotnet/framework/wcf/samples/message-queuing-to-wcf) +- [Message Security over Message Queuing](/previous-versions/dotnet/framework/wcf/samples/message-security-over-message-queuing) diff --git a/docs/framework/wcf/feature-details/how-to-exchange-messages-within-a-reliable-session.md b/docs/framework/wcf/feature-details/how-to-exchange-messages-within-a-reliable-session.md index 88717a1d6ab52..525b0bb90038d 100644 --- a/docs/framework/wcf/feature-details/how-to-exchange-messages-within-a-reliable-session.md +++ b/docs/framework/wcf/feature-details/how-to-exchange-messages-within-a-reliable-session.md @@ -11,7 +11,7 @@ This topic outlines the steps required to enable a reliable session using one of The key part of this procedure is that the endpoint configuration element contain a `bindingConfiguration` attribute that references a binding configuration named `Binding1`. The [**\**](../../configure-apps/file-schema/wcf/bindings.md) configuration element references this name to enable reliable sessions by setting the `enabled` attribute of the [**\**](/previous-versions/dotnet/netframework-4.0/ms731302(v=vs.100)) element to `true`. You specify the ordered delivery assurances for the reliable session by setting the `ordered` attribute to `true`. -For the source copy of this example, see [WS Reliable Session](../samples/ws-reliable-session.md). +For the source copy of this example, see [WS Reliable Session](/previous-versions/dotnet/framework/wcf/samples/ws-reliable-session). ### Configure the service with a WSHttpBinding to use a reliable session diff --git a/docs/framework/wcf/feature-details/how-to-exchange-queued-messages-with-wcf-endpoints.md b/docs/framework/wcf/feature-details/how-to-exchange-queued-messages-with-wcf-endpoints.md index 89516abb733ea..ea4e8dad1107b 100644 --- a/docs/framework/wcf/feature-details/how-to-exchange-queued-messages-with-wcf-endpoints.md +++ b/docs/framework/wcf/feature-details/how-to-exchange-queued-messages-with-wcf-endpoints.md @@ -75,10 +75,10 @@ Queues ensure that reliable messaging can occur between a client and a Windows C ## See also - -- [Transacted MSMQ Binding](../samples/transacted-msmq-binding.md) +- [Transacted MSMQ Binding](/previous-versions/dotnet/framework/wcf/samples/transacted-msmq-binding) - [Queuing in WCF](queuing-in-wcf.md) - [How to: Exchange Messages with WCF Endpoints and Message Queuing Applications](how-to-exchange-messages-with-wcf-endpoints-and-message-queuing-applications.md) -- [Windows Communication Foundation to Message Queuing](../samples/wcf-to-message-queuing.md) -- [Installing Message Queuing (MSMQ)](../samples/installing-message-queuing-msmq.md) -- [Message Queuing to Windows Communication Foundation](../samples/message-queuing-to-wcf.md) -- [Message Security over Message Queuing](../samples/message-security-over-message-queuing.md) +- [Windows Communication Foundation to Message Queuing](/previous-versions/dotnet/framework/wcf/samples/wcf-to-message-queuing) +- [Installing Message Queuing (MSMQ)](/previous-versions/dotnet/framework/wcf/samples/installing-message-queuing-msmq) +- [Message Queuing to Windows Communication Foundation](/previous-versions/dotnet/framework/wcf/samples/message-queuing-to-wcf) +- [Message Security over Message Queuing](/previous-versions/dotnet/framework/wcf/samples/message-security-over-message-queuing) diff --git a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service.md b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service.md index be47bc31da258..0234e719ed1fc 100644 --- a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service.md +++ b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service.md @@ -107,7 +107,7 @@ The service code includes a service implementation of the service contract, a Wi Right click the App.config file in the **Solution Explorer** and select **Properties**. Under **Copy to Output Directory** select **Copy if Newer**. - This example explicitly specifies endpoints in the configuration file. If you do not add any endpoints to the service, the runtime adds default endpoints for you. In this example, because the service has a set to `true`, your service also has publishing metadata enabled. For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](../samples/simplified-configuration-for-wcf-services.md). + This example explicitly specifies endpoints in the configuration file. If you do not add any endpoints to the service, the runtime adds default endpoints for you. In this example, because the service has a set to `true`, your service also has publishing metadata enabled. For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). ## Install and run the service diff --git a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis.md b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis.md index 8d67ff4ee31f5..2d6eee6e2cc71 100644 --- a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis.md +++ b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-iis.md @@ -13,7 +13,7 @@ This topic outlines the basic steps required to create a Windows Communication F For more information about how WCF and ASP.NET interact, see [WCF Services and ASP.NET](wcf-services-and-aspnet.md). For more information about configuring security, see [Security](security.md). - For the source copy of this example, see [IIS Hosting Using Inline Code](../samples/iis-hosting-using-inline-code.md). + For the source copy of this example, see [IIS Hosting Using Inline Code](/previous-versions/dotnet/framework/wcf/samples/iis-hosting-using-inline-code). ### To create a service hosted by IIS @@ -60,7 +60,7 @@ This topic outlines the basic steps required to create a Windows Communication F [!code-xml[c_HowTo_HostInIIS#100](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_howto_hostiniis/common/web.config#100)] - This example explicitly specifies endpoints in the configuration file. If you do not add any endpoints to the service, the runtime adds default endpoints for you. For more information about default endpoints, bindings, and behaviors see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](../samples/simplified-configuration-for-wcf-services.md). + This example explicitly specifies endpoints in the configuration file. If you do not add any endpoints to the service, the runtime adds default endpoints for you. For more information about default endpoints, bindings, and behaviors see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). 11. To make sure the service is hosted correctly, open an instance of Internet Explorer and browse to the service's URL: `http://localhost/IISHostedCalc/Service.svc` diff --git a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was.md b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was.md index 5e77412effea3..6a1c3f8515f3d 100644 --- a/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was.md +++ b/docs/framework/wcf/feature-details/how-to-host-a-wcf-service-in-was.md @@ -31,7 +31,7 @@ This topic outlines the basic steps required to create a Windows Process Activat Otherwise, the endpoint that is initialized first always determines the values of these properties, and endpoints added later throw a if they do not match those settings. - For the source copy of this example, see [TCP Activation](../samples/tcp-activation.md). + For the source copy of this example, see [TCP Activation](/previous-versions/dotnet/framework/wcf/samples/tcp-activation). ### To create a basic service hosted by WAS @@ -96,5 +96,5 @@ This topic outlines the basic steps required to create a Windows Process Activat ## See also -- [TCP Activation](../samples/tcp-activation.md) +- [TCP Activation](/previous-versions/dotnet/framework/wcf/samples/tcp-activation) - [Windows Server App Fabric Hosting Features](/previous-versions/appfabric/ee677189(v=azure.10)) diff --git a/docs/framework/wcf/feature-details/how-to-import-metadata-into-service-endpoints.md b/docs/framework/wcf/feature-details/how-to-import-metadata-into-service-endpoints.md index 364cc61a0ef27..b430135d60ca9 100644 --- a/docs/framework/wcf/feature-details/how-to-import-metadata-into-service-endpoints.md +++ b/docs/framework/wcf/feature-details/how-to-import-metadata-into-service-endpoints.md @@ -6,7 +6,7 @@ ms.assetid: b69dbe20-92a1-4911-89d8-ffbc3dad4663 --- # How to: Import Metadata into Service Endpoints -This topic explains how to import metadata into a collection of service endpoints and use the service defined in the [Getting Started](../samples/getting-started-sample.md). This topic show how to create a client application that imports metadata from the service and then calls the `Add` method on the service. +This topic explains how to import metadata into a collection of service endpoints and use the service defined in the [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample). This topic show how to create a client application that imports metadata from the service and then calls the `Add` method on the service. ### To import metadata into service endpoints @@ -36,4 +36,4 @@ This topic explains how to import metadata into a collection of service endpoint ## See also - [Metadata](metadata.md) -- [Getting Started](../samples/getting-started-sample.md) +- [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample) diff --git a/docs/framework/wcf/feature-details/how-to-install-and-configure-wcf-activation-components.md b/docs/framework/wcf/feature-details/how-to-install-and-configure-wcf-activation-components.md index 0bfad08b6ec3a..eacd914920a81 100644 --- a/docs/framework/wcf/feature-details/how-to-install-and-configure-wcf-activation-components.md +++ b/docs/framework/wcf/feature-details/how-to-install-and-configure-wcf-activation-components.md @@ -98,7 +98,7 @@ After installing and configuring WAS, see [How to: Host a WCF Service in WAS](ho ## See also -- [TCP Activation](../samples/tcp-activation.md) -- [MSMQ Activation](../samples/msmq-activation.md) -- [NamedPipe Activation](../samples/namedpipe-activation.md) +- [TCP Activation](/previous-versions/dotnet/framework/wcf/samples/tcp-activation) +- [MSMQ Activation](/previous-versions/dotnet/framework/wcf/samples/msmq-activation) +- [NamedPipe Activation](/previous-versions/dotnet/framework/wcf/samples/namedpipe-activation) - [Windows Server App Fabric Hosting Features](/previous-versions/appfabric/ee677189(v=azure.10)) diff --git a/docs/framework/wcf/feature-details/how-to-make-x-509-certificates-accessible-to-wcf.md b/docs/framework/wcf/feature-details/how-to-make-x-509-certificates-accessible-to-wcf.md index 945d557d8d5ec..154de8f2394fb 100644 --- a/docs/framework/wcf/feature-details/how-to-make-x-509-certificates-accessible-to-wcf.md +++ b/docs/framework/wcf/feature-details/how-to-make-x-509-certificates-accessible-to-wcf.md @@ -37,11 +37,11 @@ To make an X.509 certificate accessible to Windows Communication Foundation (WCF [!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](../samples/findprivatekey.md) tool. + 3. Determine where the private key for the certificate is located on the computer by using the [FindPrivateKey](/previous-versions/dotnet/framework/wcf/samples/findprivatekey) tool. - The [FindPrivateKey](../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](how-to-retrieve-the-thumbprint-of-a-certificate.md). + The [FindPrivateKey](/previous-versions/dotnet/framework/wcf/samples/findprivatekey) 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](how-to-retrieve-the-thumbprint-of-a-certificate.md). - The following code example uses the [FindPrivateKey](../samples/findprivatekey.md) tool to determine the location of the private key for a certificate in the `My` store in `CurrentUser` with a thumbprint of `46 dd 0e 7a ed 0b 7a 31 9b 02 a3 a0 43 7a d8 3f 60 40 92 9d`. + The following code example uses the [FindPrivateKey](/previous-versions/dotnet/framework/wcf/samples/findprivatekey) tool to determine the location of the private key for a certificate in the `My` store in `CurrentUser` with a thumbprint of `46 dd 0e 7a ed 0b 7a 31 9b 02 a3 a0 43 7a d8 3f 60 40 92 9d`. ```console 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 @@ -68,6 +68,6 @@ To make an X.509 certificate accessible to Windows Communication Foundation (WCF ## See also -- [FindPrivateKey](../samples/findprivatekey.md) +- [FindPrivateKey](/previous-versions/dotnet/framework/wcf/samples/findprivatekey) - [How to: Retrieve the Thumbprint of a Certificate](how-to-retrieve-the-thumbprint-of-a-certificate.md) - [Working with Certificates](working-with-certificates.md) diff --git a/docs/framework/wcf/feature-details/how-to-programmatically-add-discoverability-to-a-wcf-service-and-client.md b/docs/framework/wcf/feature-details/how-to-programmatically-add-discoverability-to-a-wcf-service-and-client.md index ec01bfacd03d3..9d80eefceb025 100644 --- a/docs/framework/wcf/feature-details/how-to-programmatically-add-discoverability-to-a-wcf-service-and-client.md +++ b/docs/framework/wcf/feature-details/how-to-programmatically-add-discoverability-to-a-wcf-service-and-client.md @@ -6,7 +6,7 @@ ms.assetid: 4f7ae7ab-6fc8-4769-9730-c14d43f7b9b1 --- # How to: Programmatically Add Discoverability to a WCF Service and Client -This topic explains how to make a Windows Communication Foundation (WCF) service discoverable. It is based on the [Self-Host](../samples/self-host.md) sample. +This topic explains how to make a Windows Communication Foundation (WCF) service discoverable. It is based on the [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) sample. ### To configure the existing Self-Host service sample for Discovery @@ -120,7 +120,7 @@ This topic explains how to make a Windows Communication Foundation (WCF) service This method uses the endpoint address returned from `FindCalculatorServiceAddress` to call the calculator service. -11. Inside the `InvokeCalculatorService` method, create an instance of the `CalculatorServiceClient` class. This class is defined by the [Self-Host](../samples/self-host.md) sample. It was generated using Svcutil.exe. +11. Inside the `InvokeCalculatorService` method, create an instance of the `CalculatorServiceClient` class. This class is defined by the [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) sample. It was generated using Svcutil.exe. ```csharp // Create a client @@ -217,7 +217,7 @@ This topic explains how to make a Windows Communication Foundation (WCF) service ## Example - The following is a listing of the code for this sample. Because this code is based on the [Self-Host](../samples/self-host.md) sample, only those files that are changed are listed. For more information about the Self-Host sample, see [Setup Instructions](../samples/set-up-instructions.md). + The following is a listing of the code for this sample. Because this code is based on the [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) sample, only those files that are changed are listed. For more information about the Self-Host sample, see [Setup Instructions](/previous-versions/dotnet/framework/wcf/samples/set-up-instructions). ```csharp // Service.cs diff --git a/docs/framework/wcf/feature-details/how-to-publish-metadata-for-a-service-using-a-configuration-file.md b/docs/framework/wcf/feature-details/how-to-publish-metadata-for-a-service-using-a-configuration-file.md index 753dac854014f..ed95af575efbf 100644 --- a/docs/framework/wcf/feature-details/how-to-publish-metadata-for-a-service-using-a-configuration-file.md +++ b/docs/framework/wcf/feature-details/how-to-publish-metadata-for-a-service-using-a-configuration-file.md @@ -9,7 +9,7 @@ ms.assetid: f061443f-92df-4824-b36a-609c4cd14a17 This is one of two how-to topics that demonstrate publishing metadata for a Windows Communication Foundation (WCF) service. There are two ways to specify how a service should publish metadata, using a configuration file and using code. This topic shows how to publish metadata for a service using a configuration file. > [!CAUTION] -> This topic shows how to publish metadata in an unsecure manner. Any client can retrieve the metadata from the service. If you require your service to publish metadata in a secure manner, see [Custom Secure Metadata Endpoint](../samples/custom-secure-metadata-endpoint.md). +> This topic shows how to publish metadata in an unsecure manner. Any client can retrieve the metadata from the service. If you require your service to publish metadata in a secure manner, see [Custom Secure Metadata Endpoint](/previous-versions/dotnet/framework/wcf/samples/custom-secure-metadata-endpoint). For more information about publishing metadata in code, see [How to: Publish Metadata for a Service Using Code](how-to-publish-metadata-for-a-service-using-code.md). Publishing metadata allows clients to retrieve the metadata using a WS-Transfer GET request or an HTTP/GET request using the `?wsdl` query string. To be sure that the code is working, create a basic WCF service. For simplicity, a basic self-hosted service is provided in the following code. @@ -175,7 +175,7 @@ namespace Metadata.Samples
``` - Because the service has a with the `httpGetEnabled` set to `true`, the service has publishing metadata enabled, and because no endpoints were explicitly added, the runtime adds the default endpoints. For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](../samples/simplified-configuration-for-wcf-services.md). + Because the service has a with the `httpGetEnabled` set to `true`, the service has publishing metadata enabled, and because no endpoints were explicitly added, the runtime adds the default endpoints. For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). ## Example @@ -254,7 +254,7 @@ namespace Metadata.Samples - - [How to: Host a WCF Service in a Managed Application](../how-to-host-a-wcf-service-in-a-managed-application.md) -- [Self-Host](../samples/self-host.md) +- [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) - [Metadata Architecture Overview](metadata-architecture-overview.md) - [Using Metadata](using-metadata.md) - [How to: Publish Metadata for a Service Using Code](how-to-publish-metadata-for-a-service-using-code.md) diff --git a/docs/framework/wcf/feature-details/how-to-publish-metadata-for-a-service-using-code.md b/docs/framework/wcf/feature-details/how-to-publish-metadata-for-a-service-using-code.md index 31b217ccd4e40..2fd7cb78d632c 100644 --- a/docs/framework/wcf/feature-details/how-to-publish-metadata-for-a-service-using-code.md +++ b/docs/framework/wcf/feature-details/how-to-publish-metadata-for-a-service-using-code.md @@ -12,7 +12,7 @@ ms.assetid: 51407e6d-4d87-42d5-be7c-9887b8652006 This is one of two how-to topics that discuss publishing metadata for a Windows Communication Foundation (WCF) service. There are two ways to specify how a service should publish metadata, using a configuration file and using code. This topic shows how to publish metadata for a service using a code. > [!CAUTION] -> This topic shows how to publish metadata in an unsecure manner. Any client can retrieve the metadata from the service. If you require your service to publish metadata in a secure manner. see [Custom Secure Metadata Endpoint](../samples/custom-secure-metadata-endpoint.md). +> This topic shows how to publish metadata in an unsecure manner. Any client can retrieve the metadata from the service. If you require your service to publish metadata in a secure manner. see [Custom Secure Metadata Endpoint](/previous-versions/dotnet/framework/wcf/samples/custom-secure-metadata-endpoint). For more information about publishing metadata in a configuration file, see [How to: Publish Metadata for a Service Using a Configuration File](how-to-publish-metadata-for-a-service-using-a-configuration-file.md). Publishing metadata allows clients to retrieve the metadata using a WS-Transfer GET request or an HTTP/GET request using the `?wsdl` query string. To be sure that the code is working you must create a basic WCF service. A basic self-hosted service is provided in the following code. @@ -65,7 +65,7 @@ This is one of two how-to topics that discuss publishing metadata for a Windows [!code-vb[htPublishMetadataCode#9](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/htpublishmetadatacode/vb/program.vb#9)] > [!NOTE] - > If you do not add any endpoints to the service, the runtime adds default endpoints for you. In this example, because the service has a set to `true`, the service has publishing metadata enabled. For more information about default endpoints, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](../samples/simplified-configuration-for-wcf-services.md). + > If you do not add any endpoints to the service, the runtime adds default endpoints for you. In this example, because the service has a set to `true`, the service has publishing metadata enabled. For more information about default endpoints, see [Simplified Configuration](../simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). 9. Open the service host and wait for incoming calls. When the user presses ENTER, close the service host. @@ -86,7 +86,7 @@ This is one of two how-to topics that discuss publishing metadata for a Windows ## See also - [How to: Host a WCF Service in a Managed Application](../how-to-host-a-wcf-service-in-a-managed-application.md) -- [Self-Host](../samples/self-host.md) +- [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) - [Metadata Architecture Overview](metadata-architecture-overview.md) - [Using Metadata](using-metadata.md) - [How to: Publish Metadata for a Service Using a Configuration File](how-to-publish-metadata-for-a-service-using-a-configuration-file.md) diff --git a/docs/framework/wcf/feature-details/how-to-secure-messages-within-reliable-sessions.md b/docs/framework/wcf/feature-details/how-to-secure-messages-within-reliable-sessions.md index 6ce939a4b62a5..1d913b116aa71 100644 --- a/docs/framework/wcf/feature-details/how-to-secure-messages-within-reliable-sessions.md +++ b/docs/framework/wcf/feature-details/how-to-secure-messages-within-reliable-sessions.md @@ -19,7 +19,7 @@ This procedure consists of the following three key tasks: It's important in the first task that the endpoint configuration element contain a `bindingConfiguration` attribute that references a binding configuration named (in this example) `MessageSecurity`. The [**\**](../../configure-apps/file-schema/wcf/bindings.md) configuration element then references this name to enable reliable sessions by setting the `enabled` attribute of the [**\**](/previous-versions/ms731375(v=vs.90)) element to `true`. You can require that the ordered delivery assurances are available within a reliable session by setting the `ordered` attribute to `true`. -For the source copy of the example on which this configuration procedure is based, see the [WS Reliable Session](../samples/ws-reliable-session.md). +For the source copy of the example on which this configuration procedure is based, see the [WS Reliable Session](/previous-versions/dotnet/framework/wcf/samples/ws-reliable-session). The essential items of the second task are accomplished by setting the `mode` attribute of the **\** element contained in the **\** element of the client and service to `Message`. diff --git a/docs/framework/wcf/feature-details/how-to-serialize-and-deserialize-json-data.md b/docs/framework/wcf/feature-details/how-to-serialize-and-deserialize-json-data.md index 8d355d74e608e..618d9f682d01d 100644 --- a/docs/framework/wcf/feature-details/how-to-serialize-and-deserialize-json-data.md +++ b/docs/framework/wcf/feature-details/how-to-serialize-and-deserialize-json-data.md @@ -15,7 +15,7 @@ This article demonstrates how to serialize .NET type objects into JSON-encoded d Normally, JSON serialization and deserialization are handled automatically by Windows Communication Foundation (WCF) when you use data contract types in service operations that are exposed over AJAX-enabled endpoints. However, in some cases you may need to work with JSON data directly. -This article is based on the [DataContractJsonSerializer sample](../samples/json-serialization.md). +This article is based on the [DataContractJsonSerializer sample](/previous-versions/dotnet/framework/wcf/samples/json-serialization). ## To define the data contract for a Person type diff --git a/docs/framework/wcf/feature-details/how-to-service-data-partitioning.md b/docs/framework/wcf/feature-details/how-to-service-data-partitioning.md index 7fbeec5ece6b2..7c9e1176ba9b4 100644 --- a/docs/framework/wcf/feature-details/how-to-service-data-partitioning.md +++ b/docs/framework/wcf/feature-details/how-to-service-data-partitioning.md @@ -172,4 +172,4 @@ This topic outlines the basic steps required to partition messages across multip ## See also -- [Routing Services](../samples/routing-services.md) +- [Routing Services](/previous-versions/dotnet/framework/wcf/samples/routing-services) diff --git a/docs/framework/wcf/feature-details/how-to-service-versioning.md b/docs/framework/wcf/feature-details/how-to-service-versioning.md index 827b6ff743ee1..49fee82bfcd7d 100644 --- a/docs/framework/wcf/feature-details/how-to-service-versioning.md +++ b/docs/framework/wcf/feature-details/how-to-service-versioning.md @@ -4,324 +4,322 @@ title: "How To: Service Versioning" ms.date: "03/30/2017" ms.assetid: 4287b6b3-b207-41cf-aebe-3b1d4363b098 --- + # How To: Service Versioning -This topic outlines the basic steps required to create a routing configuration that routes messages to different versions of the same service. In this example, messages are routed to two different versions of a calculator service, `roundingCalc` (v1) and `regularCalc` (v2). Both implementations support the same operations; however the older service, `roundingCalc`, rounds all calculations to the nearest integer value before returning. A client application must be able to indicate whether to use the newer `regularCalc` service. - +This topic outlines the basic steps required to create a routing configuration that routes messages to different versions of the same service. In this example, messages are routed to two different versions of a calculator service, `roundingCalc` (v1) and `regularCalc` (v2). Both implementations support the same operations; however the older service, `roundingCalc`, rounds all calculations to the nearest integer value before returning. A client application must be able to indicate whether to use the newer `regularCalc` service. + > [!WARNING] -> In order to route a message to a specific service version, the Routing Service must be able to determine the message destination based on the message content. In the method demonstrated below, the client will specify the version by inserting information into a message header. There are methods of service versioning that do not require clients to pass additional data. For example, a message could be routed to the most recent or most compatible version of a service or the router could use a part of the standard SOAP envelope. - - The operations exposed by both services are: - -- Add - -- Subtract - -- Multiply - -- Divide - - Because both service implementations handle the same operations, and are essentially identical other than the data that they return, the base data contained in messages sent from client applications is not unique enough to allow you to determine how to route the request. For example, Action filters cannot be used because the default actions for both services are the same. - - This can be resolved in several ways, such as exposing a specific endpoint on the router for each version of the service or adding a custom header element to the message to indicate service version. Each of these approaches allows you to uniquely route incoming messages to a specific version of the service, but utilizing unique message content is the preferred method of differentiating between requests for different service versions. - - In this example, the client application adds the ‘CalcVer’ custom header to the request message. This header will contain a value that indicates the version of the service that the message should be routed to. A value of ‘1’ indicates that the message must be processed by the roundingCalc service, while a value of ‘2’ indicates the regularCalc service. This allows the client application to directly control which version of the service will process the message. Since the custom header is a value contained within the message, you can use one endpoint to receive messages destined for both versions of the service. The following code can be used in the client application to add this custom header to the message: - -```csharp -messageHeadersElement.Add(MessageHeader.CreateHeader("CalcVer", "http://my.custom.namespace/", "2")); -``` - -### Implement Service Versioning - -1. Create the basic Routing Service configuration by specifying the service endpoint exposed by the service. The following example defines a single service endpoint, which will be used to receive messages. It also defines the client endpoints which will be used to send messages to the `roundingCalc` (v1) and the `regularCalc` (v2) services. - - ```xml - - - - - - - - - - - - - - - - - - ``` - -2. Define the filters used to route messages to the destination endpoints. For this example, the XPath filter is used to detect the value of the "CalcVer" custom header to determine which version the message should be routed to. An XPath filter is also used to detect messages that do not contain the "CalcVer" header. The following example defines the required filters and namespace table. - - ```xml - - - - - - - - - - - - +> In order to route a message to a specific service version, the Routing Service must be able to determine the message destination based on the message content. In the method demonstrated below, the client will specify the version by inserting information into a message header. There are methods of service versioning that do not require clients to pass additional data. For example, a message could be routed to the most recent or most compatible version of a service or the router could use a part of the standard SOAP envelope. + +The operations exposed by both services are: + +- Add +- Subtract +- Multiply +- Divide + +Because both service implementations handle the same operations, and are essentially identical other than the data that they return, the base data contained in messages sent from client applications is not unique enough to allow you to determine how to route the request. For example, Action filters cannot be used because the default actions for both services are the same. + +This can be resolved in several ways, such as exposing a specific endpoint on the router for each version of the service or adding a custom header element to the message to indicate service version. Each of these approaches allows you to uniquely route incoming messages to a specific version of the service, but utilizing unique message content is the preferred method of differentiating between requests for different service versions. + +In this example, the client application adds the ‘CalcVer’ custom header to the request message. This header will contain a value that indicates the version of the service that the message should be routed to. A value of ‘1’ indicates that the message must be processed by the roundingCalc service, while a value of ‘2’ indicates the regularCalc service. This allows the client application to directly control which version of the service will process the message. Since the custom header is a value contained within the message, you can use one endpoint to receive messages destined for both versions of the service. The following code can be used in the client application to add this custom header to the message: + +```csharp +messageHeadersElement.Add(MessageHeader.CreateHeader("CalcVer", "http://my.custom.namespace/", "2")); +``` + +### Implement Service Versioning + +1. Create the basic Routing Service configuration by specifying the service endpoint exposed by the service. The following example defines a single service endpoint, which will be used to receive messages. It also defines the client endpoints which will be used to send messages to the `roundingCalc` (v1) and the `regularCalc` (v2) services. + + ```xml + + + + + + + + + + + + + + + + + + ``` + +2. Define the filters used to route messages to the destination endpoints. For this example, the XPath filter is used to detect the value of the "CalcVer" custom header to determine which version the message should be routed to. An XPath filter is also used to detect messages that do not contain the "CalcVer" header. The following example defines the required filters and namespace table. + + ```xml + + + + + + + + + + + + - ``` - + ``` + > [!NOTE] > The s12 namespace prefix is defined by default in the namespace table, and represents the namespace `http://www.w3.org/2003/05/soap-envelope`. - -3. Define the filter table, which associates each filter with a client endpoint. If the message contains the "CalcVer" header with a value of 1, it will be sent to the regularCalc service. If the header contains a value of 2, it will be sent to the roundingCalc service. If no header is present, the message will be routed to the regularCalc. - - The following defines the filter table and adds the filters defined earlier. - - ```xml - - - - - - - - - - - - ``` - -4. To evaluate incoming messages against the filters contained in the filter table, you must associate the filter table with the service endpoints by using the routing behavior. The following example demonstrates associating `filterTable1` with the service endpoints: - - ```xml - - - - - - - - - ``` - -## Example - - The following is a complete listing of the configuration file. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## Example - - The following is a complete listing of the client application. - -```csharp -using System; -using System.ServiceModel; -using System.ServiceModel.Channels; - -namespace Microsoft.Samples.AdvancedFilters -{ - //The service contract is defined in generatedClient.cs, generated from the service by the svcutil tool. - - //Client implementation code. - class Client - { - static void Main() - { - //Print out the welcome text - Console.WriteLine("This sample routes the Calculator Sample through the new WCF RoutingService"); - Console.WriteLine("Wait for all the services to indicate that they've started, then press"); - Console.WriteLine(" to start the client."); - - while (Console.ReadLine() != "quit") - { - //Offer the Address configuration for the client - Console.WriteLine(""); - Console.WriteLine("Welcome to the Calculator Client!"); - - EndpointAddress epa; - //set the default address as the general router endpoint - epa = new EndpointAddress("http://localhost/routingservice/router/calculator"); - - //set up the CalculatorClient with the EndpointAddress, the WSHttpBinding, and the ICalculator contract - //We use the WSHttpBinding so that the outgoing has a message envelope, which we'll manipulate in a minute - CalculatorClient client = new CalculatorClient(new WSHttpBinding(), epa); - //client.Endpoint.Contract = ContractDescription.GetContract(typeof(ICalculator)); - - //Ask the customer if they want to add a custom header to the outgoing message. - //The Router will look for this header, and if so ignore the endpoint the message was - //received on, and instead direct the message to the RoundingCalcService. - Console.WriteLine(""); - Console.WriteLine("Which calculator service should be used?"); - Console.WriteLine("Enter 1 for the rounding calculator, 2 for the regular calculator."); - Console.WriteLine("[1] or [2]?"); - - string header = Console.ReadLine(); - - //get the current operationContextScope from the client's inner channel - using (OperationContextScope ocs = new OperationContextScope((client.InnerChannel))) - { - //get the outgoing message headers element (collection) from the context - MessageHeaders messageHeadersElement = OperationContext.Current.OutgoingMessageHeaders; - - //if they wanted to create the header, go ahead and add it to the outgoing message - if (header != null && (header=="1" || header=="2")) - { + +3. Define the filter table, which associates each filter with a client endpoint. If the message contains the "CalcVer" header with a value of 1, it will be sent to the regularCalc service. If the header contains a value of 2, it will be sent to the roundingCalc service. If no header is present, the message will be routed to the regularCalc. + + The following defines the filter table and adds the filters defined earlier. + + ```xml + + + + + + + + + + + + ``` + +4. To evaluate incoming messages against the filters contained in the filter table, you must associate the filter table with the service endpoints by using the routing behavior. The following example demonstrates associating `filterTable1` with the service endpoints: + + ```xml + + + + + + + + + ``` + +## Example 1 + +The following is a complete listing of the configuration file. + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +## Example 2 + +The following is a complete listing of the client application. + +```csharp +using System; +using System.ServiceModel; +using System.ServiceModel.Channels; + +namespace Microsoft.Samples.AdvancedFilters +{ + //The service contract is defined in generatedClient.cs, generated from the service by the svcutil tool. + + //Client implementation code. + class Client + { + static void Main() + { + //Print out the welcome text + Console.WriteLine("This sample routes the Calculator Sample through the new WCF RoutingService"); + Console.WriteLine("Wait for all the services to indicate that they've started, then press"); + Console.WriteLine(" to start the client."); + + while (Console.ReadLine() != "quit") + { + //Offer the Address configuration for the client + Console.WriteLine(""); + Console.WriteLine("Welcome to the Calculator Client!"); + + EndpointAddress epa; + //set the default address as the general router endpoint + epa = new EndpointAddress("http://localhost/routingservice/router/calculator"); + + //Set up the CalculatorClient with the EndpointAddress, the WSHttpBinding, and the ICalculator contract. + //We use the WSHttpBinding so that the outgoing has a message envelope. + CalculatorClient client = new CalculatorClient(new WSHttpBinding(), epa); + //client.Endpoint.Contract = ContractDescription.GetContract(typeof(ICalculator)); + + //Ask the customer if they want to add a custom header to the outgoing message. + //The Router will look for this header, and if so ignore the endpoint the message was + //received on, and instead direct the message to the RoundingCalcService. + Console.WriteLine(""); + Console.WriteLine("Which calculator service should be used?"); + Console.WriteLine("Enter 1 for the rounding calculator, 2 for the regular calculator."); + Console.WriteLine("[1] or [2]?"); + + string header = Console.ReadLine(); + + //get the current operationContextScope from the client's inner channel + using (OperationContextScope ocs = new OperationContextScope((client.InnerChannel))) + { + //get the outgoing message headers element (collection) from the context + MessageHeaders messageHeadersElement = OperationContext.Current.OutgoingMessageHeaders; + + //if they wanted to create the header, go ahead and add it to the outgoing message + if (header != null && (header=="1" || header=="2")) + { //create a new header "RoundingCalculator", no specific namespace, and set the value to - //the value of header. - //the Routing Service will look for this header in order to determine if the message - //should be routed to the RoundingCalculator - messageHeadersElement.Add(MessageHeader.CreateHeader("CalcVer", "http://my.custom.namespace/", header)); - } - else //incorrect choice, no header added - { - Console.WriteLine("Incorrect value entered, not adding a header"); - } - - //call the client operations - CallClient(client); - } - - //close the client to clean it up - client.Close(); - Console.WriteLine(); - Console.WriteLine("Press to run the client again or type 'quit' to quit."); - } - } - - private static void CallClient(CalculatorClient client) - { - Console.WriteLine(""); - Console.WriteLine("Sending!"); - // Call the Add service operation. - double value1 = 100.00D; - double value2 = 15.99D; - double result = client.Add(value1, value2); - Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); - - // Call the Subtract service operation. - value1 = 145.00D; - value2 = 76.54D; - result = client.Subtract(value1, value2); - Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result); - - // Call the Multiply service operation. - value1 = 9.00D; - value2 = 81.25D; - result = client.Multiply(value1, value2); - Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result); - - // Call the Divide service operation. - value1 = 22.00D; - value2 = 7.00D; - result = client.Divide(value1, value2); - Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result); - - } - } -} -``` - + //the value of header. + //the Routing Service will look for this header in order to determine if the message + //should be routed to the RoundingCalculator + messageHeadersElement.Add(MessageHeader.CreateHeader("CalcVer", "http://my.custom.namespace/", header)); + } + else //incorrect choice, no header added + { + Console.WriteLine("Incorrect value entered, not adding a header"); + } + + //call the client operations + CallClient(client); + } + + //close the client to clean it up + client.Close(); + Console.WriteLine(); + Console.WriteLine("Press to run the client again or type 'quit' to quit."); + } + } + + private static void CallClient(CalculatorClient client) + { + Console.WriteLine(""); + Console.WriteLine("Sending!"); + // Call the Add service operation. + double value1 = 100.00D; + double value2 = 15.99D; + double result = client.Add(value1, value2); + Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); + + // Call the Subtract service operation. + value1 = 145.00D; + value2 = 76.54D; + result = client.Subtract(value1, value2); + Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result); + + // Call the Multiply service operation. + value1 = 9.00D; + value2 = 81.25D; + result = client.Multiply(value1, value2); + Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result); + + // Call the Divide service operation. + value1 = 22.00D; + value2 = 7.00D; + result = client.Divide(value1, value2); + Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result); + + } + } +} +``` + ## See also -- [Routing Services](../samples/routing-services.md) +- [Routing Services](/previous-versions/dotnet/framework/wcf/samples/routing-services) diff --git a/docs/framework/wcf/feature-details/how-to-specify-channel-security-credentials.md b/docs/framework/wcf/feature-details/how-to-specify-channel-security-credentials.md index 339dbbf874ac7..ea65d86c6a1f4 100644 --- a/docs/framework/wcf/feature-details/how-to-specify-channel-security-credentials.md +++ b/docs/framework/wcf/feature-details/how-to-specify-channel-security-credentials.md @@ -11,7 +11,7 @@ The Windows Communication Foundation (WCF) Service Moniker allows COM applicatio > [!NOTE] > is an IDispatch-based interface and you will not get IntelliSense functionality in the Visual Studio environment. - This article will use the WCF service defined in the [Message Security Sample](../samples/message-security-sample.md). + This article will use the WCF service defined in the [Message Security Sample](/previous-versions/dotnet/framework/wcf/samples/message-security-sample). ### To specify a client certificate @@ -111,7 +111,7 @@ The Windows Communication Foundation (WCF) Service Moniker allows COM applicatio ### To specify an issue token -1. Issue tokens are used only for applications using federated security. For more information about federated security, see [Federation and Issued Tokens](federation-and-issued-tokens.md) and [Federation Sample](../samples/federation-sample.md). +1. Issue tokens are used only for applications using federated security. For more information about federated security, see [Federation and Issued Tokens](federation-and-issued-tokens.md) and [Federation Sample](/previous-versions/dotnet/framework/wcf/samples/federation-sample). The following Visual Basic code example illustrates how to call the method: diff --git a/docs/framework/wcf/feature-details/how-to-use-a-custom-user-name-and-password-validator.md b/docs/framework/wcf/feature-details/how-to-use-a-custom-user-name-and-password-validator.md index ded565213edad..086fd55c4a8f3 100644 --- a/docs/framework/wcf/feature-details/how-to-use-a-custom-user-name-and-password-validator.md +++ b/docs/framework/wcf/feature-details/how-to-use-a-custom-user-name-and-password-validator.md @@ -13,7 +13,7 @@ ms.assetid: 8e08b74b-fa44-4018-b63d-0d0805f85e3f By default, when a user name and password is used for authentication, Windows Communication Foundation (WCF) uses Windows to validate the user name and password. However, WCF allows for custom user name and password authentication schemes, also known as *validators*. To incorporate a custom user name and password validator, create a class that derives from and then configure it. -For a sample application, see [User Name Password Validator](../samples/user-name-password-validator.md). +For a sample application, see [User Name Password Validator](/previous-versions/dotnet/framework/wcf/samples/user-name-password-validator). ### To create a custom user name and password validator diff --git a/docs/framework/wcf/feature-details/how-to-use-a-service-moniker-with-wsdl-contracts.md b/docs/framework/wcf/feature-details/how-to-use-a-service-moniker-with-wsdl-contracts.md index 22764e20c57b0..9132e4fd770a7 100644 --- a/docs/framework/wcf/feature-details/how-to-use-a-service-moniker-with-wsdl-contracts.md +++ b/docs/framework/wcf/feature-details/how-to-use-a-service-moniker-with-wsdl-contracts.md @@ -52,5 +52,5 @@ There are situations when you may want to have a completely self-contained COM I ## See also -- [Getting Started](../samples/getting-started-sample.md) +- [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample) - [Integrating with COM Applications Overview](integrating-with-com-applications-overview.md) diff --git a/docs/framework/wcf/feature-details/how-to-use-configuration-to-add-an-aspnet-ajax-endpoint.md b/docs/framework/wcf/feature-details/how-to-use-configuration-to-add-an-aspnet-ajax-endpoint.md index 7419cf5861a43..a20a094ca8dc7 100644 --- a/docs/framework/wcf/feature-details/how-to-use-configuration-to-add-an-aspnet-ajax-endpoint.md +++ b/docs/framework/wcf/feature-details/how-to-use-configuration-to-add-an-aspnet-ajax-endpoint.md @@ -8,7 +8,7 @@ ms.assetid: 7cd0099e-dc3a-47e4-a38c-6e10f997f6ea Windows Communication Foundation (WCF) allows you to create a service that makes an ASP.NET AJAX-enabled endpoint available that can be called from JavaScript on a client Web site. To create such an endpoint, you can either use a configuration file, as with all other Windows Communication Foundation (WCF) endpoints, or use a method that does not require any configuration elements. This topic demonstrates the configuration approach. - The part of the procedure that enables the service endpoint to become ASP.NET AJAX-enabled consists of configuring the endpoint to use the and to add the [\](../../configure-apps/file-schema/wcf/enablewebscript.md) endpoint behavior. After configuring the endpoint, the steps to implement and host the service are similar to those used by any WCF service. For a working example, see the [AJAX Service Using HTTP POST](../samples/ajax-service-using-http-post.md). + The part of the procedure that enables the service endpoint to become ASP.NET AJAX-enabled consists of configuring the endpoint to use the and to add the [\](../../configure-apps/file-schema/wcf/enablewebscript.md) endpoint behavior. After configuring the endpoint, the steps to implement and host the service are similar to those used by any WCF service. For a working example, see the [AJAX Service Using HTTP POST](/previous-versions/dotnet/framework/wcf/samples/ajax-service-using-http-post). For more information about how to configure an ASP.NET AJAX endpoint without using configuration, see [How to: Add an ASP.NET AJAX Endpoint Without Using Configuration](how-to-add-an-aspnet-ajax-endpoint-without-using-configuration.md). @@ -98,7 +98,7 @@ Windows Communication Foundation (WCF) allows you to create a service that makes ## To call the service -1. The endpoint is configured at an empty address relative to the .svc file, so the service is now available and can be invoked by sending requests to service.svc/\ - for example, service.svc/Add for the `Add` operation. You can use it by entering the endpoint URL into the Scripts collection of the ASP.NET AJAX Script Manager control. For an example, see the [AJAX Service Using HTTP POST](../samples/ajax-service-using-http-post.md). +1. The endpoint is configured at an empty address relative to the .svc file, so the service is now available and can be invoked by sending requests to service.svc/\ - for example, service.svc/Add for the `Add` operation. You can use it by entering the endpoint URL into the Scripts collection of the ASP.NET AJAX Script Manager control. For an example, see the [AJAX Service Using HTTP POST](/previous-versions/dotnet/framework/wcf/samples/ajax-service-using-http-post). ## See also diff --git a/docs/framework/wcf/feature-details/how-to-use-filters.md b/docs/framework/wcf/feature-details/how-to-use-filters.md index ebf24d6fcf00f..9f323be174b78 100644 --- a/docs/framework/wcf/feature-details/how-to-use-filters.md +++ b/docs/framework/wcf/feature-details/how-to-use-filters.md @@ -324,4 +324,4 @@ This topic outlines the basic steps required to create a routing configuration t ## See also -- [Routing Services](../samples/routing-services.md) +- [Routing Services](/previous-versions/dotnet/framework/wcf/samples/routing-services) diff --git a/docs/framework/wcf/feature-details/how-to-use-svcutil-exe-to-export-metadata-from-compiled-service-code.md b/docs/framework/wcf/feature-details/how-to-use-svcutil-exe-to-export-metadata-from-compiled-service-code.md index 4524c0b206cec..d3b2f4866da6d 100644 --- a/docs/framework/wcf/feature-details/how-to-use-svcutil-exe-to-export-metadata-from-compiled-service-code.md +++ b/docs/framework/wcf/feature-details/how-to-use-svcutil-exe-to-export-metadata-from-compiled-service-code.md @@ -19,7 +19,7 @@ Svcutil.exe can export metadata for services, contracts, and data types in compi ### To export metadata for compiled service contracts -1. Compile your service contract implementations into one or more class libraries.1 +1. Compile your service contract implementations into one or more class libraries. 2. Run Svcutil.exe on the compiled assemblies. diff --git a/docs/framework/wcf/feature-details/how-to-use-the-aspnet-membership-provider.md b/docs/framework/wcf/feature-details/how-to-use-the-aspnet-membership-provider.md index 7feb85e831025..5e7c4dd3bb7db 100644 --- a/docs/framework/wcf/feature-details/how-to-use-the-aspnet-membership-provider.md +++ b/docs/framework/wcf/feature-details/how-to-use-the-aspnet-membership-provider.md @@ -12,7 +12,7 @@ ms.assetid: 322c56e0-938f-4f19-a981-7b6530045b90 The ASP.NET membership provider is a feature that enables ASP.NET developers to create Web sites that allow users to create unique user name and password combinations. With this facility, any user can establish an account with the site, and sign in for exclusive access to the site and its services. This is in contrast to Windows security, which requires users to have accounts in a Windows domain. Instead, any user that supplies their credentials (the user name/password combination) can use the site and its services. -For a sample application, see [Membership and Role Provider](../samples/membership-and-role-provider.md). For information about using the ASP.NET role provider feature, see [How to: Use the ASP.NET Role Provider with a Service](how-to-use-the-aspnet-role-provider-with-a-service.md). +For a sample application, see [Membership and Role Provider](/previous-versions/dotnet/framework/wcf/samples/membership-and-role-provider). For information about using the ASP.NET role provider feature, see [How to: Use the ASP.NET Role Provider with a Service](how-to-use-the-aspnet-role-provider-with-a-service.md). The membership feature requires using a SQL Server database to store the user information. The feature also includes methods for prompting with a question any users who have forgotten their password. @@ -154,4 +154,4 @@ The following code shows the configuration for a service that uses the ASP membe ## See also - [How to: Use the ASP.NET Role Provider with a Service](how-to-use-the-aspnet-role-provider-with-a-service.md) -- [Membership and Role Provider](../samples/membership-and-role-provider.md) +- [Membership and Role Provider](/previous-versions/dotnet/framework/wcf/samples/membership-and-role-provider) diff --git a/docs/framework/wcf/feature-details/how-to-use-the-aspnet-role-provider-with-a-service.md b/docs/framework/wcf/feature-details/how-to-use-the-aspnet-role-provider-with-a-service.md index e73f501ee572f..528cb39ab8d06 100644 --- a/docs/framework/wcf/feature-details/how-to-use-the-aspnet-role-provider-with-a-service.md +++ b/docs/framework/wcf/feature-details/how-to-use-the-aspnet-role-provider-with-a-service.md @@ -8,7 +8,7 @@ ms.assetid: 88d33a81-8ac7-48de-978c-5c5b1257951e The ASP.NET role provider (in conjunction with the ASP.NET membership provider) is a feature that enables ASP.NET developers to create Web sites that allow users to create an account with a site and to be assigned roles for authorization purposes. With this feature, any user can establish an account with the site, and log in for exclusive access to the site and its services. This is in contrast to Windows security, which requires users to have accounts in a Windows domain. Instead, any user who supplies their credentials (the user name/password combination) can use the site and its services. -For a sample application, see [Membership and Role Provider](../samples/membership-and-role-provider.md). For more information about the ASP.NET membership provider feature, see [How to: Use the ASP.NET Membership Provider](how-to-use-the-aspnet-membership-provider.md). +For a sample application, see [Membership and Role Provider](/previous-versions/dotnet/framework/wcf/samples/membership-and-role-provider). For more information about the ASP.NET membership provider feature, see [How to: Use the ASP.NET Membership Provider](how-to-use-the-aspnet-membership-provider.md). The role provider feature uses a SQL Server database to store user information. Windows Communication Foundation (WCF) developers can take advantage of these features for security purposes. When integrated into a WCF application, users must supply a user name/password combination to the WCF client application. To enable WCF to use the database, you must create an instance of the class, set its property to , and add the instance to the collection of behaviors to the that is hosting the service. @@ -64,5 +64,5 @@ The role provider feature uses a SQL Server database to store user information. ## See also -- [Membership and Role Provider](../samples/membership-and-role-provider.md) +- [Membership and Role Provider](/previous-versions/dotnet/framework/wcf/samples/membership-and-role-provider) - [How to: Use the ASP.NET Membership Provider](how-to-use-the-aspnet-membership-provider.md) diff --git a/docs/framework/wcf/feature-details/http-post-and-http-get-requests-for-aspnet-ajax-endpoints.md b/docs/framework/wcf/feature-details/http-post-and-http-get-requests-for-aspnet-ajax-endpoints.md index 099fc4798ef83..19eb45cc2b07c 100644 --- a/docs/framework/wcf/feature-details/http-post-and-http-get-requests-for-aspnet-ajax-endpoints.md +++ b/docs/framework/wcf/feature-details/http-post-and-http-get-requests-for-aspnet-ajax-endpoints.md @@ -23,9 +23,9 @@ Windows Communication Foundation (WCF) allows you to create a service that expos An operation marked with the always uses a GET request. An operation marked with the , or not marked with any of the two attributes, uses a POST request. The allows the use of other HTTP verbs, other than GET and POST (such as PUT and DELETE) through the property. However, these verbs are not supported by ASP.NET AJAX. If you intend to use the service from ASP.NET pages using the Script Manager control, do not use the property. - For a working example of switching to GET, see the [Basic AJAX Service](../samples/basic-ajax-service.md) sample. + For a working example of switching to GET, see the [Basic AJAX Service](/previous-versions/dotnet/framework/wcf/samples/basic-ajax-service) sample. - For a sample that uses POST, see the [AJAX Service Using HTTP POST](../samples/ajax-service-using-http-post.md) sample. + For a sample that uses POST, see the [AJAX Service Using HTTP POST](/previous-versions/dotnet/framework/wcf/samples/ajax-service-using-http-post) sample. ## To create a WCF service that responds to HTTP GET or HTTP POST requests @@ -84,7 +84,7 @@ Windows Communication Foundation (WCF) allows you to create a service that expos 1. You can test your service's GET operations without any client code, by using the browser. For example, if your service is configured at the `http://example.com/service.svc` address, then typing `http://example.com/service.svc/LookUpArtist?album=SomeAlbum` into the browser address bar invokes the service and causes the response to be downloaded or displayed. -2. You can use services with GET operations in the same way as any other ASP.NET AJAX services - by entering the service URL into the Scripts collection of the ASP.NET AJAX Script Manager control. For an example, see the [Basic AJAX Service](../samples/basic-ajax-service.md). +2. You can use services with GET operations in the same way as any other ASP.NET AJAX services - by entering the service URL into the Scripts collection of the ASP.NET AJAX Script Manager control. For an example, see the [Basic AJAX Service](/previous-versions/dotnet/framework/wcf/samples/basic-ajax-service). ## See also diff --git a/docs/framework/wcf/feature-details/internet-information-services-hosting-best-practices.md b/docs/framework/wcf/feature-details/internet-information-services-hosting-best-practices.md index 69ffb9ca83aa3..0bcc2d1326153 100644 --- a/docs/framework/wcf/feature-details/internet-information-services-hosting-best-practices.md +++ b/docs/framework/wcf/feature-details/internet-information-services-hosting-best-practices.md @@ -87,5 +87,5 @@ This topic outlines some best practices for hosting Windows Communication Founda ## See also -- [Service Hosting Samples](../samples/hosting.md) +- [Service Hosting Samples](/previous-versions/dotnet/framework/wcf/samples/hosting) - [Windows Server App Fabric Hosting Features](/previous-versions/appfabric/ee677189(v=azure.10)) diff --git a/docs/framework/wcf/feature-details/large-data-and-streaming.md b/docs/framework/wcf/feature-details/large-data-and-streaming.md index 3342e8bf4e1e4..c154704d364bc 100644 --- a/docs/framework/wcf/feature-details/large-data-and-streaming.md +++ b/docs/framework/wcf/feature-details/large-data-and-streaming.md @@ -78,7 +78,7 @@ Windows Communication Foundation (WCF) is an XML-based communications infrastruc ### Enabling MTOM - When interoperability is a requirement and large binary data must be sent, then MTOM message encoding is the alternative encoding strategy that you can enable on the standard or bindings by setting the respective `MessageEncoding` property to or by composing the into a . The following example code, extracted from the [MTOM Encoding](../samples/mtom-encoding.md) sample demonstrates how to enable MTOM in configuration. + When interoperability is a requirement and large binary data must be sent, then MTOM message encoding is the alternative encoding strategy that you can enable on the standard or bindings by setting the respective `MessageEncoding` property to or by composing the into a . The following example code, extracted from the [MTOM Encoding](/previous-versions/dotnet/framework/wcf/samples/mtom-encoding) sample demonstrates how to enable MTOM in configuration. ```xml diff --git a/docs/framework/wcf/feature-details/message-security-with-a-certificate-client.md b/docs/framework/wcf/feature-details/message-security-with-a-certificate-client.md index aca9afa414b81..1413ac43bc867 100644 --- a/docs/framework/wcf/feature-details/message-security-with-a-certificate-client.md +++ b/docs/framework/wcf/feature-details/message-security-with-a-certificate-client.md @@ -13,7 +13,7 @@ The following scenario shows a Windows Communication Foundation (WCF) client and ![Screenshot that shows a client with certificate.](./media/message-security-with-a-certificate-client/client-with-certificate.gif) - For a sample application, see [Message Security Certificate](../samples/message-security-certificate.md). + For a sample application, see [Message Security Certificate](/previous-versions/dotnet/framework/wcf/samples/message-security-certificate). |Characteristic|Description| |--------------------|-----------------| diff --git a/docs/framework/wcf/feature-details/message-security-with-a-user-name-client.md b/docs/framework/wcf/feature-details/message-security-with-a-user-name-client.md index d13a8597c8c30..2f510b58fb899 100644 --- a/docs/framework/wcf/feature-details/message-security-with-a-user-name-client.md +++ b/docs/framework/wcf/feature-details/message-security-with-a-user-name-client.md @@ -11,7 +11,7 @@ ms.assetid: 36335cb9-76b8-4443-92c7-44f081eabb21 The following illustration shows an Windows Communication Foundation (WCF) service and client secured using message-level security. The service is authenticated with an X.509 certificate. The client authenticates using a user name and password. - For a sample application, see [Message Security User Name](../samples/message-security-user-name.md). + For a sample application, see [Message Security User Name](/previous-versions/dotnet/framework/wcf/samples/message-security-user-name). ![Message security using username authentication](media/1fb10a61-7e1d-42f5-b1af-195bfee5b3c6.gif "1fb10a61-7e1d-42f5-b1af-195bfee5b3c6") @@ -129,7 +129,7 @@ The following illustration shows an Windows Communication Foundation (WCF) servi ## See also - [Security Overview](security-overview.md) -- [Message Security User Name](../samples/message-security-user-name.md) +- [Message Security User Name](/previous-versions/dotnet/framework/wcf/samples/message-security-user-name) - [Service Identity and Authentication](service-identity-and-authentication.md) - [\](../../configure-apps/file-schema/wcf/identity.md) - [Security Model for Windows Server App Fabric](/previous-versions/appfabric/ee677202(v=azure.10)) diff --git a/docs/framework/wcf/feature-details/message-security-with-an-anonymous-client.md b/docs/framework/wcf/feature-details/message-security-with-an-anonymous-client.md index d137f6d8af6c9..f0604a167d8fe 100644 --- a/docs/framework/wcf/feature-details/message-security-with-an-anonymous-client.md +++ b/docs/framework/wcf/feature-details/message-security-with-an-anonymous-client.md @@ -12,7 +12,7 @@ ms.assetid: cad53e1a-b7c9-4064-bc87-508c3d1dce49 The following scenario shows a client and service secured by Windows Communication Foundation (WCF) message security. A design goal is to use message security rather than transport security, so that in the future it can support a richer claims-based model. For more information about using rich claims for authorization, see [Managing Claims and Authorization with the Identity Model](managing-claims-and-authorization-with-the-identity-model.md). -For a sample application, see [Message Security Anonymous](../samples/message-security-anonymous.md). +For a sample application, see [Message Security Anonymous](/previous-versions/dotnet/framework/wcf/samples/message-security-anonymous). ![Message security with an anonymous client](media/b361a565-831c-4c10-90d7-66d8eeece0a1.gif "b361a565-831c-4c10-90d7-66d8eeece0a1") @@ -138,6 +138,6 @@ The following code configures the client. - [Security Overview](security-overview.md) - [Distributed Application Security](distributed-application-security.md) -- [Message Security Anonymous](../samples/message-security-anonymous.md) +- [Message Security Anonymous](/previous-versions/dotnet/framework/wcf/samples/message-security-anonymous) - [Service Identity and Authentication](service-identity-and-authentication.md) - [Security Model for Windows Server App Fabric](/previous-versions/appfabric/ee677202(v=azure.10)) diff --git a/docs/framework/wcf/feature-details/metadata-architecture-overview.md b/docs/framework/wcf/feature-details/metadata-architecture-overview.md index a55a891eb1766..021c354e175eb 100644 --- a/docs/framework/wcf/feature-details/metadata-architecture-overview.md +++ b/docs/framework/wcf/feature-details/metadata-architecture-overview.md @@ -55,7 +55,7 @@ Windows Communication Foundation (WCF) provides a rich infrastructure for export > > You can work around this issue by either adding the in the configuration file or adding both the endpoint and in code. > -> For an example of adding in an application configuration file, see the [Getting Started](../samples/getting-started-sample.md). For an example of adding in code, see the [Self-Host](../samples/self-host.md) sample. +> For an example of adding in an application configuration file, see the [Getting Started](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample). For an example of adding in code, see the [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) sample. > [!CAUTION] > When publishing metadata for a service that exposes two different service contracts in which each contain an operation of the same name an exception is thrown. For example, if you have a service that exposes a service contract called ICarService that has an operation Get(Car c) and the same service exposes a service contract called IBookService that has an operation Get(Book b), an exception is thrown or an error message is displayed when generating the service's metadata. To work around this issue do one of the following: diff --git a/docs/framework/wcf/feature-details/middle-tier-client-applications.md b/docs/framework/wcf/feature-details/middle-tier-client-applications.md index de75d3975dadd..42efc6b395abf 100644 --- a/docs/framework/wcf/feature-details/middle-tier-client-applications.md +++ b/docs/framework/wcf/feature-details/middle-tier-client-applications.md @@ -28,7 +28,7 @@ This topic discusses various issues specific to middle-tier client applications - You must handle faulted channels regardless of whether you share the channel. When channels are reused, however, a faulting channel can take down more than one pending request or send. - For an example that demonstrates best practices for reusing a client for multiple requests, see [Data Binding in an ASP.NET Client](../samples/data-binding-in-an-aspnet-client.md). + For an example that demonstrates best practices for reusing a client for multiple requests, see [Data Binding in an ASP.NET Client](/previous-versions/dotnet/framework/wcf/samples/data-binding-in-an-aspnet-client). In addition, you can increase the startup performance for those clients that use data types that are serializable using the generate and compile serialization code for those data types at runtime, which can result in slow start-up performance. The [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) can improve start-up performance for these applications by generating the necessary serialization code from the compiled assemblies for the application. For more information, see [How to: Improve the Startup Time of WCF Client Applications using the XmlSerializer](startup-time-of-wcf-client-applications-using-the-xmlserializer.md). diff --git a/docs/framework/wcf/feature-details/migrating-wse-3-0-web-services-to-wcf.md b/docs/framework/wcf/feature-details/migrating-wse-3-0-web-services-to-wcf.md index 3dbd822b493b7..ed8373515f236 100644 --- a/docs/framework/wcf/feature-details/migrating-wse-3-0-web-services-to-wcf.md +++ b/docs/framework/wcf/feature-details/migrating-wse-3-0-web-services-to-wcf.md @@ -75,7 +75,7 @@ The benefits of migrating WSE 3.0 Web services to Windows Communication Foundati When there is not a WCF authentication mode that is equivalent to a custom policy assertion that secures SOAP messages, derive a class from , or WCF classes and specify the equivalent binding element. For more details, see [How to: Create a Custom Binding Using the SecurityBindingElement](how-to-create-a-custom-binding-using-the-securitybindingelement.md). - To convert a custom policy assertion that does not secure a SOAP message, see [Filtering](filtering.md) and the sample [Custom Message Interceptor](../samples/custom-message-interceptor.md). + To convert a custom policy assertion that does not secure a SOAP message, see [Filtering](filtering.md) and the sample [Custom Message Interceptor](/previous-versions/dotnet/framework/wcf/samples/custom-message-interceptor). ### WSE 3.0 Custom Security Token @@ -120,7 +120,7 @@ The benefits of migrating WSE 3.0 Web services to Windows Communication Foundati ### TCP - By default, WSE 3.0 clients and Web services that send SOAP messages using the TCP transport do not interoperate with WCF clients and Web services. This incompatibility is due to differences in the framing used in the TCP protocol and for performance reasons. However, a WCF sample details how to implement a custom TCP session that interoperates with WSE 3.0. For details about this sample, see [Transport: WSE 3.0 TCP Interoperability](../samples/transport-wse-3-0-tcp-interoperability.md). + By default, WSE 3.0 clients and Web services that send SOAP messages using the TCP transport do not interoperate with WCF clients and Web services. This incompatibility is due to differences in the framing used in the TCP protocol and for performance reasons. However, a WCF sample details how to implement a custom TCP session that interoperates with WSE 3.0. For details about this sample, see [Transport: WSE 3.0 TCP Interoperability](/previous-versions/dotnet/framework/wcf/samples/transport-wse-3-0-tcp-interoperability). To specify that a WCF application uses the TCP transport, use the [\](../../configure-apps/file-schema/wcf/nettcpbinding.md). diff --git a/docs/framework/wcf/feature-details/one-way-services.md b/docs/framework/wcf/feature-details/one-way-services.md index 2456aa7ce78a0..9c93cd04d152e 100644 --- a/docs/framework/wcf/feature-details/one-way-services.md +++ b/docs/framework/wcf/feature-details/one-way-services.md @@ -37,7 +37,7 @@ public interface IOneWayCalculator } ``` - For a complete example, see the [One-Way](../samples/one-way.md) sample. + For a complete example, see the [One-Way](/previous-versions/dotnet/framework/wcf/samples/one-way) sample. ## Clients Blocking with One-Way Operations @@ -53,4 +53,4 @@ public interface IOneWayCalculator ## See also -- [One-Way](../samples/one-way.md) +- [One-Way](/previous-versions/dotnet/framework/wcf/samples/one-way) diff --git a/docs/framework/wcf/feature-details/ordered-processing-of-messages-in-single-concurrency-mode.md b/docs/framework/wcf/feature-details/ordered-processing-of-messages-in-single-concurrency-mode.md index 27bc873257807..39504faf67ec9 100644 --- a/docs/framework/wcf/feature-details/ordered-processing-of-messages-in-single-concurrency-mode.md +++ b/docs/framework/wcf/feature-details/ordered-processing-of-messages-in-single-concurrency-mode.md @@ -25,4 +25,4 @@ WCF makes no guarantees about the order in which messages are processed, unless ## See also - [Sessions, Instancing, and Concurrency](sessions-instancing-and-concurrency.md) -- [Concurrency](../samples/concurrency.md) +- [Concurrency](/previous-versions/dotnet/framework/wcf/samples/concurrency) diff --git a/docs/framework/wcf/feature-details/poison-message-handling.md b/docs/framework/wcf/feature-details/poison-message-handling.md index e41dcfafab4db..d9c2cadca57cd 100644 --- a/docs/framework/wcf/feature-details/poison-message-handling.md +++ b/docs/framework/wcf/feature-details/poison-message-handling.md @@ -60,7 +60,7 @@ The following are the maximum number of delivery attempts made for a message: When the service determines that a message is poison, the queued transport throws a that contains the `LookupId` of the poison message. - A receiving application can implement the interface to handle any errors that the application requires. For more information, see [Extending Control Over Error Handling and Reporting](../samples/extending-control-over-error-handling-and-reporting.md). + A receiving application can implement the interface to handle any errors that the application requires. For more information, see [Extending Control Over Error Handling and Reporting](/previous-versions/dotnet/framework/wcf/samples/extending-control-over-error-handling-and-reporting). The application may require some kind of automated handling of poison messages that moves the poison messages to a poison message queue so that the service can access the rest of the messages in the queue. The only scenario for using the error-handler mechanism to listen for poison-message exceptions is when the setting is set to . The poison-message sample for Message Queuing 3.0 demonstrates this behavior. The following outlines the steps to take to handle poison messages, including best practices: @@ -76,7 +76,7 @@ The following are the maximum number of delivery attempts made for a message: 4. Ensure that your service is annotated with the poison behavior attribute. - In addition, if the `ReceiveErrorHandling` is set to `Fault`, the `ServiceHost` faults when encountering the poison message. You can hook up to the faulted event and shut down the service, take corrective actions, and restart. For example, the `LookupId` in the propagated to the `IErrorHandler` can be noted and when the service host faults, you could use the `System.Messaging` API to receive the message from the queue using the `LookupId` to remove the message from the queue and store the message in some external store or another queue. You can then restart `ServiceHost` to resume normal processing. The [Poison Message Handling in MSMQ 4.0](../samples/poison-message-handling-in-msmq-4-0.md) demonstrates this behavior. + In addition, if the `ReceiveErrorHandling` is set to `Fault`, the `ServiceHost` faults when encountering the poison message. You can hook up to the faulted event and shut down the service, take corrective actions, and restart. For example, the `LookupId` in the propagated to the `IErrorHandler` can be noted and when the service host faults, you could use the `System.Messaging` API to receive the message from the queue using the `LookupId` to remove the message from the queue and store the message in some external store or another queue. You can then restart `ServiceHost` to resume normal processing. The [Poison Message Handling in MSMQ 4.0](/previous-versions/dotnet/framework/wcf/samples/poison-message-handling-in-msmq-4-0) demonstrates this behavior. ## Transaction Time-Out and Poison Messages diff --git a/docs/framework/wcf/feature-details/queues-overview.md b/docs/framework/wcf/feature-details/queues-overview.md index 1bab6f9c46016..3747d7d687020 100644 --- a/docs/framework/wcf/feature-details/queues-overview.md +++ b/docs/framework/wcf/feature-details/queues-overview.md @@ -77,10 +77,10 @@ This section introduces the general and core concepts behind queued communicatio ## See also - [Queuing in WCF](queuing-in-wcf.md) -- [Sessions and Queues](../samples/sessions-and-queues.md) -- [Dead Letter Queues](../samples/dead-letter-queues.md) -- [Volatile Queued Communication](../samples/volatile-queued-communication.md) -- [Windows Communication Foundation to Message Queuing](../samples/wcf-to-message-queuing.md) -- [Installing Message Queuing (MSMQ)](../samples/installing-message-queuing-msmq.md) -- [Message Queuing to Windows Communication Foundation](../samples/message-queuing-to-wcf.md) -- [Message Security over Message Queuing](../samples/message-security-over-message-queuing.md) +- [Sessions and Queues](/previous-versions/dotnet/framework/wcf/samples/sessions-and-queues) +- [Dead Letter Queues](/previous-versions/dotnet/framework/wcf/samples/dead-letter-queues) +- [Volatile Queued Communication](/previous-versions/dotnet/framework/wcf/samples/volatile-queued-communication) +- [Windows Communication Foundation to Message Queuing](/previous-versions/dotnet/framework/wcf/samples/wcf-to-message-queuing) +- [Installing Message Queuing (MSMQ)](/previous-versions/dotnet/framework/wcf/samples/installing-message-queuing-msmq) +- [Message Queuing to Windows Communication Foundation](/previous-versions/dotnet/framework/wcf/samples/message-queuing-to-wcf) +- [Message Security over Message Queuing](/previous-versions/dotnet/framework/wcf/samples/message-security-over-message-queuing) diff --git a/docs/framework/wcf/feature-details/queuing-in-wcf.md b/docs/framework/wcf/feature-details/queuing-in-wcf.md index dd7a68d3eb146..1117467eb7657 100644 --- a/docs/framework/wcf/feature-details/queuing-in-wcf.md +++ b/docs/framework/wcf/feature-details/queuing-in-wcf.md @@ -18,7 +18,7 @@ This section describes how to use queued communication in Windows Communication Caveats about queued binding in WCF include: -- All service operations must be one-way because the default queued binding in WCF does not support duplex communication using queues. A two-way communication sample ([Two-Way Communication](../samples/two-way-communication.md)) illustrates how to use two one-way contracts to implement duplex communication using queues. +- All service operations must be one-way because the default queued binding in WCF does not support duplex communication using queues. A two-way communication sample ([Two-Way Communication](/previous-versions/dotnet/framework/wcf/samples/two-way-communication)) illustrates how to use two one-way contracts to implement duplex communication using queues. - To generate a WCF client using metadata exchange requires an additional HTTP endpoint on the service so that it can be queried directly to generate the WCF client and obtain binding information to appropriately configure queued communication. @@ -36,7 +36,7 @@ This section describes how to use queued communication in Windows Communication MSMQ queues can also be secured using a Windows identity registered with the Active Directory directory service. When installing MSMQ, you can install Active Directory integration, which requires the computer to be part of a Windows domain network. - For more information about MSMQ, see [Installing Message Queuing (MSMQ)](../samples/installing-message-queuing-msmq.md). + For more information about MSMQ, see [Installing Message Queuing (MSMQ)](/previous-versions/dotnet/framework/wcf/samples/installing-message-queuing-msmq). ### NetMsmqBinding @@ -117,19 +117,19 @@ This section describes how to use queued communication in Windows Communication For a completed code sample illustrating the use of MSMQ in WCF see the following topics: -- [Transacted MSMQ Binding](../samples/transacted-msmq-binding.md) +- [Transacted MSMQ Binding](/previous-versions/dotnet/framework/wcf/samples/transacted-msmq-binding) -- [Volatile Queued Communication](../samples/volatile-queued-communication.md) +- [Volatile Queued Communication](/previous-versions/dotnet/framework/wcf/samples/volatile-queued-communication) -- [Dead Letter Queues](../samples/dead-letter-queues.md) +- [Dead Letter Queues](/previous-versions/dotnet/framework/wcf/samples/dead-letter-queues) -- [Sessions and Queues](../samples/sessions-and-queues.md) +- [Sessions and Queues](/previous-versions/dotnet/framework/wcf/samples/sessions-and-queues) -- [Two-Way Communication](../samples/two-way-communication.md) +- [Two-Way Communication](/previous-versions/dotnet/framework/wcf/samples/two-way-communication) -- [SRMP](../samples/srmp.md) +- [SRMP](/previous-versions/dotnet/framework/wcf/samples/srmp) -- [Message Security over Message Queuing](../samples/message-security-over-message-queuing.md) +- [Message Security over Message Queuing](/previous-versions/dotnet/framework/wcf/samples/message-security-over-message-queuing) ## See also diff --git a/docs/framework/wcf/feature-details/reliable-sessions-overview.md b/docs/framework/wcf/feature-details/reliable-sessions-overview.md index 2d82c3b35b1f0..eb99670dd06c6 100644 --- a/docs/framework/wcf/feature-details/reliable-sessions-overview.md +++ b/docs/framework/wcf/feature-details/reliable-sessions-overview.md @@ -124,4 +124,4 @@ If your scenario has any of the following characteristics, then you must serious ## See also - [Using Bindings to Configure Services and Clients](../using-bindings-to-configure-services-and-clients.md) -- [WS Reliable Session](../samples/ws-reliable-session.md) +- [WS Reliable Session](/previous-versions/dotnet/framework/wcf/samples/ws-reliable-session) diff --git a/docs/framework/wcf/feature-details/securing-messages-using-message-security.md b/docs/framework/wcf/feature-details/securing-messages-using-message-security.md index 9e2da7bbdef6c..a631cb1f0a355 100644 --- a/docs/framework/wcf/feature-details/securing-messages-using-message-security.md +++ b/docs/framework/wcf/feature-details/securing-messages-using-message-security.md @@ -68,6 +68,6 @@ This section discusses WCF message security when using . - A WCF service verifies that all messages it receives were addressed to the particular queue it is listening on. If the message’s destination queue does not match the queue it is found in, the service does not process the message. This is an issue that services listening to a dead-letter queue must address because any message in the dead-letter queue was meant to be delivered elsewhere. To read messages from a dead-letter queue, or from a poison queue, a `ServiceBehavior` with the parameter must be used. For an example, see [Dead Letter Queues](../samples/dead-letter-queues.md). + A WCF service verifies that all messages it receives were addressed to the particular queue it is listening on. If the message’s destination queue does not match the queue it is found in, the service does not process the message. This is an issue that services listening to a dead-letter queue must address because any message in the dead-letter queue was meant to be delivered elsewhere. To read messages from a dead-letter queue, or from a poison queue, a `ServiceBehavior` with the parameter must be used. For an example, see [Dead Letter Queues](/previous-versions/dotnet/framework/wcf/samples/dead-letter-queues). ## MsmqIntegrationBinding and Service Addressing diff --git a/docs/framework/wcf/feature-details/service-identity-and-authentication.md b/docs/framework/wcf/feature-details/service-identity-and-authentication.md index 8a4a50f2be870..7d8b45523ec70 100644 --- a/docs/framework/wcf/feature-details/service-identity-and-authentication.md +++ b/docs/framework/wcf/feature-details/service-identity-and-authentication.md @@ -13,7 +13,7 @@ ms.assetid: a4c8f52c-5b30-45c4-a545-63244aba82be A service's *endpoint identity* is a value generated from the service Web Services Description Language (WSDL). This value, propagated to any client, is used to authenticate the service. After the client initiates a communication to an endpoint and the service authenticates itself to the client, the client compares the endpoint identity value with the actual value the endpoint authentication process returned. If they match, the client is assured it has contacted the expected service endpoint. This functions as a protection against *phishing* by preventing a client from being redirected to an endpoint hosted by a malicious service. - For a sample application that demonstrates identity setting, see [Service Identity Sample](../samples/service-identity-sample.md). For more information about endpoints and endpoint addresses, see [Addresses](endpoint-addresses.md). + For a sample application that demonstrates identity setting, see [Service Identity Sample](/previous-versions/dotnet/framework/wcf/samples/service-identity-sample). For more information about endpoints and endpoint addresses, see [Addresses](endpoint-addresses.md). > [!NOTE] > When you use NT LanMan (NTLM) for authentication, the service identity is not checked because, under NTLM, the client is unable to authenticate the server. NTLM is used when computers are part of a Windows workgroup, or when running an older version of Windows that does not support Kerberos authentication. diff --git a/docs/framework/wcf/feature-details/sessions-instancing-and-concurrency.md b/docs/framework/wcf/feature-details/sessions-instancing-and-concurrency.md index fe0070afa69b0..95eeefe5fd02f 100644 --- a/docs/framework/wcf/feature-details/sessions-instancing-and-concurrency.md +++ b/docs/framework/wcf/feature-details/sessions-instancing-and-concurrency.md @@ -114,6 +114,6 @@ public class CalculatorService : ICalculatorConcurrency - [Using Sessions](../using-sessions.md) - [How to: Create a Service That Requires Sessions](how-to-create-a-service-that-requires-sessions.md) - [How to: Control Service Instancing](how-to-control-service-instancing.md) -- [Concurrency](../samples/concurrency.md) -- [Instancing](../samples/instancing.md) -- [Session](../samples/session.md) +- [Concurrency](/previous-versions/dotnet/framework/wcf/samples/concurrency) +- [Instancing](/previous-versions/dotnet/framework/wcf/samples/instancing) +- [Session](/previous-versions/dotnet/framework/wcf/samples/session) diff --git a/docs/framework/wcf/feature-details/stand-alone-json-serialization.md b/docs/framework/wcf/feature-details/stand-alone-json-serialization.md index dc2a257483881..bedd73698a93a 100644 --- a/docs/framework/wcf/feature-details/stand-alone-json-serialization.md +++ b/docs/framework/wcf/feature-details/stand-alone-json-serialization.md @@ -82,7 +82,7 @@ All collections, dictionaries, and arrays are represented in JSON as arrays. - If you would like to work with JSON directly (accessing keys and values dynamically, without pre-defining a rigid contract), you have several options: - - Consider using the [Weakly-typed JSON Serialization (AJAX)](../samples/weakly-typed-json-serialization-sample.md) sample. + - Consider using the [Weakly-typed JSON Serialization (AJAX)](/previous-versions/dotnet/framework/wcf/samples/weakly-typed-json-serialization-sample) sample. - Consider using the interface and deserialization constructors - these two mechanisms allow you to access JSON key/value pairs on serialization and deserialization respectively, but do not work in partial trust scenarios. diff --git a/docs/framework/wcf/feature-details/supported-deployment-scenarios.md b/docs/framework/wcf/feature-details/supported-deployment-scenarios.md index 0629616876eb6..7d8e6da3cd0aa 100644 --- a/docs/framework/wcf/feature-details/supported-deployment-scenarios.md +++ b/docs/framework/wcf/feature-details/supported-deployment-scenarios.md @@ -40,7 +40,7 @@ WCF can be used to communicate with remote servers from within partially trusted ## See also -- [Code Access Security](../../misc/code-access-security.md) +- [Code Access Security](/previous-versions/dotnet/framework/code-access-security/code-access-security) - [Windows Presentation Foundation Browser-Hosted Applications Overview](/dotnet/desktop/wpf/app-development/wpf-xaml-browser-applications-overview) - [Partial Trust](partial-trust.md) - [ASP.NET Trust Levels and Policy Files](/previous-versions/wyts434y(v=vs.140)) diff --git a/docs/framework/wcf/feature-details/transport-security-with-an-anonymous-client.md b/docs/framework/wcf/feature-details/transport-security-with-an-anonymous-client.md index 9d577582f5280..853ec5a8a0aa8 100644 --- a/docs/framework/wcf/feature-details/transport-security-with-an-anonymous-client.md +++ b/docs/framework/wcf/feature-details/transport-security-with-an-anonymous-client.md @@ -11,7 +11,7 @@ ms.assetid: 056653a5-384e-4a02-ae3c-1b0157d2ccb4 This Windows Communication Foundation (WCF) scenario uses transport security (HTTPS) to ensure confidentiality and integrity. The server must be authenticated with a Secure Sockets Layer (SSL) certificate, and the clients must trust the server's certificate. The client is not authenticated by any mechanism and is, therefore, anonymous. -For a sample application, see [WS Transport Security](../samples/ws-transport-security.md). For more information about transport security, see [Transport Security Overview](transport-security-overview.md). +For a sample application, see [WS Transport Security](/previous-versions/dotnet/framework/wcf/samples/ws-transport-security). For more information about transport security, see [Transport Security Overview](transport-security-overview.md). For more information about using a certificate with a service, see [Working with Certificates](working-with-certificates.md) and [How to: Configure a Port with an SSL Certificate](how-to-configure-a-port-with-an-ssl-certificate.md). @@ -119,6 +119,6 @@ The following configuration can be used instead of the code to set up the servic ## See also - [Security Overview](security-overview.md) -- [WS Transport Security](../samples/ws-transport-security.md) +- [WS Transport Security](/previous-versions/dotnet/framework/wcf/samples/ws-transport-security) - [Transport Security Overview](transport-security-overview.md) - [Security Model for Windows Server App Fabric](/previous-versions/appfabric/ee677202(v=azure.10)) diff --git a/docs/framework/wcf/feature-details/troubleshooting-correlation.md b/docs/framework/wcf/feature-details/troubleshooting-correlation.md index 717747c4d3d7c..f93306fd5501c 100644 --- a/docs/framework/wcf/feature-details/troubleshooting-correlation.md +++ b/docs/framework/wcf/feature-details/troubleshooting-correlation.md @@ -66,7 +66,7 @@ class CustomFactory : WorkflowServiceHostFactory ## Use Tracking to Monitor the Progress of the Workflow - Tracking provides a way to monitor the progress of a workflow. By default, tracking records are emitted for workflow life-cycle events, activity life-cycle events, fault propagation, and bookmark resumption. Additionally, custom tracking records can be emitted by custom activities. When troubleshooting correlation, the activity tracking records, the bookmark resumption records, and the fault propagation records are the most useful. The activity tracking records can be used to determine the current progress of the workflow and can help identify which messaging activity is currently waiting for messages. Bookmark resumption records are useful because they indicate that a message was received by the workflow, and fault propagation records provide a record of any faults in the workflow. To enable tracking, specify the desired in the of the . In the following example, the `ConsoleTrackingParticipant` (from the [Custom Tracking](../../windows-workflow-foundation/samples/custom-tracking.md) sample) is configured by using the default tracking profile. + Tracking provides a way to monitor the progress of a workflow. By default, tracking records are emitted for workflow life-cycle events, activity life-cycle events, fault propagation, and bookmark resumption. Additionally, custom tracking records can be emitted by custom activities. When troubleshooting correlation, the activity tracking records, the bookmark resumption records, and the fault propagation records are the most useful. The activity tracking records can be used to determine the current progress of the workflow and can help identify which messaging activity is currently waiting for messages. Bookmark resumption records are useful because they indicate that a message was received by the workflow, and fault propagation records provide a record of any faults in the workflow. To enable tracking, specify the desired in the of the . In the following example, the `ConsoleTrackingParticipant` (from the [Custom Tracking](/previous-versions/dotnet/framework/windows-workflow-foundation/samples/custom-tracking) sample) is configured by using the default tracking profile. ```csharp host.WorkflowExtensions.Add(new ConsoleTrackingParticipant()); @@ -74,7 +74,7 @@ host.WorkflowExtensions.Add(new ConsoleTrackingParticipant()); A tracking participant such as the ConsoleTrackingParticipant is useful for self-hosted workflow services that have a console window. For a Web-hosted service, a tracking participant that logs the tracking information to a durable store should be used, such as the built-in , or a custom tracking participant that logs the information to a file. - For more information about tracking and configuring tracking for a Web-hosted workflow service, see [Workflow Tracking and Tracing](../../windows-workflow-foundation/workflow-tracking-and-tracing.md), [Configuring Tracking for a Workflow](../../windows-workflow-foundation/configuring-tracking-for-a-workflow.md), and the [Tracking [WF Samples]](../../windows-workflow-foundation/samples/tracking.md) samples. + For more information about tracking and configuring tracking for a Web-hosted workflow service, see [Workflow Tracking and Tracing](../../windows-workflow-foundation/workflow-tracking-and-tracing.md), [Configuring Tracking for a Workflow](../../windows-workflow-foundation/configuring-tracking-for-a-workflow.md), and the [Tracking [WF Samples]](/previous-versions/dotnet/framework/windows-workflow-foundation/samples/tracking) samples. ## Use WCF Tracing diff --git a/docs/framework/wcf/feature-details/uritemplate-and-uritemplatetable.md b/docs/framework/wcf/feature-details/uritemplate-and-uritemplatetable.md index 2a5a147b72e70..70632b4a68bbd 100644 --- a/docs/framework/wcf/feature-details/uritemplate-and-uritemplatetable.md +++ b/docs/framework/wcf/feature-details/uritemplate-and-uritemplatetable.md @@ -335,6 +335,6 @@ When a variable is given a default value of `null` there are some additional con - [WCF Web HTTP Programming Model Overview](wcf-web-http-programming-model-overview.md) - [WCF Web HTTP Programming Object Model](wcf-web-http-programming-object-model.md) -- [UriTemplate](../samples/uritemplate-sample.md) -- [UriTemplate Table](../samples/uritemplate-table-sample.md) -- [UriTemplate Table Dispatcher](../samples/uritemplate-table-dispatcher-sample.md) +- [UriTemplate](/previous-versions/dotnet/framework/wcf/samples/uritemplate-sample) +- [UriTemplate Table](/previous-versions/dotnet/framework/wcf/samples/uritemplate-table-sample) +- [UriTemplate Table Dispatcher](/previous-versions/dotnet/framework/wcf/samples/uritemplate-table-dispatcher-sample) diff --git a/docs/framework/wcf/feature-details/using-a-data-contract-resolver.md b/docs/framework/wcf/feature-details/using-a-data-contract-resolver.md index ebfb522de9bbb..2493a64d9780b 100644 --- a/docs/framework/wcf/feature-details/using-a-data-contract-resolver.md +++ b/docs/framework/wcf/feature-details/using-a-data-contract-resolver.md @@ -82,10 +82,10 @@ if (serializerBehavior == null) SerializerBehavior.DataContractResolver = new MyCustomerResolver(); ``` - You can declaratively specify a data contract resolver by implementing an attribute that can be applied to a service. For more information, see the [KnownAssemblyAttribute](../samples/knownassemblyattribute.md) sample. This sample implements an attribute called "KnownAssembly" that adds a custom data contract resolver to the service’s behavior. + You can declaratively specify a data contract resolver by implementing an attribute that can be applied to a service. For more information, see the [KnownAssemblyAttribute](/previous-versions/dotnet/framework/wcf/samples/knownassemblyattribute) sample. This sample implements an attribute called "KnownAssembly" that adds a custom data contract resolver to the service’s behavior. ## See also - [Data Contract Known Types](data-contract-known-types.md) -- [DataContractSerializer Sample](../samples/datacontractserializer-sample.md) -- [KnownAssemblyAttribute](../samples/knownassemblyattribute.md) +- [DataContractSerializer Sample](/previous-versions/dotnet/framework/wcf/samples/datacontractserializer-sample) +- [KnownAssemblyAttribute](/previous-versions/dotnet/framework/wcf/samples/knownassemblyattribute) diff --git a/docs/framework/wcf/feature-details/using-data-contracts.md b/docs/framework/wcf/feature-details/using-data-contracts.md index 44f6f29094a3d..97985d6a9c809 100644 --- a/docs/framework/wcf/feature-details/using-data-contracts.md +++ b/docs/framework/wcf/feature-details/using-data-contracts.md @@ -63,7 +63,7 @@ A *data contract* is a formal agreement between a service and a client that abst [!code-csharp[C_DataContract#4](../../../../samples/snippets/csharp/VS_Snippets_CFX/c_datacontract/cs/source.cs#4)] [!code-vb[C_DataContract#4](../../../../samples/snippets/visualbasic/VS_Snippets_CFX/c_datacontract/vb/source.vb#4)] - For a complete code sample of a WCF service that defines a data contract see the [Basic Data Contract](../samples/basic-data-contract.md) sample. + For a complete code sample of a WCF service that defines a data contract see the [Basic Data Contract](/previous-versions/dotnet/framework/wcf/samples/basic-data-contract) sample. ## See also diff --git a/docs/framework/wcf/feature-details/wcf-services-and-aspnet.md b/docs/framework/wcf/feature-details/wcf-services-and-aspnet.md index 00ea0f46123b3..3b9a82f0047ab 100644 --- a/docs/framework/wcf/feature-details/wcf-services-and-aspnet.md +++ b/docs/framework/wcf/feature-details/wcf-services-and-aspnet.md @@ -96,7 +96,7 @@ The following table illustrates how the application-wide compatibility mode sett > [!NOTE] > IIS 7.0 and WAS allows WCF services to communicate over protocols other than HTTP. However, WCF services running in applications that have enabled ASP.NET compatibility mode are not permitted to expose non-HTTP endpoints. Such a configuration generates an activation exception when the service receives its first message. -For more information about enabling ASP.NET compatibility mode for WCF services, see and the [ASP.NET Compatibility](../samples/aspnet-compatibility.md) sample. +For more information about enabling ASP.NET compatibility mode for WCF services, see and the [ASP.NET Compatibility](/previous-versions/dotnet/framework/wcf/samples/aspnet-compatibility) sample. ## See also diff --git a/docs/framework/wcf/feature-details/wcf-web-http-programming-object-model.md b/docs/framework/wcf/feature-details/wcf-web-http-programming-object-model.md index b4f314e08af6d..1f091c3a5b00b 100644 --- a/docs/framework/wcf/feature-details/wcf-web-http-programming-object-model.md +++ b/docs/framework/wcf/feature-details/wcf-web-http-programming-object-model.md @@ -91,7 +91,7 @@ The WCF WEB HTTP Programming Model allows developers to expose Windows Communic is extensible by using a number of virtual methods: , , , , and . Developers can derive a class from and override these methods to customize the default behavior. - The is an example of extending . enables Windows Communication Foundation (WCF) endpoints to receive HTTP requests from a browser-based ASP.NET AJAX client. The [AJAX Service Using HTTP POST](../samples/ajax-service-using-http-post.md) is an example of using this extensibility point. + The is an example of extending . enables Windows Communication Foundation (WCF) endpoints to receive HTTP requests from a browser-based ASP.NET AJAX client. The [AJAX Service Using HTTP POST](/previous-versions/dotnet/framework/wcf/samples/ajax-service-using-http-post) is an example of using this extensibility point. > [!WARNING] > When using the , are not supported within or attributes. diff --git a/docs/framework/wcf/feature-details/workflow-service-host-extensibility.md b/docs/framework/wcf/feature-details/workflow-service-host-extensibility.md index a18cf65346f90..7e6746b16ca4e 100644 --- a/docs/framework/wcf/feature-details/workflow-service-host-extensibility.md +++ b/docs/framework/wcf/feature-details/workflow-service-host-extensibility.md @@ -46,7 +46,7 @@ host.Description.Behaviors.Add(new WorkflowUnhandledExceptionBehavior { Action = ## Hosting Non-Service Workflows - can be used to host non-service workflows, or workflows that either do not begin with a activity or workflows that do not use the messaging activities. Workflow services normally begin with a activity. When the receives a message for a workflow service, if it is not already running (or persisted) a new workflow service instance is created. If a workflow does not begin with a Receive activity, it cannot be started by sending a message because there is no activity to receive the message. To host a non-service workflow, derive a class from and override , , and . Override if you want to provide a preferred instance ID. Override to create a custom workflow creation context or populate an instance of the existing . Override to manually extract the bookmark from the incoming message. If you override this method, you must invoke in its body so as to respond to the message sent to the WorkflowHostingEndpoint. If you do not do so, a limit may be eventually exceeded. In two-way contracts, you may be able to detect your failure to invoke because of the client’s failure to receive a response. In one-way contracts, you may not recognize the mistake of failing to call until it’s too late, after the throttle limit is exceeded. For more information, please see the [WorkflowHostingEndpoint Resume Bookmark](../../windows-workflow-foundation/samples/workflowhostingendpoint-resume-bookmark.md)To create a new instance of a non-service workflow, declare a service contract that defines an operation that creates a new instance. The creation operation should take an IDictionary\ to pass any required workflow parameters. This contract is implicitly implemented by the -derived class. When hosting the workflow, add an instance of the -derived class to the host by calling and call . To create an instance of the workflow, create a of your service contract type and call . You can then call the create operation defined in your service contract. + can be used to host non-service workflows, or workflows that either do not begin with a activity or workflows that do not use the messaging activities. Workflow services normally begin with a activity. When the receives a message for a workflow service, if it is not already running (or persisted) a new workflow service instance is created. If a workflow does not begin with a Receive activity, it cannot be started by sending a message because there is no activity to receive the message. To host a non-service workflow, derive a class from and override , , and . Override if you want to provide a preferred instance ID. Override to create a custom workflow creation context or populate an instance of the existing . Override to manually extract the bookmark from the incoming message. If you override this method, you must invoke in its body so as to respond to the message sent to the WorkflowHostingEndpoint. If you do not do so, a limit may be eventually exceeded. In two-way contracts, you may be able to detect your failure to invoke because of the client’s failure to receive a response. In one-way contracts, you may not recognize the mistake of failing to call until it’s too late, after the throttle limit is exceeded. For more information, please see the [WorkflowHostingEndpoint Resume Bookmark](/previous-versions/dotnet/framework/windows-workflow-foundation/samples/workflowhostingendpoint-resume-bookmark)To create a new instance of a non-service workflow, declare a service contract that defines an operation that creates a new instance. The creation operation should take an IDictionary\ to pass any required workflow parameters. This contract is implicitly implemented by the -derived class. When hosting the workflow, add an instance of the -derived class to the host by calling and call . To create an instance of the workflow, create a of your service contract type and call . You can then call the create operation defined in your service contract. ## See also diff --git a/docs/framework/wcf/feature-details/working-with-certificates.md b/docs/framework/wcf/feature-details/working-with-certificates.md index a9160a6847635..091348159f6b7 100644 --- a/docs/framework/wcf/feature-details/working-with-certificates.md +++ b/docs/framework/wcf/feature-details/working-with-certificates.md @@ -86,7 +86,7 @@ You can also set the property using configuration. The following elements are us The `CertificateValidationMode` property also enables you to customize how certificates are authenticated. By default, the level is set to `ChainTrust`. To use the value, you must also set the `CustomCertificateValidatorType` attribute to an assembly and type used to validate the certificate. To create a custom validator, you must inherit from the abstract class. -When creating a custom authenticator, the most important method to override is the method. For an example of custom authentication, see the [X.509 Certificate Validator](../samples/x-509-certificate-validator.md) sample. For more information, see [Custom Credential and Credential Validation](../extending/custom-credential-and-credential-validation.md). +When creating a custom authenticator, the most important method to override is the method. For an example of custom authentication, see the [X.509 Certificate Validator](/previous-versions/dotnet/framework/wcf/samples/x-509-certificate-validator) sample. For more information, see [Custom Credential and Credential Validation](../extending/custom-credential-and-credential-validation.md). ## Using the PowerShell New-SelfSignedCertificate Cmdlet to Build a Certificate Chain diff --git a/docs/framework/wcf/feature-details/wsdl-and-policy.md b/docs/framework/wcf/feature-details/wsdl-and-policy.md index 89bb2dc1a4c9d..747adcfb8754f 100644 --- a/docs/framework/wcf/feature-details/wsdl-and-policy.md +++ b/docs/framework/wcf/feature-details/wsdl-and-policy.md @@ -73,6 +73,6 @@ This topic covers Windows Communication Foundation (WCF) WSDL 1.1, WS-Policy and ## See also -- [Custom WSDL Publication](../samples/custom-wsdl-publication.md) +- [Custom WSDL Publication](/previous-versions/dotnet/framework/wcf/samples/custom-wsdl-publication) - [How to: Export Custom WSDL](../extending/how-to-export-custom-wsdl.md) - [How to: Import Custom WSDL](../extending/how-to-import-custom-wsdl.md) diff --git a/docs/framework/wcf/find-private-key-tool-findprivatekey-exe.md b/docs/framework/wcf/find-private-key-tool-findprivatekey-exe.md index 942496bb0167e..57dfdbfcde9fa 100644 --- a/docs/framework/wcf/find-private-key-tool-findprivatekey-exe.md +++ b/docs/framework/wcf/find-private-key-tool-findprivatekey-exe.md @@ -9,7 +9,7 @@ ms.topic: reference This command-line tool can be used to retrieve a private key from a certificate store. For example, *FindPrivateKey.exe* can be used to find the location and name of the private key file associated with a specific X.509 certificate in the certificate store. > [!IMPORTANT] -> The FindPrivateKey tool is shipped as a WCF sample. For more information about where to find the sample and how to build it, see [FindPrivateKey](./samples/findprivatekey.md). +> The FindPrivateKey tool is shipped as a WCF sample. For more information about where to find the sample and how to build it, see [FindPrivateKey](/previous-versions/dotnet/framework/wcf/samples/findprivatekey). ## Syntax diff --git a/docs/framework/wcf/getting-started-tutorial.md b/docs/framework/wcf/getting-started-tutorial.md index 23cb7c5d38a8e..8a8e5d86a77e1 100644 --- a/docs/framework/wcf/getting-started-tutorial.md +++ b/docs/framework/wcf/getting-started-tutorial.md @@ -14,7 +14,7 @@ The following series of tutorials introduce you to the Windows Communication Fou The tutorial assumes you're using Visual Studio as the development environment. If you're using another development environment, ignore the Visual Studio-specific instructions. -For sample WCF applications that you can download and run, see [Windows Communication Foundation samples](samples/index.md). For an introduction to the samples, see [Getting started sample](samples/getting-started-sample.md). +For sample WCF applications that you can download and run, see [Windows Communication Foundation samples](/previous-versions/dotnet/framework/wcf/samples/index). For an introduction to the samples, see [Getting started sample](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample). For more in-depth information about creating services and clients, see [Basic WCF programming](basic-wcf-programming.md). @@ -64,6 +64,6 @@ The next two tutorials describe how to create, configure, and use a client appli - [How to: Use Svcutil.exe to download metadata documents](feature-details/how-to-use-svcutil-exe-to-download-metadata-documents.md) - [How to: Publish metadata for a service using a configuration file](feature-details/how-to-publish-metadata-for-a-service-using-a-configuration-file.md) - [Using bindings to configure services and clients](using-bindings-to-configure-services-and-clients.md) -- [Getting started sample](samples/getting-started-sample.md) -- [Windows Communication Foundation samples](samples/index.md) -- [Self-Host](samples/self-host.md) +- [Getting started sample](/previous-versions/dotnet/framework/wcf/samples/getting-started-sample) +- [Windows Communication Foundation samples](/previous-versions/dotnet/framework/wcf/samples/index) +- [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) diff --git a/docs/framework/wcf/guide-to-the-documentation.md b/docs/framework/wcf/guide-to-the-documentation.md index ec127571f6609..4837a9ac21216 100644 --- a/docs/framework/wcf/guide-to-the-documentation.md +++ b/docs/framework/wcf/guide-to-the-documentation.md @@ -13,7 +13,7 @@ Provided here is guidance about the Windows Communication Foundation (WCF) docum ## New to Windows Communication Foundation Programming -- If you are new to programming with WCF and you just want to see sample applications that work, see the topics listed in [Windows Communication Foundation Samples](./samples/index.md). +- If you are new to programming with WCF and you just want to see sample applications that work, see the topics listed in [Windows Communication Foundation Samples](/previous-versions/dotnet/framework/wcf/samples/index). - For a tutorial that walks through the basic steps of creating a WCF service and client, see [Getting Started Tutorial](getting-started-tutorial.md). @@ -59,7 +59,7 @@ Provided here is guidance about the Windows Communication Foundation (WCF) docum ## See also -- [Windows Communication Foundation Samples](./samples/index.md) +- [Windows Communication Foundation Samples](/previous-versions/dotnet/framework/wcf/samples/index) - [Conceptual Overview](conceptual-overview.md) - [Guidelines and Best Practices](guidelines-and-best-practices.md) - [Building Clients](building-clients.md) diff --git a/docs/framework/wcf/guidelines-and-best-practices.md b/docs/framework/wcf/guidelines-and-best-practices.md index 589fb5b08811b..fb91ee8f3e3c4 100644 --- a/docs/framework/wcf/guidelines-and-best-practices.md +++ b/docs/framework/wcf/guidelines-and-best-practices.md @@ -46,6 +46,6 @@ This section contains topics that provide guidelines for creating Windows Commun ## See also - [What Is Windows Communication Foundation](whats-wcf.md) -- [Windows Communication Foundation (WCF) samples](./samples/index.md) +- [Windows Communication Foundation (WCF) samples](/previous-versions/dotnet/framework/wcf/samples/index) - [Conceptual Overview](conceptual-overview.md) - [Building Clients](building-clients.md) diff --git a/docs/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application.md b/docs/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application.md index 50323b1983a73..e55d541bbbb7d 100644 --- a/docs/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application.md +++ b/docs/framework/wcf/how-to-host-a-wcf-service-in-a-managed-application.md @@ -58,7 +58,7 @@ The following procedure demonstrates how to implement a self-hosted service in a [!code-vb[CFX_SelfHost4#4](../../../samples/snippets/visualbasic/VS_Snippets_CFX/cfx_selfhost4/vb/module1.vb#4)] > [!NOTE] - > This example uses default endpoints, and no configuration file is required for this service. If no endpoints are configured, then the runtime creates one endpoint for each base address for each service contract implemented by the service. For more information about default endpoints, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](./samples/simplified-configuration-for-wcf-services.md). + > This example uses default endpoints, and no configuration file is required for this service. If no endpoints are configured, then the runtime creates one endpoint for each base address for each service contract implemented by the service. For more information about default endpoints, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). 7. Press **Ctrl**+**Shift**+**B** to build the solution. @@ -95,7 +95,7 @@ The following example creates a object to - - - [How to: Host a WCF Service in IIS](./feature-details/how-to-host-a-wcf-service-in-iis.md) -- [Self-Host](./samples/self-host.md) +- [Self-Host](/previous-versions/dotnet/framework/wcf/samples/self-host) - [Hosting Services](hosting-services.md) - [How to: Define a Service Contract](how-to-define-a-wcf-service-contract.md) - [How to: Implement a Service Contract](how-to-implement-a-wcf-contract.md) diff --git a/docs/framework/wcf/how-to-host-and-run-a-basic-wcf-service.md b/docs/framework/wcf/how-to-host-and-run-a-basic-wcf-service.md index c78b07d05797a..d5df6050824e2 100644 --- a/docs/framework/wcf/how-to-host-and-run-a-basic-wcf-service.md +++ b/docs/framework/wcf/how-to-host-and-run-a-basic-wcf-service.md @@ -208,11 +208,11 @@ The steps in the code you added to host the service are described as follows: - **Step 3**: Create a instance. A service endpoint is composed of an address, a binding, and a service contract. The constructor is composed of the service contract interface type, a binding, and an address. The service contract is `ICalculator`, which you defined and implement in the service type. The binding for this sample is , which is a built-in binding and connects to endpoints that conform to the WS-* specifications. For more information about WCF bindings, see [WCF bindings overview](bindings-overview.md). You append the address to the base address to identify the endpoint. The code specifies the address as CalculatorService and the fully qualified address for the endpoint as `http://localhost:8000/GettingStarted/CalculatorService`. > [!IMPORTANT] - > For .NET Framework Version 4 and later, adding a service endpoint is optional. For these versions, if you don't add your code or configuration, WCF adds one default endpoint for each combination of base address and contract implemented by the service. For more information about default endpoints, see [Specifying an endpoint address](specifying-an-endpoint-address.md). For more information about default endpoints, bindings, and behaviors, see [Simplified configuration](simplified-configuration.md) and [Simplified configuration for WCF services](samples/simplified-configuration-for-wcf-services.md). + > For .NET Framework Version 4 and later, adding a service endpoint is optional. For these versions, if you don't add your code or configuration, WCF adds one default endpoint for each combination of base address and contract implemented by the service. For more information about default endpoints, see [Specifying an endpoint address](specifying-an-endpoint-address.md). For more information about default endpoints, bindings, and behaviors, see [Simplified configuration](simplified-configuration.md) and [Simplified configuration for WCF services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). - **Step 4**: Enable metadata exchange. Clients use metadata exchange to generate proxies for calling the service operations. To enable metadata exchange, create a instance, set its property to `true`, and add the `ServiceMetadataBehavior` object to the collection of the instance. -- **Step 5**: Open to listen for incoming messages. The application waits for you to press **Enter**. After the application instantiates , it executes a try/catch block. For more information about safely catching exceptions thrown by , see [Use Close and Abort to release WCF client resources](samples/use-close-abort-release-wcf-client-resources.md). +- **Step 5**: Open to listen for incoming messages. The application waits for you to press **Enter**. After the application instantiates , it executes a try/catch block. For more information about safely catching exceptions thrown by , see [Use Close and Abort to release WCF client resources](/previous-versions/dotnet/framework/wcf/samples/use-close-abort-release-wcf-client-resources). > [!IMPORTANT] > When you add a WCF service library, Visual Studio hosts it for you if you debug it by starting a service host. To avoid conflicts, you can prevent Visual Studio from hosting the WCF service library. diff --git a/docs/framework/wcf/how-to-impersonate-a-client-on-a-service.md b/docs/framework/wcf/how-to-impersonate-a-client-on-a-service.md index 9ac7ec5b3724e..b4fce04617663 100644 --- a/docs/framework/wcf/how-to-impersonate-a-client-on-a-service.md +++ b/docs/framework/wcf/how-to-impersonate-a-client-on-a-service.md @@ -13,7 +13,7 @@ ms.assetid: 431db851-a75b-4009-9fe2-247243d810d3 --- # How to: Impersonate a Client on a Service -Impersonating a client on a Windows Communication Foundation (WCF) service enables the service to perform actions on behalf of the client. For actions subject to access control list (ACL) checks, such as access to directories and files on a machine or access to a SQL Server database, the ACL check is against the client user account. This topic shows the basic steps required to enable a client in a Windows domain to set a client impersonation level. For a working example of this, see [Impersonating the Client](./samples/impersonating-the-client.md). For more information about client impersonation, see [Delegation and Impersonation](./feature-details/delegation-and-impersonation-with-wcf.md). +Impersonating a client on a Windows Communication Foundation (WCF) service enables the service to perform actions on behalf of the client. For actions subject to access control list (ACL) checks, such as access to directories and files on a machine or access to a SQL Server database, the ACL check is against the client user account. This topic shows the basic steps required to enable a client in a Windows domain to set a client impersonation level. For a working example of this, see [Impersonating the Client](/previous-versions/dotnet/framework/wcf/samples/impersonating-the-client). For more information about client impersonation, see [Delegation and Impersonation](./feature-details/delegation-and-impersonation-with-wcf.md). > [!NOTE] > When the client and service are running on the same computer and the client is running under a system account (that is, `Local System` or `Network Service`), the client cannot be impersonated when a secure session is established with stateful Security Context tokens. A WinForms or console application typically is run under the currently logged in account, so that account can be impersonated by default. However, when the client is an ASP.NET page and that page is hosted in IIS 6.0 or IIS 7.0, then the client does run under the `Network Service` account by default. All of the system-provided bindings that support secure sessions use a stateless Security Context token by default. However, if the client is an ASP.NET page and secure sessions with stateful Security Context tokens are used, the client cannot be impersonated. For more information about using stateful Security Context tokens in a secure session, see [How to: Create a Security Context Token for a Secure Session](./feature-details/how-to-create-a-security-context-token-for-a-secure-session.md). @@ -45,5 +45,5 @@ Impersonating a client on a Windows Communication Foundation (WCF) service enabl - - -- [Impersonating the Client](./samples/impersonating-the-client.md) +- [Impersonating the Client](/previous-versions/dotnet/framework/wcf/samples/impersonating-the-client) - [Delegation and Impersonation](./feature-details/delegation-and-impersonation-with-wcf.md) diff --git a/docs/framework/wcf/how-to-restrict-access-with-the-principalpermissionattribute-class.md b/docs/framework/wcf/how-to-restrict-access-with-the-principalpermissionattribute-class.md index eebbcdb684af7..b9aeafbbc245c 100644 --- a/docs/framework/wcf/how-to-restrict-access-with-the-principalpermissionattribute-class.md +++ b/docs/framework/wcf/how-to-restrict-access-with-the-principalpermissionattribute-class.md @@ -13,7 +13,7 @@ ms.assetid: 5162f5c4-8781-4cc4-9425-bb7620eaeaf4 --- # How to: Restrict Access with the PrincipalPermissionAttribute Class -Controlling the access to resources on a Windows-domain computer is a basic security task. For example, only certain users should be able to view sensitive data, such as payroll information. This topic explains how to restrict access to a method by demanding that the user belong to a predefined group. For a working sample, see [Authorizing Access to Service Operations](./samples/authorizing-access-to-service-operations.md). +Controlling the access to resources on a Windows-domain computer is a basic security task. For example, only certain users should be able to view sensitive data, such as payroll information. This topic explains how to restrict access to a method by demanding that the user belong to a predefined group. For a working sample, see [Authorizing Access to Service Operations](/previous-versions/dotnet/framework/wcf/samples/authorizing-access-to-service-operations). The task consists of two separate procedures. The first creates the group and populates it with users. The second applies the class to specify the group. @@ -86,6 +86,6 @@ Controlling the access to resources on a Windows-domain computer is a basic secu - - - -- [Authorizing Access to Service Operations](./samples/authorizing-access-to-service-operations.md) +- [Authorizing Access to Service Operations](/previous-versions/dotnet/framework/wcf/samples/authorizing-access-to-service-operations) - [Security Overview](./feature-details/security-overview.md) - [Implementing Service Contracts](implementing-service-contracts.md) diff --git a/docs/framework/wcf/how-to-secure-a-service-with-windows-credentials.md b/docs/framework/wcf/how-to-secure-a-service-with-windows-credentials.md index 2a45bc22746a8..fff900c58c83d 100644 --- a/docs/framework/wcf/how-to-secure-a-service-with-windows-credentials.md +++ b/docs/framework/wcf/how-to-secure-a-service-with-windows-credentials.md @@ -11,7 +11,7 @@ ms.assetid: d171b5ca-96ef-47ff-800c-c138023cf76e --- # How to: Secure a Service with Windows Credentials -This topic shows how to enable transport security on a Windows Communication Foundation (WCF) service that resides in a Windows domain and is called by clients in the same domain. For more information about this scenario, see [Transport Security with Windows Authentication](./feature-details/transport-security-with-windows-authentication.md). For a sample application, see the [WSHttpBinding](./samples/wshttpbinding.md) sample. +This topic shows how to enable transport security on a Windows Communication Foundation (WCF) service that resides in a Windows domain and is called by clients in the same domain. For more information about this scenario, see [Transport Security with Windows Authentication](./feature-details/transport-security-with-windows-authentication.md). For a sample application, see the [WSHttpBinding](/previous-versions/dotnet/framework/wcf/samples/wshttpbinding) sample. This topic assumes you have an existing contract interface and implementation already defined, and adds on to that. You can also modify an existing service and client. diff --git a/docs/framework/wcf/how-to-specify-a-client-binding-in-code.md b/docs/framework/wcf/how-to-specify-a-client-binding-in-code.md index ce11420cb91c6..2256c7346a219 100644 --- a/docs/framework/wcf/how-to-specify-a-client-binding-in-code.md +++ b/docs/framework/wcf/how-to-specify-a-client-binding-in-code.md @@ -15,7 +15,7 @@ In this example, a client is created to use a calculator service and the binding The client is built in two parts. Svcutil.exe generates the `ClientCalculator` that implements the `ICalculator` interface. This client application is then constructed by constructing an instance of `ClientCalculator` and then specifying the binding and the address for the service in code. - For the source copy of this example, see the [BasicBinding](./samples/basicbinding.md) sample. + For the source copy of this example, see the [BasicBinding](/previous-versions/dotnet/framework/wcf/samples/basicbinding) sample. ### To specify a custom binding in code diff --git a/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md b/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md index cdd5af45400a2..70bcb81e2c54e 100644 --- a/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md +++ b/docs/framework/wcf/how-to-specify-a-client-binding-in-configuration.md @@ -16,7 +16,7 @@ In this example, a client console application is created to use a calculator ser You can perform all of the following configuration steps by using the [Configuration Editor Tool (SvcConfigEditor.exe)](configuration-editor-tool-svcconfigeditor-exe.md). - For the source copy of this example, see the [BasicBinding](./samples/basicbinding.md) sample. + For the source copy of this example, see the [BasicBinding](/previous-versions/dotnet/framework/wcf/samples/basicbinding) sample. ### Specifying a client binding in configuration diff --git a/docs/framework/wcf/how-to-specify-a-service-binding-in-configuration.md b/docs/framework/wcf/how-to-specify-a-service-binding-in-configuration.md index c830be4816335..b710b6bc29430 100644 --- a/docs/framework/wcf/how-to-specify-a-service-binding-in-configuration.md +++ b/docs/framework/wcf/how-to-specify-a-service-binding-in-configuration.md @@ -15,7 +15,7 @@ In this example, an `ICalculator` contract is defined for a basic calculator ser All of the following configuration steps can be undertaken using the [Configuration Editor Tool (SvcConfigEditor.exe)](configuration-editor-tool-svcconfigeditor-exe.md). - For the source copy of this example, see [BasicBinding](./samples/basicbinding.md). + For the source copy of this example, see [BasicBinding](/previous-versions/dotnet/framework/wcf/samples/basicbinding). ## To specify the BasicHttpBinding to use to configure the service diff --git a/docs/framework/wcf/index.md b/docs/framework/wcf/index.md index c3f6f8041c29d..5c995e771d721 100644 --- a/docs/framework/wcf/index.md +++ b/docs/framework/wcf/index.md @@ -58,7 +58,7 @@ This section of the documentation provides information about Windows Communicati [Windows Communication Foundation Tools](tools.md)\ Describes WCF tools designed to make it easier to create, deploy, and manage WCF applications - [Windows Communication Foundation Samples](./samples/index.md)\ + [Windows Communication Foundation Samples](/previous-versions/dotnet/framework/wcf/samples/index)\ Samples that provide instruction on various aspects of Windows Communication Foundation [Windows Communication Foundation Glossary](glossary.md)\ diff --git a/docs/framework/wcf/load-balancing.md b/docs/framework/wcf/load-balancing.md index f5bcc07727b30..625df07ccb160 100644 --- a/docs/framework/wcf/load-balancing.md +++ b/docs/framework/wcf/load-balancing.md @@ -74,7 +74,7 @@ One way to increase the capacity of Windows Communication Foundation (WCF) appli
``` - For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](./samples/simplified-configuration-for-wcf-services.md). + For more information about default endpoints, bindings, and behaviors, see [Simplified Configuration](simplified-configuration.md) and [Simplified Configuration for WCF Services](/previous-versions/dotnet/framework/wcf/samples/simplified-configuration-for-wcf-services). ## Load Balancing with the WSHttp Binding and the WSDualHttp Binding diff --git a/docs/framework/wcf/samples/address-headers.md b/docs/framework/wcf/samples/address-headers.md deleted file mode 100644 index e4babdfb34fa8..0000000000000 --- a/docs/framework/wcf/samples/address-headers.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -description: "Learn more about: Address Headers" -title: "Address Headers" -ms.date: "03/30/2017" -ms.assetid: b0c94d4a-3bde-4b4d-bb6d-9f12bc3a6940 ---- - -# Address Headers - -The Address Headers sample demonstrates how clients can pass reference parameters to a service using Windows Communication Foundation (WCF). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -The WS-Addressing specification defines the notion of an endpoint reference as a way to address a particular Web service endpoint. In WCF, endpoint references are modeled using the `EndpointAddress` class - `EndpointAddress` is the type of the Address field of the `ServiceEndpoint` class. - -Part of the endpoint reference model is that each reference can carry some reference parameters that add extra identifying information. In WCF, these reference parameters are modeled as instances of `AddressHeader` class. - -In this sample, the client adds a reference parameter to the `EndpointAddress` of the client endpoint. The service looks for this reference parameter and uses its value in the logic of its "Hello" service operation. - -## Client - -For the client to send a reference parameter, it must add an `AddressHeader` to the `EndpointAddress` of the `ServiceEndpoint`. Because the `EndpointAddress` class is immutable, modification of an endpoint address must be done using the `EndpointAddressBuilder` class. The following code initializes the client to send a reference parameter as part of its message. - -```csharp -HelloClient client = new HelloClient(); -EndpointAddressBuilder builder = - new EndpointAddressBuilder(client.Endpoint.Address); -AddressHeader header = - AddressHeader.CreateAddressHeader(IDName, IDNamespace, "John"); -builder.Headers.Add(header); -client.Endpoint.Address = builder.ToEndpointAddress(); -``` - -The code creates an `EndpointAddressBuilder` using the original `EndpointAddress` as an initial value. It then adds a newly created address header; the call to `CreateAddressHeader` creates a header with a particular name, namespace, and value. Here the value is "John". Once the header is added to the builder, the `ToEndpointAddress()` method converts the (mutable) builder back into an (immutable) endpoint address, which is assigned back to the client endpoint's Address field. - -Now when the client calls `Console.WriteLine(client.Hello());`, the service is able to get the value of this address parameter, as seen in the resulting output of the client. - -`Hello, John` - -## Server - -The implementation of the service operation `Hello()` uses the current `OperationContext` to inspect the values of the headers on the incoming message. - -```csharp -string id = null; -// look at headers on incoming message -for (int i = 0; - i < OperationContext.Current.IncomingMessageHeaders.Count; - ++i) -{ - MessageHeaderInfo h = OperationContext.Current.IncomingMessageHeaders[i]; - // for any reference parameters with the correct name & namespace - if (h.IsReferenceParameter && - h.Name == IDName && - h.Namespace == IDNamespace) - { - // read the value of that header - XmlReader xr = OperationContext.Current.IncomingMessageHeaders.GetReaderAtHeader(i); - id = xr.ReadElementContentAsString(); - } -} -return "Hello, " + id; -``` - -The code iterates over all the headers on the incoming message, looking for headers that are reference parameters with the particular name and. When the parameter is found, it reads the value of the parameter and stores it in the "id" variable. - -#### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Client\AddressHeaders` diff --git a/docs/framework/wcf/samples/addressing.md b/docs/framework/wcf/samples/addressing.md deleted file mode 100644 index 6328683789984..0000000000000 --- a/docs/framework/wcf/samples/addressing.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -description: "Learn more about: Addressing" -title: "Addressing" -ms.date: "03/30/2017" -ms.assetid: d438e6f2-d0f3-43aa-b259-b51b5bda2e64 ---- -# Addressing - -The Addressing sample demonstrates various aspects and features of endpoint addresses. The sample is based on the [Getting Started](getting-started-sample.md). In this sample the service is self-hosted. Both the service and the client are console applications. The service defines multiple endpoints using a combination of relative and absolute endpoint addresses. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The service configuration file specifies a base address and four endpoints. The base address is specified using the add element, under service/host/baseAddresses as demonstrated in the following sample configuration. - -```xml - - - - - - - -``` - - The first endpoint definition shown in the following sample configuration specifies a relative address, which means the endpoint address is a combination of the base address and the relative address following the rules of URI composition. - -```xml - - - -``` - - In this case, the relative address is empty (""), so the endpoint address is the same as the base address. The actual endpoint address is `http://localhost:8000/servicemodelsamples/service`. - - The second endpoint definition also specifies a relative address, as shown in the following sample configuration. - -```xml - - - - -``` - - The relative address, "test", is appended to the base address. The actual endpoint address is `http://localhost:8000/servicemodelsamples/service/test`. - - The third endpoint definition specifies an absolute address, as shown in the following sample configuration. - -```xml - -``` - - The base address plays no role in the address. The actual endpoint address is `http://localhost:8001/hello/servicemodelsamples`. - - The fourth endpoint address specifies an absolute address and a different transport—TCP. The base address plays no role in the address. The actual endpoint address is `net.tcp://localhost:9000/servicemodelsamples/service`. - -```xml - - - - - -``` - - The client accesses just one of the four service endpoints, but all four are defined in its configuration file. The client selects an endpoint when it creates the `CalculatorProxy` object. By changing the configuration name from `CalculatorEndpoint1` through `CalculatorEndpoint4`, you can exercise each of the endpoints. - - When you run the sample, the service enumerates the address, binding name and contract name for each of its endpoints. The metadata exchange (MEX) endpoint is just another endpoint from the ServiceHost's perspective so it shows up in the list. - -```console -Service endpoints: -Endpoint - address: http://localhost:8000/ServiceModelSamples/service - binding: WSHttpBinding - contract: ICalculator -Endpoint - address: http://localhost:8000/ServiceModelSamples/service/test - binding: WSHttpBinding - contract: ICalculator -Endpoint - address: http://localhost:8001/hello/servicemodelsamples - binding: WSHttpBinding - contract: ICalculator -Endpoint - address: net.tcp://localhost:9000/servicemodelsamples/service - binding: NetTcpBinding - contract: ICalculator -Endpoint - address: http://localhost:8000/ServiceModelSamples/service/mex - binding: MetadataExchangeHttpBinding - contract: IMetadataExchange - -The service is ready. -Press to terminate service. -``` - - When you run the client, the operation requests and responses are displayed in both the service and client console windows. Press ENTER in each console window to shut down the service and client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - - > [!NOTE] - > If you use Svcutil.exe to regenerate the configuration for this sample, be sure to modify the endpoint name in the client configuration to match the client code. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Addressing` diff --git a/docs/framework/wcf/samples/ajax-service-using-complex-types-sample.md b/docs/framework/wcf/samples/ajax-service-using-complex-types-sample.md deleted file mode 100644 index e5a1414a5f4f5..0000000000000 --- a/docs/framework/wcf/samples/ajax-service-using-complex-types-sample.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -description: "Learn more about: AJAX Service Using Complex Types Sample" -title: "AJAX Service Using Complex Types Sample" -ms.date: "03/30/2017" -ms.assetid: 88242b99-4811-4cbe-8201-52ddf48fb174 ---- -# AJAX Service Using Complex Types Sample - -This sample demonstrates how to use Windows Communication Foundation (WCF) to create an ASP.NET Asynchronous JavaScript and XML (AJAX) service that creates instances of complex types and sends them between service and client as JavaScript Object Notation (JSON). You can access an AJAX service by using JavaScript code from a Web browser client. This sample builds on the [Basic AJAX Service](basic-ajax-service.md) sample. - -AJAX support in WCF is optimized for use with ASP.NET AJAX through the control. For an example of using WCF with ASP.NET AJAX, see the [AJAX Samples](ajax.md). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -The service in the following sample is a WCF service with no AJAX-specific code. Because the attribute is not applied, the default HTTP verb ("POST") is used. The service has one operation, `DoMath`, which returns a complex type named `MathResult`. The complex type is a standard data contract type, which also contains no AJAX-specific code. - -```csharp -[DataContract] -public class MathResult -{ - [DataMember] - public double sum; - [DataMember] - public double difference; - [DataMember] - public double product; - [DataMember] - public double quotient; -} -``` - -Create an AJAX endpoint on the service by using the , just as in the Basic AJAX Service sample. - -The client Web page ComplexTypeClientPage.aspx contains ASP.NET and JavaScript code to invoke the service when the user clicks the **Perform calculation** button on the page. The code to invoke the service constructs a JSON body and sends it using HTTP POST, similar to the [AJAX Service Using HTTP POST](ajax-service-using-http-post.md) sample. - -After the service call succeeds, you can access the individual data members (`sum`, `difference`, `product` and `quotient`) on the resulting JavaScript object. - -```javascript -function onSuccess(mathResult){ - document.getElementById("sum").value = mathResult.sum; - document.getElementById("difference").value = mathResult.difference; - document.getElementById("product").value = mathResult.product; - document.getElementById("quotient").value = mathResult.quotient; -} -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. Build the solution ComplexTypeAjaxService.sln as described in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. Navigate to `http://localhost/ServiceModelSamples/ComplexTypeClientPage.aspx` (do not open ComplexTypeClientPage.aspx in the browser from the project directory). - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Ajax\ComplexTypeAjaxService` - -## See also - -- [Basic AJAX Service](basic-ajax-service.md) diff --git a/docs/framework/wcf/samples/ajax-service-using-http-post.md b/docs/framework/wcf/samples/ajax-service-using-http-post.md deleted file mode 100644 index 31416e9a189fe..0000000000000 --- a/docs/framework/wcf/samples/ajax-service-using-http-post.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -description: "Learn more about: AJAX Service Using HTTP POST" -title: "AJAX Service Using HTTP POST" -ms.date: "03/30/2017" -ms.assetid: 1ac80f20-ac1c-4ed1-9850-7e49569ff44e ---- -# AJAX Service Using HTTP POST - -This sample demonstrates how to use Windows Communication Foundation (WCF) to create an ASP.NET Asynchronous JavaScript and XML (AJAX) service that uses HTTP POST. An AJAX service is one that you can access by using basic JavaScript code from a Web browser client. This sample builds on the [Basic AJAX Service](basic-ajax-service.md) sample; the only difference between the two samples is the use of HTTP POST instead of HTTP GET. - -AJAX support in Windows Communication Foundation (WCF) is optimized for use with ASP.NET AJAX through the `ScriptManager` control. For an example of using WCF with ASP.NET AJAX, see the [Ajax Samples](ajax-service-using-http-post.md). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -The service in the following sample is a WCF service with no AJAX-specific code. - -If the attribute is applied on an operation, or the attribute is not applied, the default HTTP verb ("POST") is used. POST requests are harder to construct than GET requests, but they are not cached; use POST requests for all operations where caching is not appropriate. - -```csharp -[ServiceContract(Namespace = "PostAjaxService")] -public interface ICalculator -{ - [WebInvoke] - double Add(double n1, double n2); - //Other operations omitted… -} -``` - -Create an AJAX endpoint on the service by using the , just as in the Basic AJAX Service sample. - -Unlike GET requests, you cannot invoke POST services from the browser. For example, navigating to `http://localhost/ServiceModelSamples/service.svc/Add?n1=100&n2=200` results in an error, because the POST service expects the `n1` and `n2` parameters to be sent in the message body in the JSON format, and not in the URL. - -The client Web page PostAjaxClientPage.aspx contains ASP.NET code to invoke the service whenever the user clicks one of the operation buttons on the page. The service responds in the same way as in the [Basic AJAX Service](basic-ajax-service.md) sample, with the GET request. - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Ajax\PostAjaxService` - -## To set up, build, and run the sample - -1. Ensure that you perform the setup instructions [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. Build the solution PostAjaxService.sln as described in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. Navigate to `http://localhost/ServiceModelSamples/PostAjaxClientPage.aspx` (do not open PostAjaxClientPage.aspx in the browser from the project directory). diff --git a/docs/framework/wcf/samples/ajax-service-with-json-and-xml-sample.md b/docs/framework/wcf/samples/ajax-service-with-json-and-xml-sample.md deleted file mode 100644 index 626202d7c57c1..0000000000000 --- a/docs/framework/wcf/samples/ajax-service-with-json-and-xml-sample.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -description: "Learn more about: AJAX Service with JSON and XML Sample" -title: "AJAX Service with JSON and XML Sample" -ms.date: "03/30/2017" -ms.assetid: 8ea5860d-0c42-4ae9-941a-e07efdd8e29c ---- -# AJAX Service with JSON and XML Sample - -This sample demonstrates how to use Windows Communication Foundation (WCF) to create an Asynchronous JavaScript and XML (AJAX) service that returns either JavaScript Object Notation (JSON) or XML data. You can access an AJAX service by using JavaScript code from a Web browser client. This sample builds on the [Basic AJAX Service](basic-ajax-service.md) sample. - -Unlike the other AJAX samples, this sample does not use ASP.NET AJAX and the control. With some additional configuration, WCF AJAX services can be accessed from any HTML page through JavaScript, and this scenario is shown here. For an example of using WCF with ASP.NET AJAX, see [AJAX Samples](ajax.md). - -This sample shows how to switch the response type of an operation between JSON and XML. This functionality is available regardless of whether the service is configured to be accessed by ASP.NET AJAX or by an HTML/JavaScript client page. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -To enable the use of non-ASP.NET AJAX clients, use (not ) in the .svc file. adds a standard endpoint to the service. The endpoint is configured at an empty address relative to the .svc file; this means that the address of the service is `http://localhost/ServiceModelSamples/service.svc`, with no additional suffixes other than the operation name. - -`<%@ServiceHost language="c#" Debug="true" Service="Microsoft.Samples.XmlAjaxService.CalculatorService" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>` - -The following section in Web.config can be used to make additional configuration changes to the endpoint. It can be removed if no extra changes are needed. - -```xml - - - - - - - - -``` - -The default data format for is XML, while the default data format for is JSON. For more information, see [Creating WCF AJAX Services without ASP.NET](../feature-details/creating-wcf-ajax-services-without-aspnet.md). - -The service in the following sample is a standard WCF service with two operations. Both operations require the body style on the or attributes, which is specific to the `webHttp` behavior and has no bearing on the JSON/XML data format switch. - -```csharp -[OperationContract] -[WebInvoke(ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)] -MathResult DoMathXml(double n1, double n2); -``` - -The response format for the operation is specified as XML, which is the default setting for the [\](../../configure-apps/file-schema/wcf/webhttp.md) behavior. However, it is good practice explicitly specify the response format. - -The other operation uses the `WebInvokeAttribute` attribute and explicitly specifies JSON instead of XML for the response. - -```csharp -[OperationContract] -[WebInvoke(ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)] -MathResult DoMathJson(double n1, double n2); -``` - -Note that in both cases the operations return a complex type, `MathResult`, which is a standard WCF data contract type. - -The client Web page XmlAjaxClientPage.htm contains JavaScript code that invokes one of the preceding two operations when the user clicks the **Perform calculation (return JSON)** or **Perform calculation (return XML)** buttons on the page. The code to invoke the service constructs a JSON body and sends it using HTTP POST. The request is created manually in JavaScript, unlike the [Basic AJAX Service](basic-ajax-service.md) sample and the other samples using ASP.NET AJAX. - -```csharp -// Create HTTP request -var xmlHttp; -// Request instantiation code omitted… -// Result handler code omitted… - -// Build the operation URL -var url = "service.svc/ajaxEndpoint/"; -url = url + operation; - -// Build the body of the JSON message -var body = '{"n1":'; -body = body + document.getElementById("num1").value + ',"n2":'; -body = body + document.getElementById("num2").value + '}'; - -// Send the HTTP request -xmlHttp.open("POST", url, true); -xmlHttp.setRequestHeader("Content-type", "application/json"); -xmlHttp.send(body); -``` - -When the service responds, the response is displayed without any further processing in a textbox on the page. This is implemented for demonstration purposes to allow you to directly observe the XML and JSON data formats used. - -```javascript -// Create result handler -xmlHttp.onreadystatechange=function(){ - if(xmlHttp.readyState == 4){ - document.getElementById("result").value = xmlHttp.responseText; - } -} -``` - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\AJAX\XmlAjaxService` - -#### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. Build the solution XmlAjaxService.sln as described in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. Navigate to `http://localhost/ServiceModelSamples/XmlAjaxClientPage.htm` (do not open XmlAjaxClientPage.htm in the browser from the project directory). - -## See also - -- [AJAX Service Using HTTP POST](ajax-service-using-http-post.md) diff --git a/docs/framework/wcf/samples/ajax-service-without-configuration.md b/docs/framework/wcf/samples/ajax-service-without-configuration.md deleted file mode 100644 index 016128bdf9035..0000000000000 --- a/docs/framework/wcf/samples/ajax-service-without-configuration.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -description: "Learn more about: AJAX Service Without Configuration" -title: "AJAX Service Without Configuration" -ms.date: "03/30/2017" -ms.assetid: e6db7acd-5679-45d4-b98a-8449c6873838 ---- -# AJAX Service Without Configuration - -This sample demonstrates how to use Windows Communication Foundation (WCF) to create a basic ASP.NET Asynchronous JavaScript and XML (AJAX) service (a service that you can access by using JavaScript code from a Web browser client) without using any configuration settings. The service uses special syntax in the .svc file to automatically enable an AJAX endpoint. - -AJAX support in WCF is optimized for use with ASP.NET AJAX through the `ScriptManager` control. For an example of using WCF with ASP.NET AJAX, see the [Ajax Samples](ajax.md). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - This sample builds upon the AJAX Service Using HTTP POST. As described in the [Basic AJAX Service](basic-ajax-service.md) sample, is used to host the service. - -```text -<%ServiceHost - language=c# - Debug="true" - Service="Microsoft.Ajax.Samples.CalculatorService - Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" -%> -``` - - automatically adds a to the service. If no configuration changes need to be made to the endpoint, the `` section can be completely removed from the Web.config file for the service. The Web.config file contains some ASP.NET settings, which are used by ConfigFreeClientPage.aspx. If that were not the case, the entire Web.config file could be removed. - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Ajax\ConfigFreeAjaxService` - -#### To set up, build, and run the sample - -1. Ensure that you perform the setup instructions in [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. Build the solution ConfigFreeAjaxService.sln as described in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. Navigate to `http://localhost/ServiceModelSamples/ConfigFreeClientPage.aspx` (do not open ConfigFreeClientPage.aspx in the browser from within the project directory). - -> [!NOTE] -> When running this sample, please ensure that Anonymous Authentication and Windows Authentication are not enabled simultaneously for the ServiceModelSamples folder in IIS. If that is the case, please disable Windows Authentication. Once you have run the sample, enable Windows Authentication and run "iisreset". - -## See also - -- [Basic AJAX Service](basic-ajax-service.md) diff --git a/docs/framework/wcf/samples/ajax.md b/docs/framework/wcf/samples/ajax.md deleted file mode 100644 index 91e894397c571..0000000000000 --- a/docs/framework/wcf/samples/ajax.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: "Learn more about: AJAX" -title: "AJAX" -ms.date: "03/30/2017" -ms.assetid: 9e0eb40a-69ef-4821-bdc3-45a9b71a58c3 ---- -# AJAX - -This section includes samples that demonstrate Asynchronous JavaScript and XML functionality. - -## In This Section - - [JSONP](jsonp.md) - Demonstrates how to support JSON with Padding (JSONP) in WCF REST services. - - [JSON Serialization](json-serialization.md) - Demonstrates how to use the to serialize and deserialize data in the JavaScript Object Notation (JSON) format. - - [Basic AJAX Service](basic-ajax-service.md) - Demonstrates how to use WCF to create a basic ASP.NET Asynchronous JavaScript and XML (AJAX) service. - - [AJAX Service Using HTTP POST](ajax-service-using-http-post.md) - Demonstrates how to use WCF to create an ASP.NET Asynchronous JavaScript and XML (AJAX) service that uses HTTP POST. - - [AJAX Service Without Configuration](ajax-service-without-configuration.md) - Demonstrates how to use WCF to create a basic ASP.NET Asynchronous JavaScript and XML (AJAX) service. - - [AJAX Service Using Complex Types](ajax-service-using-complex-types-sample.md) - Demonstrates how to use WCF to create an ASP.NET Asynchronous JavaScript and XML (AJAX) service that creates instances of complex types. - - [AJAX Service with JSON and XML](ajax-service-with-json-and-xml-sample.md) - Demonstrates how to use WCF to create an Asynchronous JavaScript and XML (AJAX) service that returns either JavaScript Object Notation (JSON) or XML data. diff --git a/docs/framework/wcf/samples/announcements-sample.md b/docs/framework/wcf/samples/announcements-sample.md deleted file mode 100644 index 42859f149b0f2..0000000000000 --- a/docs/framework/wcf/samples/announcements-sample.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -description: "Learn more about: Announcements Sample" -title: "Announcements Sample" -ms.date: "03/30/2017" -ms.assetid: 954a75e4-9a97-41d6-94fc-43765d4205a9 ---- -# Announcements Sample - -This sample shows how to use the Announcement functionality of the Discovery feature. Announcements allow services to send out announcement messages that contain metadata about the service. By default a hello announcement is sent when the service starts up and a bye announcement is sent when the service shuts down. These announcements can be multicast or they can be sent point-to-point. This sample consists of two projects service and client. - -## Service - -This project contains a self-hosted calculator service. In the `Main` method, a service host is created and a service endpoint is added to it. Next, a is created. To enable announcements, an announcement endpoint must be added to the . In this case a standard endpoint, using UDP multicast is added as the announcement endpoint. This broadcasts the announcements over a well-known UDP address. - -```csharp -Uri baseAddress = new Uri("http://localhost:8000/" + Guid.NewGuid().ToString()); - -// Create a ServiceHost for the CalculatorService type. -using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress)) -{ - serviceHost.AddServiceEndpoint(typeof(ICalculatorService), new WSHttpBinding(), String.Empty); - - ServiceDiscoveryBehavior serviceDiscoveryBehavior = new ServiceDiscoveryBehavior(); - - // Announce the availability of the service over UDP multicast - serviceDiscoveryBehavior.AnnouncementEndpoints.Add(new UdpAnnouncementEndpoint()); - - // Make the service discoverable over UDP multicast. - serviceHost.Description.Behaviors.Add(serviceDiscoveryBehavior); - serviceHost.AddServiceEndpoint(new UdpDiscoveryEndpoint()); - serviceHost.Open(); - // ... -} -``` - -## Client - -In this project, note that the client hosts an . Furthermore, two delegates are registered with events. These events dictate what the client does when online and offline announcements are received. - -```csharp -// Create an AnnouncementService instance -AnnouncementService announcementService = new AnnouncementService(); - -// Subscribe the announcement events -announcementService.OnlineAnnouncementReceived += OnOnlineEvent; -announcementService.OfflineAnnouncementReceived += OnOfflineEvent; -``` - -The `OnOnlineEvent` and `OnOfflineEvent` methods handle the hello and bye announcement messages respectively. - -```csharp -static void OnOnlineEvent(object sender, AnnouncementEventArgs e) -{ - Console.WriteLine(); - Console.WriteLine("Received an online announcement from {0}:", e.AnnouncementMessage.EndpointDiscoveryMetadata.Address); -PrintEndpointDiscoveryMetadata(e.AnnouncementMessage.EndpointDiscoveryMetadata); -} - -static void OnOfflineEvent(object sender, AnnouncementEventArgs e) -{ - Console.WriteLine(); - Console.WriteLine("Received an offline announcement from {0}:", e.AnnouncementMessage.EndpointDiscoveryMetadata.Address); - PrintEndpointDiscoveryMetadata(e.AnnouncementMessage.EndpointDiscoveryMetadata); -} -``` - -#### To use this sample - -1. This sample uses HTTP endpoints and to run this sample, proper URL ACLs must be added. For more information, see [Configuring HTTP and HTTPS](../feature-details/configuring-http-and-https.md). Executing the following command at an elevated privilege should add the appropriate ACLs. You may want to substitute your Domain and Username for the following arguments if the command does not work as is. `netsh http add urlacl url=http://+:8000/ user=%DOMAIN%\%UserName%` - -2. Build the solution. - -3. Run the client.exe application. - -4. Run the service.exe application. Note the client receives an online announcement. - -5. Close the service.exe application. Note the client receives an offline announcement. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Discovery\Announcements` diff --git a/docs/framework/wcf/samples/asmx-client-with-a-wcf-service.md b/docs/framework/wcf/samples/asmx-client-with-a-wcf-service.md deleted file mode 100644 index 6bdfe740ab0a1..0000000000000 --- a/docs/framework/wcf/samples/asmx-client-with-a-wcf-service.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -description: "Learn more about: ASMX Client with a WCF Service" -title: "ASMX Client with a WCF Service" -ms.date: "03/30/2017" -ms.assetid: 3ea381ee-ac7d-4d62-8c6c-12dc3650879f ---- -# ASMX Client with a WCF Service - -This sample demonstrates how to create a service using Windows Communication Foundation (WCF) and then access the service from a non-WCF client, such as an ASMX client. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -This sample consists of a client console program (.exe) and a service library (.dll) hosted by Internet Information Services (IIS). The service implements a contract that defines a request-reply communication pattern. The contract is defined by the `ICalculator` interface, which exposes math operations (`Add`, `Subtract`, `Multiply`, and `Divide`). The ASMX client makes synchronous requests to a math operation and the service replies with the result. - -The service implements an `ICalculator` contract as defined in the following code. - -```csharp -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples"), XmlSerializerFormat] -public interface ICalculator -{ - [OperationContract] - double Add(double n1, double n2); - [OperationContract] - double Subtract(double n1, double n2); - [OperationContract] - double Multiply(double n1, double n2); - [OperationContract] - double Divide(double n1, double n2); -} -``` - -The and map CLR types to an XML representation. The interprets some XML representations differently than XmlSerializer. Non-WCF proxy generators, such as Wsdl.exe, generate a more usable interface when the XmlSerializer is being used. The is applied to the `ICalculator` interface, to ensure that the XmlSerializer is used for mapping CLR types to XML. The service implementation calculates and returns the appropriate result. - -The service exposes a single endpoint for communicating with the service, defined using a configuration file (Web.config). The endpoint consists of an address, a binding, and a contract. The service exposes the endpoint at the base address provided by the Internet Information Services (IIS) host. The `binding` attribute is set to basicHttpBinding that provides HTTP communications using SOAP 1.1, which is compliant with WS-I BasicProfile 1.1 as shown in the following sample configuration. - -```xml - - - - - - -``` - -The ASMX client communicates with the WCF service using a typed proxy that is generated by the Web Services Description Language (WSDL) utility (Wsdl.exe). The typed proxy is contained in the file generatedClient.cs. The WSDL utility retrieves metadata for the specified service and generates a typed proxy for use by a client to communicate. By default, the framework does not expose any metadata. To expose the metadata required to generate the proxy, you must add a [\](../../configure-apps/file-schema/wcf/servicemetadata.md) and set its `httpGetEnabled` attribute to `True` as shown in the following configuration. - -```xml - - - - - - - - - -``` - -Run the following command from a command prompt in the client directory to generate the typed proxy. - -```console -wsdl /n:Microsoft.ServiceModel.Samples /o:generatedClient.cs /urlkey:CalculatorServiceAddress http://localhost/servicemodelsamples/service.svc?wsdl -``` - -By using the generated typed proxy, the client can access a given service endpoint by configuring the appropriate address. The client uses a configuration file (App.config) to specify the endpoint to communicate with. - -```xml - - - -``` - -The client implementation constructs an instance of the typed proxy to begin communicating with the service. - -```csharp -// Create a client to the CalculatorService. -using (CalculatorService client = new CalculatorService()) -{ - // Call the Add service operation. - double value1 = 100.00D; - double value2 = 15.99D; - double result = client.Add(value1, value2); - Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); - - // Call the Subtract service operation. - value1 = 145.00D; - value2 = 76.54D; - result = client.Subtract(value1, value2); - Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result); - - // Call the Multiply service operation. - value1 = 9.00D; - value2 = 81.25D; - result = client.Multiply(value1, value2); - Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result); - - // Call the Divide service operation. - value1 = 22.00D; - value2 = 7.00D; - result = client.Divide(value1, value2); - Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result); - -} - -Console.WriteLine(); -Console.WriteLine("Press to terminate client."); -Console.ReadLine(); -``` - -When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!NOTE] -> For more information about passing and returning complex data types see: [Data Binding in a Windows Forms Client](data-binding-in-a-windows-forms-client.md), [Data Binding in a Windows Presentation Foundation Client](data-binding-in-a-wpf-client.md), and [Data Binding in an ASP.NET Client](data-binding-in-an-aspnet-client.md) - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Interop\ASMX` diff --git a/docs/framework/wcf/samples/aspnet-caching-integration.md b/docs/framework/wcf/samples/aspnet-caching-integration.md deleted file mode 100644 index 48158b618741f..0000000000000 --- a/docs/framework/wcf/samples/aspnet-caching-integration.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -description: "Learn more about: ASP.NET Caching Integration" -title: "ASP.NET Caching Integration" -ms.date: "03/30/2017" -ms.assetid: f581923a-8a72-42fc-bd6a-46de2aaeecc1 ---- -# ASP.NET Caching Integration - -This sample demonstrates how to utilize the ASP.NET output cache with the WCF WEB HTTP programming model. This topic focuses on the ASP.NET output cache integration feature. - -## Demonstrates - -Integration with the ASP.NET Output Cache - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Web\AspNetCachingIntegration` - -## Discussion - -The sample uses the to utilize ASP.NET output caching with the Windows Communication Foundation (WCF) service. The is applied to service operations, and provides the name of a cache profile in a configuration file that should be applied to responses from the given operation. - -In the Service.cs file of the sample Service project, both the `GetCustomer` and `GetCustomers` operations are marked with the , which provides the cache profile name "CacheFor60Seconds". In the Web.config file of the Service project, the cache profile "CacheFor60Seconds" is provided under the <`caching`> element of <`system.web`>. For this cache profile, the value of the `duration` attribute is "60", so responses associated with this profile are cached in the ASP.NET output cache for 60 seconds. Also, for this cache profile, the `varmByParam` attribute is set to "format" so requests with different values for the `format` query string parameter have their responses cached separately. Lastly, the cache profile’s `varyByHeader` attribute is set to "Accept", so requests with different Accept header values have their responses cached separately. - -Program.cs in the Client project demonstrates how such a client can be authored using . Note that this is just one way to access a WCF service. It is also possible to access the service using other .NET Framework classes like the WCF channel factory and . Other samples in the SDK (such as the [Basic HTTP Service](basic-http-service.md) sample) illustrate how to use these classes to communicate with a WCF service. - -## To run the sample - -The sample consists of three projects: - -- **Service**: A Web Application project that includes a WCF HTTP service hosted in ASP.NET. - -- **Client**: A console application project that makes calls to the service. - -- **Common**: A shared library that contains the Customer type used by the client and service. - -As the Client console application runs, the client makes requests to the service and writes the pertinent information from the responses to the console window. - -#### To run the sample - -1. Open the solution for the ASP.NET Caching Integration Sample. - -2. Press CTRL+SHIFT+B to build the solution. - -3. If the **Solution Explorer** window is not already open, press CTRL+W+S. - -4. From the **Solution Explorer** window, right click the **Service** project and select **Start New Instance**. This launches the ASP.NET development server, which hosts the service. - -5. From the **Solution Explorer** window, right click the **Client** project and select **Start New Instance**. - -6. The client console window appears and provides the URI of the running service and the URI of the HTML help page for the running service. At any point in time you can view the HTML help page by typing the URI of the help page in a browser. - -7. As the sample runs, the client writes the status of the current activity. - -8. Press any key to terminate the client console application. - -9. Press SHIFT+F5 to stop debugging the service. - -10. In the Windows Notification Area, right click the ASP.NET development server icon and select **Stop**. diff --git a/docs/framework/wcf/samples/aspnet-compatibility.md b/docs/framework/wcf/samples/aspnet-compatibility.md deleted file mode 100644 index 4d0e41a63b5cf..0000000000000 --- a/docs/framework/wcf/samples/aspnet-compatibility.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -description: "Learn more about: ASP.NET Compatibility" -title: "ASP.NET Compatibility" -ms.date: "03/30/2017" -ms.assetid: c8b51f1e-c096-4c42-ad99-0519887bbbc5 ---- -# ASP.NET Compatibility - -This sample demonstrates how to enable ASP.NET Compatibility mode in Windows Communication Foundation (WCF). Services running in ASP.NET Compatibility mode participate fully in the ASP.NET application pipeline and can make use of ASP.NET features such as file/URL authorization, session state, and the class. The class allows access to cookies, sessions, and other ASP.NET features. This mode requires that the bindings use the HTTP transport and the service itself must be hosted in IIS. - -In this sample, the client is a console application (an executable) and the service is hosted in Internet Information Services (IIS). - -> [!NOTE] -> The set-up procedure and build instructions for this sample are located at the end of this topic. - -This sample requires a .NET Framework 4 application pool in order to run. To create a new application pool, or to modify the default application pool, follow these steps. - -1. Open **Control Panel**. Open the **Administrative Tools** applet under the **System and Security** heading. Open the **Internet Information Services (IIS) Manager** applet. - -2. Expand the treeview in the **Connections** pane. Select the **Application Pools** node. - -3. To set the default application pool to use .NET Framework 4 (which may cause incompatibility problems with existing sites), right-click the **DefaultAppPool** list item and select **Basic Settings…**. Set the **.Net Framework Version** pull-down to **.Net Framework v4.0.30128** (or later). - -4. To create a new application pool that uses .NET Framework 4 (to preserve compatibility for other applications), right-click the **Application Pools** node and select **Add Application Pool…**. Name the new application pool, and set the **.Net Framework Version** pull-down to **.Net Framework v4.0.30128** (or later). After running the setup steps below, right-click the **ServiceModelSamples** application and select **Manage Application**, **Advanced Settings…**. Set the **Application Pool** to the new application pool. - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Hosting\WebHost\ASPNetCompatibility` - -This sample is based on the [Getting Started](getting-started-sample.md), which implements a calculator service. The `ICalculator` contract has been modified as the `ICalculatorSession` contract to allow a set of operations to be performed, while keeping a running result. - -```csharp -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] -public interface ICalculatorSession -{ - [OperationContract] - void Clear(); - [OperationContract] - void AddTo(double n); - [OperationContract] - void SubtractFrom(double n); - [OperationContract] - void MultiplyBy(double n); - [OperationContract] - void DivideBy(double n); - [OperationContract] - double Result(); -} -``` - -The service maintains state, using the feature, for each client as multiple service operations are called to perform a calculation. The client can retrieve the current result by calling `Result` and can clear the result to zero by calling `Clear`. - -The service uses the ASP.NET session to store the result for each client session. This allows the service to maintain the running result for each client across multiple calls to the service. - -> [!NOTE] -> ASP.NET session state and WCF sessions are very different things. See [Session](session.md) for details on WCF sessions. - -The service has an intimate dependency on ASP.NET session state and requires ASP.NET compatibility mode to function correctly. These requirements are expressed declaratively by applying the `AspNetCompatibilityRequirements` attribute. - -```csharp -[AspNetCompatibilityRequirements(RequirementsMode = - AspNetCompatibilityRequirementsMode.Required)] -public class CalculatorService : ICalculatorSession -{ - double Result - { // store result in AspNet Session - get { - if (HttpContext.Current.Session["Result"] != null) - return (double)HttpContext.Current.Session["Result"]; - return 0.0D; - } - set - { - HttpContext.Current.Session["Result"] = value; - } - } - public void Clear() - { - Result = 0.0D; - } - public void AddTo(double n) - { - Result += n; - } - public void SubtractFrom(double n) - { - Result -= n; - } - public void MultiplyBy(double n) - { - Result *= n; - } - public void DivideBy(double n) - { - Result /= n; - } - public double Result() - { - return Result; - } -} -``` - -When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -0, + 100, - 50, * 17.65, / 2 = 441.25 -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Be sure you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. After the solution has been built, run Setup.bat to set up the ServiceModelSamples Application in IIS 7.0. The ServiceModelSamples directory should now appear as an IIS 7.0 Application. - -4. To run the sample in a single- or cross-computer configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -## See also - -- [AppFabric Hosting and Persistence Samples](/previous-versions/appfabric/ff383418(v=azure.10)) diff --git a/docs/framework/wcf/samples/authorization-policy.md b/docs/framework/wcf/samples/authorization-policy.md deleted file mode 100644 index 4751ce704d58f..0000000000000 --- a/docs/framework/wcf/samples/authorization-policy.md +++ /dev/null @@ -1,505 +0,0 @@ ---- -description: "Learn more about: Authorization Policy" -title: "Authorization Policy" -ms.date: "03/30/2017" -ms.assetid: 1db325ec-85be-47d0-8b6e-3ba2fdf3dda0 ---- -# Authorization Policy - -This sample demonstrates how to implement a custom claim authorization policy and an associated custom service authorization manager. This is useful when the service makes claim-based access checks to service operations and prior to the access checks, grants the caller certain rights. This sample shows both the process of adding claims as well as the process for doing an access check against the finalized set of claims. All application messages between the client and server are signed and encrypted. By default with the `wsHttpBinding` binding, a username and password supplied by the client are used to logon to a valid Windows account. This sample demonstrates how to utilize a custom to authenticate the client. In addition this sample shows the client authenticating to the service using an X.509 certificate. This sample shows an implementation of and , which between them grant access to specific methods of the service for specific users. This sample is based on the [Message Security User Name](message-security-user-name.md), but demonstrates how to perform a claim transformation prior to the being called. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - In summary, this sample demonstrates how: - -- The client can be authenticated using a user name-password. - -- The client can be authenticated using an X.509 certificate. - -- The server validates the client credentials against a custom `UsernamePassword` validator. - -- The server is authenticated using the server's X.509 certificate. - -- The server can use to control access to certain methods in the service. - -- How to implement . - -The service exposes two endpoints for communicating with the service, defined using the configuration file App.config. Each endpoint consists of an address, a binding, and a contract. One binding is configured with a standard `wsHttpBinding` binding that uses WS-Security and client username authentication. The other binding is configured with a standard `wsHttpBinding` binding that uses WS-Security and client certificate authentication. The [\](../../configure-apps/file-schema/wcf/behavior-of-endpointbehaviors.md) specifies that the user credentials are to be used for service authentication. The server certificate must contain the same value for the `SubjectName` property as the `findValue` attribute in the [\](../../configure-apps/file-schema/wcf/servicecertificate-of-servicecredentials.md). - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -Each client endpoint configuration consists of a configuration name, an absolute address for the service endpoint, the binding, and the contract. The client binding is configured with the appropriate security mode as specified in this case in the [\](../../configure-apps/file-schema/wcf/security-of-wshttpbinding.md) and `clientCredentialType` as specified in the [\](../../configure-apps/file-schema/wcf/message-of-wshttpbinding.md). - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -For the user name-based endpoint, the client implementation sets the user name and password to use. - -```csharp -// Create a client with Username endpoint configuration -CalculatorClient client1 = new CalculatorClient("Username"); - -client1.ClientCredentials.UserName.UserName = "test1"; -client1.ClientCredentials.UserName.Password = "1tset"; - -try -{ - // Call the Add service operation. - double value1 = 100.00D; - double value2 = 15.99D; - double result = client1.Add(value1, value2); - Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); - ... -} -catch (Exception e) -{ - Console.WriteLine("Call failed : {0}", e.Message); -} - -client1.Close(); -``` - -For the certificate-based endpoint, the client implementation sets the client certificate to use. - -```csharp -// Create a client with Certificate endpoint configuration -CalculatorClient client2 = new CalculatorClient("Certificate"); - -client2.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySubjectName, "test1"); - -try -{ - // Call the Add service operation. - double value1 = 100.00D; - double value2 = 15.99D; - double result = client2.Add(value1, value2); - Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); - ... -} -catch (Exception e) -{ - Console.WriteLine("Call failed : {0}", e.Message); -} - -client2.Close(); -``` - -This sample uses a custom to validate user names and passwords. The sample implements `MyCustomUserNamePasswordValidator`, derived from . See the documentation about for more information. For the purposes of demonstrating the integration with the , this custom validator sample implements the method to accept user name/password pairs where the user name matches the password as shown in the following code. - -```csharp -public class MyCustomUserNamePasswordValidator : UserNamePasswordValidator -{ - // This method validates users. It allows in two users, - // test1 and test2 with passwords 1tset and 2tset respectively. - // This code is for illustration purposes only and - // MUST NOT be used in a production environment because it - // is NOT secure. - public override void Validate(string userName, string password) - { - if (null == userName || null == password) - { - throw new ArgumentNullException(); - } - - if (!(userName == "test1" && password == "1tset") && !(userName == "test2" && password == "2tset")) - { - throw new SecurityTokenException("Unknown Username or Password"); - } - } -} -``` - -Once the validator is implemented in service code, the service host must be informed about the validator instance to use. This is done using the following code: - -```csharp -Servicehost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom; -serviceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator = new MyCustomUserNamePasswordValidatorProvider(); -``` - -Or you can do the same thing in configuration: - -```xml - - - - - ... - - -``` - -Windows Communication Foundation (WCF) provides a rich claims-based model for performing access checks. The object is used to perform the access check and determine whether the claims associated with the client satisfy the requirements necessary to access the service method. - -For the purposes of demonstration, this sample shows an implementation of that implements the method to allow a user's access to methods based on claims of type `http://example.com/claims/allowedoperation` whose value is the Action URI of the operation that is allowed to be called. - -```csharp -public class MyServiceAuthorizationManager : ServiceAuthorizationManager -{ - protected override bool CheckAccessCore(OperationContext operationContext) - { - string action = operationContext.RequestContext.RequestMessage.Headers.Action; - Console.WriteLine("action: {0}", action); - foreach(ClaimSet cs in operationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets) - { - if ( cs.Issuer == ClaimSet.System ) - { - foreach (Claim c in cs.FindClaims("http://example.com/claims/allowedoperation", Rights.PossessProperty)) - { - Console.WriteLine("resource: {0}", c.Resource.ToString()); - if (action == c.Resource.ToString()) - return true; - } - } - } - return false; - } -} -``` - -Once the custom is implemented, the service host must be informed about the to use. This is done as shown in the following code. - -```xml - - ... - - ... - - -``` - -The primary method to implement is the method. - -```csharp -public class MyAuthorizationPolicy : IAuthorizationPolicy -{ - string id; - - public MyAuthorizationPolicy() - { - id = Guid.NewGuid().ToString(); - } - - public bool Evaluate(EvaluationContext evaluationContext, - ref object state) - { - bool bRet = false; - CustomAuthState customstate = null; - - if (state == null) - { - customstate = new CustomAuthState(); - state = customstate; - } - else - customstate = (CustomAuthState)state; - Console.WriteLine("In Evaluate"); - if (!customstate.ClaimsAdded) - { - IList claims = new List(); - - foreach (ClaimSet cs in evaluationContext.ClaimSets) - foreach (Claim c in cs.FindClaims(ClaimTypes.Name, - Rights.PossessProperty)) - foreach (string s in - GetAllowedOpList(c.Resource.ToString())) - { - claims.Add(new - Claim("http://example.com/claims/allowedoperation", - s, Rights.PossessProperty)); - Console.WriteLine("Claim added {0}", s); - } - evaluationContext.AddClaimSet(this, - new DefaultClaimSet(this.Issuer,claims)); - customstate.ClaimsAdded = true; - bRet = true; - } - else - { - bRet = true; - } - return bRet; - } -... -} -``` - -The previous code shows how the method checks that no new claims have been added that affect the processing and adds specific claims. The claims that are allowed are obtained from the `GetAllowedOpList` method, which is implemented to return a specific list of operations that the user is allowed to perform. The authorization policy adds claims for accessing the particular operation. This is later used by the to perform access check decisions. - -Once the custom is implemented, the service host must be informed about the authorization policies to use. - -```xml - - - - - -``` - -When you run the sample, the operation requests and responses are displayed in the client console window. The client successfully calls the Add, Subtract and Multiple methods and gets an "Access is denied" message when trying to call the Divide method. Press ENTER in the client window to shut down the client. - -## Setup Batch File - -The Setup.bat batch file included with this sample allows you to configure the server with relevant certificates to run a self-hosted application that requires server certificate-based security. - -The following provides a brief overview of the different sections of the batch files so that they can be modified to run in the appropriate configuration: - -- Creating the server certificate. - - The following lines from the Setup.bat batch file create the server certificate to be used. The %SERVER_NAME% variable specifies the server name. Change this variable to specify your own server name. The default value is localhost. - - ```bat - echo ************ - echo Server cert setup starting - echo %SERVER_NAME% - echo ************ - echo making server cert - echo ************ - makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=%SERVER_NAME% -sky exchange -pe - ``` - -- Installing the server certificate into client's trusted certificate store. - - The following lines in the Setup.bat batch file copy the server certificate into the client trusted people store. This step is required because certificates that are generated by Makecert.exe are not implicitly trusted by the client system. If you already have a certificate that is rooted in a client trusted root certificate—for example, a Microsoft issued certificate—this step of populating the client certificate store with the server certificate is not required. - - ```console - certmgr.exe -add -r LocalMachine -s My -c -n %SERVER_NAME% -r CurrentUser -s TrustedPeople - ``` - -- Creating the client certificate. - - The following lines from the Setup.bat batch file create the client certificate to be used. The %USER_NAME% variable specifies the server name. This value is set to "test1" because this is the name the `IAuthorizationPolicy` looks for. If you change the value of %USER_NAME% you must change the corresponding value in the `IAuthorizationPolicy.Evaluate` method. - - The certificate is stored in My (Personal) store under the CurrentUser store location. - - ```bat - echo ************ - echo making client cert - echo ************ - makecert.exe -sr CurrentUser -ss MY -a sha1 -n CN=%CLIENT_NAME% -sky exchange -pe - ``` - -- Installing the client certificate into server's trusted certificate store. - - The following lines in the Setup.bat batch file copy the client certificate into the trusted people store. This step is required because certificates that are generated by Makecert.exe are not implicitly trusted by the server system. If you already have a certificate that is rooted in a trusted root certificate—for example, a Microsoft issued certificate—this step of populating the server certificate store with the client certificate is not required. - - ```console - certmgr.exe -add -r CurrentUser -s My -c -n %CLIENT_NAME% -r LocalMachine -s TrustedPeople - ``` - -### To set up and build the sample - -1. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -2. To run the sample in a single- or cross-computer configuration, use the following instructions. - -> [!NOTE] -> If you use Svcutil.exe to regenerate the configuration for this sample, be sure to modify the endpoint name in the client configuration to match the client code. - -### To run the sample on the same computer - -1. Open Developer Command Prompt for Visual Studio with administrator privileges and run *Setup.bat* from the sample install folder. This installs all the certificates required for running the sample. - - > [!NOTE] - > The Setup.bat batch file is designed to be run from Developer Command Prompt for Visual Studio. The PATH environment variable set within Developer Command Prompt for Visual Studio points to the directory that contains executables required by the *Setup.bat* script. - -1. Launch Service.exe from *service\bin*. - -1. Launch Client.exe from *\client\bin*. Client activity is displayed on the client console application. - -If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -### To run the sample across computers - -1. Create a directory on the service computer. - -2. Copy the service program files from *\service\bin* to the directory on the service computer. Also copy the Setup.bat, Cleanup.bat, GetComputerName.vbs and ImportClientCert.bat files to the service computer. - -3. Create a directory on the client computer for the client binaries. - -4. Copy the client program files to the client directory on the client computer. Also copy the Setup.bat, Cleanup.bat, and ImportServiceCert.bat files to the client. - -5. On the server, run `setup.bat service` in Developer Command Prompt for Visual Studio opened with administrator privileges. - - Running `setup.bat` with the `service` argument creates a service certificate with the fully qualified domain name of the computer, and exports the service certificate to a file named *Service.cer*. - -6. Edit *Service.exe.config* to reflect the new certificate name (in the `findValue` attribute in the [\](../../configure-apps/file-schema/wcf/servicecertificate-of-servicecredentials.md)) which is the same as the fully qualified domain name of the computer. Also change the **computername** in the \/\ element from localhost to the fully qualified name of your service computer. - -7. Copy the *Service.cer* file from the service directory to the client directory on the client computer. - -8. On the client, run `setup.bat client` in Developer Command Prompt for Visual Studio opened with administrator privileges. - - Running `setup.bat` with the `client` argument creates a client certificate named **test1** and exports the client certificate to a file named *Client.cer*. - -9. In the *Client.exe.config* file on the client computer, change the address value of the endpoint to match the new address of your service. Do this by replacing **localhost** with the fully qualified domain name of the server. - -10. Copy the Client.cer file from the client directory to the service directory on the server. - -11. On the client, run *ImportServiceCert.bat* in Developer Command Prompt for Visual Studio opened with administrator privileges. - - This imports the service certificate from the Service.cer file into the **CurrentUser - TrustedPeople** store. - -12. On the server, run *ImportClientCert.bat* in Developer Command Prompt for Visual Studio opened with administrator privileges. - - This imports the client certificate from the Client.cer file into the **LocalMachine - TrustedPeople** store. - -13. On the server computer, launch Service.exe from the command prompt window. - -14. On the client computer, launch Client.exe from a command prompt window. - - If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -### Clean up after the sample - -To clean up after the sample, run *Cleanup.bat* in the samples folder when you have finished running the sample. This removes the server and client certificates from the certificate store. - -> [!NOTE] -> This script does not remove service certificates on a client when running this sample across computers. If you have run WCF samples that use certificates across computers, be sure to clear the service certificates that have been installed in the CurrentUser - TrustedPeople store. To do this, use the following command: `certmgr -del -r CurrentUser -s TrustedPeople -c -n ` For example: `certmgr -del -r CurrentUser -s TrustedPeople -c -n server1.contoso.com`. diff --git a/docs/framework/wcf/samples/authorizing-access-to-service-operations.md b/docs/framework/wcf/samples/authorizing-access-to-service-operations.md deleted file mode 100644 index 594417e470a5f..0000000000000 --- a/docs/framework/wcf/samples/authorizing-access-to-service-operations.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -description: "Learn more about: Authorizing Access to Service Operations" -title: "Authorizing Access to Service Operations" -ms.date: "03/30/2017" -helpviewer_keywords: - - "service behaviors, authorizing access sample" - - "Authorizing Access To Service Operations Sample [Windows Communication Foundation]" - - "authorization, Windows Communication Foundation sample" -ms.assetid: ddcfdaa5-8b2e-4e13-bd85-887209dc6328 ---- -# Authorizing Access to Service Operations - -This sample demonstrates how to use the [\](../../configure-apps/file-schema/wcf/serviceauthorization-element.md) to enable use of the attribute to authorize access to service operations. This sample is based on the [Getting Started](getting-started-sample.md) sample. The service and client are configured using the [\](../../configure-apps/file-schema/wcf/wshttpbinding.md). The `mode` attribute of the [\](../../configure-apps/file-schema/wcf/security-of-custombinding.md) has been set to `Message` and `clientCredentialType` has been set to `Windows`. The is applied to each service method and used to restrict access to each operation. The caller must be a Windows administrator to access each operation. - - In this sample, the client is a console application (.exe) and the service is hosted by Internet Information Services (IIS). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The service configuration file uses the [\](../../configure-apps/file-schema/wcf/serviceauthorization-element.md) to set the `principalPermissionMode` attribute: - -```xml - - - - - - - - -``` - - Setting the `principalPermissionMode` to `UseWindowsGroups` enables the use of based on Windows group names. - - The is applied to each operation to require the caller to be part of the Windows administrators group, as shown in the following sample code. - -```csharp -[PrincipalPermission(SecurityAction.Demand, - Role = "Builtin\\Administrators")] -public double Add(double n1, double n2) -{ - double result = n1 + n2; - return result; -} -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. The client successfully communicates with each operation if it is running under an account that is part of the Administrators group; otherwise, access is denied. To experiment with authorization failure, run the client under an account that is not part of the Administrators group. Press ENTER in the console window to shut down the client. - - A service can be notified of authorization failures by implementing an . See [Extending Control Over Error Handling and Reporting](extending-control-over-error-handling-and-reporting.md) for information about implementing `IErrorHandler`. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-computer configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). diff --git a/docs/framework/wcf/samples/basic-ajax-service.md b/docs/framework/wcf/samples/basic-ajax-service.md deleted file mode 100644 index 9a25615d97483..0000000000000 --- a/docs/framework/wcf/samples/basic-ajax-service.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -description: "Learn more about: Basic AJAX Service" -title: "Basic AJAX Service" -ms.date: "03/30/2017" -ms.assetid: d66d0c91-0109-45a0-a901-f3e4667c2465 ---- -# Basic AJAX Service - -This sample demonstrates how to use Windows Communication Foundation (WCF) to create a basic ASP.NET Asynchronous JavaScript and XML (AJAX) service (a service that you can access using JavaScript code from a Web browser client). The service uses the attribute to ensure that the service responds to HTTP GET requests and is configured to use the JavaScript Object Notation (JSON) data format for responses. - -AJAX support in WCF is optimized for use with ASP.NET AJAX through the `ScriptManager` control. For an example of using WCF with ASP.NET AJAX, see the [AJAX Samples](ajax.md). - -> [!NOTE] -> The set-up procedure and build instructions for this sample are located at the end of this topic. - -In the following code, the attribute is applied to the `Add` operation to ensure that the service responds to HTTP GET requests. The code uses GET for simplicity (you can construct an HTTP GET request from any Web browser). You can also use GET to enable caching. HTTP POST is the default in the absence of the `WebGetAttribute` attribute. - -```csharp -[ServiceContract(Namespace = "SimpleAjaxService")] -public interface ICalculator -{ - [WebGet] - double Add(double n1, double n2); - //Other operations omitted… -} -``` - -The sample .svc file uses , which adds a standard endpoint to the service. The endpoint is configured at an empty address relative to the .svc file. This means that the address of the service is `http://localhost/ServiceModelSamples/service.svc`, with no additional suffixes other than the operation name. - -`<%@ServiceHost language="C#" Debug="true" Service="Microsoft.Samples.SimpleAjaxService.CalculatorService" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>` - -The is pre-configured to make the service accessible from an ASP.NET AJAX client page. The following section in Web.config can be used to make additional configuration changes to the endpoint. It can be removed if no extra changes are required. - -```xml - - - - - - - - -``` - -The sets the default data format for the service to JSON instead of XML. To invoke the service, navigate to `http://localhost/ServiceModelSamples/service.svc/Add?n1=100&n2=200` after completing the set up and build steps shown later in this topic. This testing functionality is enabled by the use of a HTTP GET request. - -The client Web page SimpleAjaxClientPage.aspx contains ASP.NET code to invoke the service whenever the user clicks one of the operation buttons on the page. The `ScriptManager` control is used to make a proxy to the service accessible through JavaScript. - -```aspx-csharp - - - - - -``` - -The local proxy is instantiated and operations are invoked using the following JavaScript code. - -```javascript -// Code for extracting arguments n1 and n2 omitted… -// Instantiate a service proxy -var proxy = new SimpleAjaxService.ICalculator(); -// Code for selecting operation omitted… -proxy.Add(parseFloat(n1), parseFloat(n2), onSuccess, onFail, null); -``` - -If the service call succeeds, the code invokes the `onSuccess` handler and the result of the operation is displayed in a text box. - -```javascript -function onSuccess(mathResult){ - document.getElementById("result").value = mathResult; -} -``` - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Ajax\SimpleAjaxService` diff --git a/docs/framework/wcf/samples/basic-binding.md b/docs/framework/wcf/samples/basic-binding.md deleted file mode 100644 index 6ec51e1afa64b..0000000000000 --- a/docs/framework/wcf/samples/basic-binding.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -description: "Learn more about: Basic Binding" -title: "Basic Binding" -ms.date: "03/30/2017" -ms.assetid: 2a0e8ac4-23e7-45ef-98dc-40691aac530a ---- -# Basic Binding - -This section contains basic samples that demonstrate using the binding attribute of an endpoint element. - -## In This Section - - [Message Security Sample](message-security-sample.md) - Demonstrates how to implement an application that uses the `basicHttpBinding` and message security. - - [BasicBinding with Transport Security](basicbinding-with-transport-security.md) - Demonstrates the use of SSL transport security with the basic binding. - - [BasicBinding](basicbinding.md) - Demonstrates the use of `basicHttpBinding` that provides HTTP communication and maximum interoperability with first- and second-generation Web services. diff --git a/docs/framework/wcf/samples/basic-data-contract.md b/docs/framework/wcf/samples/basic-data-contract.md deleted file mode 100644 index e4919746b44ca..0000000000000 --- a/docs/framework/wcf/samples/basic-data-contract.md +++ /dev/null @@ -1,144 +0,0 @@ ---- -description: "Learn more about: Basic Data Contract" -title: "Basic Data Contract" -ms.date: "03/30/2017" -helpviewer_keywords: - - "Data Contract" -ms.assetid: b124e9e0-cb73-4ae0-b9c3-e6cdf5eced98 ---- -# Basic Data Contract - -This sample demonstrates how to implement a data contract. Data contracts allow you to pass structured data to and from services. This sample is based on the [Getting Started](getting-started-sample.md) but uses complex numbers instead of basic numeric types. - -In this sample, the service is hosted by Internet Information Services (IIS) and the client is a console application (.exe). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The service contract for this service uses complex numbers, as shown in the following sample code. - -```csharp -// Define a service contract. -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] -public interface ICalculator -{ - [OperationContract] - ComplexNumber Add(ComplexNumber n1, ComplexNumber n2); - [OperationContract] - ComplexNumber Subtract(ComplexNumber n1, ComplexNumber n2); - [OperationContract] - ComplexNumber Multiply(ComplexNumber n1, ComplexNumber n2); - [OperationContract] - ComplexNumber Divide(ComplexNumber n1, ComplexNumber n2); -} -``` - - The and attributes have been applied to the definition of the `ComplexNumber` class to indicate which fields of the class can be passed over the wire between the client and the service, as shown in the following sample code. - -```csharp -[DataContract(Namespace="http://Microsoft.ServiceModel.Samples")] -public class ComplexNumber -{ - [DataMember] - public double Real = 0.0D; - [DataMember] - public double Imaginary = 0.0D; - - public ComplexNumber(double real, double imaginary) - { - this.Real = real; - this.Imaginary = imaginary; - } -} -``` - -The service implementation calculates and returns the appropriate result, accepting and returning numbers of the `ComplexNumber` type. - -```csharp -// This is the service class that implements the service contract. -public class CalculatorService : ICalculator -{ - public ComplexNumber Add(ComplexNumber n1, ComplexNumber n2) - { - return new ComplexNumber(n1.Real + n2.Real, n1.Imaginary + - n2.Imaginary); - } - - public ComplexNumber Subtract(ComplexNumber n1, ComplexNumber n2) - { - return new ComplexNumber(n1.Real - n2.Real, n1.Imaginary - - n2.Imaginary); - } - public ComplexNumber Multiply(ComplexNumber n1, ComplexNumber n2) - { - double real1 = n1.Real * n2.Real; - double imaginary1 = n1.Real * n2.Imaginary; - double imaginary2 = n2.Real * n1.Imaginary; - double real2 = n1.Imaginary * n2.Imaginary * -1; - return new ComplexNumber(real1 + real2, imaginary1 + - imaginary2); - } - - public ComplexNumber Divide(ComplexNumber n1, ComplexNumber n2) - { - ComplexNumber conjugate = - new ComplexNumber(n2.Real, -1*n2.Imaginary); - ComplexNumber numerator = Multiply(n1, conjugate); - ComplexNumber denominator = Multiply(n2, conjugate); - return new ComplexNumber(numerator.Real / denominator.Real, - numerator.Imaginary); - } -} -``` - -The client implementation also uses complex numbers. Both the service contract and the data contract are defined in the source file generatedClient.cs, which is generated by the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) from service metadata. - -```csharp -// Create a client. -DataContractCalculatorClient client = new DataContractCalculatorClient(); -// Call the Add service operation. -ComplexNumber value1 = new ComplexNumber() - { - Real = 1, - Imaginary = 2 - }; -ComplexNumber value2 = new ComplexNumber() - { - Real = 3, - Imaginary = 4 - }; -ComplexNumber result = proxy.Add(value1, value2); -Console.WriteLine("Add({0} + {1}i, {2} + {3}i) = {4} + {5}i", - value1.Real, value1.Imaginary, value2.Real, value2.Imaginary, - result.Real, result.Imaginary); - … -} -``` - -When you run the sample, the requests and responses of the operation are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(1 + 2i, 3 + 4i) = 4 + 6i -Subtract(1 + 2i, 3 + 4i) = -2 + -2i -Multiply(2 + 3i, 4 + 7i) = -13 + 26i -Divide(3 + 7i, 5 + -2i) = 0.0344827586206897 + 41i - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Contract\Data\Basic` diff --git a/docs/framework/wcf/samples/basic-http-service.md b/docs/framework/wcf/samples/basic-http-service.md deleted file mode 100644 index 4b49340122b16..0000000000000 --- a/docs/framework/wcf/samples/basic-http-service.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -description: "Learn more about: Basic HTTP Service" -title: "Basic HTTP Service" -ms.date: "03/30/2017" -ms.assetid: 27048b43-8a54-4f2a-9952-594bbfab10ad ---- -# Basic HTTP Service - -This sample demonstrates how to implement an HTTP-based, RPC-based service - popularly referred to as "POX" (Plain Old XML) service – using the Windows Communication Foundation (WCF) REST Programming model. This sample consists of two components: a self-hosted WCF HTTP service (Service.cs) and a console application (Program.cs) that creates the service and makes calls to it. - -## Sample Details - -The WCF service exposes 2 operations, `EchoWithGet` and `EchoWithPost`, which returns the string that was passed as input. - -The `EchoWithGet` operation is annotated with , which indicates that the operation processes HTTP `GET` requests. Because the does not explicitly specify a , the operation expects the input string to be passed in using a query string parameter with name `s`. Note that the format of the URI that the service expects can be customized using the property. - -The `EchoWithPost` operation is annotated with , which indicates it is not a `GET` operation (it has side effects). Because the does not explicitly specify a `Method`, the operation processes HTTP `POST` requests that have the string in the request body (in the XML format, for instance). Note that the HTTP method and the format of the URI for the request can be customized using the and properties respectively. - -The App.config file configures the WCF service with a default that has the property set to `true`. As a result, the WCF infrastructure creates an automatic HTML based help page at `http://localhost:8000/Customers/help` that provides information about how to construct HTTP requests to the service and how to consume the service’s HTTP response. - -Program.cs demonstrates how a WCF channel factory can be used to make calls to the service and process responses. Note that this is just one way to access a WCF service. It is also possible to access the service using other .NET Framework classes like and . - -The sample consists a self-hosted service and a client that both run within a console application. As the console application runs, the client makes requests to the service and writes the pertinent information from the responses to the console window. - -#### To use this sample - -1. Open the solution for the Basic Http Service Sample. When launching Visual Studio 2012, you must run as an administrator for the sample to execute successfully. Do this by right-clicking the Visual Studio 2012 icon and selecting **Run as Administrator** from the context menu. - -2. Press CTRL+SHIFT+B to build the solution and then press Ctrl+F5 to run the console application without debugging. The console window appears and provides the URI of the running service and the URI of the HTML help page for the running service. At any point in time you can view the HTML help page by typing the URI of the help page in a browser. As the sample runs, the client writes the status of the current activity. - -3. Press any key to terminate the sample. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Web\BasicHttpService` diff --git a/docs/framework/wcf/samples/basic-sample.md b/docs/framework/wcf/samples/basic-sample.md deleted file mode 100644 index 4b4c410b8af3c..0000000000000 --- a/docs/framework/wcf/samples/basic-sample.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -description: "Learn more about: Basic Sample" -title: "Basic Sample" -ms.date: "03/30/2017" -ms.assetid: c1910bc1-3d0a-4fa6-b12a-4ed6fe759620 ---- -# Basic Sample - -This sample shows how to make a service discoverable and how to search for and call a discoverable service. This sample is composed of two projects: service and client. - -> [!NOTE] -> This sample implements discovery in code. For a sample that implements discovery in configuration, see [Configuration](configuration-sample.md). - -## Service - -This is a simple calculator service implementation. The discovery related code can be found in `Main` where a is added to the service host and a is added as shown in the following code. - -```csharp -using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress)) -{ - serviceHost.AddServiceEndpoint(typeof(ICalculatorService), new - WSHttpBinding(), String.Empty); - - // Make the service discoverable over UDP multicast - serviceHost.Description.Behaviors.Add(new ServiceDiscoveryBehavior()); - serviceHost.AddServiceEndpoint(new UdpDiscoveryEndpoint()); - - serviceHost.Open(); - // ... -} -``` - -## Client - -The client uses a to locate the service. The , a standard endpoint, resolves the endpoint of the service when the client is opened. In this case, the looks for the service based on the service contract. The conducts the search over a by default. Once it locates a service endpoint, the client connects to that service over the specified binding. - -```csharp -public static void Main() -{ - DynamicEndpoint dynamicEndpoint = new DynamicEndpoint( ContractDescription.GetContract(typeof(ICalculatorService)), new WSHttpBinding()); - // ... -} -``` - -The client defines a method called `InvokeCalculatorService` that uses the class to search for services. The inherits from , so it can be passed to the `InvokeCalculatorService` method. The example then uses the to create an instance of `CalculatorServiceClient` and calls the various operations of the calculator service. - -```csharp -static void InvokeCalculatorService(ServiceEndpoint serviceEndpoint) -{ - // Create a client - CalculatorServiceClient client = new CalculatorServiceClient(serviceEndpoint); - - Console.WriteLine("Invoking CalculatorService"); - Console.WriteLine(); - - double value1 = 100.00D; - double value2 = 15.99D; - - // Call the Add service operation. - double result = client.Add(value1, value2); - Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); - - // Call the Subtract service operation. - result = client.Subtract(value1, value2); - Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result); - - // Call the Multiply service operation. - result = client.Multiply(value1, value2); - Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result); - - // Call the Divide service operation. - result = client.Divide(value1, value2); - Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result); - Console.WriteLine(); - - //Closing the client gracefully closes the connection and cleans up resources - client.Close(); -} -``` - -#### To use this sample - -1. This sample uses HTTP endpoints and to run this sample, proper URL ACLs must be added. For more information, see [Configuring HTTP and HTTPS](../feature-details/configuring-http-and-https.md). Executing the following command at an elevated privilege should add the appropriate ACLs. You may want to substitute your Domain and Username for the following arguments if the command does not work as is. `netsh http add urlacl url=http://+:8000/ user=%DOMAIN%\%UserName%` - -2. Using Visual Studio 2012, open the Basic.sln and build the sample. - -3. Run the service.exe application. - -4. After the service has started, run the client.exe. - -5. Observe that the client was able to find the service without knowing its address. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Discovery\Basic` diff --git a/docs/framework/wcf/samples/basic.md b/docs/framework/wcf/samples/basic.md deleted file mode 100644 index 45d98e84bc50a..0000000000000 --- a/docs/framework/wcf/samples/basic.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -description: "Learn more about: Basic" -title: "Basic2" -ms.date: "03/30/2017" -ms.assetid: 04e4d3bd-ab89-4b50-8f42-2a4430751a9c ---- -# Basic - -This section includes sections of samples that demonstrate basic Windows Communication Foundation (WCF)functionality. - -## In This Section - - [Getting Started](getting-started-sample.md) - Demonstrates how to implement a typical service and a typical client using WCF. - - [AJAX](ajax.md) - Demonstrates Asynchronous JavaScript and XML. - - [Binding](binding.md) - Demonstrates using the binding attribute of an endpoint element. - - [Client](client.md) - Demonstrates WCF client applications. - - [Contract](contract.md) - Demonstrates data contracts. - - [Discovery](discovery-samples.md) - Demonstrates WCF discovery. - - [Management](management.md) - Demonstrates WCF management. - - [Routing Services](routing-services.md) - Demonstrates WCF routing services. - - [Security](security-in-wcf.md) - Demonstrates WCF security. - - [Services](services.md) - Demonstrates WCF services. - - [Syndication](syndication.md) - DemonstratesWCF syndication. - - [Web](web.md) - Demonstrates Web-hosting in WCF. diff --git a/docs/framework/wcf/samples/basicbinding-with-transport-security.md b/docs/framework/wcf/samples/basicbinding-with-transport-security.md deleted file mode 100644 index 5d3c06ccbe9c2..0000000000000 --- a/docs/framework/wcf/samples/basicbinding-with-transport-security.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -description: "Learn more about: BasicBinding with Transport Security" -title: "BasicBinding with Transport Security" -ms.date: "03/30/2017" -ms.assetid: f49b1de6-0254-4362-8ef2-fccd8ff9688b ---- -# BasicBinding with Transport Security - -This sample demonstrates the use of SSL transport security with the basic binding. This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Binding\Basic\TransportSecurity` - -## Sample Details - -By default, the basic binding supports HTTP communication. The sample shows how to enable transport security for the basic binding. Before you run the sample, you must create a certificate and assign it by using the Web Server Certificate Wizard. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -The program code in the sample is identical to that of the [Getting Started](getting-started-sample.md) service. The endpoint definition and binding definition in the configuration file settings are modified to enable secure communication, as shown in the following sample configuration. - -```xml - - - - - - - - - - - - - - - - - - -``` - -Because the certificate used in this sample is a test certificate created with Makecert.exe, a security alert appears when you try to access an HTTPS: address in your browser, such as `https://localhost/servicemodelsamples/service.svc`. To allow the Windows Communication Foundation (WCF) client to work with a test certificate, some additional code is added to the client to suppress the security alert. This code, and the accompanying class, is not necessary when using real certificates. - -```csharp -// This code is required only for test certificates such as those -// created by Makecert.exe. -PermissiveCertificatePolicy.Enact("CN=ServiceModelSamples-HTTPS-Server"); -``` - -When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -#### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command: - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. Ensure that you have performed the [Internet Information Services (IIS) Server Certificate Installation Instructions](iis-server-certificate-installation-instructions.md). - -4. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -5. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). diff --git a/docs/framework/wcf/samples/basicbinding.md b/docs/framework/wcf/samples/basicbinding.md deleted file mode 100644 index 3cadc752e3725..0000000000000 --- a/docs/framework/wcf/samples/basicbinding.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -description: "Learn more about: BasicBinding" -title: "BasicBinding" -ms.date: "03/30/2017" -ms.assetid: 86fbeb87-4d89-4b61-9577-867e0ac12945 ---- -# BasicBinding - -This sample demonstrates the use of `basicHttpBinding` that provides HTTP communication and maximum interoperability with first- and second-generation Web services. - -> [!NOTE] -> The set-up procedure and build instructions for this sample are located at the end of this topic. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Binding\Basic\Http` - -## Sample Details - -This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. - -To use the basic binding with default behavior, only the binding section name is required. If you want to configure the basic binding and change some of its settings, it is necessary to define a binding configuration. The endpoint must reference the binding configuration by name by using the `bindingConfiguration` attribute of the <`endpoint`> element, as shown in the following sample code. - -```xml - - - - - -``` - -In this sample, the binding configuration is named `"Binding1"` and is defined as shown in the following code example. - -```xml - - - - - - - -``` - -The binding element provides attributes for setting the host name comparison mode, maximum message size, proxy options, timeouts, message encoding, and other options. - -When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -#### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command. - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). diff --git a/docs/framework/wcf/samples/behavior-security.md b/docs/framework/wcf/samples/behavior-security.md deleted file mode 100644 index dfb570b53f842..0000000000000 --- a/docs/framework/wcf/samples/behavior-security.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -description: "Learn more about: Behavior Security" -title: "Behavior Security" -ms.date: "03/30/2017" -ms.assetid: 19710ae3-f197-4d28-ba9d-52e465006819 ---- -# Behavior Security - -This section includes samples that demonstrate configuring security for service behaviors. - -## In This Section - - [Service Auditing Behavior](service-auditing-behavior.md) - This sample demonstrates how to use the to enable auditing of security events during service operations. - - [Membership and Role Provider](membership-and-role-provider.md) - This sample demonstrates how a service can use the ASP.NET membership and role providers to authenticate and authorize clients. - - [Authorizing Access to Service Operations](authorizing-access-to-service-operations.md) - This sample demonstrates how to use the [\](../../configure-apps/file-schema/wcf/serviceauthorization-element.md) to enable use of the attribute to authorize access to service operations. - - [Impersonating the Client](impersonating-the-client.md) - This sample demonstrates how to impersonate the caller application at the service so that the service can access system resources on behalf of the caller. diff --git a/docs/framework/wcf/samples/behaviors.md b/docs/framework/wcf/samples/behaviors.md deleted file mode 100644 index 65d2d36469d5c..0000000000000 --- a/docs/framework/wcf/samples/behaviors.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: "Learn more about: Behaviors" -title: "Behaviors" -ms.date: "03/30/2017" -ms.assetid: b0885b65-4e74-4bc9-bbf0-eb7ebe566da1 ---- -# Behaviors - -This section contains samples that demonstrate Windows Communication Foundation (WCF) service behaviors. - -## In This Section - - [Concurrency](concurrency.md) - Demonstrates using the with the enumeration, which controls whether an instance of a service processes messages sequentially or concurrently. - - [Default Service Behavior](default-service-behavior.md) - Demonstrates how service behavior settings can be configured. - - [Instancing](instancing.md) - Demonstrates the instancing behavior setting, which controls how instances of a service class are created in response to client requests. - - [Metadata Publishing Behavior](metadata-publishing-behavior.md) - Demonstrates how to control the metadata publishing features of a service. - - [Service Transaction Behavior](service-transaction-behavior.md) - Demonstrates the use of a client-coordinated transaction and the settings of and to control service transaction behavior. - - [Service Debug Behavior](service-debug-behavior.md) - Demonstrates how service debug behavior settings can be configured. - - [Throttling](throttling.md) - Demonstrates the use of throttling controls. - - [Behavior Security](behavior-security.md) - Demonstrates configuring service behavior security. diff --git a/docs/framework/wcf/samples/binding-extensibility.md b/docs/framework/wcf/samples/binding-extensibility.md deleted file mode 100644 index 46d806210631a..0000000000000 --- a/docs/framework/wcf/samples/binding-extensibility.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: "Learn more about: Binding Extensibility" -title: "Binding Extensibility" -ms.date: "03/30/2017" -ms.assetid: cabdd583-ddf5-493e-9dba-c6c31cde8f65 ---- -# Binding Extensibility - -This section contains samples that demonstrate custom binding in Windows Communication Foundation (WCF). - -## In This Section - - - Demonstrates how to implement a binding that stacks or the on top of the . - - [WSStreamedHttpBinding](wsstreamedhttpbinding.md) - Demonstrates how to create a binding that is designed to support streaming scenarios when the HTTP transport is used. diff --git a/docs/framework/wcf/samples/binding.md b/docs/framework/wcf/samples/binding.md deleted file mode 100644 index 1c5567ebbbb8a..0000000000000 --- a/docs/framework/wcf/samples/binding.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -description: "Learn more about: Binding" -title: "Binding WCF Samples" -ms.date: "03/30/2017" -ms.assetid: 324fa627-d012-465a-b266-95594a09dac2 ---- -# Binding - -This section contains samples that demonstrate using the binding attribute of an endpoint element. - -## In this section - - [Basic Binding](basic-binding.md) - Demonstrates basic binding in WCF. - - [Custom Binding](custom-binding.md) - Demonstrates custom binding in WCF. - - [Net Binding](net-binding.md) - Demonstrates network binding in WCF. - - [WS Binding](ws-binding.md) - Demonstrates Windows Service binding in WCF. diff --git a/docs/framework/wcf/samples/building-the-samples.md b/docs/framework/wcf/samples/building-the-samples.md deleted file mode 100644 index 7123cbdafd485..0000000000000 --- a/docs/framework/wcf/samples/building-the-samples.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -description: "Learn more about: Building the Windows Communication Foundation Samples" -title: "Building the Windows Communication Foundation Samples" -ms.date: "03/30/2017" -ms.assetid: 2899e7a5-9cb2-4e8d-b8d2-f31391549198 ---- -# Building the Windows Communication Foundation Samples - -The Windows Communication Foundation (WCF) samples can be built using the Visual Studio IDE or using the **msbuild** command from the command line. Both procedures are described in this topic. - -> [!NOTE] -> Before building or running any of the WCF samples, ensure you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -## To build the sample using a command prompt - -1. Open Developer Command Prompt for Visual Studio and navigate to the language-specific subdirectory under the directory location where you installed the sample. - -2. Type `msbuild` at the command line. The client program files are built to *client\bin* and the service program files are built to *service\bin*. If the service is hosted by Internet Information Services (IIS), the service program files are also copied to the *servicemodelsamples* directory and its *\bin* subdirectory. - -> [!NOTE] -> You must set the ACLs on *%systemdrive%\inetpub\wwwroot* to grant modify permissions to the account under which you are running. Otherwise some post build events fail. Alternatively, you can leave the ACLs as they are and run the SDK command prompt as administrator. - -## To build the sample using Visual Studio - -1. From the **File** menu in Visual Studio, select **Open** > **Project/Solution**. Navigate to the language-specific subdirectory under the directory in which you installed the sample, and double-click the .sln file icon to open the solution in Visual Studio. - -1. From the **Build** menu, select **Rebuild Solution**. - - The client program files are built to client\bin and the service program files are built to service\bin. If the service is hosted in IIS, the service program files are also copied to the *servicemodelsamples* directory and its *\bin* subdirectory. - -> [!NOTE] -> You must set the ACLs on %systemdrive%\inetpub\wwwroot to grant modify permissions to the account under which you are running. Otherwise some post build events fail. Alternatively, you can leave the ACLs as they are and run the SDK command prompt or Visual Studio as administrator. Some Visual Studio actions (such as attaching a debugger to the ASP.NET worker process) also require administrative privileges. - -## Setup Batch Files and Scripts - - Setup.exe and Cleanup.exe batch files and scripts should be run from Developer Command Prompt for Visual Studio. Several set up and clean up files perform tasks that require administrative privileges and should be launched with administrator privileges. - -## Important Security Information about Metadata Endpoints - - To prevent unintentional disclosure of potentially sensitive service metadata, the default configuration for Windows Communication Foundation (WCF) services disables metadata publishing. This behavior is secure by default, but also means that you cannot use a metadata import tool (such as Svcutil.exe) to generate the client code required to call the service unless the service’s metadata publishing behavior is explicitly enabled in configuration. To make experimenting with the samples easier, almost all samples expose an unsecured metadata publishing endpoint. Such endpoints are potentially available to anonymous unauthenticated consumers and care must be taken before deploying such endpoints to ensure that publicly disclosing a service’s metadata is appropriate. For more information about publishing service metadata, see the [Metadata Publishing Behavior](metadata-publishing-behavior.md) sample. See the [Custom Secure Metadata Endpoint](custom-secure-metadata-endpoint.md) sample for a sample securing a metadata endpoint. - -## Exception Handling - - Generally speaking these samples do not include exception handling to keep the code focused on the subject of the sample. For more information about exception handling, see the [Expected Exceptions](expected-exceptions.md) sample. - -## Regenerating Clients and Configuration with Svcutil - - You can use the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) to regenerate client code and configuration for most of the samples. Some samples require manually edited configuration. For example, if you use Svcutil.exe to regenerate the configuration for a sample that uses client certificate credentials, you must manually specify the credentials previously configured. Some samples use specific Svcutil.exe options to affect the generated code, these options are specified in the specific sample topics. - -### To regenerate the client and configuration files - -1. Open an SDK command prompt and navigate to the language-specific subdirectory under the directory location where you installed the sample. - -2. If the service is a Web-hosted type, use the following command. - - ```console - svcutil.exe /n:"http://Microsoft.ServiceModel.Samples,Microsoft.ServiceModel.Samples" http://localhost/servicemodelsamples/service.svc/mex /out:generatedClient.cs - ``` - - If the service is a self-hosted type the following command. - - ```console - svcutil.exe /n:"http://Microsoft.ServiceModel.Samples,Microsoft.ServiceModel.Samples" http://localhost:8000/servicemodelsamples/service.svc/mex /out:generatedClient.cs - ``` - - Replace `http://localhost:8000/ServiceModelSamples/service.svc/mex` with the address of the self-hosted service's mex endpoint. - - To generate the client in a Visual Basic type, use the following command. - - ```console - svcutil.exe /n:"http://Microsoft.ServiceModel.Samples,Microsoft.ServiceModel.Samples" http://localhost/servicemodelsamples/service.svc/mex /l:vb /out:generatedClient.vb - ``` - - If the service is a self-hosted type, use the following command. - - ```console - svcutil.exe /n:"http://Microsoft.ServiceModel.Samples,Microsoft.ServiceModel.Samples" http://localhost:8000/servicemodelsamples/service.svc/mex /l:vb /out:generatedClient.vb - ``` - - > [!NOTE] - > To skip the generation of client configuration add the **/noConfig** option. - -## See also - -- [Running the Windows Communication Foundation Samples](running-the-samples.md) -- [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) diff --git a/docs/framework/wcf/samples/channel-factory.md b/docs/framework/wcf/samples/channel-factory.md deleted file mode 100644 index f5f528b7e2527..0000000000000 --- a/docs/framework/wcf/samples/channel-factory.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -description: "Learn more about: Channel Factory" -title: "Channel Factory" -ms.date: "03/30/2017" -ms.assetid: 09b53aa1-b13c-476c-a461-e82fcacd2a8b ---- -# Channel Factory - -This sample demonstrates how a client application can create a channel with the class instead of a generated client. This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -This sample uses the class to create a channel to a service endpoint. Typically, to create a channel to a service endpoint you generate a client type with the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) and create an instance of the generated type. You can also create a channel by using the class, as demonstrated in this sample. The service created by the following sample code is identical to the service in the [Getting Started](getting-started-sample.md). - -```csharp -EndpointAddress address = new EndpointAddress("http://localhost/servicemodelsamples/service.svc"); -WSHttpBinding binding = new WSHttpBinding(); -ChannelFactory factory = new - ChannelFactory(binding, address); -ICalculator channel = factory.CreateChannel(); -``` - -> [!IMPORTANT] -> If you are running this sample in a cross-machine scenario, you must replace "localhost" in the preceding code with the fully-qualified name of the machine that is running the service. This sample does not use configuration to set the endpoint address, so this must be done in code. - -Once the channel is created, service operations can be invoked just as with a generated client. - -```csharp -// Call the Add service operation. -double value1 = 100.00D; -double value2 = 15.99D; -double result = channel.Add(value1, value2); -Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); -``` - -To close the channel, it must first be cast to an interface. This is because the channel as generated is declared in the client application using the `ICalculator` interface, which has methods like `Add` and `Subtract` but not `Close`. The `Close` method originates on the interface. - -```csharp -// Close the channel. - ((IClientChannel)client).Close(); -``` - -When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client application. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). Note that this sample does not enable metadata publishing. You must first enable metadata publishing for this sample to regenerate the client type. - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -### To run the sample cross machine - -1. Replace "localhost" in the following code with the fully-qualified name of the machine that is running the service. - - ```csharp - EndpointAddress address = new EndpointAddress("http://localhost/servicemodelsamples/service.svc"); - ``` - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Client\ChannelFactory` diff --git a/docs/framework/wcf/samples/channels-extensibility.md b/docs/framework/wcf/samples/channels-extensibility.md deleted file mode 100644 index 5d72a98ba4456..0000000000000 --- a/docs/framework/wcf/samples/channels-extensibility.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: "Learn more about: Channels Extensibility" -title: "Channels Extensibility" -ms.date: "03/30/2017" -ms.assetid: 4cc3b20b-778a-4ae8-b58c-a3822fb13065 ---- -# Channels Extensibility - -This section contains samples that demonstrate custom channels. - -## In This Section - - [Local Channel](local-channel.md) - Demonstrates the local channel, a WCF transport channel that is used for communication within the same application domain. - - [Reliable Secure Profile](reliable-secure-profile.md) - Demonstrates how to compose WCF and Reliable Secure Profile (RSP). - - [Custom Channel Dispatcher](custom-channel-dispatcher.md) - Demonstrates how to build the channel stack in a custom way by implementing directly and how to create a custom channel dispatcher in Web host environment. - - [Chunking Channel](chunking-channel.md) - Demonstrates how to limit the amount of memory used to buffer large messages sent using WCF. - - [HttpCookieSession](httpcookiesession.md) - Demonstrates how to build a custom protocol channel to use HTTP cookies for session management. - - [Custom Message Interceptor](custom-message-interceptor.md) - Demonstrates how to implement a custom binding element that creates channel factories and channel listeners to intercept all incoming and outgoing messages at a particular point in the run-time stack. diff --git a/docs/framework/wcf/samples/chunking-channel.md b/docs/framework/wcf/samples/chunking-channel.md deleted file mode 100644 index 35544c4512bd2..0000000000000 --- a/docs/framework/wcf/samples/chunking-channel.md +++ /dev/null @@ -1,391 +0,0 @@ ---- -description: "Learn more about: Chunking Channel" -title: "Chunking Channel" -ms.date: "03/30/2017" -ms.assetid: e4d53379-b37c-4b19-8726-9cc914d5d39f ---- -# Chunking Channel - -When sending large messages using Windows Communication Foundation (WCF), it is often desirable to limit the amount of memory used to buffer those messages. One possible solution is to stream the message body (assuming the bulk of the data is in the body). However some protocols require buffering of the entire message. Reliable messaging and security are two such examples. Another possible solution is to divide up the large message into smaller messages called chunks, send those chunks one chunk at a time, and reconstitute the large message on the receiving side. The application itself could do this chunking and de-chunking or it could use a custom channel to do it. The chunking channel sample shows how a custom protocol or layered channel can be used to do chunking and de-chunking of arbitrarily large messages. - -Chunking should always be employed only after the entire message to be sent has been constructed. A chunking channel should always be layered below a security channel and a reliable session channel. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Channels\ChunkingChannel` - -## Chunking Channel Assumptions and Limitations - -### Message Structure - -The chunking channel assumes the following message structure for messages to be chunked: - -```xml - - - - - data to be chunked - - - -``` - -When using the ServiceModel, contract operations that have 1 input parameter comply with this shape of message for their input message. Similarly, contract operations that have 1 output parameter or return value comply with this shape of message for their output message. The following are examples of such operations: - -```csharp -[ServiceContract] -interface ITestService -{ - [OperationContract] - Stream EchoStream(Stream stream); - - [OperationContract] - Stream DownloadStream(); - - [OperationContract(IsOneWay = true)] - void UploadStream(Stream stream); -} -``` - -### Sessions - -The chunking channel requires messages to be delivered exactly once, in ordered delivery of messages (chunks). This means the underlying channel stack must be sessionful. Sessions can be provided by the transport (for example, TCP transport) or by a sessionful protocol channel (for example, ReliableSession channel). - -### Asynchronous Send and Receive - -Asynchronous send and receive methods are not implemented in this version of the chunking channel sample. - -## Chunking Protocol - -The chunking channel defines a protocol that indicates the start and end of a series of chunks as well as the sequence number of each chunk. The following three example messages demonstrate the start, chunk and end messages with comments that describe the key aspects of each. - -### Start Message - -```xml - - - - http://samples.microsoft.com/chunkingAction - - -53f183ee-04aa-44a0-b8d3-e45224563109 - - - - - -http://tempuri.org/ITestService/EchoStream - - - - - - - - - - -``` - -### Chunk Message - -```xml - - - - - http://samples.microsoft.com/chunkingAction - - - - 53f183ee-04aa-44a0-b8d3-e45224563109 - - - - 1096 - - - - - -kfSr2QcBlkHTvQ== - - - -``` - -### End Message - -```xml - - - - http://samples.microsoft.com/chunkingAction - - - - 53f183ee-04aa-44a0-b8d3-e45224563109 - - - - - - 79 - - - - - - - - - -``` - -## Chunking Channel Architecture - -The chunking channel is an `IDuplexSessionChannel` that, at a high level, follows the typical channel architecture. There is a `ChunkingBindingElement` that can build a `ChunkingChannelFactory` and a `ChunkingChannelListener`. The `ChunkingChannelFactory` creates instances of `ChunkingChannel` when it is asked to. The `ChunkingChannelListener` creates instances of `ChunkingChannel` when a new inner channel is accepted. The `ChunkingChannel` itself is responsible for sending and receiving messages. - -At the next level down, `ChunkingChannel` relies on several components to implement the chunking protocol. On the send side, the channel uses a custom called `ChunkingWriter` that does the actual chunking. `ChunkingWriter` uses the inner channel directly to send chunks. Using a custom `XmlDictionaryWriter` allows us to send out chunks as the large body of the original message is being written. This means we do not buffer the entire original message. - -![Diagram that shows the chunking channel send architecture.](./media/chunking-channel/chunking-channel-send.gif) - -On the receive side, `ChunkingChannel` pulls messages from the inner channel and hands them to a custom called `ChunkingReader`, which reconstitutes the original message from the incoming chunks. `ChunkingChannel` wraps this `ChunkingReader` in a custom `Message` implementation called `ChunkingMessage` and returns this message to the layer above. This combination of `ChunkingReader` and `ChunkingMessage` allows us to de-chunk the original message body as it is being read by the layer above instead of having to buffer the entire original message body. `ChunkingReader` has a queue where it buffers incoming chunks up to a maximum configurable number of buffered chunks. When this maximum limit is reached, the reader waits for messages to be drained from the queue by the layer above (that is, by just reading from the original message body) or until the maximum receive timeout is reached. - -![Diagram that shows the chunking channel receive architecture.](./media/chunking-channel/chunking-channel-receive.gif) - -## Chunking Programming Model - -Service developers can specify which messages are to be chunked by applying the `ChunkingBehavior` attribute to operations within the contract. The attribute exposes an `AppliesTo` property that allows the developer to specify whether chunking applies to the input message, the output message or both. The following example shows the usage of `ChunkingBehavior` attribute: - -```csharp -[ServiceContract] -interface ITestService -{ - [OperationContract] - [ChunkingBehavior(ChunkingAppliesTo.Both)] - Stream EchoStream(Stream stream); - - [OperationContract] - [ChunkingBehavior(ChunkingAppliesTo.OutMessage)] - Stream DownloadStream(); - - [OperationContract(IsOneWay=true)] - [ChunkingBehavior(ChunkingAppliesTo.InMessage)] - void UploadStream(Stream stream); - -} -``` - -From this programming model, the `ChunkingBindingElement` compiles a list of action URIs that identify messages to be chunked. The action of each outgoing message is compared against this list to determine if the message should be chunked or sent directly. - -## Implementing the Send Operation - -At a high level, the Send operation first checks whether the outgoing message must be chunked and, if not, sends the message directly using the inner channel. - -If the message must be chunked, Send creates a new `ChunkingWriter` and calls `WriteBodyContents` on the outgoing message passing it this `ChunkingWriter`. The `ChunkingWriter` then does the message chunking (including copying original message headers to the start chunk message) and sends chunks using the inner channel. - -A few details worth noting: - -- Send first calls `ThrowIfDisposedOrNotOpened` to ensure the `CommunicationState` is opened. - -- Sending is synchronized so that only one message can be sent at a time for each session. There is a `ManualResetEvent` named `sendingDone` that is reset when a chunked message is being sent. Once the end chunk message is sent, this event is set. The Send method waits for this event to be set before it tries to send the outgoing message. - -- Send locks the `CommunicationObject.ThisLock` to prevent synchronized state changes while sending. See the documentation for more information about states and state machine. - -- The timeout passed to Send is used as the timeout for the entire send operation which includes sending all of the chunks. - -- The custom design was chosen to avoid buffering the entire original message body. If we were to get an on the body using `message.GetReaderAtBodyContents` the entire body would be buffered. Instead, we have a custom that is passed to `message.WriteBodyContents`. As the message calls WriteBase64 on the writer, the writer packages up chunks into messages and sends them using the inner channel. WriteBase64 blocks until the chunk is sent. - -## Implementing the Receive Operation - -At a high level, the Receive operation first checks that the incoming message is not `null` and that its action is the `ChunkingAction`. If it does not meet both criteria, the message is returned unchanged from Receive. Otherwise, Receive creates a new `ChunkingReader` and a new `ChunkingMessage` wrapped around it (by calling `GetNewChunkingMessage`). Before returning that new `ChunkingMessage`, Receive uses a threadpool thread to execute `ReceiveChunkLoop`, which calls `innerChannel.Receive` in a loop and hands off chunks to the `ChunkingReader` until the end chunk message is received or the receive timeout is hit. - -A few details worth noting: - -- Like Send, Receive first calls `ThrowIfDisposedOrNotOepned` to ensure the `CommunicationState` is Opened. - -- Receive is also synchronized so that only one message can be received at a time from the session. This is especially important because once a start chunk message is received, all subsequent received messages are expected to be chunks within this new chunk sequence until an end chunk message is received. Receive cannot pull messages from the inner channel until all chunks that belong to the message currently being de-chunked are received. To accomplish this, Receive uses a `ManualResetEvent` named `currentMessageCompleted`, which is set when the end chunk message is received and reset when a new start chunk message is received. - -- Unlike Send, Receive does not prevent synchronized state transitions while receiving. For example, Close can be called while receiving and waits until the pending receive of the original message is completed or the specified timeout value is reached. - -- The timeout passed to Receive is used as the timeout for the entire receive operation, which includes receiving all of the chunks. - -- If the layer that consumes the message is consuming the message body at a rate lower than the rate of incoming chunk messages, the `ChunkingReader` buffers those incoming chunks up to the limit specified by `ChunkingBindingElement.MaxBufferedChunks`. Once that limit is reached, no more chunks are pulled from the lower layer until either a buffered chunk is consumed or the receive timeout is reached. - -## CommunicationObject Overrides - -### OnOpen - -`OnOpen` calls `innerChannel.Open` to open the inner channel. - -### OnClose - -`OnClose` first sets `stopReceive` to `true` to signal the pending `ReceiveChunkLoop` to stop. It then waits for the `receiveStopped` , which is set when `ReceiveChunkLoop` stops. Assuming the `ReceiveChunkLoop` stops within the specified timeout, `OnClose` calls `innerChannel.Close` with the remaining timeout. - -### OnAbort - -`OnAbort` calls `innerChannel.Abort` to abort the inner channel. If there is a pending `ReceiveChunkLoop` it gets an exception from the pending `innerChannel.Receive` call. - -### OnFaulted - -The `ChunkingChannel` does not require special behavior when the channel is faulted so `OnFaulted` is not overridden. - -## Implementing Channel Factory - -The `ChunkingChannelFactory` is responsible for creating instances of `ChunkingDuplexSessionChannel` and for cascading state transitions to the inner channel factory. - -`OnCreateChannel` uses the inner channel factory to create an `IDuplexSessionChannel` inner channel. It then creates a new `ChunkingDuplexSessionChannel` passing it this inner channel along with the list of message actions to be chunked and the maximum number of chunks to buffer upon receive. The list of message actions to be chunked and the maximum number of chunks to buffer are two parameters passed to `ChunkingChannelFactory` in its constructor. The section on `ChunkingBindingElement` describes where these values come from. - -The `OnOpen`, `OnClose`, `OnAbort` and their asynchronous equivalents call the corresponding state transition method on the inner channel factory. - -## Implementing Channel Listener - -The `ChunkingChannelListener` is a wrapper around an inner channel listener. Its main function, besides delegate calls to that inner channel listener, is to wrap new `ChunkingDuplexSessionChannels` around channels accepted from the inner channel listener. This is done in `OnAcceptChannel` and `OnEndAcceptChannel`. The newly created `ChunkingDuplexSessionChannel` is passed the inner channel along with the other parameters previously described. - -## Implementing Binding Element and Binding - -`ChunkingBindingElement` is responsible for creating the `ChunkingChannelFactory` and `ChunkingChannelListener`. The `ChunkingBindingElement` checks whether T in `CanBuildChannelFactory`\ and `CanBuildChannelListener`\ is of type `IDuplexSessionChannel` (the only channel supported by the chunking channel) and that the other binding elements in the binding support this channel type. - -`BuildChannelFactory`\ first checks that the requested channel type can be built and then gets a list of message actions to be chunked. For more information, see the following section. It then creates a new `ChunkingChannelFactory` passing it the inner channel factory (as returned from `context.BuildInnerChannelFactory`), the list of message actions, and the maximum number of chunks to buffer. The maximum number of chunks comes from a property called `MaxBufferedChunks` exposed by the `ChunkingBindingElement`. - -`BuildChannelListener` has a similar implementation for creating `ChunkingChannelListener` and passing it the inner channel listener. - -There is an example binding included in this sample named `TcpChunkingBinding`. This binding consists of two binding elements: `TcpTransportBindingElement` and `ChunkingBindingElement`. In addition to exposing the `MaxBufferedChunks` property, the binding also sets some of the `TcpTransportBindingElement` properties such as `MaxReceivedMessageSize` (sets it to `ChunkingUtils.ChunkSize` + 100KB bytes for headers). - -`TcpChunkingBinding` also implements `IBindingRuntimePreferences` and returns true from the `ReceiveSynchronously` method indicating that only the synchronous Receive calls are implemented. - -### Determining Which Messages To Chunk - -The chunking channel chunks only the messages identified through the `ChunkingBehavior` attribute. The `ChunkingBehavior` class implements `IOperationBehavior` and is implemented by calling the `AddBindingParameter` method. In this method, the `ChunkingBehavior` examines the value of its `AppliesTo` property (`InMessage`, `OutMessage` or both) to determine which messages should be chunked. It then gets the action of each of those messages (from the Messages collection on `OperationDescription`) and adds it to a string collection contained within an instance of `ChunkingBindingParameter`. It then adds this `ChunkingBindingParameter` to the provided `BindingParameterCollection`. - -This `BindingParameterCollection` is passed inside the `BindingContext` to each binding element in the binding when that binding element builds the channel factory or the channel listener. The `ChunkingBindingElement`'s implementation of `BuildChannelFactory` and `BuildChannelListener` pull this `ChunkingBindingParameter` out of the `BindingContext’`s `BindingParameterCollection`. The collection of actions contained within the `ChunkingBindingParameter` is then passed to the `ChunkingChannelFactory` or `ChunkingChannelListener`, which in turn passes it to the `ChunkingDuplexSessionChannel`. - -## Running the Sample - -#### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command. - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -5. Run Service.exe first, then run Client.exe and watch both console windows for output. - -When running the sample, the following output is expected. - -Client: - -```console -Press enter when service is available - - > Sent chunk 1 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 2 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 3 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 4 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 5 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 6 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 7 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 8 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 9 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 10 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 1 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 2 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 3 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 4 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 5 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 6 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 7 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 8 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 9 of message 5b226ad5-c088-4988-b737-6a565e0563dd - < Received chunk 10 of message 5b226ad5-c088-4988-b737-6a565e0563dd -``` - -Server: - -```console -Service started, press enter to exit - < Received chunk 1 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 2 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 3 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 4 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 5 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 6 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 7 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 8 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 9 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - < Received chunk 10 of message 867c1fd1-d39e-4be1-bc7b-32066d7ced10 - > Sent chunk 1 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 2 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 3 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 4 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 5 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 6 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 7 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 8 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 9 of message 5b226ad5-c088-4988-b737-6a565e0563dd - > Sent chunk 10 of message 5b226ad5-c088-4988-b737-6a565e0563dd -``` diff --git a/docs/framework/wcf/samples/circular-tracing.md b/docs/framework/wcf/samples/circular-tracing.md deleted file mode 100644 index d03445e48e956..0000000000000 --- a/docs/framework/wcf/samples/circular-tracing.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -description: "Learn more about: Circular Tracing" -title: "Circular Tracing" -ms.date: "03/30/2017" -ms.assetid: 5ff139f9-8806-47bc-8f33-47fe6c436b92 ---- -# Circular Tracing - -This sample demonstrates the implementation of a circular buffer trace listener. A common scenario for production services is to have services that are available for long periods of time and to have trace logging enabled at a low level. These services consume a lot of disk space. When troubleshooting a service, the most recent data in the trace log is relevant to solving a problem. This sample demonstrates an implementation of a circular buffer trace listener in which only the most recent traces are kept on disk up to a configurable amount of data. This sample is based on the [Getting Started](getting-started-sample.md) and includes a custom tracing listener. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -This sample assumes that you are familiar with the [Tracing and Message Logging](tracing-and-message-logging.md) sample and have read the documentation provided for the [Tracing and Message Logging](tracing-and-message-logging.md) sample. - -## Circular Buffer Trace Listener - -The concept behind the implementation of the Circular Buffer Trace Listener is to have two files that can each store up to half of the total desired trace log data. The listener creates one file and writes to that file until it reaches the limit of half of the data size, at which point it switches to a second file. When the listener reaches the limit for the second file - it overwrites the first file with new traces. - -This listener derives from the `XmlWriteTraceListener` and allows the logs to be viewed with the [Service Trace Viewer Tool (SvcTraceViewer.exe)](../service-trace-viewer-tool-svctraceviewer-exe.md). When attempting to view the logs, the two log files can be easily recombined by opening both of the log files at the same time in the Service Trace Viewer tool. The Service Trace Viewer tool automatically takes care of sorting the traces so that they appear in the correct order. - -## Configuration - -A service can be configured to use the Circular Buffer Trace Listener by adding the following code for a listener and source elements. The max file size is specified by setting the `maxFileSizeKB` attribute in the circular trace listener's configuration. This is demonstrated in the following code. - -```xml - - - - - - - - - - - - - -``` - -#### To set up, build, and run the sample - -1. Be sure you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-computer configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Management\CircularTracing` - -## See also - -- [AppFabric Monitoring Samples](/previous-versions/appfabric/ff383407(v=azure.10)) diff --git a/docs/framework/wcf/samples/client-interoperability.md b/docs/framework/wcf/samples/client-interoperability.md deleted file mode 100644 index 5f3a43418f2e9..0000000000000 --- a/docs/framework/wcf/samples/client-interoperability.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: "Learn more about: Client Interoperability" -title: "Client Interoperability" -ms.date: "03/30/2017" -ms.assetid: e890e40a-b76a-48c4-9e5b-a4b385fac847 ---- -# Client Interoperability - -This section contains samples that demonstrate interoperability between Windows Communication Foundation (WCF) and other technologies. - -## In This Section - - [Interoperating with ASMX Web Services](interoperating-with-asmx-web-services.md) - Demonstrates how to integrate a WCF client application with an existing ASMX Web service. - - [XMLSerializer Sample](xmlserializer-sample.md) - Demonstrates how to serialize and deserialize types that are compatible with the . diff --git a/docs/framework/wcf/samples/client-validation.md b/docs/framework/wcf/samples/client-validation.md deleted file mode 100644 index 51c2d29fd92f8..0000000000000 --- a/docs/framework/wcf/samples/client-validation.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -description: "Learn more about: Client Validation" -title: "Client Validation" -ms.date: "03/30/2017" -ms.assetid: f0c1f805-1a81-4d0d-a112-bf5e2e87a631 ---- -# Client Validation - -Services frequently publish metadata to enable automatic generation and configuration of client proxy types. When the service is not trusted, client applications should validate that the metadata conforms to the client application's policy regarding security, transactions, the type of service contract and so on. The following sample demonstrates how to write a client endpoint behavior that validates the service endpoint to ensure that service endpoint is safe to use. - - The service exposes four service endpoints. The first endpoint uses the WSDualHttpBinding, the second endpoint uses NTLM authentication, the third endpoint enables transaction flow, and the fourth endpoint uses certificate-based authentication. - - The client uses the class to retrieve the metadata for the service. The client enforces a policy of prohibiting duplex bindings, NTLM authentication, and transaction flow using a validating behavior. For each instance imported from the service's metadata, the client application adds an instance of the `InternetClientValidatorBehavior` endpoint behavior to the before attempting to use a Windows Communication Foundation (WCF) client to connect to the endpoint. The behavior's `Validate` method runs before any operations on the service are called and enforces the client's policy by throwing `InvalidOperationExceptions`. - -### To build the sample - -1. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -### To run the sample on the same computer - -1. Open a Developer Command Prompt for Visual Studio with administrator privileges and run Setup.bat from the sample install folder. This installs all the certificates required for running the sample. - -2. Run the service application from \service\bin\Debug. - -3. Run the client application from \client\bin\Debug. Client activity is displayed on the client console application. - -4. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -5. Remove the certificates by running Cleanup.bat when you have finished with the sample. Other security samples use the same certificates. - -### To run the sample across computers - -1. On the server, in a Developer Command Prompt for Visual Studio run with administrator privileges, type `setup.bat service`. Running `setup.bat` with the `service` argument creates a service certificate with the fully-qualified domain name of the computer and exports the service certificate to a file named Service.cer. - -2. On the server, edit App.config to reflect the new certificate name. That is, change the `findValue` attribute in the [\](../../configure-apps/file-schema/wcf/servicecertificate-of-clientcredentials-element.md) element to the fully-qualified domain name of the computer. - -3. Copy the Service.cer file from the service directory to the client directory on the client computer. - -4. On the client, open a Developer Command Prompt for Visual Studio with administrator privileges, and type `setup.bat client`. Running `setup.bat` with the `client` argument creates a client certificate named Client.com and exports the client certificate to a file named Client.cer. - -5. In the client.cs file change the address value of the MEX endpoint and the `findValue` for setting the default server certificate to match the new address of your service. You do this by replacing localhost with the fully-qualified domain name of the server. Rebuild. - -6. Copy the Client.cer file from the client directory to the service directory on the server. - -7. On the client, run ImportServiceCert.bat in a Developer Command Prompt for Visual Studio opened with administrator privileges. This imports the service certificate from the Service.cer file into the CurrentUser - TrustedPeople store. - -8. On the server, run ImportClientCert.bat in a Developer Command Prompt for Visual Studio opened with administrator privileges. This imports the client certificate from the Client.cer file into the LocalMachine - TrustedPeople store. - -9. On the service computer, build the service project in Visual Studio and run service.exe. - -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](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -### To clean up after the sample - -- Run Cleanup.bat in the samples folder once you have finished running the sample. - - > [!NOTE] - > This script does not remove service certificates on a client when running this sample across computers. If you have run WCF samples that use certificates across computers, be sure to clear the service certificates that have been installed in the CurrentUser - TrustedPeople store. To do this, use the following command: `certmgr -del -r CurrentUser -s TrustedPeople -c -n . For example: certmgr -del -r CurrentUser -s TrustedPeople -c -n server1.contoso.com`. - -## See also - -- [Using Metadata](../feature-details/using-metadata.md) diff --git a/docs/framework/wcf/samples/client.md b/docs/framework/wcf/samples/client.md deleted file mode 100644 index 3711640fedc93..0000000000000 --- a/docs/framework/wcf/samples/client.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: "Learn more about: Client" -title: "Client" -ms.date: "03/30/2017" -ms.assetid: fabb0c70-b79b-4e58-a5d3-9705de85ee5b ---- -# Client - -This section contains samples that demonstrate Windows Communication Foundation (WCF) client applications. - -## In This Section - - [Client Interoperability](client-interoperability.md) - Demonstrates interoperability between WCF and other technologies. - - [Address Headers](address-headers.md) - Demonstrates how clients can pass reference parameters to a service using WCF. - - [Channel Factory](channel-factory.md) - Demonstrates how a client application can create a channel with the class instead of a generated client. - - [Expected Exceptions](expected-exceptions.md) - Demonstrates how to catch expected exceptions when using a typed client. - - [Retrieve Metadata](retrieve-metadata.md) - Demonstrates how to implement a client that dynamically retrieves metadata from a service to choose an endpoint with which to communicate. - - [Use Close and Abort to release WCF client resources](use-close-abort-release-wcf-client-resources.md) - Demonstrates how you should not use the C# "using" statement to automatically clean up resources when using a typed client. - - [Typed Client](typed-client.md) - Demonstrates how to obtain information from a typed client generated by the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md). diff --git a/docs/framework/wcf/samples/concurrency.md b/docs/framework/wcf/samples/concurrency.md deleted file mode 100644 index a5fd0182bbfb1..0000000000000 --- a/docs/framework/wcf/samples/concurrency.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -description: "Learn more about: Concurrency" -title: "Concurrency" -ms.date: "03/30/2017" -helpviewer_keywords: - - "service behaviors, concurency sample" - - "Concurrency Sample [Windows Communication Foundation]" -ms.assetid: f8dbdfb3-6858-4f95-abe3-3a1db7878926 ---- -# Concurrency - -The Concurrency sample demonstrates using the with the enumeration, which controls whether an instance of a service processes messages sequentially or concurrently. The sample is based on the [Getting Started](getting-started-sample.md), which implements the `ICalculator` service contract. This sample defines a new contract, `ICalculatorConcurrency`, which inherits from `ICalculator`, providing two additional operations for inspecting the state of the service concurrency. By altering the concurrency setting, you can observe the change in behavior by running the client. - - In this sample, the client is a console application (.exe) and the service is hosted by Internet Information Services (IIS). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - There are three concurrency modes available: - -- `Single`: Each service instance processes one message at a time. This is the default concurrency mode. - -- `Multiple`: Each service instance processes multiple messages concurrently. The service implementation must be thread-safe to use this concurrency mode. - -- `Reentrant`: Each service instance processes one message at a time, but accepts reentrant calls. The service only accepts these calls when it is calling out. Reentrant is demonstrated in the [ConcurrencyMode.Reentrant](concurrencymode-reentrant.md) sample. - - The use of concurrency is related to the instancing mode. In instancing, concurrency is not relevant, because each message is processed by a new service instance. In instancing, either or concurrency is relevant, depending on whether the single instance processes messages sequentially or concurrently. In instancing, any of the concurrency modes may be relevant. - - The service class specifies concurrency behavior with the `[ServiceBehavior(ConcurrencyMode=)]` attribute as shown in the code sample that follows. By changing which lines are commented out, you can experiment with the `Single` and `Multiple` concurrency modes. Remember to rebuild the service after changing the concurrency mode. - -```csharp -// Single allows a single message to be processed sequentially by each service instance. -//[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single)] - -// Multiple allows concurrent processing of multiple messages by a service instance. -// The service implementation should be thread-safe. This can be used to increase throughput. -[ServiceBehavior(ConcurrencyMode=ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)] - -// Uses Thread.Sleep to vary the execution time of each operation. -public class CalculatorService : ICalculatorConcurrency -{ - int operationCount; - - public double Add(double n1, double n2) - { - operationCount++; - System.Threading.Thread.Sleep(180); - return n1 + n2; - } - - public double Subtract(double n1, double n2) - { - operationCount++; - System.Threading.Thread.Sleep(100); - return n1 - n2; - } - - public double Multiply(double n1, double n2) - { - operationCount++; - System.Threading.Thread.Sleep(150); - return n1 * n2; - } - - public double Divide(double n1, double n2) - { - operationCount++; - System.Threading.Thread.Sleep(120); - return n1 / n2; - } - - public string GetConcurrencyMode() - { - // Return the ConcurrencyMode of the service. - ServiceHost host = (ServiceHost)OperationContext.Current.Host; - ServiceBehaviorAttribute behavior = host.Description.Behaviors.Find(); - return behavior.ConcurrencyMode.ToString(); - } - - public int GetOperationCount() - { - // Return the number of operations. - return operationCount; - } -} -``` - - The sample uses concurrency with instancing by default. The client code has been modified to use an asynchronous proxy. This allows the client to make multiple calls to the service without waiting for a response between each call. You can observe the difference in behavior of the service concurrency mode. - - When you run the sample, the operation requests and responses are displayed in the client console window. The concurrency mode that the service is running under is displayed, each operation is called, and then the operation count is displayed. Notice that when the concurrency mode is `Multiple`, the results are returned in a different order than how they were called, because the service processes multiple messages concurrently. By changing the concurrency mode to `Single`, the results are returned in the order they were called, because the service processes each message sequentially. Press ENTER in the client window to shut down the client. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. If you use Svcutil.exe to generate the proxy client, ensure that you include the `/async` option. - -3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Behaviors\Concurrency` diff --git a/docs/framework/wcf/samples/concurrencymode-reentrant.md b/docs/framework/wcf/samples/concurrencymode-reentrant.md deleted file mode 100644 index fd06ef427cf3f..0000000000000 --- a/docs/framework/wcf/samples/concurrencymode-reentrant.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -description: "Learn more about: ConcurrencyMode Reentrant" -title: "ConcurrencyMode Reentrant" -ms.date: "03/30/2017" -ms.assetid: b2046c38-53d8-4a6c-a084-d6c7091d92b1 ---- -# ConcurrencyMode Reentrant - -This sample demonstrates the necessity and implications of using ConcurrencyMode.Reentrant on a service implementation. ConcurrencyMode.Reentrant implies that the service (or callback) processes only one message at a given time (analogous to `ConcurencyMode.Single`). To ensure thread safety, Windows Communication Foundation (WCF) locks the `InstanceContext` processing a message so that no other messages can be processed. In case of Reentrant mode, the `InstanceContext` is unlocked just before the service makes an outgoing call thereby allowing the subsequent call, (which can be reentrant as demonstrated in the sample) to get the lock next time it comes in to the service. To demonstrate the behavior, the sample shows how a client and service can send messages between each other using a duplex contract. - - The contract defined is a duplex contract with the `Ping` method being implemented by the service and the callback method `Pong` being implemented by the client. A client invokes the server's `Ping` method with a tick count thereby initiating the call. The service checks whether the tick count is not equal to 0 and then invokes the callbacks `Pong` method while decrementing the tick count. This is done by the following code in the sample. - -```csharp -public void Ping(int ticks) -{ - Console.WriteLine("Ping: Ticks = " + ticks); - //Keep pinging back and forth till Ticks reaches 0. - if (ticks != 0) - { - OperationContext.Current.GetCallbackChannel().Pong((ticks - 1)); - } -} -``` - - The callback's `Pong` implementation has the same logic as the `Ping` implementation. That is, it checks whether the tick count is not zero and then invokes the `Ping` method on the callback channel (in this case, it is the channel that was used to send the original `Ping` message) with the tick count decremented by 1. The moment the tick count reaches 0, the method returns thereby unwrapping all the replies back to the first call made by the client that initiated the call. This is shown in the callback implementation. - -```csharp -public void Pong(int ticks) -{ - Console.WriteLine("Pong: Ticks = " + ticks); - if (ticks != 0) - { - //Retrieve the Callback Channel (in this case the Channel which was used to send the - //original message) and make an outgoing call until ticks reaches 0. - IPingPong channel = OperationContext.Current.GetCallbackChannel(); - channel.Ping((ticks - 1)); - } -} -``` - - Both the `Ping` and `Pong` methods are request/reply, which means that the first call to `Ping` does not return until the call to `CallbackChannel.Pong()` returns. On the client, the `Pong` method cannot return until the next `Ping` call that it made returns. Because both the callback and the service must make outgoing request/reply calls before they can reply for the pending request, both the implementations must be marked with the ConcurrencyMode.Reentrant behavior. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -## Demonstrates - - To run the sample, build the client and server projects. Then open two command windows and change the directories to the \\CS\Service\bin\debug and \\CS\Client\bin\debug directories. Then start the service by typing `service.exe` and then invoke the Client.exe with the initial value of ticks passed as an input argument. A sample output for 10 ticks is shown. - -```console -Prompt>Service.exe -ServiceHost Started. Press Enter to terminate service. -Ping: Ticks = 10 -Ping: Ticks = 8 -Ping: Ticks = 6 -Ping: Ticks = 4 -Ping: Ticks = 2 -Ping: Ticks = 0 - -Prompt>Client.exe 10 -Pong: Ticks = 9 -Pong: Ticks = 7 -Pong: Ticks = 5 -Pong: Ticks = 3 -Pong: Ticks = 1 -``` - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Reentrant` diff --git a/docs/framework/wcf/samples/configuration-channel-factory.md b/docs/framework/wcf/samples/configuration-channel-factory.md deleted file mode 100644 index 7c175e95ea2bf..0000000000000 --- a/docs/framework/wcf/samples/configuration-channel-factory.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -description: "Learn more about: Configuration Channel Factory" -title: "Configuration Channel Factory" -ms.date: "03/30/2017" -ms.assetid: 3b749493-bd8a-4ccb-893e-5948901a1486 ---- -# Configuration Channel Factory - -This sample covers the usage of the . The allows central management of WCF client configuration. This can also be useful in scenarios in which configuration is selected or changed after the application domain load time. - -## Demonstrates - - - -## Discussion - - This sample shows how to use to add a particular configuration file to a client application, without having to use the default application configuration file. - - The sample consists of two projects. The first project is a simple service that runs to reply to messages coming from the clients. The second project is a client application that builds two objects using a for the Test.config configuration file and uses them to communicate with the service. Both clients communicate with the service using the configuration specified in Test.config. - - The following code adds a custom configuration file to a client application. - -```csharp -ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); -fileMap.ExeConfigFilename = "Test.config"; -Configuration newConfiguration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); - -ConfigurationChannelFactory factory1 = new ConfigurationChannelFactory("endpoint1", newConfiguration, new EndpointAddress("http://localhost:8000/servicemodelsamples/service")); -ICalculatorChannel client1 = factory1.CreateChannel(); -``` - -#### To set up, build, and run the sample - -1. Open Visual Studio 2012 with administrator privileges. - -2. Right-click the ConfigurationChannelFactory solution (2 projects) and then select **Properties**. - -3. In **Common Properties**, select **Startup Project**, and then click **Multiple startup projects**. - -4. Move the **Service** project to the beginning of the list, with the **Action ‘Start’**, and then move the **Client** project after the **Service** project, also with the **Action ‘Start’**, so the **Client** project is executed after the **Service** project. - -5. Click **OK**, and then press F5 (or CTRL+F5) to run the sample. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\ConfigurationChannelFactory` diff --git a/docs/framework/wcf/samples/configuration-sample.md b/docs/framework/wcf/samples/configuration-sample.md deleted file mode 100644 index 93b2791d759ce..0000000000000 --- a/docs/framework/wcf/samples/configuration-sample.md +++ /dev/null @@ -1,267 +0,0 @@ ---- -description: "Learn more about: Configuration Sample" -title: "Configuration Sample" -ms.date: "03/30/2017" -ms.assetid: 75515b4a-8d70-44c8-99e0-7423df41380e ---- -# Configuration Sample - -This sample demonstrates the use of a configuration file to make a service discoverable. - -> [!NOTE] -> This sample implements discovery in configuration. For a sample that implements discovery in code, see [Basic](basic-sample.md). - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Discovery\Configuration` - -## Service Configuration - - The configuration file in this sample demonstrates two features: - -- Making the service discoverable over a standard . - -- Adjusting discovery-related information for the service’s application endpoint and adjusting some of the discovery-related settings on the standard endpoint. - - To enable discovery, a few changes must be made in the application configuration file for the service: - -- A discovery endpoint must be added to the `` element. This is a standard endpoint. This is a system endpoint that the runtime associates with the discovery service. The discovery service listens for messages on this endpoint. - -- A `` behavior is added to the `` section. This enables the service to be discovered at runtime and uses the discovery endpoint mentioned previously to listen for discovery `Probe` and `Resolve` messages. With these two additions, the service is discoverable at the discovery endpoint specified. - - The following config snippet shows a service with an application endpoint and a discovery endpoint defined: - -```xml - - - - - -``` - - To take advantage of announcements, you will need to add an announcement endpoint. To do this, modify the configuration file as shown in the following code. - -```xml - - - - - -``` - - Adding an announcement endpoint to the discovery service behavior creates a default announcement client for the service. This guarantees that the service will send an online and offline announcement when the service is opened and closed respectively. - - This configuration file goes beyond just those simple steps by modifying additional behaviors. It is possible to control discovery-related information by using specific endpoints. That is, a user can control whether an endpoint can be discovered and the user can also mark that endpoint with and custom XML metadata. To do this, the user must add a `behaviorConfiguration` property to the application endpoint. In this case, the following property is added to the application endpoint. - -`behaviorConfiguration="endpointBehaviorConfiguration"` - - Now, through the behavior configuration element, you can control discovery-related attributes. In this case, two scopes are added to the application endpoint. - -```xml - - - - - - - - - - - -``` - - For more information about scopes, see [Discovery Find and FindCriteria](../feature-details/discovery-find-and-findcriteria.md). - - You can also control specific details of the discovery endpoint. This is done through the . In this sample, the version of the protocol used is modified as well as adding a `maxResponseDelay` attribute as shown in the following code example. - -```xml - - - - - -``` - - The following is the complete configuration file used in this example: - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## Client Configuration - - In the application configuration file for the client, a `standardEndpoint` of type `dynamicEndpoint` is used to utilize discovery as shown in the following config snippet. - -```xml - - - - - -``` - - When a client is using a `dynamicEndpoint`, the runtime performs discovery automatically. Various settings are used during discovery, such as those defined in the `discoveryClientSettings` section, which specifies the type of discovery endpoint to use: - -```xml - -``` - - The find criteria used to search for services: - -```xml - - - - - - - - This is custom metadata that is sent to the service along with the client's find request. - - -``` - - This sample extends this feature and modifies the used by the client, as well as some properties of the standard `updDiscoveryEndpoint` used for discovery. The are modified to use a scope and a specific `scopeMatchBy` algorithm, as well as custom termination criteria. Furthermore, the sample also shows how a client can send XML elements using `Probe` messages. Lastly, some changes are made to the , such as the version of the protocol used and UDP-specific settings as shown in the following configuration file. - -```xml - - - - - - -``` - - The following is the complete client configuration used in the sample. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - This is custom metadata that is sent to the service along with the client's find request. - - - - - - - - - - - - - - - - - -``` - -#### To use this sample - -1. This sample uses HTTP endpoints and to run this sample, proper URL ACLs must be added. For more information, see [Configuring HTTP and HTTPS](../feature-details/configuring-http-and-https.md). Executing the following command at an elevated privilege should add the appropriate ACLs. You may want to substitute your Domain and Username for the following arguments if the command does not work as is. `netsh http add urlacl url=http://+:8000/ user=%DOMAIN%\%UserName%` - -2. Build the solution. - -3. Run the service executable from the build directory. - -4. Run the client executable. Note that the client is able to locate the service. diff --git a/docs/framework/wcf/samples/configurationcodegenerator.md b/docs/framework/wcf/samples/configurationcodegenerator.md deleted file mode 100644 index e76e9e0233217..0000000000000 --- a/docs/framework/wcf/samples/configurationcodegenerator.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -description: "Learn more about: ConfigurationCodeGenerator" -title: "ConfigurationCodeGenerator" -ms.date: "03/30/2017" -ms.assetid: 3913aae8-165f-4014-9262-7fe426f90cb2 ---- -# ConfigurationCodeGenerator - -The ConfigurationCodeGenerator is a tool that you can use to expose your custom channel implementations to the configuration system. This allows users of your custom channel to configure your channel by using a .config file just as they would configure a system-provided binding such as `NetTcpBinding` or a custom binding using the `TcpTransportBindingElement`. - - When you write a custom channel and expose it to the programming model by using a new `BindingElement` or `Binding`, you must create a set of classes to make the `BindingElement` or `Binding` configurable using a .config file. You can use the ConfigurationCodeGenerator tool to generate these classes and enhance your customer's experience. - -### To build the tool - -1. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -2. Building the solution generates one file: ConfigurationCodeGenerator.exe. The file SampleRun.cmd has a sample command line that shows how to use this tool to generate the classes for the [Transport: UDP](transport-udp.md) sample. - -### To run the tool - -1. At the command prompt type the following if you have both a custom `BindingElement` type and a custom `Binding` type: - - ```console - ConfigurationCodeGenerator.exe /be:YourCustomBindingElementTypeName /sb:YourCustomStdBindingTypeName /dll:TheAssemblyWhereTheseTypesAreDefined - ``` - - Or type the following if you have only a custom `BindingElement` type: - - ```console - ConfigurationCodeGenerator.exe /be:YourCustomBindingElementTypeName /dll: TheAssemblyWhereThisTypeIsDefined - ``` - - Or type the following if you have only a custom `Binding` type: - - ```console - ConfigurationCodeGenerator.exe /sb:YourCustomStdBindingTypeName /dll:TheAssemblyWhereThisTypeIsDefined - ``` - - 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. - - 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. - - The SampleConfig.xml file contains the configuration code that you must add to the configuration file that registers the handlers defined in the previous step 1 or 2. diff --git a/docs/framework/wcf/samples/contract.md b/docs/framework/wcf/samples/contract.md deleted file mode 100644 index 0d27b51d4d94c..0000000000000 --- a/docs/framework/wcf/samples/contract.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: "Learn more about: Contract" -title: "WCF contract samples" -ms.date: "03/30/2017" -ms.assetid: 305eeb65-a52f-459e-9aa8-0ef071eade16 ---- -# Contract - -This section contains samples that demonstrate contracts in Windows Communication Foundation (WCF). - -## In This Section - - [Data Contracts](data-contracts.md) - Demonstrates data contracts in WCF. - - [Message Contracts](message-contracts.md) - Demonstrates message contracts in WCF. - - [Service Contracts](service-contracts.md) - Demonstrates service contracts in WCF. - - [DataContractResolver](datacontractresolver.md) - Demonstrates how the serialization and deserialization processes can be customized by using the class. - - [KnownAssemblyAttribute](knownassemblyattribute.md) - Demonstrates how to dynamically add known types during serialization and deserialization. - - [Using DataContractSerializer and DataContractResolver to Provide the Functionality of NetDataContractSerializer](datacontractserializer-datacontractresolver-netdatacontractserializer.md) - Demonstrates how to use with an appropriate provides the same functionality as . diff --git a/docs/framework/wcf/samples/cryptographic-agility-in-wcf-security.md b/docs/framework/wcf/samples/cryptographic-agility-in-wcf-security.md deleted file mode 100644 index b9c48f9813b9a..0000000000000 --- a/docs/framework/wcf/samples/cryptographic-agility-in-wcf-security.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -description: "Learn more about: Cryptographic agility in WCF security" -title: "Cryptographic agility in WCF security" -ms.date: "03/30/2017" -ms.assetid: c2c549e5-ac19-40c5-b686-8f67f52b6dbf ---- -# Cryptographic agility in WCF security - -This sample shows how to specify in a standard/custom algorithm to provide a cryptographic agile implementation in a Windows Communication Foundation (WCF) client and service. The sample is composed of the following projects: - -**Service** - -This is a self-hosted WCF service that implements the `ICalculator` interface and secures the endpoint using the with secure session and reliable session disabled. The service defines a custom `SecurityAlgorithmSuite` class to specify the cryptographic algorithms to be used for message security. - -**Client** - -This is a WCF client that accesses the service after successful authentication. It invokes the operations exposed by the `ICalculator` interface and implemented by the service. The client also defines the same custom `SecurityAlgorithmSuite` class to specify the cryptographic algorithms to be used for message security. - -## To use this sample - -1. Open the CryptoAgility.sln solution in Visual Studio 2012. - -2. Press CTRL+SHIFT+B to build the solution. - -3. Open File Explorer and navigate to the \WCF\Basic\Security\CryptoAgility\Service\bin directory and run the service.exe file with administrator privileges by right-clicking service.exe and selecting **Run as administrator**. - -4. Navigate to \WCF\Basic\Security\CryptoAgility\Client\bin directory and run the client.exe file normally. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Security\CryptoAgility` - -## See also - -- [Windows Communication Foundation Security](../feature-details/security.md) diff --git a/docs/framework/wcf/samples/custom-binding-imperative.md b/docs/framework/wcf/samples/custom-binding-imperative.md deleted file mode 100644 index 57a122804f5d8..0000000000000 --- a/docs/framework/wcf/samples/custom-binding-imperative.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -description: "Learn more about: Custom Binding Imperative" -title: "Custom Binding Imperative" -ms.date: "03/30/2017" -ms.assetid: 6e13bf96-5de0-4476-b646-5f150774418d ---- -# Custom Binding Imperative - -The sample demonstrates how to write imperative code to define and use custom bindings without using a configuration file or a Windows Communication Foundation (WCF) generated client. This sample combines the features provided by the HTTP transport and the reliable session channel to create a reliable HTTP-based binding. This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - On both the client and the service, a custom binding is created that contains two binding elements (Reliable Session and HTTP): - -```csharp -ReliableSessionBindingElement reliableSession = new ReliableSessionBindingElement(); -reliableSession.Ordered = true; - -HttpTransportBindingElement httpTransport = new HttpTransportBindingElement(); -httpTransport.AuthenticationScheme = System.Net.AuthenticationSchemes.Anonymous; -httpTransport.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; - -CustomBinding binding = new CustomBinding(reliableSession, httpTransport); -``` - - On the service, the binding is used by adding an endpoint to the ServiceHost: - -```csharp -serviceHost.AddServiceEndpoint(typeof(ICalculator), binding, ""); -``` - - On the client, the binding is used by a to create a channel to the service: - -```csharp -EndpointAddress address = new EndpointAddress("http://localhost:8000/servicemodelsamples/service"); -ChannelFactory channelFactory = new ChannelFactory(binding, address); -ICalculator channel = channelFactory.CreateChannel(); -``` - - This channel is then used to interact with the service: - -```csharp -// Call the Add service operation. -double value1 = 100.00D; -double value2 = 15.99D; -double result = channel.Add(value1, value2); -Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Be sure you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WF\Basic\Binding\Custom\Imperative` - -## See also - -- [Custom Binding Samples](custom-binding.md) diff --git a/docs/framework/wcf/samples/custom-binding-reliable-session-over-https.md b/docs/framework/wcf/samples/custom-binding-reliable-session-over-https.md deleted file mode 100644 index 63ca736632b0a..0000000000000 --- a/docs/framework/wcf/samples/custom-binding-reliable-session-over-https.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -description: "Learn more about: Custom Binding Reliable Session over HTTPS" -title: "Custom Binding Reliable Session over HTTPS" -ms.date: "03/30/2017" -ms.assetid: 16aaa80d-3ffe-47c4-8b16-ec65c4d25f8d ---- -# Custom Binding Reliable Session over HTTPS - -This sample demonstrates the use of SSL transport security with Reliable Sessions. Reliable Sessions implements the WS-Reliable Messaging protocol. You can have a secure reliable session by composing WS-Security over Reliable Sessions. But sometimes, you may choose to instead use HTTP transport security with SSL. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Binding\Custom\ReliableSessionOverHttps` - -## Sample Details - - SSL ensures that the packets themselves are secured. It is important to note that this is different from securing the reliable session using WS-Secure Conversation. - - To use reliable session over HTTPS, you must create a custom binding. This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. A custom binding is created using the reliable session binding element and the [\](../../configure-apps/file-schema/wcf/httpstransport.md). The following configuration is of the custom binding. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - - The program code in the sample is identical to that of the [Getting Started](getting-started-sample.md) service. You must create a certificate and assign it by using the Web Server Certificate Wizard before building and running the sample. The endpoint definition and binding definition in the configuration file settings enable the use of custom binding as shown in the following sample configuration for the client. - -```xml - - - - - - - - - - - - - - - - - - - - - -``` - - The address specified uses the `https://` scheme. - - Because the certificate used in this sample is a test certificate created with Makecert.exe, a security alert appears when you try to access an https: address, such as `https://localhost/servicemodelsamples/service.svc`, from your browser. To allow the Windows Communication Foundation (WCF) client to work with a test certificate in place, some additional code has been added to the client to suppress the security alert. This code, and the accompanying class, is not required when using production certificates. - -```csharp -// This code is required only for test certificates like those created by Makecert.exe. -PermissiveCertificatePolicy.Enact("CN=ServiceModelSamples-HTTPS-Server"); -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -#### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command. - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. Ensure that you have performed the [Internet Information Services (IIS) Server Certificate Installation Instructions](iis-server-certificate-installation-instructions.md). - -4. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -5. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). diff --git a/docs/framework/wcf/samples/custom-binding-reliable-session.md b/docs/framework/wcf/samples/custom-binding-reliable-session.md deleted file mode 100644 index c133fc918c534..0000000000000 --- a/docs/framework/wcf/samples/custom-binding-reliable-session.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -description: "Learn more about: Custom Binding Reliable Session" -title: "Custom Binding Reliable Session" -ms.date: "03/30/2017" -ms.assetid: c5fcd409-246f-4f3e-b3f1-629506ca4c04 ---- -# Custom Binding Reliable Session - -A custom binding is defined by an ordered list of discrete binding elements. This sample demonstrates how to configure a custom binding with various transport and message encoding elements, especially enabling reliable sessions. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Binding\Custom\ReliableSession` - -## Sample Details - -Reliable sessions provide features for reliable messaging and sessions. Reliable messaging retries communication on failure and allows delivery assurances such as in-order arrival of messages to be specified. Sessions maintain state for clients between calls. The sample implements sessions for maintaining client state and specifies in-order delivery assurances. The sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. The reliable session features are enabled and configured in the application configuration files for the client and service. - -> [!NOTE] -> The set-up procedure and build instructions for this sample are located at the end of this topic. - -The ordering of binding elements is important in defining a custom binding, because each represents a layer in the channel stack (see [Custom Bindings](../extending/custom-bindings.md)). - -The service configuration for the sample is defined as shown in the following code example. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -When running in a cross-machine scenario, you must change client's endpoint address to reflect the host name of the service. - -When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -#### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command: - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - - > [!IMPORTANT] - > When running the client in a cross-machine configuration, be sure to replace "localhost" in both the `address` attribute of the [\](../../configure-apps/file-schema/wcf/endpoint-element.md) element and the `clientBaseAddress` attribute of the [\](../../configure-apps/file-schema/wcf/compositeduplex.md) with the name of the appropriate machine, as shown in the following example. - - ```xml - - - ``` diff --git a/docs/framework/wcf/samples/custom-binding-security.md b/docs/framework/wcf/samples/custom-binding-security.md deleted file mode 100644 index fa7f6fa722fbd..0000000000000 --- a/docs/framework/wcf/samples/custom-binding-security.md +++ /dev/null @@ -1,183 +0,0 @@ ---- -description: "Learn more about: Custom Binding Security" -title: "Custom Binding Security" -ms.date: "03/30/2017" -ms.assetid: a6383dff-4308-46d2-bc6d-acd4e18b4b8d ---- -# Custom Binding Security - -This sample demonstrates how to configure security by using a custom binding. It shows how to use a custom binding to enable message-level security together with a secure transport. This is useful when a secure transport is required to transmit the messages between client and service and simultaneously the messages must be secure on the message level. This configuration is not supported by system-provided bindings. - -This sample consists of a client console program (EXE) and a service console program (EXE). The service implements a duplex contract. The contract is defined by the `ICalculatorDuplex` interface, which exposes math operations (Add, Subtract, Multiply, and Divide). The `ICalculatorDuplex` interface allows the client to perform math operations, calculating a running result over a session. Independently, the service may return results on the `ICalculatorDuplexCallback` interface. A duplex contract requires a session, because a context must be established to correlate the set of messages being sent between the client and the service. A custom binding is defined that supports duplex communication and is secure. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -The service configuration defines a custom binding that supports the following: - -- TCP communication protected by using the TLS/SSL protocol. - -- Windows message security. - -The custom binding configuration enables secure transport by simultaneously enabling the message-level security. The ordering of binding elements is important in defining a custom binding, because each represents a layer in the channel stack (see [Custom Bindings](../extending/custom-bindings.md)). The custom binding is defined in the service and client configuration files, as shown in the following sample configuration. - -```xml - - - - - - - - - - - - -``` - -The custom binding uses a service certificate to authenticate the service on the transport level and to protect the messages during the transmission between client and service. This is accomplished by the `sslStreamSecurity` binding element. The service's certificate is configured using a service behavior as shown in the following sample configuration. - -```xml - - - - - - - - - - - -``` - -Additionally, the custom binding uses message security with Windows credential type - this is the default credential type. This is accomplished by the `security` binding element. Both client and service are authenticated using message-level security if the Kerberos authentication mechanism is available. This happens if the sample is run in the Active Directory environment. If the Kerberos authentication mechanism is not available, NTLM authentication is used. NTLM authenticates the client to the service but does not authenticate the service to the client. The `security` binding element is configured to use `SecureConversation` `authenticationType`, which results in the creation of a security session on both the client and the service. This is required to enable the service's duplex contract to work. - -When you run the sample, the operation requests and responses are displayed in the client's console window. Press ENTER in the client window to shut down the client. - -```console -Press to terminate client. -Result(100) -Result(50) -Result(882.5) -Result(441.25) -Equation(0 + 100 - 50 * 17.65 / 2 = 441.25) -``` - -When you run the sample, you see the messages returned to the client on the callback interface sent from the service. Each intermediate result is displayed, followed by the entire equation upon completion of all operations. Press ENTER to shut down the client. - -The included Setup.bat file enables you to configure the client and server with the relevant service certificate to run a hosted application that requires certificate-based security. This batch file must be modified to work across computers or to work in a non-hosted case. - -The following provides a brief overview of the different sections of the batch files that apply to this sample so that they can be modified to run in the appropriate configuration: - -- Creating the server certificate. - - The following lines from the Setup.bat file create the server certificate to be used. The `%SERVER_NAME%` variable specifies the server name. Change this variable to specify your own server name. This batch file defaults the server name to localhost. - - The certificate is stored in the CurrentUser store for the Web-hosted services. - - ```bat - echo ************ - echo Server cert setup starting - echo %SERVER_NAME% - echo ************ - echo making server cert - echo ************ - makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=%SERVER_NAME% -sky exchange -pe - ``` - -- Installing the server certificate into the client's trusted certificate store. - - The following lines in the Setup.bat file copy the server certificate into the client trusted people store. This step is required because certificates generated by Makecert.exe are not implicitly trusted by the client system. If you already have a certificate that is rooted in a client trusted root certificate—for example, a Microsoft-issued certificate—this step of populating the client certificate store with the server certificate is not required. - - ```console - certmgr.exe -add -r LocalMachine -s My -c -n %SERVER_NAME% -r CurrentUser -s TrustedPeople - ``` - - > [!NOTE] - > The Setup.bat batch file is designed to be run from a Visual Studio 2010 Command Prompt. It requires that the MSSDK environment variable point to the directory where the SDK is installed. This environment variable is automatically set within a Visual Studio 2010 Command Prompt. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-computer configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -### To run the sample on the same computer - -1. Open a Developer Command Prompt for Visual Studio window with administrator privileges and run Setup.bat from the sample install folder. This installs all the certificates required for running the sample. - - > [!NOTE] - > The Setup.bat batch file is designed to be run from a Visual Studio 2012 Command Prompt. The PATH environment variable set within the Visual Studio 2012 Command Prompt points to the directory that contains executables required by the Setup.bat script. - -2. Launch Service.exe from \service\bin. - -3. Launch Client.exe from \client\bin. Client activity is displayed on the client console application. - -4. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -### To run the sample across computers - -1. 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. - - 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. - - > [!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 [\](../../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. - -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. - - 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): - - ```console - 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). - - 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): - - ```console - certmgr.exe -add -c %SERVER_NAME%.cer -s -r CurrentUser TrustedPeople - ``` - - Steps c, d, and e are not necessary if the certificate is issued by a Trusted Issuer. - - 6. Modify the client’s App.config file as follows: - - ```xml - - - - ``` - - 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](../feature-details/service-identity-and-authentication.md) topic. - - 8. Run Client.exe from a command prompt. - -### To clean up after the sample - -- Run Cleanup.bat in the samples folder after you have finished running the sample. diff --git a/docs/framework/wcf/samples/custom-binding-transport-and-encoding.md b/docs/framework/wcf/samples/custom-binding-transport-and-encoding.md deleted file mode 100644 index 2c54349043c89..0000000000000 --- a/docs/framework/wcf/samples/custom-binding-transport-and-encoding.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -description: "Learn more about: Custom Binding Transport and Encoding" -title: "Custom Binding Transport and Encoding" -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -ms.assetid: 6c0b353d-79ee-4e61-b348-be49ad0e9a16 ---- -# Custom Binding Transport and Encoding - -A custom binding is defined by an ordered list of discrete binding elements. This sample demonstrates how to configure a custom binding with various transport and message encoding elements. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - This sample is based on the [Self-Host](self-host.md), and has been modified to configure three endpoints to support HTTP, TCP, and NamedPipe transports with custom bindings. The client configuration was similarly modified, and the client code changed to communicate with each of the three endpoints. - - The sample demonstrates a how to configure a custom binding that supports a particular transport and message encoding. This is accomplished by configuring a transport and a message encoding for the `binding` element. The ordering of binding elements is important in defining a custom binding, because each represents a layer in the channel stack (see [Custom Bindings](../extending/custom-bindings.md)). This sample configures three custom bindings: an HTTP transport with text encoding, a TCP transport with text encoding, and a NamedPipe transport with a binary encoding. - - The service configuration defines the custom bindings as follows: - -```xml - - - - - - - - - - - - - - - - -``` - - When you run the sample, the operation requests and responses are displayed in both the service and client console window. The client communicates with each of the three endpoints, accessing first HTTP, then TCP, and finally NamedPipe. Press ENTER in each console window to shut down the service and client. - - The `namedPipeTransport` binding does not support machine-to-machine operations. It is used only for communication on the same machine. Therefore, when running the sample in a cross-machine scenario, comment out the following lines in the client code file: - -```csharp -CalculatorClient client = new CalculatorClient("default"); -Console.WriteLine("Communicate with named pipe endpoint."); -// Call operations. -DoCalculations(client); -//Closing the client gracefully closes the connection and cleans up resources -client.Close(); -``` - -```vb -Dim client As New CalculatorClient("default") -Console.WriteLine("Communicate with named pipe endpoint.") -' call operations -DoCalculations(client) -'Closing the client gracefully closes the connection and cleans up resources -client.Close() -``` - -> [!NOTE] -> If you use Svcutil.exe to regenerate the configuration for this sample, be sure to modify the endpoint name in the client configuration to match the client code. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C#, C++, or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Binding\Custom\Transport` diff --git a/docs/framework/wcf/samples/custom-binding.md b/docs/framework/wcf/samples/custom-binding.md deleted file mode 100644 index 3288078344f36..0000000000000 --- a/docs/framework/wcf/samples/custom-binding.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -description: "Learn more about: Custom Binding" -title: "Custom Binding" -ms.date: "03/30/2017" -ms.assetid: 3c9537ea-9708-4ebc-b861-219f2e2db53d ---- -# Custom Binding - -This section contains samples that demonstrate using a custom binding attribute of an endpoint element. - -## In This Section - - [Custom Binding Imperative](custom-binding-imperative.md) - Demonstrates how to write imperative code to define and use custom bindings without using a configuration file or a WCF generated client. - - [Custom Binding Transport and Encoding](custom-binding-transport-and-encoding.md) - Demonstrates how to configure a custom binding with various transport and message encoding elements. - - [Custom Binding Reliable Session](custom-binding-reliable-session.md) - Demonstrates how to configure a custom binding with various transport and message encoding elements, especially enabling reliable sessions. - - [Custom Binding Reliable Session over HTTPS](custom-binding-reliable-session-over-https.md) - Demonstrates the use of SSL transport security with Reliable Sessions. diff --git a/docs/framework/wcf/samples/custom-channel-dispatcher.md b/docs/framework/wcf/samples/custom-channel-dispatcher.md deleted file mode 100644 index 2547e9d1181c9..0000000000000 --- a/docs/framework/wcf/samples/custom-channel-dispatcher.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -description: "Learn more about: Custom Channel Dispatcher" -title: "Custom Channel Dispatcher" -ms.date: "03/30/2017" -ms.assetid: 813acf03-9661-4d57-a3c7-eeab497321c6 ---- -# Custom Channel Dispatcher - -This sample demonstrates how to build the channel stack in a custom way by implementing directly and how to create a custom channel dispatcher in Web host environment. The channel dispatcher interacts with to accept channels and retrieves messages from the channel stack. This sample also provides a basic sample to show how to build a channel stack in a Web host environment by using . - -## Custom ServiceHostBase - - This sample implements the base type instead of to demonstrate how to replace the Windows Communication Foundation (WCF) stack implementation with a custom message handling layer on top of the channel stack. You override the virtual method to build channel listeners and the channel dispatcher. - - To implement a Web-hosted service, get the service extension from the collection and add it to the so that the transport layer knows how to configure the channel listener based on the hosting environment settings, that is, the Internet Information Services (IIS)/Windows Process Activation Service (WAS) settings. - -## Custom Channel Dispatcher - - The custom channel dispatcher extends the type . This type implements the channel-layer programming logic. In this sample, only is supported for request-reply message exchange pattern, but the custom channel dispatcher can be easily extended to other channel types. - - The dispatcher first opens the channel listener and then accepts the singleton reply channel. With the channel, it starts to send messages (requests) in an infinite loop. For each request, it creates a reply message and sends it back to the client. - -## Creating a Response Message - - The message processing is implemented in the type `MyServiceManager`. In the `HandleRequest` method, the `Action` header of the message is first checked to see whether the request is supported. A predefined SOAP action "http://tempuri.org/HelloWorld/Hello" is defined to provide message filtering. This is similar to the service contract concept in the WCF implementation of . - - For the correct SOAP action case, the sample retrieves the requested message data and generates a corresponding response to the request similar to what is seen in the case. - - You specially handled the HTTP-GET verb by returning a custom HTML message, in this, case so that you can browse the service from a browser to see that it is compiled correctly. If the SOAP action does not match, send a fault message back to indicate that the request is not supported. - - The client of this sample is a normal WCF client that does not assume anything from the service. So, the service is specially designed to match what you get from a normal WCF implementation. As a result, only a service contract is required on the client. - -## Using the sample - - Running the client application directly produces the following output. - -```output -Client is talking to a request/reply WCF service. -Type what you want to say to the server: Howdy -Server replied: You said: Howdy. Message id: 1 -Server replied: You said: Howdy. Message id: 2 -Server replied: You said: Howdy. Message id: 3 -Server replied: You said: Howdy. Message id: 4 -Server replied: You said: Howdy. Message id: 5 -``` - - You can also browse the service from a browser so that an HTTP-GET message gets processed on the server. This gets you well-formatted HTML text back. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Channels\CustomChannelDispatcher` diff --git a/docs/framework/wcf/samples/custom-find-criteria.md b/docs/framework/wcf/samples/custom-find-criteria.md deleted file mode 100644 index f9ffea99f1bd5..0000000000000 --- a/docs/framework/wcf/samples/custom-find-criteria.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -description: "Learn more about: Custom Find Criteria" -title: "Custom Find Criteria" -ms.date: "03/30/2017" -ms.assetid: b2723929-8829-424d-8015-a37ba2ab4f68 ---- -# Custom Find Criteria - -This sample demonstrates how to create a custom scope match using logic and how to implement a custom discovery service. Clients use custom scope matching functionality to refine and further build on top of the system-provided find functionality of WCF Discovery. The scenario this sample covers is as follows: - -1. A client is looking for a calculator service. - -2. To refine its search, the client must use a custom scope matching rule. - -3. According to this rule, a service responds back to the client if its endpoint matches any of the scopes specified by the client. - -## Demonstrates - -- Creating a custom discovery service. - -- Implementing a custom scope match by algorithm. - -## Discussion - - The client is looking for "OR" type matching criteria. A service responds back if the scopes on its endpoints match any of the scopes provided by the client. In this case, the client is looking for a calculator service that has any of the scopes in the following list: - -1. `net.tcp://Microsoft.Samples.Discovery/RedmondLocation` - -2. `net.tcp://Microsoft.Samples.Discovery/SeattleLocation` - -3. `net.tcp://Microsoft.Samples.Discovery/PortlandLocation` - - To accomplish this, the client directs services to use a custom scope matching rule by passing in a custom scope match by URI. To facilitate the custom scope matching, the service must use a custom discovery service that understands the custom scope match rule and implements the associated matching logic. - - In the client project, open the Program.cs file. Note that the `ScopeMatchBy` field of the `FindCriteria` object is set to a specific URI. This identifier is sent to the service. If the service does not understand this rule, it ignores the client’s find request. - - Open the service project. Three files are used to implement the Custom Discovery Service: - -1. **AsyncResult.cs**: This is the implementation of the `AsyncResult` that is required by Discovery methods. - -2. **CustomDiscoveryService.cs**: This file implements the custom discovery service. The implementation extends the class and overrides the necessary methods. Note the implementation of the method. The method checks to see whether the custom scope match by rule was specified by the client. This is the same custom URI that the client specified previously. If the custom rule is specified, the code path that implements the "OR" match logic is followed. - - This custom logic goes through all of the scopes on each of the endpoints that the service has. If any of the endpoint's scopes match any of the scopes provided by the client, the discovery service adds that endpoint to the response that is sent back to the client. - -3. **CustomDiscoveryExtension.cs**: The last step in implementing the discovery service is to connect this implementation of the custom discover service to the service host. The helper class used here is the `CustomDiscoveryExtension` class. This class extends the class. The user must override the method. In this case, the method returns an instance of the custom discovery service that was created before. `PublishedEndpoints` is a that contains all of the application endpoints that are added to the . The custom discovery service uses this to populate its internal list. A user can to add other endpoint metadata as well. - - Lastly, open Program.cs. Note that both the and `CustomDiscoveryExtension` are added to the host. Once this is done and the host has an endpoint over which to receive discovery messages, the application can use the custom discovery service. - - Observe that the client is able to find the service without knowing its address. - -#### To set up, build, and run the sample - -1. Open the solution that contains the project. - -2. Build the project. - -3. Run the service application. - -4. Run the client application. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Discovery\CustomFindCriteria` diff --git a/docs/framework/wcf/samples/custom-lifetime.md b/docs/framework/wcf/samples/custom-lifetime.md deleted file mode 100644 index 925764065ed0d..0000000000000 --- a/docs/framework/wcf/samples/custom-lifetime.md +++ /dev/null @@ -1,249 +0,0 @@ ---- -description: "Learn more about: Custom lifetime" -title: "Custom lifetime" -ms.date: "08/20/2018" -ms.assetid: 52806c07-b91c-48fe-b992-88a41924f51f ---- -# Custom lifetime - -This sample demonstrates how to write a Windows Communication Foundation (WCF) extension to provide custom lifetime services for shared WCF service instances. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this article. - -## Shared instancing - -WCF offers several instancing modes for your service instances. The shared instancing mode covered in this article provides a way to share a service instance between multiple channels. Clients can contact a factory method in the service and create a new channel to start communication. The following code snippet shows how a client application creates a new channel to an existing service instance: - -```csharp -// Create a header for the shared instance id -MessageHeader shareableInstanceContextHeader = MessageHeader.CreateHeader( - CustomHeader.HeaderName, - CustomHeader.HeaderNamespace, - Guid.NewGuid().ToString()); - -// Create the channel factory -ChannelFactory channelFactory = - new ChannelFactory("echoservice"); - -// Create the first channel -IEchoService proxy = channelFactory.CreateChannel(); - -// Call an operation to create shared service instance -using (new OperationContextScope((IClientChannel)proxy)) -{ - OperationContext.Current.OutgoingMessageHeaders.Add(shareableInstanceContextHeader); - Console.WriteLine("Service returned: " + proxy.Echo("Apple")); -} - -((IChannel)proxy).Close(); - -// Create the second channel -IEchoService proxy2 = channelFactory.CreateChannel(); - -// Call an operation using the same header that will reuse the shared service instance -using (new OperationContextScope((IClientChannel)proxy2)) -{ - OperationContext.Current.OutgoingMessageHeaders.Add(shareableInstanceContextHeader); - Console.WriteLine("Service returned: " + proxy2.Echo("Apple")); -} -``` - -Unlike other instancing modes, the shared instancing mode has a unique way of releasing the service instances. By default, when all the channels are closed for an , the WCF service runtime checks to see if the service is configured to or , and if so releases the instance and claims the resources. If a custom is being used, WCF invokes the method of the provider implementation before releasing the instance. If returns `true` the instance is released, otherwise the implementation is responsible for notifying the `Dispatcher` of the idle state by using a callback method. This is done by calling the method of the provider. - -This sample demonstrates how you can delay releasing the with an idle timeout of 20 seconds. - -## Extending the InstanceContext - -In WCF, is the link between the service instance and the `Dispatcher`. WCF allows you to extend this runtime component by adding new state or behavior by using its extensible object pattern. The extensible object pattern is used in WCF to either extend existing runtime classes with new functionality or to add new state features to an object. There are three interfaces in the extensible object pattern: , , and . - -The interface is implemented by objects to allow extensions that customize their functionality. - -The interface is implemented by objects that can be extensions of classes of type `T`. - -And finally, the interface is a collection of implementations that allows for retrieving an implementation of by their type. - -Therefore, in order to extend the , you must implement the interface. In this sample project, the `CustomLeaseExtension` class contains this implementation. - -```csharp -class CustomLeaseExtension : IExtension -{ -} -``` - -The interface has two methods and . As their names imply, these two methods are called when the runtime attaches and detaches the extension to an instance of the class. In this sample, the `Attach` method is used to keep track of the object that belongs to the current instance of the extension. - -```csharp -InstanceContext owner; - -public void Attach(InstanceContext owner) -{ - this.owner = owner; -} -``` - -In addition, you must add the necessary implementation to the extension to provide the extended lifetime support. Therefore, the `ICustomLease` interface is declared with the desired methods and is implemented in the `CustomLeaseExtension` class. - -```csharp -interface ICustomLease -{ - bool IsIdle { get; } - InstanceContextIdleCallback Callback { get; set; } -} - -class CustomLeaseExtension : IExtension, ICustomLease -{ -} -``` - -When WCF invokes the method in the implementation, this call is routed to the method of the `CustomLeaseExtension`. Then, the `CustomLeaseExtension` checks its private state to see whether the is idle. If it is idle, it returns `true`. Otherwise, it starts a timer for a specified amount of extended lifetime. - -```csharp -public bool IsIdle -{ - get - { - lock (thisLock) - { - if (isIdle) - { - return true; - } - else - { - StartTimer(); - return false; - } - } - } -} -``` - -In the timer’s `Elapsed` event, the callback function in the Dispatcher is called in order to start another clean-up cycle. - -```csharp -void idleTimer_Elapsed(object sender, ElapsedEventArgs args) -{ - lock (thisLock) - { - StopTimer(); - isIdle = true; - Utility.WriteMessageToConsole( - ResourceHelper.GetString("MsgLeaseExpired")); - callback(owner); - } -} -``` - -There's no way to renew the running timer when a new message arrives for the instance being moved to the idle state. - -The sample implements to intercept the calls to the method and route them to the `CustomLeaseExtension`. The implementation is contained in `CustomLifetimeLease` class. The method is invoked when WCF is about to release the service instance. However, there is only one instance of a particular `ISharedSessionInstance` implementation in the ServiceBehavior’s collection. This means there's no way of knowing if the is closed at the time WCF checks the method. Therefore, this sample uses thread locking to serialize requests to the method. - -> [!IMPORTANT] -> Using thread locking is not a recommended approach because serialization can severely affect the performance of your application. - -A private member field is used in the `CustomLifetimeLease` class to track the idle state and is returned by the method. Each time the method is called, the `isIdle` field is returned and reset to `false`. It is essential to set this value to `false` in order to make sure the Dispatcher calls the method. - -```csharp -public bool IsIdle(InstanceContext instanceContext) -{ - get - { - lock (thisLock) - { - //... - bool idleCopy = isIdle; - isIdle = false; - return idleCopy; - } - } -} -``` - -If the method returns `false`, the Dispatcher registers a callback function by using the method. This method receives a reference to the being released. Therefore, the sample code can query the `ICustomLease` type extension and check the `ICustomLease.IsIdle` property in the extended state. - -```csharp -public void NotifyIdle(InstanceContextIdleCallback callback, - InstanceContext instanceContext) -{ - lock (thisLock) - { - ICustomLease customLease = - instanceContext.Extensions.Find(); - customLease.Callback = callback; - isIdle = customLease.IsIdle; - if (isIdle) - { - callback(instanceContext); - } - } -} -``` - -Before the `ICustomLease.IsIdle` property is checked, the Callback property needs to be set as this is essential for `CustomLeaseExtension` to notify the Dispatcher when it becomes idle. If `ICustomLease.IsIdle` returns `true`, the `isIdle` private member is simply set in `CustomLifetimeLease` to `true` and calls the callback method. Because the code holds a lock, other threads can't change the value of this private member. And the next time Dispatcher calls the , it returns `true` and lets Dispatcher release the instance. - -Now that the groundwork for the custom extension is completed, it has to be hooked up to the service model. To hook up the `CustomLeaseExtension` implementation to the , WCF provides the interface to perform the bootstrapping of . In the sample, the `CustomLeaseInitializer` class implements this interface and adds an instance of `CustomLeaseExtension` to the collection from the only method initialization. This method is called by Dispatcher while initializing the . - -```csharp -public void InitializeInstanceContext(InstanceContext instanceContext, - System.ServiceModel.Channels.Message message, IContextChannel channel) - - //... - - IExtension customLeaseExtension = - new CustomLeaseExtension(timeout, headerId); - instanceContext.Extensions.Add(customLeaseExtension); -} -``` - - Finally the implementation is hooked up to the service model by using the implementation. This implementation is placed in the `CustomLeaseTimeAttribute` class and it also derives from the base class to expose this behavior as an attribute. - -```csharp -public void ApplyDispatchBehavior(ServiceDescription description, - ServiceHostBase serviceHostBase) -{ - CustomLifetimeLease customLease = new CustomLifetimeLease(timeout); - - foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers) - { - ChannelDispatcher cd = cdb as ChannelDispatcher; - - if (cd != null) - { - foreach (EndpointDispatcher ed in cd.Endpoints) - { - ed.DispatchRuntime.InstanceContextProvider = customLease; - } - } - } -} -``` - -This behavior can be added to a sample service class by annotating it with the `CustomLeaseTime` attribute. - -```csharp -[CustomLeaseTime(Timeout = 20000)] -public class EchoService : IEchoService -{ - //… -} -``` - -When you run the sample, the operation requests and responses are displayed in both the service and client console windows. Press ENTER in each console window to shut down the service and client. - -### To set up, build, and run the sample - -1. Ensure that you've performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Instancing\Lifetime` diff --git a/docs/framework/wcf/samples/custom-message-encoder-compression-encoder.md b/docs/framework/wcf/samples/custom-message-encoder-compression-encoder.md deleted file mode 100644 index d071d08f0edfe..0000000000000 --- a/docs/framework/wcf/samples/custom-message-encoder-compression-encoder.md +++ /dev/null @@ -1,353 +0,0 @@ ---- -description: "Learn more about: Custom Message Encoder: Compression Encoder" -title: "Custom Message Encoder: Compression Encoder" -ms.date: "03/30/2017" -ms.assetid: 57450b6c-89fe-4b8a-8376-3d794857bfd7 ---- -# Custom Message Encoder: Compression Encoder - -This sample demonstrates how to implement a custom encoder using the Windows Communication Foundation (WCF) platform. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\MessageEncoder\Compression` - -## Sample Details - -This sample consists of a client console program (.exe), a self-hosted service console program (.exe) and a compression message encoder library (.dll). The service implements a contract that defines a request-reply communication pattern. The contract is defined by the `ISampleServer` interface, which exposes basic string echoing operations (`Echo` and `BigEcho`). The client makes synchronous requests to a given operation and the service replies by repeating the message back to the client. Client and service activity is visible in the console windows. The intent of this sample is to show how to write a custom encoder and demonstrate the impact of compression of a message on the wire. You can add instrumentation to the compression message encoder to calculate message size, processing time, or both. - -> [!NOTE] -> In the .NET Framework 4, automatic decompression has been enabled on a WCF client if the server is sending a compressed response (created with an algorithm such as GZip or Deflate). If the service is Web-hosted in Internet Information Server (IIS), then IIS can be configured for the service to send a compressed response. This sample can be used if the requirement is to do compression and decompression on both the client and the service or if the service is self-hosted. - -The sample demonstrates how to build and integrate a custom message encoder into a WCF application. The library GZipEncoder.dll is deployed with both the client and the service. This sample also demonstrates the impact of compressing messages. The code in GZipEncoder.dll demonstrates the following: - -- Building a custom encoder and encoder factory. - -- Developing a binding element for a custom encoder. - -- Using the custom binding configuration for integrating custom binding elements. - -- Developing a custom configuration handler to allow file configuration of a custom binding element. - -As indicated previously, there are several layers that are implemented in a custom encoder. To better illustrate the relationship between each of these layers, a simplified order of events for service start-up is in the following list: - -1. The server starts. - -2. The configuration information is read. - - 1. The service configuration registers the custom configuration handler. - - 2. The service host is created and opened. - - 3. The custom configuration element creates and returns the custom binding element. - - 4. The custom binding element creates and returns a message encoder factory. - -3. A message is received. - -4. The message encoder factory returns a message encoder for reading in the message and writing out the response. - -5. The encoder layer is implemented as a class factory. Only the encoder class factory must be publicly exposed for the custom encoder. The factory object is returned by the binding element when the or object is created. Message encoders can operate in a buffered or streaming mode. This sample demonstrates both buffered mode and streaming mode. - -For each mode there is an accompanying `ReadMessage` and `WriteMessage` method on the abstract `MessageEncoder` class. A majority of the encoding work takes place in these methods. The sample wraps the existing text and binary message encoders. This allows the sample to delegate the reading and writing of the wire representation of messages to the inner encoder and allows the compression encoder to compress or decompress the results. Because there is no pipeline for message encoding, this is the only model for using multiple encoders in WCF. Once the message has been decompressed, the resulting message is passed up the stack for the channel stack to handle. During compression, the resulting compressed message is written directly to the stream provided. - -This sample uses helper methods (`CompressBuffer` and `DecompressBuffer`) to perform conversion from buffers to streams to use the `GZipStream` class. - -The buffered `ReadMessage` and `WriteMessage` classes make use of the `BufferManager` class. The encoder is accessible only through the encoder factory. The abstract `MessageEncoderFactory` class provides a property named `Encoder` for accessing the current encoder and a method named `CreateSessionEncoder` for creating an encoder that supports sessions. Such an encoder can be used in the scenario where the channel supports sessions, is ordered and is reliable. This scenario allows for optimization in each session of the data written to the wire. If this is not desired, the base method should not be overloaded. The `Encoder` property provides a mechanism for accessing the session-less encoder and the default implementation of the `CreateSessionEncoder` method returns the value of the property. Because the sample wraps an existing encoder to provide compression, the `MessageEncoderFactory` implementation accepts a `MessageEncoderFactory` that represents the inner encoder factory. - -Now that the encoder and encoder factory are defined, they can be used with a WCF client and service. However, these encoders must be added to the channel stack. You can derive classes from the and classes and override the `OnInitialize` methods to add this encoder factory manually. You can also expose the encoder factory through a custom binding element. - -To create a new custom binding element, derive a class from the class. There are, however, several types of binding elements. To ensure that the custom binding element is recognized as a message encoding binding element, you also must implement the . The exposes a method for creating a new message encoder factory (`CreateMessageEncoderFactory`), which is implemented to return an instance of the matching message encoder factory. Additionally, the has a property to indicate the addressing version. Because this sample wraps the existing encoders, the sample implementation also wraps the existing encoder binding elements and takes an inner encoder binding element as a parameter to the constructor and exposes it through a property. The following sample code shows the implementation of the `GZipMessageEncodingBindingElement` class. - -```csharp -public sealed class GZipMessageEncodingBindingElement - : MessageEncodingBindingElement //BindingElement - , IPolicyExportExtension -{ - - //We use an inner binding element to store information - //required for the inner encoder. - MessageEncodingBindingElement innerBindingElement; - - //By default, use the default text encoder as the inner encoder. - public GZipMessageEncodingBindingElement() - : this(new TextMessageEncodingBindingElement()) { } - - public GZipMessageEncodingBindingElement(MessageEncodingBindingElement messageEncoderBindingElement) - { - this.innerBindingElement = messageEncoderBindingElement; - } - - public MessageEncodingBindingElement InnerMessageEncodingBindingElement - { - get { return innerBindingElement; } - set { innerBindingElement = value; } - } - - //Main entry point into the encoder binding element. - // Called by WCF to get the factory that creates the - //message encoder. - public override MessageEncoderFactory CreateMessageEncoderFactory() - { - return new -GZipMessageEncoderFactory(innerBindingElement.CreateMessageEncoderFactory()); - } - - public override MessageVersion MessageVersion - { - get { return innerBindingElement.MessageVersion; } - set { innerBindingElement.MessageVersion = value; } - } - - public override BindingElement Clone() - { - return new - GZipMessageEncodingBindingElement(this.innerBindingElement); - } - - public override T GetProperty(BindingContext context) - { - if (typeof(T) == typeof(XmlDictionaryReaderQuotas)) - { - return innerBindingElement.GetProperty(context); - } - else - { - return base.GetProperty(context); - } - } - - public override IChannelFactory BuildChannelFactory(BindingContext context) - { - if (context == null) - throw new ArgumentNullException("context"); - - context.BindingParameters.Add(this); - return context.BuildInnerChannelFactory(); - } - - public override IChannelListener BuildChannelListener(BindingContext context) - { - if (context == null) - throw new ArgumentNullException("context"); - - context.BindingParameters.Add(this); - return context.BuildInnerChannelListener(); - } - - public override bool CanBuildChannelListener(BindingContext context) - { - if (context == null) - throw new ArgumentNullException("context"); - - context.BindingParameters.Add(this); - return context.CanBuildInnerChannelListener(); - } - - void IPolicyExportExtension.ExportPolicy(MetadataExporter exporter, PolicyConversionContext policyContext) - { - if (policyContext == null) - { - throw new ArgumentNullException("policyContext"); - } - XmlDocument document = new XmlDocument(); - policyContext.GetBindingAssertions().Add(document.CreateElement( - GZipMessageEncodingPolicyConstants.GZipEncodingPrefix, - GZipMessageEncodingPolicyConstants.GZipEncodingName, - GZipMessageEncodingPolicyConstants.GZipEncodingNamespace)); - } -} -``` - -Note that `GZipMessageEncodingBindingElement` class implements the `IPolicyExportExtension` interface, so that this binding element can be exported as a policy in metadata, as shown in the following example. - -```xml - - - - - - - - -``` - -The `GZipMessageEncodingBindingElementImporter` class implements the `IPolicyImportExtension` interface, this class imports policy for `GZipMessageEncodingBindingElement`. Svcutil.exe tool can be used to import policies to the configuration file, to handle `GZipMessageEncodingBindingElement`, the following should be added to Svcutil.exe.config. - -```xml - - - - - - - - - - - - - - - - - -``` - -Now that there is a matching binding element for the compression encoder, it can be programmatically hooked into the service or client by constructing a new custom binding object and adding the custom binding element to it, as shown in the following sample code. - -```csharp -ICollection bindingElements = new List(); -HttpTransportBindingElement httpBindingElement = new HttpTransportBindingElement(); -GZipMessageEncodingBindingElement compBindingElement = new GZipMessageEncodingBindingElement (); -bindingElements.Add(compBindingElement); -bindingElements.Add(httpBindingElement); -CustomBinding binding = new CustomBinding(bindingElements); -binding.Name = "SampleBinding"; -binding.Namespace = "http://tempuri.org/bindings"; -``` - -While this may be sufficient for the majority of user scenarios, supporting a file configuration is critical if a service is to be Web-hosted. To support the Web-hosted scenario, you must develop a custom configuration handler to allow a custom binding element to be configurable in a file. - -You can build a configuration handler for the binding element on top of the configuration system. The configuration handler for the binding element must derive from the class. The informs the configuration system of the type of binding element to create for this section. All aspects of the `BindingElement` that can be set should be exposed as properties in the derived class. The assists in mapping the configuration element attributes to the properties and setting default values if attributes are missing. After the values from configuration are loaded and applied to the properties, the method is called, which converts the properties into a concrete instance of a binding element. The method is used to convert the properties on the derived class into the values to be set on the newly created binding element. - -The following sample code shows the implementation of the `GZipMessageEncodingElement`. - -```csharp -public class GZipMessageEncodingElement : BindingElementExtensionElement -{ - public GZipMessageEncodingElement() - { - } - -//Called by the WCF to discover the type of binding element this -//config section enables - public override Type BindingElementType - { - get { return typeof(GZipMessageEncodingBindingElement); } - } - - //The only property we need to configure for our binding element is - //the type of inner encoder to use. Here, we support text and - //binary. - [ConfigurationProperty("innerMessageEncoding", - DefaultValue = "textMessageEncoding")] - public string InnerMessageEncoding - { - get { return (string)base["innerMessageEncoding"]; } - set { base["innerMessageEncoding"] = value; } - } - - //Called by the WCF to apply the configuration settings (the - //property above) to the binding element - public override void ApplyConfiguration(BindingElement bindingElement) - { - GZipMessageEncodingBindingElement binding = - (GZipMessageEncodingBindingElement)bindingElement; - PropertyInformationCollection propertyInfo = - this.ElementInformation.Properties; - if (propertyInfo["innerMessageEncoding"].ValueOrigin != - PropertyValueOrigin.Default) - { - switch (this.InnerMessageEncoding) - { - case "textMessageEncoding": - binding.InnerMessageEncodingBindingElement = - new TextMessageEncodingBindingElement(); - break; - case "binaryMessageEncoding": - binding.InnerMessageEncodingBindingElement = - new BinaryMessageEncodingBindingElement(); - break; - } - } - } - - //Called by the WCF to create the binding element - protected override BindingElement CreateBindingElement() - { - GZipMessageEncodingBindingElement bindingElement = - new GZipMessageEncodingBindingElement(); - this.ApplyConfiguration(bindingElement); - return bindingElement; - } -} -``` - -This configuration handler maps to the following representation in the App.config or Web.config for the service or client. - -```xml - -``` - -To use this configuration handler, it must be registered within the [\](../../configure-apps/file-schema/wcf/system-servicemodel.md) element, as shown in the following sample configuration. - -```xml - - - - - -``` - -When you run the server, the operation requests and responses are displayed in the console window. Press ENTER in the window to shut down the server. - -```console -Press Enter key to Exit. - - Server Echo(string input) called: - Client message: Simple hello - - Server BigEcho(string[] input) called: - 64 client messages -``` - -When you run the client, the operation requests and responses are displayed in the console window. Press ENTER in the client window to shut down the client. - -```console -Calling Echo(string): -Server responds: Simple hello Simple hello - -Calling BigEcho(string[]): -Server responds: Hello 0 - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command: - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\MessageEncoder\Compression` diff --git a/docs/framework/wcf/samples/custom-message-encoder-custom-text-encoder.md b/docs/framework/wcf/samples/custom-message-encoder-custom-text-encoder.md deleted file mode 100644 index b5fe00b71bb33..0000000000000 --- a/docs/framework/wcf/samples/custom-message-encoder-custom-text-encoder.md +++ /dev/null @@ -1,238 +0,0 @@ ---- -title: "Custom Message Encoder: Custom Text Encoder" -description: Use this sample to implement a custom text message encoder using WCF. This encoder supports all platform-supported character encodings for interoperability. -ms.date: "03/30/2017" -ms.assetid: 68ff5c74-3d33-4b44-bcae-e1d2f5dea0de ---- -# Custom Message Encoder: Custom Text Encoder - -This sample demonstrates how to implement a custom text message encoder using Windows Communication Foundation (WCF). - -> [!WARNING] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\MessageEncoder\Text` - -The of WCF supports only the UTF-8, UTF-16 and big-endian Unicode encodings. The custom text message encoder in this sample supports all platform-supported character encodings that may be required for interoperability. The sample consists of a client console program (.exe), a service library (.dll) hosted by Internet Information Services (IIS), and a text message encoder library (.dll). The service implements a contract that defines a request-reply communication pattern. The contract is defined by the `ICalculator` interface, which exposes math operations (Add, Subtract, Multiply, and Divide). The client makes synchronous requests to a given math operation and the service replies with the result. Both client and service uses the `CustomTextMessageEncoder` instead of the default . - -The custom encoder implementation consists of a message encoder factory, a message encoder, a message encoding binding element and a configuration handler, and demonstrates the following: - -- Building a custom encoder and encoder factory. - -- Creating a binding element for a custom encoder. - -- Using the custom binding configuration for integrating custom binding elements. - -- Developing a custom configuration handler to allow file configuration of a custom binding element. - -## To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command. - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -## Message Encoder Factory and the Message Encoder - -When the or the client channel is opened, the design time component `CustomTextMessageBindingElement` creates the `CustomTextMessageEncoderFactory`. The factory creates the `CustomTextMessageEncoder`. The message encoder operates both in the streaming mode and the buffered mode. It uses the and to read and write the messages respectively. As opposed to the optimized XML readers and writers of WCF that support only UTF-8, UTF-16 and big-endian Unicode, these readers and writers support all platform-supported encoding. - -The following code example shows the CustomTextMessageEncoder. - -```csharp -public class CustomTextMessageEncoder : MessageEncoder -{ - private CustomTextMessageEncoderFactory factory; - private XmlWriterSettings writerSettings; - private string contentType; - - public CustomTextMessageEncoder(CustomTextMessageEncoderFactory factory) - { - this.factory = factory; - - this.writerSettings = new XmlWriterSettings(); - this.writerSettings.Encoding = Encoding.GetEncoding(factory.CharSet); - this.contentType = $"{this.factory.MediaType}; charset={this.writerSettings.Encoding.HeaderName}"; - } - - public override string ContentType - { - get - { - return this.contentType; - } - } - - public override string MediaType - { - get - { - return factory.MediaType; - } - } - - public override MessageVersion MessageVersion - { - get - { - return this.factory.MessageVersion; - } - } - - public override Message ReadMessage(ArraySegment buffer, BufferManager bufferManager, string contentType) - { - byte[] msgContents = new byte[buffer.Count]; - Array.Copy(buffer.Array, buffer.Offset, msgContents, 0, msgContents.Length); - bufferManager.ReturnBuffer(buffer.Array); - - MemoryStream stream = new MemoryStream(msgContents); - return ReadMessage(stream, int.MaxValue); - } - - public override Message ReadMessage(Stream stream, int maxSizeOfHeaders, string contentType) - { - XmlReader reader = XmlReader.Create(stream); - return Message.CreateMessage(reader, maxSizeOfHeaders, this.MessageVersion); - } - - public override ArraySegment WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset) - { - MemoryStream stream = new MemoryStream(); - XmlWriter writer = XmlWriter.Create(stream, this.writerSettings); - message.WriteMessage(writer); - writer.Close(); - - byte[] messageBytes = stream.GetBuffer(); - int messageLength = (int)stream.Position; - stream.Close(); - - int totalLength = messageLength + messageOffset; - byte[] totalBytes = bufferManager.TakeBuffer(totalLength); - Array.Copy(messageBytes, 0, totalBytes, messageOffset, messageLength); - - ArraySegment byteArray = new ArraySegment(totalBytes, messageOffset, messageLength); - return byteArray; - } - - public override void WriteMessage(Message message, Stream stream) - { - XmlWriter writer = XmlWriter.Create(stream, this.writerSettings); - message.WriteMessage(writer); - writer.Close(); - } -} -``` - -The following code example shows how to build the message encoder factory. - -```csharp -public class CustomTextMessageEncoderFactory : MessageEncoderFactory -{ - private MessageEncoder encoder; - private MessageVersion version; - private string mediaType; - private string charSet; - - internal CustomTextMessageEncoderFactory(string mediaType, string charSet, - MessageVersion version) - { - this.version = version; - this.mediaType = mediaType; - this.charSet = charSet; - this.encoder = new CustomTextMessageEncoder(this); - } - - public override MessageEncoder Encoder - { - get - { - return this.encoder; - } - } - - public override MessageVersion MessageVersion - { - get - { - return this.version; - } - } - - internal string MediaType - { - get - { - return this.mediaType; - } - } - - internal string CharSet - { - get - { - return this.charSet; - } - } -} -``` - -## Message Encoding Binding Element - -The binding elements allow the configuration of the WCF run-time stack. To use the custom message encoder in a WCF application, a binding element is required that creates the message encoder factory with the appropriate settings at the appropriate level in the run-time stack. - -The `CustomTextMessageBindingElement` derives from the base class and inherits from the class. This allows other WCF components to recognize this binding element as being a message encoding binding element. The implementation of returns an instance of the matching message encoder factory with appropriate settings. - -The `CustomTextMessageBindingElement` exposes settings for `MessageVersion`, `ContentType`, and `Encoding` through properties. The encoder supports both Soap11Addressing and Soap12Addressing1 versions. The default is Soap11Addressing1. The default value of the `ContentType` is "text/xml". The `Encoding` property allows you to set the value of the desired character encoding. The sample client and service uses the ISO-8859-1 (Latin1) character encoding, which is not supported by the of WCF. - -The following code shows how to programmatically create the binding using the custom text message encoder. - -```csharp -ICollection bindingElements = new List(); -HttpTransportBindingElement httpBindingElement = new HttpTransportBindingElement(); -CustomTextMessageBindingElement textBindingElement = new CustomTextMessageBindingElement(); -bindingElements.Add(textBindingElement); -bindingElements.Add(httpBindingElement); -CustomBinding binding = new CustomBinding(bindingElements); -``` - -## Adding Metadata Support to the Message Encoding Binding Element - -Any type that derives from is responsible for updating the version of the SOAP binding in the WSDL document generated for the service. This is done by implementing the `ExportEndpoint` method on the interface and then modifying the generated WSDL. In this sample, the `CustomTextMessageBindingElement` uses the WSDL export logic from the `TextMessageEncodingBindingElement`. - -For this sample, the client configuration is hand configured. You cannot use Svcutil.exe to generate the client configuration because the `CustomTextMessageBindingElement` does not export a policy assertion to describe its behavior. You should generally implement the interface on a custom binding element to export a custom policy assertion that describes the behavior or capability implemented by the binding element. For an example of how to export a policy assertion for a custom binding element, see the [Transport: UDP](transport-udp.md) sample. - -## Message Encoding Binding Configuration Handler - -The previous section shows how to use the custom text message encoder programmatically. The `CustomTextMessageEncodingBindingSection` implements a configuration handler that allows you to specify the use of a custom text message encoder within a configuration file. The `CustomTextMessageEncodingBindingSection` class derives from the class. The `BindingElementType` property informs the configuration system of the type of binding element to create for this section. - -All of the settings defined by `CustomTextMessageBindingElement` are exposed as the properties in the `CustomTextMessageEncodingBindingSection`. The assists in mapping the configuration element attributes to the properties and setting default values if the attribute is not set. After the values from configuration are loaded and applied to the properties of the type, the method is called, which converts the properties into a concrete instance of a binding element. - -This configuration handler maps to the following representation in the App.config or Web.config for the service or client. - -```xml - -``` - -The sample uses the ISO-8859-1 encoding. - -To use this configuration handler it must be registered using the following configuration element. - -```xml - - - - - -``` diff --git a/docs/framework/wcf/samples/custom-message-filter.md b/docs/framework/wcf/samples/custom-message-filter.md deleted file mode 100644 index 523f78883f3ea..0000000000000 --- a/docs/framework/wcf/samples/custom-message-filter.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -description: "Learn more about: Custom Message Filter" -title: "Custom Message Filter" -ms.date: "03/30/2017" -ms.assetid: 98dd0af8-fce6-4255-ac32-42eb547eea67 ---- -# Custom Message Filter - -This sample demonstrates how to replace the message filters that Windows Communication Foundation (WCF) uses to dispatch messages to endpoints. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - When the first message on a channel arrives at the server, the server must determine which (if any) of the endpoints associated with that URI should receive the message. This process is controlled by the objects attached to the . - - Each endpoint of a service has a single . The has both an and a . The union of these two filters is the message filter used for that endpoint. - - By default, the for an endpoint matches any message that is addressed to an address that matches the service endpoint's . By default, the for an endpoint inspects the action of the incoming message and matches any message with an action that corresponds to one of the actions of the service endpoint contract's operations (only `IsInitiating`=`true` actions are considered). As a result, by default, the filter for an endpoint only matches if both the message's To header is the of the endpoint and the message's action matches one of the endpoint operation's actions. - - These filters can be changed using a behavior. In the sample, the service creates an that replaces the and on the : - -```csharp -class FilteringEndpointBehavior : IEndpointBehavior -{ - //... -} -``` - - Two address filters are defined: - -```csharp -// Matches any message whose To address contains the letter 'e' -class MatchEAddressFilter : MessageFilter { } -// Matches any message whose To address does not contain the letter 'e' -class MatchNoEAddressFilter : MessageFilter { } -``` - - The `FilteringEndpointBehavior` is made configurable and allows for two different variations. - -```csharp -public class FilteringEndpointBehaviorExtension : BehaviorExtensionElement { } -``` - - Variation 1 matches only addresses that contain an 'e' (but that have any Action) whereas Variation 2 matches only addresses that lack an 'e': - -```csharp -if (Variation == 1) - return new FilteringEndpointBehavior( - new MatchEAddressFilter(), new MatchAllMessageFilter()); -else - return new FilteringEndpointBehavior( - new MatchNoEAddressFilter(), new MatchAllMessageFilter()); -``` - - In the configuration file, the service registers the new behavior: - -```xml - - - - - -``` - - Then the service creates `endpointBehavior` configurations for each variation: - -```xml - - - - - - - - -``` - - Finally, the service's endpoint references one of the `behaviorConfigurations`: - -```xml - -``` - - The implementation of the client application is straightforward; it creates two channels to the service's URI (by passing in that value as the second (`via`) parameter to and sends a single message on each channel, but it uses different endpoint addresses for each. As a result, the outbound messages from the client have different To designations, and the server responds accordingly, as demonstrated by the client's output: - -```console -Sending message to urn:e... -Exception: The message with To 'urn:e' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree. - -Sending message to urn:a... -Hello -``` - - Switching the variation in the server's configuration file causes the filter to be swapped and the client sees the opposite behavior (the message to `urn:e` succeeds, whereas the message to `urn:a` fails). - -```xml - -``` - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\MessageFilter` - -### To set up, build, and run the sample - -1. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -2. To run the sample in a single-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -3. To run the sample in a cross-machine configuration, follow the instructions at [Running the Windows Communication Foundation Samples](running-the-samples.md) and change the following line in Client.cs. - - ```csharp - Uri serviceVia = new Uri("http://localhost/ServiceModelSamples/service.svc"); - ``` - - Replace localhost with the name of server. - - ```csharp - Uri serviceVia = new Uri("http://servermachinename/ServiceModelSamples/service.svc"); - ``` diff --git a/docs/framework/wcf/samples/custom-message-interceptor.md b/docs/framework/wcf/samples/custom-message-interceptor.md deleted file mode 100644 index 16775c56c8bbf..0000000000000 --- a/docs/framework/wcf/samples/custom-message-interceptor.md +++ /dev/null @@ -1,174 +0,0 @@ ---- -description: "Learn more about: Custom Message Interceptor" -title: "Custom Message Interceptor" -ms.date: "03/30/2017" -ms.assetid: 73f20972-53f8-475a-8bfe-c133bfa225b0 ---- -# Custom Message Interceptor - -This sample demonstrates the use of the channel extensibility model. In particular, it shows how to implement a custom binding element that creates channel factories and channel listeners to intercept all incoming and outgoing messages at a particular point in the run-time stack. The sample also includes a client and server that demonstrate the use of these custom factories. - - In this sample, both the client and the service are console programs (.exe). The client and service both make use of a common library (.dll) that contains the custom binding element and its associated run-time objects. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Channels\MessageInterceptor` - - The sample describes the recommended procedure for creating a custom layered channel in Windows Communication Foundation (WCF), by using the channel framework and following WCF best practices. The steps to create a custom layered channel are as follows: - -1. Decide which of the channel shapes your channel factory and channel listener will support. - -2. Create a channel factory and a channel listener that support your channel shapes. - -3. Add a binding element that adds the custom layered channel to a channel stack. - -4. Add a binding element extension section to expose the new binding element to the configuration system. - -## Channel Shapes - - The first step in writing a custom layered channel is to decide which shapes are required for the channel. For our message inspector, we support any shape that the layer below us supports (for example, if the layer below us can build and , then we also expose and ). - -## Channel Factory and Listener Factory - - The next step in writing a custom layered channel is to create an implementation of for client channels and of for service channels. - - These classes take an inner factory and listener, and delegate all but the `OnCreateChannel` and `OnAcceptChannel` calls to the inner factory and listener. - -```csharp -class InterceptingChannelFactory : ChannelFactoryBase -{ - //... -} - -class InterceptingChannelListener : ListenerFactoryBase -{ - //... -} -``` - -## Adding a Binding Element - - The sample defines a custom binding element: `InterceptingBindingElement`. `InterceptingBindingElement` takes a `ChannelMessageInterceptor` as an input, and uses this `ChannelMessageInterceptor` to manipulate messages that pass through it. This is the only class that must be public. The factory, listener, and channels can all be internal implementations of the public run-time interfaces. - -```csharp -public class InterceptingBindingElement : BindingElement -{ -} -``` - -## Adding Configuration Support - - To integrate with binding configuration, the library defines a configuration section handler as a binding element extension section. The client and server configuration files must register the binding element extension with the configuration system. Implementers that want to expose their binding element to the configuration system can derive from this class. - -```csharp -public abstract class InterceptingElement : BindingElementExtensionElement -{ - //... -} -``` - -## Adding Policy - - To integrate with our policy system, `InterceptingBindingElement` implements IPolicyExportExtension to signal that we should participate in generating policy. To support importing policy on a generated client, the user can register a derived class of `InterceptingBindingElementImporter` and override `CreateMessageInterceptor`() to generate their policy-enabled `ChannelMessageInterceptor` class. - -## Example: Droppable Message Inspector - - Included in the sample is an example implementation of `ChannelMessageInspector` which drops messages. - -```csharp -class DroppingServerElement : InterceptingElement -{ - protected override ChannelMessageInterceptor CreateMessageInterceptor() - { - return new DroppingServerInterceptor(); - } -} -``` - - You can access it from configuration as follows: - -```xml - - ... - - ... - - - - - - - -``` - - The client and server both use this newly created configuration section to insert the custom factories into the lowest-level of their run-time channel stacks (above the transport level). - -```xml - - - - - - -``` - - The client uses the `MessageInterceptor` library to add a custom header to even numbered messages. The service on the other hand uses `MessageInterceptor` library to drop any messages that do not have this special header. - - You should see the following client output after running the service and then the client. - -```console -Reporting the next 10 wind speed -100 kph -Server dropped a message. -90 kph -80 kph -Server dropped a message. -70 kph -60 kph -Server dropped a message. -50 kph -40 kph -Server dropped a message. -30 kph -20 kph -Server dropped a message. -10 kph -Press ENTER to shut down client -``` - - The client reports 10 different wind speeds to the service, but only tags half of them with the special header. - - On the service, you should see the following output: - -```console -Press ENTER to exit. -Dangerous wind detected! Reported speed (90) is greater than 64 kph. -Dangerous wind detected! Reported speed (70) is greater than 64 kph. -5 wind speed reports have been received. -``` - -### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command. - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -5. Run Service.exe first then run Client.exe and watch both console windows for output. diff --git a/docs/framework/wcf/samples/custom-secure-metadata-endpoint.md b/docs/framework/wcf/samples/custom-secure-metadata-endpoint.md deleted file mode 100644 index c220fa32bf71b..0000000000000 --- a/docs/framework/wcf/samples/custom-secure-metadata-endpoint.md +++ /dev/null @@ -1,186 +0,0 @@ ---- -description: "Learn more about: Custom Secure Metadata Endpoint" -title: "Custom Secure Metadata Endpoint" -ms.date: "03/30/2017" -ms.assetid: 9e369e99-ea4a-49ff-aed2-9fdf61091a48 ---- -# Custom Secure Metadata Endpoint - -This sample demonstrates how to implement a service with a secure metadata endpoint that uses one of the non-metadata exchange bindings, and how to configure [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) or clients to fetch the metadata from such a metadata endpoint. There are two system-provided bindings available for exposing metadata endpoints: mexHttpBinding and mexHttpsBinding. mexHttpBinding is used to expose a metadata endpoint over HTTP in a non-secure manner. mexHttpsBinding is used to expose a metadata endpoint over HTTPS in a secure manner. This sample illustrates how to expose a secure metadata endpoint using the . You would want to do this when you want to change the security settings on the binding, but you do not want to use HTTPS. If you use the mexHttpsBinding your metadata endpoint will be secure, but there is no way to modify the binding settings. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -## Service - - The service in this sample has two endpoints. The application endpoint serves the `ICalculator` contract on a `WSHttpBinding` with `ReliableSession` enabled and `Message` security using certificates. The metadata endpoint also uses `WSHttpBinding`, with the same security settings but with no `ReliableSession`. Here is the relevant configuration: - -```xml - - - - - - - - - - - - - - - - - - - - - - -``` - - In many of the other samples, the metadata endpoint uses the default `mexHttpBinding`, which is not secure. Here the metadata is secured using `WSHttpBinding` with `Message` security. In order for metadata clients to retrieve this metadata, they must be configured with a matching binding. This sample demonstrates two such clients. - - The first client uses Svcutil.exe to fetch the metadata and generate client code and configuration at design time. Because the service uses a non-default binding for the metadata, the Svcutil.exe tool must be specifically configured so that it can get the metadata from the service using that binding. - - The second client uses the `MetadataResolver` to dynamically fetch the metadata for a known contract and then invoke operations on the dynamically generated client. - -## Svcutil client - - When using the default binding to host your `IMetadataExchange` endpoint, you can run Svcutil.exe with the address of that endpoint: - -```console -svcutil http://localhost/servicemodelsamples/service.svc/mex -``` - - and it works. But in this sample, the server uses a non-default endpoint to host the metadata. So Svcutil.exe must be instructed to use the correct binding. This can be done using a Svcutil.exe.config file. - - The Svcutil.exe.config file looks like a normal client configuration file. The only unusual aspects are the client endpoint name and contract: - -```xml - -``` - - The endpoint name must be the name of the scheme of the address where the metadata is hosted and the endpoint contract must be `IMetadataExchange`. Thus, when Svcutil.exe is run with a command-line such as the following: - -```console -svcutil http://localhost/servicemodelsamples/service.svc/mex -``` - - it looks for the endpoint named "http" and contract `IMetadataExchange` to configure the binding and behavior of the communication exchange with the metadata endpoint. The rest of the Svcutil.exe.config file in the sample specifies the binding configuration and behavior credentials to match the server's configuration of the metadata endpoint. - - In order for Svcutil.exe to pick up the configuration in Svcutil.exe.config, Svcutil.exe must be in the same directory as the configuration file. As a result, you must copy Svcutil.exe from its install location to the directory that contains the Svcutil.exe.config file. Then from that directory, run the following command: - -```console -.\svcutil.exe http://localhost/servicemodelsamples/service.svc/mex -``` - - The leading ".\\" ensures that the copy of Svcutil.exe in this directory (the one which has a corresponding Svcutil.exe.config) is run. - -## MetadataResolver client - - If the client knows the contract and how to talk to the metadata at design time, the client can dynamically find out the binding and address of application endpoints using the `MetadataResolver`. This sample client demonstrates this, showing how to configure the binding and credentials used by `MetadataResolver` by creating and configuring a `MetadataExchangeClient`. - - The same binding and certificate information that appeared in Svcutil.exe.config can be specified imperatively on the `MetadataExchangeClient`: - -```csharp -// Specify the Metadata Exchange binding and its security mode -WSHttpBinding mexBinding = new WSHttpBinding(SecurityMode.Message); -mexBinding.Security.Message.ClientCredentialType = MessageCredentialType.Certificate; - -// Create a MetadataExchangeClient for retrieving metadata, and set the // certificate details -MetadataExchangeClient mexClient = new MetadataExchangeClient(mexBinding); -mexClient.SoapCredentials.ClientCertificate.SetCertificate( StoreLocation.CurrentUser, StoreName.My, - X509FindType.FindBySubjectName, "client.com"); -mexClient.SoapCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.PeerOrChainTrust; -mexClient.SoapCredentials.ServiceCertificate.SetDefaultCertificate( StoreLocation.CurrentUser, StoreName.TrustedPeople, - X509FindType.FindBySubjectName, "localhost"); -``` - - With the `mexClient` configured, we can enumerate the contracts we are interested in, and use `MetadataResolver` to fetch a list of endpoints with those contracts: - -```csharp -// The contract we want to fetch metadata for -Collection contracts = new Collection(); -ContractDescription contract = ContractDescription.GetContract(typeof(ICalculator)); -contracts.Add(contract); -// Find endpoints for that contract -EndpointAddress mexAddress = new EndpointAddress(ConfigurationManager.AppSettings["mexAddress"]); -ServiceEndpointCollection endpoints = MetadataResolver.Resolve(contracts, mexAddress, mexClient); -``` - - Finally we can use the information from those endpoints to initialize the binding and address of a `ChannelFactory` used to create channels to communicate with the application endpoints. - -```csharp -ChannelFactory cf = new ChannelFactory(endpoint.Binding, endpoint.Address); -``` - - The key point of this sample client is to demonstrate that, if you are using `MetadataResolver`, and you must specify custom bindings or behaviors for the metadata exchange communication, you can use a `MetadataExchangeClient` to specify those custom settings. - -#### To set up and build the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -#### To run the sample on the same machine - -1. Run Setup.bat from the sample install folder. This installs all the certificates required for running the sample. Note that Setup.bat uses the FindPrivateKey.exe tool, which is installed by running setupCertTool.bat from [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. Run the client application from \MetadataResolverClient\bin or \SvcutilClient\bin. Client activity is displayed on the client console application. - -3. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -4. Remove the certificates by running Cleanup.bat when you have finished with the sample. Other security samples use the same certificates. - -#### To run the sample across machines - -1. On the server, run `setup.bat service`. Running `setup.bat` with the `service` argument creates a service certificate with the fully-qualified domain name of the machine and exports the service certificate to a file named Service.cer. - -2. On the server, edit Web.config to reflect the new certificate name. That is, change the `findValue` attribute in the [\](../../configure-apps/file-schema/wcf/servicecertificate-of-clientcredentials-element.md) element to the fully-qualified domain name of the machine. - -3. Copy the Service.cer file from the service directory to the client directory on the client machine. - -4. On the client, run `setup.bat client`. Running `setup.bat` with the `client` argument creates a client certificate named Client.com and exports the client certificate to a file named Client.cer. - -5. In the App.config file of the `MetadataResolverClient` on the client machine, change the address value of the mex endpoint to match the new address of your service. You do this by replacing localhost with the fully-qualified domain name of the server. Also change the occurrence of "localhost" in the metadataResolverClient.cs file to the new service certificate name (the fully-qualified domain name of the server). Do the same thing for the App.config of the SvcutilClient project. - -6. Copy the Client.cer file from the client directory to the service directory on the server. - -7. On the client, run `ImportServiceCert.bat`. This imports the service certificate from the Service.cer file into the CurrentUser - TrustedPeople store. - -8. On the server, run `ImportClientCert.bat`, This imports the client certificate from the Client.cer file into the LocalMachine - TrustedPeople store. - -9. On the service machine, build the service project in Visual Studio and select the help page in a web browser to verify that it is running. - -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](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -#### To clean up after the sample - -- Run Cleanup.bat in the samples folder once you have finished running the sample. - - > [!NOTE] - > This script does not remove service certificates on a client when running this sample across machines. If you have run Windows Communication Foundation (WCF) samples that use certificates across machines, be sure to clear the service certificates that have been installed in the CurrentUser - TrustedPeople store. To do this, use the following command: `certmgr -del -r CurrentUser -s TrustedPeople -c -n `. For example: `certmgr -del -r CurrentUser -s TrustedPeople -c -n server1.contoso.com`. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Metadata\CustomMexEndpoint` diff --git a/docs/framework/wcf/samples/custom-service-host.md b/docs/framework/wcf/samples/custom-service-host.md deleted file mode 100644 index 8077b717ea5b0..0000000000000 --- a/docs/framework/wcf/samples/custom-service-host.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -description: "Learn more about: Custom Service Host" -title: Custom Service Host -ms.date: "03/30/2017" -ms.assetid: fe16ff50-7156-4499-9c32-13d8a79dc100 ---- -# Custom Service Host - -This sample demonstrates how to use a custom derivative of the class to alter the run-time behavior of a service. This approach provides a reusable alternative to configuring a large number of services in a common way. The sample also demonstrates how to use the class to use a custom ServiceHost in the Internet Information Services (IIS) or Windows Process Activation Service (WAS) hosting environment. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Hosting\CustomServiceHost` - -## About the scenario - - To prevent unintentional disclosure of potentially sensitive service metadata, the default configuration for Windows Communication Foundation (WCF) services disables metadata publishing. This behavior is secure by default, but also means that you cannot use a metadata import tool (such as Svcutil.exe) to generate the client code required to call the service unless the service's metadata publishing behavior is explicitly enabled in configuration. - - Enabling metadata publishing for a large number of services involves adding the same configuration elements to each individual service, which results in a large amount of configuration information that is essentially the same. As an alternative to configuring each service individually, it is possible to write the imperative code that enables metadata publishing once and then reuse that code across several different services. This is accomplished by creating a new class that derives from and overrides the `ApplyConfiguration`() method to imperatively add the metadata publishing behavior. - -> [!IMPORTANT] -> For clarity, this sample demonstrates how to create an unsecured metadata publishing endpoint. Such endpoints are potentially available to anonymous unauthenticated consumers and care must be taken before deploying such endpoints to ensure that publicly disclosing a service's metadata is appropriate. - -## Implementing a custom ServiceHost - - The class exposes several useful virtual methods that inheritors can override to alter the run-time behavior of a service. For example, the `ApplyConfiguration`() method reads service configuration information from the configuration store and alters the host's accordingly. The default implementation reads configuration from the application's configuration file. Custom implementations can override `ApplyConfiguration`() to further alter the using imperative code or even replace the default configuration store entirely. For example, to read a service's endpoint configuration from a database instead of the application's configuration file. - - In this sample, we want to build a custom ServiceHost that adds the ServiceMetadataBehavior (which enables metadata publishing) even if this behavior is not explicitly added in the service's configuration file. To accomplish this, create a new class that inherits from and overrides `ApplyConfiguration`(). - -```csharp -class SelfDescribingServiceHost : ServiceHost -{ - public SelfDescribingServiceHost(Type serviceType, params Uri[] baseAddresses) - : base(serviceType, baseAddresses) { } - - //Overriding ApplyConfiguration() allows us to - //alter the ServiceDescription prior to opening - //the service host. - protected override void ApplyConfiguration() - { - //First, we call base.ApplyConfiguration() - //to read any configuration that was provided for - //the service we're hosting. After this call, - //this.Description describes the service - //as it was configured. - base.ApplyConfiguration(); - - //(rest of implementation elided for clarity) - } -} -``` - - Because we do not want to ignore any configuration that has been provided in the application's configuration file, the first thing our override of `ApplyConfiguration`() does is call the base implementation. Once this method completes, we can imperatively add the to the description using the following imperative code. - -```csharp -ServiceMetadataBehavior mexBehavior = this.Description.Behaviors.Find(); -if (mexBehavior == null) -{ - mexBehavior = new ServiceMetadataBehavior(); - this.Description.Behaviors.Add(mexBehavior); -} -else -{ - //Metadata behavior has already been configured, - //so we do not have any work to do. - return; -} -``` - - The last thing our `ApplyConfiguration`() override must do is add the default metadata endpoint. By convention, one metadata endpoint is created for each URI in the service host's BaseAddresses collection. - -```csharp -//Add a metadata endpoint at each base address -//using the "/mex" addressing convention -foreach (Uri baseAddress in this.BaseAddresses) -{ - if (baseAddress.Scheme == Uri.UriSchemeHttp) - { - mexBehavior.HttpGetEnabled = true; - this.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, - MetadataExchangeBindings.CreateMexHttpBinding(), - "mex"); - } - else if (baseAddress.Scheme == Uri.UriSchemeHttps) - { - mexBehavior.HttpsGetEnabled = true; - this.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, - MetadataExchangeBindings.CreateMexHttpsBinding(), - "mex"); - } - else if (baseAddress.Scheme == Uri.UriSchemeNetPipe) - { - this.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, - MetadataExchangeBindings.CreateMexNamedPipeBinding(), - "mex"); - } - else if (baseAddress.Scheme == Uri.UriSchemeNetTcp) - { - this.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, - MetadataExchangeBindings.CreateMexTcpBinding(), - "mex"); - } -} -``` - -## Using a custom ServiceHost in self-host - - Now that we have completed our custom ServiceHost implementation, we can use it to add metadata publishing behavior to any service by hosting that service inside of an instance of our `SelfDescribingServiceHost`. The following code shows how to use it in the self-host scenario. - -```csharp -SelfDescribingServiceHost host = - new SelfDescribingServiceHost( typeof( Calculator ) ); -host.Open(); -``` - - Our custom host still reads the service's endpoint configuration from the application's configuration file, as if we had used the default class to host the service. However, because we added the logic to enable metadata publishing inside of our custom host, we no longer must explicitly enable the metadata publishing behavior in configuration. This approach has a distinct advantage when you are building an application that contains several services and you want to enable metadata publishing on each of them without writing the same configuration elements over and over. - -## Using a custom ServiceHost in IIS or WAS - - Using a custom service host in self-host scenarios is straightforward, because it is your application code that is ultimately responsible for creating and opening the service host instance. In the IIS or WAS hosting environment, however, the WCF infrastructure is dynamically instantiating your service's host in response to incoming messages. Custom service hosts can also be used in this hosting environment, but they require some additional code in the form of a ServiceHostFactory. The following code shows a derivative of that returns instances of our custom `SelfDescribingServiceHost`. - -```csharp -public class SelfDescribingServiceHostFactory : ServiceHostFactory -{ - protected override ServiceHost CreateServiceHost(Type serviceType, - Uri[] baseAddresses) - { - //All the custom factory does is return a new instance - //of our custom host class. The bulk of the custom logic should - //live in the custom host (as opposed to the factory) - //for maximum - //reuse value outside of the IIS/WAS hosting environment. - return new SelfDescribingServiceHost(serviceType, - baseAddresses); - } -} -``` - - As you can see, implementing a custom ServiceHostFactory is straightforward. All of the custom logic resides inside of the ServiceHost implementation; the factory returns an instance of the derived class. - - To use a custom factory with a service implementation, we must add some additional metadata to the service's .svc file. - -```aspx-csharp -<% @ServiceHost Service="Microsoft.ServiceModel.Samples.CalculatorService" - Factory="Microsoft.ServiceModel.Samples.SelfDescribingServiceHostFactory" - language=c# Debug="true" %> -``` - - Here we have added an additional `Factory` attribute to the `@ServiceHost` directive, and passed the CLR type name of our custom factory as the attribute's value. When IIS or WAS receives a message for this service, the WCF hosting infrastructure first creates an instance of the ServiceHostFactory and then instantiates the service host itself by calling `ServiceHostFactory.CreateServiceHost()`. - -## Running the sample - - Although this sample does provide a fully functional client and service implementation, the point of the sample is to illustrate how to alter a service's run-time behavior by means of a custom host., do the following steps: - -### Observe the effect of the custom host - -1. Open the service's Web.config file and observe that there is no configuration explicitly enabling metadata for the service. - -2. Open the service's .svc file and observe that its @ServiceHost directive contains a Factory attribute that specifies the name of a custom ServiceHostFactory. - -### Set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. After the solution has been built, run Setup.bat to set up the ServiceModelSamples Application in IIS 7.0. The ServiceModelSamples directory should now appear as an IIS 7.0 Application. - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -5. To remove the IIS 7.0 application, run *Cleanup.bat*. - -## See also - -- [How to: Host a WCF Service in IIS](../feature-details/how-to-host-a-wcf-service-in-iis.md) diff --git a/docs/framework/wcf/samples/custom-token.md b/docs/framework/wcf/samples/custom-token.md deleted file mode 100644 index 06c82a977b838..0000000000000 --- a/docs/framework/wcf/samples/custom-token.md +++ /dev/null @@ -1,633 +0,0 @@ ---- -description: "Learn more about: Custom Token" -title: "Custom Token" -ms.date: "03/30/2017" -ms.assetid: e7fd8b38-c370-454f-ba3e-19759019f03d ---- -# Custom Token - -This sample demonstrates how to add a custom token implementation into a Windows Communication Foundation (WCF) application. The example uses a `CreditCardToken` to securely pass information about client credit cards to the service. The token is passed in the WS-Security message header and is signed and encrypted using the symmetric security binding element along with message body and other message headers. This is useful in cases where the built-in tokens are not sufficient. This sample demonstrates how to provide a custom security token to a service instead of using one of the built-in tokens. The service implements a contract that defines a request-reply communication pattern. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - To summarize, this sample demonstrates the following: - -- How a client can pass a custom security token to a service. - -- How the service can consume and validate a custom security token. - -- How the WCF service code can obtain the information about received security tokens including the custom security token. - -- How the server's X.509 certificate is used to protect the symmetric key used for message encryption and signature. - -## Client Authentication Using a Custom Security Token - - The service exposes a single endpoint that is programmatically created using `BindingHelper` and `EchoServiceHost` classes. The endpoint consists of an address, a binding, and a contract. The binding is configured with a custom binding using `SymmetricSecurityBindingElement` and `HttpTransportBindingElement`. This sample sets the `SymmetricSecurityBindingElement` to use a service's X.509 certificate to protect the symmetric key during transmission and to pass a custom `CreditCardToken` in a WS-Security message header as a signed and encrypted security token. The behavior specifies the service credentials that are to be used for client authentication and also information about the service X.509 certificate. - -```csharp -public static class BindingHelper -{ - public static Binding CreateCreditCardBinding() - { - var httpTransport = new HttpTransportBindingElement(); - - // The message security binding element will be configured to require a credit card. - // The token that is encrypted with the service's certificate. - var messageSecurity = new SymmetricSecurityBindingElement(); - messageSecurity.EndpointSupportingTokenParameters.SignedEncrypted.Add(new CreditCardTokenParameters()); - X509SecurityTokenParameters x509ProtectionParameters = new X509SecurityTokenParameters(); - x509ProtectionParameters.InclusionMode = SecurityTokenInclusionMode.Never; - messageSecurity.ProtectionTokenParameters = x509ProtectionParameters; - return new CustomBinding(messageSecurity, httpTransport); - } -} -``` - - To consume a credit card token in the message, the sample uses custom service credentials to provide this functionality. The service credentials class is located in the `CreditCardServiceCredentials` class and is added to the behaviors collections of the service host in the `EchoServiceHost.InitializeRuntime` method. - -```csharp -class EchoServiceHost : ServiceHost -{ - string creditCardFile; - - public EchoServiceHost(parameters Uri[] addresses) - : base(typeof(EchoService), addresses) - { - creditCardFile = ConfigurationManager.AppSettings["creditCardFile"]; - if (string.IsNullOrEmpty(creditCardFile)) - { - throw new ConfigurationErrorsException("creditCardFile not specified in service config"); - } - - creditCardFile = String.Format("{0}\\{1}", System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath, creditCardFile); - } - - override protected void InitializeRuntime() - { - // Create a credit card service credentials and add it to the behaviors. - CreditCardServiceCredentials serviceCredentials = new CreditCardServiceCredentials(this.creditCardFile); - serviceCredentials.ServiceCertificate.SetCertificate("CN=localhost", StoreLocation.LocalMachine, StoreName.My); - this.Description.Behaviors.Remove((typeof(ServiceCredentials))); - this.Description.Behaviors.Add(serviceCredentials); - - // Register a credit card binding for the endpoint. - Binding creditCardBinding = BindingHelper.CreateCreditCardBinding(); - this.AddServiceEndpoint(typeof(IEchoService), creditCardBinding, string.Empty); - - base.InitializeRuntime(); - } -} -``` - - The client endpoint is configured in a similar manner as the service endpoint. The client uses the same `BindingHelper` class to create a binding. The rest of the setup is located in the `Client` class. The client also sets information to be contained in the `CreditCardToken` and information about the service X.509 certificate in the setup code by adding a `CreditCardClientCredentials` instance with the proper data to the client endpoint behaviors collection. The sample uses X.509 certificate with subject name set to `CN=localhost` as the service certificate. - -```csharp -Binding creditCardBinding = BindingHelper.CreateCreditCardBinding(); -var serviceAddress = new EndpointAddress("http://localhost/servicemodelsamples/service.svc"); - -// Create a client with given client endpoint configuration. -channelFactory = new ChannelFactory(creditCardBinding, serviceAddress); - -// Configure the credit card credentials on the channel factory. -var credentials = - new CreditCardClientCredentials( - new CreditCardInfo(creditCardNumber, issuer, expirationTime)); -// Configure the service certificate on the credentials. -credentials.ServiceCertificate.SetDefaultCertificate( - "CN=localhost", StoreLocation.LocalMachine, StoreName.My); - -// Replace ClientCredentials with CreditCardClientCredentials. -channelFactory.Endpoint.Behaviors.Remove(typeof(ClientCredentials)); -channelFactory.Endpoint.Behaviors.Add(credentials); - -client = channelFactory.CreateChannel(); - -Console.WriteLine($"Echo service returned: {client.Echo()}"); - -((IChannel)client).Close(); -channelFactory.Close(); -``` - -## Custom Security Token Implementation - - To enable a custom security token in WCF, create an object representation of the custom security token. The sample has this representation in the `CreditCardToken` class. The object representation is responsible for holding all relevant security token information and to provide a list of security keys contained in the security token. In this case, the credit card security token does not contain any security key. - - The next section describes what must be done to enable a custom token to be transmitted over the wire and consumed by a WCF endpoint. - -```csharp -class CreditCardToken : SecurityToken -{ - CreditCardInfo cardInfo; - DateTime effectiveTime = DateTime.UtcNow; - string id; - ReadOnlyCollection securityKeys; - - public CreditCardToken(CreditCardInfo cardInfo) : this(cardInfo, Guid.NewGuid().ToString()) { } - - public CreditCardToken(CreditCardInfo cardInfo, string id) - { - if (cardInfo == null) - throw new ArgumentNullException(nameof(cardInfo)); - - if (id == null) - throw new ArgumentNullException(nameof(id)); - - this.cardInfo = cardInfo; - this.id = id; - - // The credit card token is not capable of any cryptography. - this.securityKeys = new ReadOnlyCollection(new List()); - } - - public CreditCardInfo CardInfo { get { return this.cardInfo; } } - - public override ReadOnlyCollection SecurityKeys { get { return this.securityKeys; } } - - public override DateTime ValidFrom { get { return this.effectiveTime; } } - public override DateTime ValidTo { get { return this.cardInfo.ExpirationDate; } } - public override string Id { get { return this.id; } } -} -``` - -## Getting the Custom Credit Card Token to and from the Message - - Security token serializers in WCF are responsible for creating an object representation of security tokens from the XML in the message and creating a XML form of the security tokens. They are also responsible for other functionality such as reading and writing key identifiers pointing to security tokens, but this example uses only security token-related functionality. To enable a custom token you must implement your own security token serializer. This sample uses the `CreditCardSecurityTokenSerializer` class for this purpose. - - On the service, the custom serializer reads the XML form of the custom token and creates the custom token object representation from it. - - On the client, the `CreditCardSecurityTokenSerializer` class writes the information contained in the security token object representation into the XML writer. - -```csharp -public class CreditCardSecurityTokenSerializer : WSSecurityTokenSerializer -{ - public CreditCardSecurityTokenSerializer(SecurityTokenVersion version) : base() { } - - protected override bool CanReadTokenCore(XmlReader reader) - { - XmlDictionaryReader localReader = XmlDictionaryReader.CreateDictionaryReader(reader); - - if (reader == null) - throw new ArgumentNullException(nameof(reader)); - - if (reader.IsStartElement(Constants.CreditCardTokenName, Constants.CreditCardTokenNamespace)) - return true; - - return base.CanReadTokenCore(reader); - } - - protected override SecurityToken ReadTokenCore(XmlReader reader, SecurityTokenResolver tokenResolver) - { - if (reader == null) - throw new ArgumentNullException(nameof(reader)); - - if (reader.IsStartElement(Constants.CreditCardTokenName, Constants.CreditCardTokenNamespace)) - { - string id = reader.GetAttribute(Constants.Id, Constants.WsUtilityNamespace); - - reader.ReadStartElement(); - - // Read the credit card number. - string creditCardNumber = reader.ReadElementString(Constants.CreditCardNumberElementName, Constants.CreditCardTokenNamespace); - - // Read the expiration date. - string expirationTimeString = reader.ReadElementString(Constants.CreditCardExpirationElementName, Constants.CreditCardTokenNamespace); - DateTime expirationTime = XmlConvert.ToDateTime(expirationTimeString, XmlDateTimeSerializationMode.Utc); - - // Read the issuer of the credit card. - string creditCardIssuer = reader.ReadElementString(Constants.CreditCardIssuerElementName, Constants.CreditCardTokenNamespace); - reader.ReadEndElement(); - - var cardInfo = new CreditCardInfo(creditCardNumber, creditCardIssuer, expirationTime); - - return new CreditCardToken(cardInfo, id); - } - else - { - return WSSecurityTokenSerializer.DefaultInstance.ReadToken(reader, tokenResolver); - } - } - - protected override bool CanWriteTokenCore(SecurityToken token) - { - if (token is CreditCardToken) - return true; - return base.CanWriteTokenCore(token); - } - - protected override void WriteTokenCore(XmlWriter writer, SecurityToken token) - { - if (writer == null) - throw new ArgumentNullException(nameof(writer)); - if (token == null) - throw new ArgumentNullException(nameof(token)); - - CreditCardToken c = token as CreditCardToken; - if (c != null) - { - writer.WriteStartElement(Constants.CreditCardTokenPrefix, Constants.CreditCardTokenName, Constants.CreditCardTokenNamespace); - writer.WriteAttributeString(Constants.WsUtilityPrefix, Constants.Id, Constants.WsUtilityNamespace, token.Id); - writer.WriteElementString(Constants.CreditCardNumberElementName, Constants.CreditCardTokenNamespace, c.CardInfo.CardNumber); - writer.WriteElementString(Constants.CreditCardExpirationElementName, Constants.CreditCardTokenNamespace, XmlConvert.ToString(c.CardInfo.ExpirationDate, XmlDateTimeSerializationMode.Utc)); - writer.WriteElementString(Constants.CreditCardIssuerElementName, Constants.CreditCardTokenNamespace, c.CardInfo.CardIssuer); - writer.WriteEndElement(); - writer.Flush(); - } - else - { - base.WriteTokenCore(writer, token); - } - } -} -``` - -## How Token Provider and Token Authenticator Classes are Created - - Client and service credentials are responsible for providing the security token manager instance. The security token manager instance is used to get token providers, token authenticators and token serializers. - - The token provider creates an object representation of the token based on the information contained in the client or service credentials. The token object representation is then written to the message using the token serializer (discussed in the previous section). - - The token authenticator validates tokens that arrive in the message. The incoming token object representation is created by the token serializer. This object representation is then passed to the token authenticator for validation. After the token is successfully validated, the token authenticator returns a collection of `IAuthorizationPolicy` objects that represent the information contained in the token. This information is used later during the message processing to perform authorization decisions and to provide claims for the application. In this example, the credit card token authenticator uses `CreditCardTokenAuthorizationPolicy` for this purpose. - - The token serializer is responsible for getting the object representation of the token to and from the wire. This is discussed in the previous section. - - In this sample, we use a token provider only on the client and a token authenticator only on the service, because we want to transmit a credit card token only in the client-to-service direction. - - The functionality on the client is located in the `CreditCardClientCredentials`, `CreditCardClientCredentialsSecurityTokenManager` and `CreditCardTokenProvider` classes. - - On the service, the functionality resides in the `CreditCardServiceCredentials`, `CreditCardServiceCredentialsSecurityTokenManager`, `CreditCardTokenAuthenticator` and `CreditCardTokenAuthorizationPolicy` classes. - -```csharp - public class CreditCardClientCredentials : ClientCredentials - { - CreditCardInfo creditCardInfo; - - public CreditCardClientCredentials(CreditCardInfo creditCardInfo) - : base() - { - if (creditCardInfo == null) - throw new ArgumentNullException(nameof(creditCardInfo)); - - this.creditCardInfo = creditCardInfo; - } - - public CreditCardInfo CreditCardInfo - { - get { return this.creditCardInfo; } - } - - protected override ClientCredentials CloneCore() - { - return new CreditCardClientCredentials(this.creditCardInfo); - } - - public override SecurityTokenManager CreateSecurityTokenManager() - { - return new CreditCardClientCredentialsSecurityTokenManager(this); - } - } - - public class CreditCardClientCredentialsSecurityTokenManager : ClientCredentialsSecurityTokenManager - { - CreditCardClientCredentials creditCardClientCredentials; - - public CreditCardClientCredentialsSecurityTokenManager(CreditCardClientCredentials creditCardClientCredentials) - : base (creditCardClientCredentials) - { - this.creditCardClientCredentials = creditCardClientCredentials; - } - - public override SecurityTokenProvider CreateSecurityTokenProvider(SecurityTokenRequirement tokenRequirement) - { - // Handle this token for Custom. - if (tokenRequirement.TokenType == Constants.CreditCardTokenType) - return new CreditCardTokenProvider(this.creditCardClientCredentials.CreditCardInfo); - // Return server cert. - else if (tokenRequirement is InitiatorServiceModelSecurityTokenRequirement) - { - if (tokenRequirement.TokenType == SecurityTokenTypes.X509Certificate) - { - return new X509SecurityTokenProvider(creditCardClientCredentials.ServiceCertificate.DefaultCertificate); - } - } - - return base.CreateSecurityTokenProvider(tokenRequirement); - } - - public override SecurityTokenSerializer CreateSecurityTokenSerializer(SecurityTokenVersion version) - { - - return new CreditCardSecurityTokenSerializer(version); - } - - } - - class CreditCardTokenProvider : SecurityTokenProvider - { - CreditCardInfo creditCardInfo; - - public CreditCardTokenProvider(CreditCardInfo creditCardInfo) : base() - { - if (creditCardInfo == null) - throw new ArgumentNullException(nameof(creditCardInfo)); - - this.creditCardInfo = creditCardInfo; - } - - protected override SecurityToken GetTokenCore(TimeSpan timeout) - { - SecurityToken result = new CreditCardToken(this.creditCardInfo); - return result; - } - } - - public class CreditCardServiceCredentials : ServiceCredentials - { - string creditCardFile; - - public CreditCardServiceCredentials(string creditCardFile) - : base() - { - if (creditCardFile == null) - throw new ArgumentNullException(nameof(creditCardFile)); - - this.creditCardFile = creditCardFile; - } - - public string CreditCardDataFile - { - get { return this.creditCardFile; } - } - - protected override ServiceCredentials CloneCore() - { - return new CreditCardServiceCredentials(this.creditCardFile); - } - - public override SecurityTokenManager CreateSecurityTokenManager() - { - return new CreditCardServiceCredentialsSecurityTokenManager(this); - } - } - - public class CreditCardServiceCredentialsSecurityTokenManager : ServiceCredentialsSecurityTokenManager - { - CreditCardServiceCredentials creditCardServiceCredentials; - - public CreditCardServiceCredentialsSecurityTokenManager(CreditCardServiceCredentials creditCardServiceCredentials) - : base(creditCardServiceCredentials) - { - this.creditCardServiceCredentials = creditCardServiceCredentials; - } - - public override SecurityTokenAuthenticator CreateSecurityTokenAuthenticator(SecurityTokenRequirement tokenRequirement, out SecurityTokenResolver outOfBandTokenResolver) - { - if (tokenRequirement.TokenType == Constants.CreditCardTokenType) - { - outOfBandTokenResolver = null; - return new CreditCardTokenAuthenticator(creditCardServiceCredentials.CreditCardDataFile); - } - - return base.CreateSecurityTokenAuthenticator(tokenRequirement, out outOfBandTokenResolver); - } - - public override SecurityTokenSerializer CreateSecurityTokenSerializer(SecurityTokenVersion version) - { - return new CreditCardSecurityTokenSerializer(version); - } - } - - class CreditCardTokenAuthenticator : SecurityTokenAuthenticator - { - string creditCardsFile; - public CreditCardTokenAuthenticator(string creditCardsFile) - { - this.creditCardsFile = creditCardsFile; - } - - protected override bool CanValidateTokenCore(SecurityToken token) - { - return (token is CreditCardToken); - } - - protected override ReadOnlyCollection ValidateTokenCore(SecurityToken token) - { - CreditCardToken creditCardToken = token as CreditCardToken; - - if (creditCardToken.CardInfo.ExpirationDate < DateTime.UtcNow) - throw new SecurityTokenValidationException("The credit card has expired."); - if (!IsCardNumberAndExpirationValid(creditCardToken.CardInfo)) - throw new SecurityTokenValidationException("Unknown or invalid credit card."); - - // the credit card token has only 1 claim - the card number. The issuer for the claim is the - // credit card issuer - - var cardIssuerClaimSet = new DefaultClaimSet(new Claim(ClaimTypes.Name, creditCardToken.CardInfo.CardIssuer, Rights.PossessProperty)); - var cardClaimSet = new DefaultClaimSet(cardIssuerClaimSet, new Claim(Constants.CreditCardNumberClaim, creditCardToken.CardInfo.CardNumber, Rights.PossessProperty)); - var policies = new List(1); - policies.Add(new CreditCardTokenAuthorizationPolicy(cardClaimSet)); - return policies.AsReadOnly(); - } - - /// - /// Helper method to check if a given credit card entry is present in the User DB - /// - private bool IsCardNumberAndExpirationValid(CreditCardInfo cardInfo) - { - try - { - using (var myStreamReader = new StreamReader(this.creditCardsFile)) - { - string line = ""; - while ((line = myStreamReader.ReadLine()) != null) - { - string[] splitEntry = line.Split('#'); - if (splitEntry[0] == cardInfo.CardNumber) - { - string expirationDateString = splitEntry[1].Trim(); - DateTime expirationDateOnFile = DateTime.Parse(expirationDateString, System.Globalization.DateTimeFormatInfo.InvariantInfo, System.Globalization.DateTimeStyles.AdjustToUniversal); - if (cardInfo.ExpirationDate == expirationDateOnFile) - { - string issuer = splitEntry[2]; - return issuer.Equals(cardInfo.CardIssuer, StringComparison.InvariantCultureIgnoreCase); - } - else - { - return false; - } - } - } - return false; - } - } - catch (Exception e) - { - throw new Exception("BookStoreService: Error while retrieving credit card information from User DB " + e.ToString()); - } - } - } - - public class CreditCardTokenAuthorizationPolicy : IAuthorizationPolicy - { - string id; - ClaimSet issuer; - IEnumerable issuedClaimSets; - - public CreditCardTokenAuthorizationPolicy(ClaimSet issuedClaims) - { - if (issuedClaims == null) - throw new ArgumentNullException(nameof(issuedClaims)); - this.issuer = issuedClaims.Issuer; - this.issuedClaimSets = new ClaimSet[] { issuedClaims }; - this.id = Guid.NewGuid().ToString(); - } - - public ClaimSet Issuer { get { return this.issuer; } } - - public string Id { get { return this.id; } } - - public bool Evaluate(EvaluationContext context, ref object state) - { - foreach (ClaimSet issuance in this.issuedClaimSets) - { - context.AddClaimSet(this, issuance); - } - - return true; - } - } -``` - -## Displaying the Callers' Information - - To display the caller's information, use the `ServiceSecurityContext.Current.AuthorizationContext.ClaimSets` as shown in the following sample code. The `ServiceSecurityContext.Current.AuthorizationContext.ClaimSets` contains authorization claims associated with the current caller. The claims are supplied by the `CreditCardToken` class in its `AuthorizationPolicies` collection. - -```csharp -bool TryGetStringClaimValue(ClaimSet claimSet, string claimType, out string claimValue) -{ - claimValue = null; - IEnumerable matchingClaims = claimSet.FindClaims(claimType, Rights.PossessProperty); - if (matchingClaims == null) - return false; - IEnumerator enumerator = matchingClaims.GetEnumerator(); - enumerator.MoveNext(); - claimValue = (enumerator.Current.Resource == null) ? null : - enumerator.Current.Resource.ToString(); - return true; -} - -string GetCallerCreditCardNumber() -{ - foreach (ClaimSet claimSet in - ServiceSecurityContext.Current.AuthorizationContext.ClaimSets) - { - string creditCardNumber = null; - if (TryGetStringClaimValue(claimSet, - Constants.CreditCardNumberClaim, out creditCardNumber)) - { - string issuer; - if (!TryGetStringClaimValue(claimSet.Issuer, - ClaimTypes.Name, out issuer)) - { - issuer = "Unknown"; - } - return $"Credit card '{creditCardNumber}' issued by '{issuer}'"; - } - } - return "Credit card is not known"; -} -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -## Setup Batch File - - The Setup.bat batch file included with this sample allows you to configure the server with relevant certificates to run the IIS-hosted application that requires server certificate-based security. This batch file must be modified to work across computers or to work in a non-hosted case. - - The following provides a brief overview of the different sections of the batch files so that they can be modified to run in the appropriate configuration. - -- Creating the server certificate: - - The following lines from the `Setup.bat` batch file create the server certificate to be used. The `%SERVER_NAME%` variable specifies the server name. Change this variable to specify your own server name. The default in this batch file is localhost. If you change the `%SERVER_NAME%` variable, you must go through the Client.cs and Service.cs files and replace all instances of localhost with the server name that you use in the Setup.bat script. - - The certificate is stored in My (Personal) store under the `LocalMachine` store location. The certificate is stored in the LocalMachine store for the IIS-hosted services. For self-hosted services, you should modify the batch file to store the client certificate in the CurrentUser store location by replacing the string LocalMachine with CurrentUser. - - ```bat - echo ************ - echo Server cert setup starting - echo %SERVER_NAME% - echo ************ - echo making server cert - echo ************ - makecert.exe -sr LocalMachine -ss MY -a sha1 -n CN=%SERVER_NAME% -sky exchange -pe - ``` - -- Installing the server certificate into client's trusted certificate store: - - The following lines in the Setup.bat batch file copy the server certificate into the client trusted people store. This step is required because certificates generated by Makecert.exe are not implicitly trusted by the client system. If you already have a certificate that is rooted in a client trusted root certificate—for example, a Microsoft issued certificate—this step of populating the client certificate store with the server certificate is not required. - - ```bat - echo ************ - echo copying server cert to client's TrustedPeople store - echo ************ - certmgr.exe -add -r LocalMachine -s My -c -n %SERVER_NAME% -r CurrentUser -s TrustedPeople - ``` - -- To enable access to the certificate private key from the IIS-hosted service, the user account under which the IIS-hosted process is running must be granted appropriate permissions for the private key. This is accomplished by last steps in the Setup.bat script. - - ```bat - echo ************ - echo setting privileges on server certificates - echo ************ - for /F "delims=" %%i in ('"%ProgramFiles%\ServiceModelSampleTools\FindPrivateKey.exe" My LocalMachine -n CN^=%SERVER_NAME% -a') do set PRIVATE_KEY_FILE=%%i - set WP_ACCOUNT=NT AUTHORITY\NETWORK SERVICE - (ver | findstr /C:"5.1") && set WP_ACCOUNT=%COMPUTERNAME%\ASPNET - echo Y|cacls.exe "%PRIVATE_KEY_FILE%" /E /G "%WP_ACCOUNT%":R - iisreset - ``` - -> [!NOTE] -> The Setup.bat batch file is designed to be run from a Visual Studio 2012 Command Prompt. The PATH environment variable set within the Visual Studio 2012 Command Prompt points to the directory that contains executables required by the Setup.bat script. - -#### To set up and build the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -#### To run the sample on the same computer - -1. Open a Visual Studio 2012 Command Prompt window with administrator privileges and run Setup.bat from the sample install folder. This installs all the certificates required for running the sample.Make sure that the path includes the folder where Makecert.exe is located. - -> [!NOTE] -> Be sure to remove the certificates by running Cleanup.bat when finished with the sample. Other security samples use the same certificates. - -1. Launch Client.exe from client\bin directory. Client activity is displayed on the client console application. - -2. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -#### To run the sample across computer - -1. Create a directory on the service computer for the service binaries. - -2. Copy the service program files into the service directory on the service computer. Do not forget to copy CreditCardFile.txt; otherwise the credit card authenticator cannot validate credit card information sent from the client. Also copy the Setup.bat and Cleanup.bat files to the service computer. - -3. You must have a server certificate with the subject name that contains the fully-qualified domain name of the computer. You can create one using the Setup.bat if you change the `%SERVER_NAME%` variable to fully-qualified name of the computer where the service is hosted. Note that the Setup.bat file must be run in a Developer Command Prompt for Visual Studio opened with administrator privileges. - -4. Copy the server certificate into the CurrentUser-TrustedPeople store on the client. You must do this only if the server certificate is not issued by a trusted issuer. - -5. In the EchoServiceHost.cs file, change the value of the certificate subject name to specify a fully-qualified computer name instead of localhost. - -6. Copy the client program files from the \client\bin\ folder, under the language-specific folder, to the client computer. - -7. In the Client.cs file, change the address value of the endpoint to match the new address of your service. - -8. In the Client.cs file change the subject name of the service X.509 certificate to match the fully-qualified computer name of the remote host instead of localhost. - -9. On the client computer, launch Client.exe from a command prompt window. - -10. If the client and service are not able to communicate, see [Troubleshooting Tips for WCF Samples](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -#### To clean up after the sample - -1. Run Cleanup.bat in the samples folder once you have finished running the sample. diff --git a/docs/framework/wcf/samples/custom-wsdl-publication.md b/docs/framework/wcf/samples/custom-wsdl-publication.md deleted file mode 100644 index bbfbd8cd33d71..0000000000000 --- a/docs/framework/wcf/samples/custom-wsdl-publication.md +++ /dev/null @@ -1,308 +0,0 @@ ---- -description: "Learn more about: Custom WSDL Publication" -title: "Custom WSDL Publication" -ms.date: "03/30/2017" -ms.assetid: 3b3e8103-2c95-4db3-a05b-46aa8e9d4d29 ---- -# Custom WSDL Publication - -This sample demonstrates how to: - -- Implement a on a custom attribute to export attribute properties as WSDL annotations. - -- Implement to import the custom WSDL annotations. - -- Implement and on a custom contract behavior and a custom operation behavior, respectively, to write imported annotations as comments in the CodeDom for the imported contract and operation. - -- Use the to download the WSDL, a to import the WSDL using the custom WSDL importer, and the to generate Windows Communication Foundation (WCF) client code with the WSDL annotations as /// and ''' comments in C# and Visual Basic. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -## Service - - The service in this sample is marked with two custom attributes. The first, the `WsdlDocumentationAttribute`, accepts a string in the constructor and can be applied to provide a contract interface or operation with a string that describes its usage. The second, `WsdlParamOrReturnDocumentationAttribute`, can be applied to return values or parameters to describe those values in the operation. The following example shows a service contract, `ICalculator`, described using these attributes. - -```csharp -// Define a service contract. -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] -// Document it. -[WsdlDocumentation("The ICalculator contract performs basic calculation services.")] -public interface ICalculator -{ - [OperationContract] - [WsdlDocumentation("The Add operation adds two numbers and returns the result.")] - [return:WsdlParamOrReturnDocumentation("The result of adding the two arguments together.")] - double Add( - [WsdlParamOrReturnDocumentation("The first value to add.")]double n1, - [WsdlParamOrReturnDocumentation("The second value to add.")]double n2 - ); - - [OperationContract] - [WsdlDocumentation("The Subtract operation subtracts the second argument from the first.")] - [return:WsdlParamOrReturnDocumentation("The result of the second argument subtracted from the first.")] - double Subtract( - [WsdlParamOrReturnDocumentation("The value from which the second is subtracted.")]double n1, - [WsdlParamOrReturnDocumentation("The value that is subtracted from the first.")]double n2 - ); - - [OperationContract] - [WsdlDocumentation("The Multiply operation multiplies two values.")] - [return:WsdlParamOrReturnDocumentation("The result of multiplying the first and second arguments.")] - double Multiply( - [WsdlParamOrReturnDocumentation("The first value to multiply.")]double n1, - [WsdlParamOrReturnDocumentation("The second value to multiply.")]double n2 - ); - - [OperationContract] - [WsdlDocumentation("The Divide operation returns the value of the first argument divided by the second argument.")] - [return:WsdlParamOrReturnDocumentation("The result of dividing the first argument by the second.")] - double Divide( - [WsdlParamOrReturnDocumentation("The numerator.")]double n1, - [WsdlParamOrReturnDocumentation("The denominator.")]double n2 - ); -} -``` - - The `WsdlDocumentationAttribute` implements and , so the attribute instances are added to the corresponding or when the service is opened. The attribute also implements . When is called, the that is used to export the metadata and the that contains the service description objects are passed in as parameters enabling the modification of the exported metadata. - - In this sample, depending upon whether the export context object has a or an , a comment is extracted from the attribute using the text property and is added to the WSDL annotation element as shown in the following code. - -```csharp -public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) -{ - if (contractDescription != null) - { - // Inside this block it is the contract-level comment attribute. - // This.Text returns the string for the contract attribute. - // Set the doc element; if this isn't done first, there is no XmlElement in the - // DocumentElement property. - context.WsdlPortType.Documentation = string.Empty; - // Contract comments. - XmlDocument owner = context.WsdlPortType.DocumentationElement.OwnerDocument; - XmlElement summaryElement = owner.CreateElement("summary"); - summaryElement.InnerText = this.Text; - context.WsdlPortType.DocumentationElement.AppendChild(summaryElement); - } - else - { - Operation operation = context.GetOperation(operationDescription); - if (operation != null) - { - // We are dealing strictly with the operation here. - // This.Text returns the string for the operation-level attributes. - // Set the doc element; if this isn't done first, there is no XmlElement in the - // DocumentElement property. - operation.Documentation = String.Empty; - - // Operation C# triple comments. - XmlDocument owner = operation.DocumentationElement.OwnerDocument; - XmlElement newSummaryElement = owner.CreateElement("summary"); - newSummaryElement.InnerText = this.Text; - operation.DocumentationElement.AppendChild(newSummaryElement); - } - } -} -``` - - If an operation is being exported, the sample uses reflection to obtain any `WsdlParamOrReturnDocumentationAttribute` values for parameters and return values and adds them to the WSDL annotation elements for that operation as follows. - -```csharp -// Get returns information -ParameterInfo returnValue = operationDescription.SyncMethod.ReturnParameter; -object[] returnAttrs = returnValue.GetCustomAttributes(typeof(WsdlParamOrReturnDocumentationAttribute), false); -if (returnAttrs.Length != 0) -{ - // text. - XmlElement returnsElement = owner.CreateElement("returns"); - returnsElement.InnerText = ((WsdlParamOrReturnDocumentationAttribute)returnAttrs[0]).ParamComment; - operation.DocumentationElement.AppendChild(returnsElement); -} - -// Get parameter information. -ParameterInfo[] args = operationDescription.SyncMethod.GetParameters(); -for (int i = 0; i < args.Length; i++) -{ - object[] docAttrs = args[i].GetCustomAttributes(typeof(WsdlParamOrReturnDocumentationAttribute), false); - if (docAttrs.Length == 1) - { - // Text. - XmlElement newParamElement = owner.CreateElement("param"); - XmlAttribute paramName = owner.CreateAttribute("name"); - paramName.Value = args[i].Name; - newParamElement.InnerText = ((WsdlParamOrReturnDocumentationAttribute)docAttrs[0]).ParamComment; - newParamElement.Attributes.Append(paramName); - operation.DocumentationElement.AppendChild(newParamElement); - } -} -``` - - The sample then publishes metadata in the standard way, using the following configuration file. - -```xml - - - - - - - - - - - - - - - - - - -``` - -## Svcutil client - - This sample does not use Svcutil.exe. The contract is provided in the generatedClient.cs file so that after the sample demonstrates custom WSDL import and code generation, the service can be invoked. To use the following custom WSDL importer for this example, you can run Svcutil.exe and specify the `/svcutilConfig` option, giving the path to the client configuration file used in this sample, which references the `WsdlDocumentation.dll` library. To load the `WsdlDocumentationImporter`, however, Svuctil.exe must be able to locate and load the `WsdlDocumentation.dll` library, which means either that it is registered in the global assembly cache, in the path, or is in the same directory as Svcutil.exe. For a basic sample such as this, the easiest thing to do is to copy Svcutil.exe and the client configuration file into the same directory as `WsdlDocumentation.dll` and run it from there. - -## The Custom WSDL Importer - - The custom object `WsdlDocumentationImporter` also implements and to be added to the imported ServiceEndpoints and and to be invoked to modify the code generation when the contract or operation code is being created. - - First, in the method, the sample determines whether the WSDL annotation is at the contract or operation level, and adds itself as a behavior at the appropriate scope, passing the imported annotation text to its constructor. - -```csharp -public void ImportContract(WsdlImporter importer, WsdlContractConversionContext context) -{ - // Contract Documentation - if (context.WsdlPortType.Documentation != null) - { - // System examines the contract behaviors to see whether any implement IWsdlImportExtension. - context.Contract.Behaviors.Add(new WsdlDocumentationImporter(context.WsdlPortType.Documentation)); - } - // Operation Documentation - foreach (Operation operation in context.WsdlPortType.Operations) - { - if (operation.Documentation != null) - { - OperationDescription operationDescription = context.Contract.Operations.Find(operation.Name); - if (operationDescription != null) - { - // System examines the operation behaviors to see whether any implement IWsdlImportExtension. - operationDescription.Behaviors.Add(new WsdlDocumentationImporter(operation.Documentation)); - } - } - } -} -``` - - Then, when the code is generated, the system invokes the and methods, passing the appropriate context information. The sample formats the custom WSDL annotations and inserts them as comments into the CodeDom. - -```csharp -public void GenerateContract(ServiceContractGenerationContext context) -{ - Debug.WriteLine("In generate contract."); - context.ContractType.Comments.AddRange(FormatComments(text)); -} - -public void GenerateOperation(OperationContractGenerationContext context) -{ - context.SyncMethod.Comments.AddRange(FormatComments(text)); - Debug.WriteLine("In generate operation."); -} -``` - -## The Client Application - - The client application loads the custom WSDL importer by specifying it in the application configuration file. - -```xml - - - - - - - - -``` - - Once the custom importer has been specified, the WCF metadata system loads the custom importer into any created for that purpose. This sample uses the to download the metadata, the properly configured to import the metadata using the custom importer the sample creates, and the to compile the modified contract information into both Visual Basic and C# client code that can be used in Visual Studio to support Intellisense or compiled into XML documentation. - -```csharp -/// From WSDL Documentation: -/// -/// The ICalculator contract performs basic calculation -/// services. -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")] -[System.ServiceModel.ServiceContractAttribute(Namespace="http://Microsoft.ServiceModel.Samples", ConfigurationName="ICalculator")] -public interface ICalculator -{ - - /// From WSDL Documentation: - /// - /// The Add operation adds two numbers and returns the - /// result.The result of adding the two arguments - /// together.The first value to add.The second value to add. - /// - [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Add", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/AddResponse")] - double Add(double n1, double n2); - - /// From WSDL Documentation: - /// - /// The Subtract operation subtracts the second argument from the - /// first.The result of the second argument subtracted from the - /// first.The value from which the second is - /// subtracted.The value that is subtracted from the - /// first. - /// - [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Subtract", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/SubtractResponse")] - double Subtract(double n1, double n2); - - /// From WSDL Documentation: - /// - /// The Multiply operation multiplies two values.The - /// result of multiplying the first and second arguments.The first value to multiply.The second value - /// to multiply. - /// - [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Multiply", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/MultiplyResponse")] - double Multiply(double n1, double n2); - - /// From WSDL Documentation: - /// - /// The Divide operation returns the value of the first argument divided - /// by the second argument.The result of dividing the first - /// argument by the second.The numerator.The denominator. - /// - [System.ServiceModel.OperationContractAttribute(Action="http://Microsoft.ServiceModel.Samples/ICalculator/Divide", ReplyAction="http://Microsoft.ServiceModel.Samples/ICalculator/DivideResponse")] - double Divide(double n1, double n2); -} -``` - -#### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Metadata\WsdlDocumentation` diff --git a/docs/framework/wcf/samples/customchannelstester.md b/docs/framework/wcf/samples/customchannelstester.md deleted file mode 100644 index 878adbb23ae5b..0000000000000 --- a/docs/framework/wcf/samples/customchannelstester.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -description: "Learn more about: CustomChannelsTester" -title: "CustomChannelsTester" -ms.date: "03/30/2017" -ms.assetid: ee1fa307-98b1-4647-8860-2e9217ba6082 ---- -# CustomChannelsTester - -The `CustomChannelsTester` is a tool that you can use to test your custom channel implementations against a set of predefined service contracts. You can select the set of service contracts and pass it to the tool using an XML file. The tool then generates the service and client that exercises your custom channel implementations during message exchange. - -### To build the tool - -1. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -2. Building the solution generates three files: CustomChannelsTester.exe, TestSpec.xml and SampleRun.cmd. The file SampleRun.cmd has a sample command line that shows how to use this tool to test the [Transport: UDP](transport-udp.md) sample. - -### To run the tool - -- At the command prompt type the following command: - - ```console - CustomChannelsTester.exe /binding:YourCustomBindngName /dll:TheAssemblyWhereThisTypeisDefined /testspec:XmlFileNameWhichContainsTestOptions - ``` - - Using the `/binding` option is required. - - `/dll` is required if "binding" is not a system-provided binding provided by Windows Communication Foundation (WCF). - - `/testspec` is optional. - - This creates server and clients based on the test specifications and the binding. - - Executes the client and server and returns the results. - - The following is the sample XML for the description of the test specifications (testspec.xml): - - ```xml - - - true - - false - - true - - true - - - - ReplaceThisWithTheServerMachineName - - 8000 - - - - 300 - - 60 - - 1 - - 1 - - - ``` diff --git a/docs/framework/wcf/samples/data-binding-in-a-windows-forms-client.md b/docs/framework/wcf/samples/data-binding-in-a-windows-forms-client.md deleted file mode 100644 index bbe1ea7b5f152..0000000000000 --- a/docs/framework/wcf/samples/data-binding-in-a-windows-forms-client.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: "Learn more about: Data Binding in a Windows Forms Client" -title: "Data Binding in a Windows Forms Client" -ms.date: "03/30/2017" -ms.assetid: a2a30b37-d6e2-4552-820e-e60b2bbe8829 ---- -# Data Binding in a Windows Forms Client - -This sample demonstrates how to bind to data returned by a Windows Communication Foundation (WCF) service in a Windows Forms application. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this article. - - This sample demonstrates a service that implements a contract that defines a request-reply communication pattern. The sample consists of a client Windows Forms application (.exe) and a WCF service hosted by Internet Information Services (IIS). - - The contract is defined by the `IWeatherService` interface, which exposes an operation named `GetWeatherData`. This operation accepts an array of cities and returns an array of `WeatherData` objects that represent the high and low forecasted temperature for a city. - - The data binding occurs on the client in the Windows Forms application. A `DataGridView` is defined in the Windows Forms designer, which is a graphical representation of the data. An intermediary named `BindingSource` is also created. The data source of `BindingSource` is set to the data array returned by the service. The purpose of the `BindingSource` is to provide a layer of indirection between the data and the data view. All interaction with the data, such as navigating, sorting, filtering, and updating, is accomplished with calls to the `BindingSource` component. To accomplish data binding to the `DataGridView`, the `datasource` of the `DataGridView` is then set to the `BindingSource` object. All of the data returned from the WCF service is then displayed graphically to the user. Every time the user clicks the button, the returned data is automatically updated in the data-bound `DataGridView`. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Scenario\DataBinding\WindowsForms` diff --git a/docs/framework/wcf/samples/data-binding-in-a-wpf-client.md b/docs/framework/wcf/samples/data-binding-in-a-wpf-client.md deleted file mode 100644 index dd788ba5b24fc..0000000000000 --- a/docs/framework/wcf/samples/data-binding-in-a-wpf-client.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -description: "Learn more about: Data Binding in a Windows Presentation Foundation Client" -title: "Data Binding in a Windows Presentation Foundation Client" -ms.date: "03/30/2017" -ms.assetid: bb8c8293-5973-4aef-9b07-afeff5d3293c ---- -# Data Binding in a Windows Presentation Foundation Client - -This sample demonstrates the use of data binding in a Windows Presentation Foundation (WPF) client. The sample uses a Windows Communication Foundation (WCF) service that randomly generates an array of albums to return to the client. Each album has a name, a price, and a list of album tracks. The album tracks have a name and duration. The information that is returned by the service is automatically bound to the user interface (UI) provided by the Windows Presentation Foundation (WPF) client. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - Data binding allows a data source to be automatically bound to a UI. This simplifies the programming model because it does not require that you programmatically update each UI element with the data from a data object or an array of data objects. You can bind an object to a single UI element or an array to a control that takes multiple inputs, such as a `ListBox`. The following code shows how to bind data to the `DataContext` of a UI element. - -```csharp -// Event handler executed when call is complete -void client_GetAlbumListCompleted(object sender, GetAlbumListCompletedEventArgs e) -{ - // This is on the UI thread, myPanel can be accessed directly - myPanel.DataContext = e.Result; -} -``` - - In the previous sample, the `DataContext` for the `grid` layout element named `myPanel` is set to the data returned by the `GetAlbumList` method. The `DataContext` allows elements to inherit information from their parent elements about the data source that is used for binding, as well as other characteristics of the binding such as the path. The line of code must be executed every time the data on the server is updated. For example, it is executed when the window is initialized and when a new album is added. - - In the following sample XAML code, the `ListBox` specifies `ItemsSource="{Binding }"`. - -```xml - -``` - - This specifies that the data bound to the top-level UI element is also bound to this control (that is, the array of Albums). In addition, `ItemTemplate="{StaticResource AlbumStyle}"` specifies the data template to be used for each item in the `ListBox`. You can also define data templates to specify how the data should be formatted. These data templates can be reused for other UI elements in the application, the advantage is that the data template is defined and maintained in one place. - - The `AlbumStyle` data template lays out a grid with two `TextBlock`s side by side. One specifies the name of the Album and the other the number of Tracks in the album. - -```xaml - - - - - - - - - - -``` - - The following XAML code creates a second `ListBox`. - -```xaml - -``` - - The code specifies a path for the `ItemsSource`. This indicates that the data bound to this control is not the top-level data but a property of the top-level data named `Tracks`. This property represents the array of tracks contained within the album. In addition, a different `DataTemplate` named `TrackStyle` is specified. The layout of the `TrackStyle` template is similar to that of the `AlbumStyle` template, but the `TextBlock`s are bound to different properties. This is because the two templates are used with different data objects. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Scenario\DataBinding\WPFDataBinding` diff --git a/docs/framework/wcf/samples/data-binding-in-an-aspnet-client.md b/docs/framework/wcf/samples/data-binding-in-an-aspnet-client.md deleted file mode 100644 index a2ca2d2840dc6..0000000000000 --- a/docs/framework/wcf/samples/data-binding-in-an-aspnet-client.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -description: "Learn more about: Data Binding in an ASP.NET Client" -title: "Data Binding in an ASP.NET Client" -ms.date: "03/30/2017" -ms.assetid: 68b49fa6-94e7-4d4c-a34e-902a2b3770b6 ---- -# Data Binding in an ASP.NET Client - -This sample demonstrates how to bind data returned by a typical Windows Communication Foundation (WCF) service in a Web Forms application. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - This sample demonstrates a service that implements a contract that defines a request-reply communication pattern. The sample consists of a client Web Forms application accessible from a browser and a WCF service hosted by Internet Information Services (IIS). - - The service implements a contract that defines a request-reply communication pattern. The contract is defined by the `IWeatherService` interface, which exposes an operation named `GetWeatherData`. This operation accepts an array of cities and returns an array of `WeatherData` objects that represent the high and low forecasted temperature for a city. - - On the ASP.NET client .aspx page, a DataGrid Web control is defined, which contains the graphical representation of the data returned by the service. Code on the .aspx page calls the WCF service for weather data and returns the data to an array of `WeatherData` objects. The DataGrid specifies where to get its data from by setting its `DataSource` property to that array. The data binding occurs with a call to the DataGrid's `DataBind` method. All of this code is contained inside the .`aspx` page's `Page_Load` method, so every time the user refreshes the browser page, the data is updated in the DataGrid. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. This sample's client is a Web site that runs under a development Web server. To launch the development Web server, type the following at the command prompt: `%SystemDrive%\Program Files\Common Files\Microsoft Shared\DevServer\9.0\WebDev.WebServer.EXE" /port:8000 /path:\CS\client /vpath:/client`. Then browse to `http://localhost:8000/client`. To run this sample across computers, replace all references to `localhost` in the client's Web.config file with the computer name of the server. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Scenario\DataBinding\WebForms` diff --git a/docs/framework/wcf/samples/data-binding-scenarios.md b/docs/framework/wcf/samples/data-binding-scenarios.md deleted file mode 100644 index 733414751b039..0000000000000 --- a/docs/framework/wcf/samples/data-binding-scenarios.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -description: "Learn more about: Data Binding Scenarios" -title: "Data Binding Scenarios" -ms.date: "03/30/2017" -ms.assetid: a2c10dc4-84af-4dab-baee-e9c84ca26ebf ---- -# Data Binding Scenarios - -This section contains samples that demonstrate Windows Communication Foundation (WCF) data binding scenarios. - -## In This Section - - [Data Binding in a Windows Forms Client](data-binding-in-a-windows-forms-client.md) - Demonstrates how to bind to data returned by a WCF service in a Windows Forms application. - - [Data Binding in an ASP.NET Client](data-binding-in-an-aspnet-client.md) - Demonstrates how to bind data returned by a typical WCF service in a Web Forms application. - - [Data Binding in a Windows Presentation Foundation Client](data-binding-in-a-wpf-client.md) - Demonstrates the use of data binding in a Windows Presentation Foundation (WPF) client. diff --git a/docs/framework/wcf/samples/data-contracts.md b/docs/framework/wcf/samples/data-contracts.md deleted file mode 100644 index 6a46a030b7041..0000000000000 --- a/docs/framework/wcf/samples/data-contracts.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: "Learn more about: Data Contracts" -title: "Data Contracts" -ms.date: "03/30/2017" -ms.assetid: 941049b6-8e98-497f-ab3f-19848241699f ---- -# Data Contracts - -This section contains samples that demonstrate data contracts in Windows Communication Foundation (WCF). - -## In This Section - - [Basic Data Contract](basic-data-contract.md) - Demonstrates how to implement a data contract. - - [DataContractSerializer Sample](datacontractserializer-sample.md) - Demonstrates the , which performs general serialization and deserialization services for the data contract classes. - - [Known Types](known-types.md) - Demonstrates how to specify information about derived types in a data contract. - - [Object References](object-references.md) - Demonstrates how to pass objects by references between server and client. - - [POCO Support](poco-support.md) - Demonstrates the serialization support for unmarked types; that is, types to which serialization attributes have not been applied, sometimes referred to as Plain Old CLR Object (POCO) types. - - [Usage of Serialization Binder](usage-of-serialization-binder.md) - This sample shows how to use the to change the version of a generic type when it is serialized. diff --git a/docs/framework/wcf/samples/datacontract-surrogate.md b/docs/framework/wcf/samples/datacontract-surrogate.md deleted file mode 100644 index 5bb8b8d4355b6..0000000000000 --- a/docs/framework/wcf/samples/datacontract-surrogate.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -description: "Learn more about: DataContract Surrogate" -title: "DataContract Surrogate" -ms.date: "03/30/2017" -ms.assetid: b0188f3c-00a9-4cf0-a887-a2284c8fb014 ---- -# DataContract Surrogate - -This sample demonstrates how processes like serialization, deserialization, schema export, and schema import can be customized using a data contract surrogate class. This sample shows how to use a surrogate in a client and server scenario where data is serialized and transmitted between a Windows Communication Foundation (WCF) client and service. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The sample uses the following service contract: - -```csharp -[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples")] -[AllowNonSerializableTypes] -public interface IPersonnelDataService -{ - [OperationContract] - void AddEmployee(Employee employee); - - [OperationContract] - Employee GetEmployee(string name); -} -``` - - The `AddEmployee` operation allows users to add data about new employees and the `GetEmployee` operation supports search for employees based on name. - - These operations use the following data type: - -```csharp -[DataContract(Namespace = "http://Microsoft.ServiceModel.Samples")] -class Employee -{ - [DataMember] - public DateTime dateHired; - - [DataMember] - public Decimal salary; - - [DataMember] - public Person person; -} -``` - - In the `Employee` type, the `Person` class (shown in the following sample code) cannot be serialized by the because it is not a valid data contract class. - -```csharp -public class Person -{ - public string firstName; - - public string lastName; - - public int age; - - public Person() { } -} -``` - - You can apply the attribute to the `Person` class, but this is not always possible. For example, the `Person` class can be defined in a separate assembly over which you have no control. - - Given this restriction, one way to serialize the `Person` class is to substitute it with another class that is marked with and copy over necessary data to the new class. The objective is to make the `Person` class appear as a DataContract to the . Note that this is one way to serialize non-data contract classes. - - The sample logically replaces the `Person` class with a different class named `PersonSurrogated`. - -```csharp -[DataContract(Name="Person", Namespace = "http://Microsoft.ServiceModel.Samples")] -public class PersonSurrogated -{ - [DataMember] - public string FirstName; - - [DataMember] - public string LastName; - - [DataMember] - public int Age; -} -``` - - The data contract surrogate is used to achieve this replacement. A data contract surrogate is a class that implements . In this sample, the `AllowNonSerializableTypesSurrogate` class implements this interface. - - In the interface implementation, the first task is to establish a type mapping from `Person` to `PersonSurrogated`. This is used both at serialization time as well as at schema export time. This mapping is achieved by implementing the method. - -```csharp -public Type GetDataContractType(Type type) -{ - if (typeof(Person).IsAssignableFrom(type)) - { - return typeof(PersonSurrogated); - } - return type; -} -``` - - The method maps a `Person` instance to a `PersonSurrogated` instance during serialization, as shown in the following sample code. - -```csharp -public object GetObjectToSerialize(object obj, Type targetType) -{ - if (obj is Person) - { - Person person = (Person)obj; - PersonSurrogated personSurrogated = new PersonSurrogated(); - personSurrogated.FirstName = person.firstName; - personSurrogated.LastName = person.lastName; - personSurrogated.Age = person.age; - return personSurrogated; - } - return obj; -} -``` - - The method provides the reverse mapping for deserialization, as shown in the following sample code. - -```csharp -public object GetDeserializedObject(object obj, -Type targetType) -{ - if (obj is PersonSurrogated) - { - PersonSurrogated personSurrogated = (PersonSurrogated)obj; - Person person = new Person(); - person.firstName = personSurrogated.FirstName; - person.lastName = personSurrogated.LastName; - person.age = personSurrogated.Age; - return person; - } - return obj; -} -``` - - To map the `PersonSurrogated` data contract to the existing `Person` class during schema import, the sample implements the method, as shown in the following sample code. - -```csharp -public Type GetReferencedTypeOnImport(string typeName, - string typeNamespace, object customData) -{ -if ( -typeNamespace.Equals("http://schemas.datacontract.org/2004/07/DCSurrogateSample") -) - { - if (typeName.Equals("PersonSurrogated")) - { - return typeof(Person); - } - } - return null; -} -``` - - The following sample code completes the implementation of the interface. - -```csharp -public System.CodeDom.CodeTypeDeclaration ProcessImportedType( - System.CodeDom.CodeTypeDeclaration typeDeclaration, - System.CodeDom.CodeCompileUnit compileUnit) -{ - return typeDeclaration; -} -public object GetCustomDataToExport(Type clrType, - Type dataContractType) -{ - return null; -} - -public object GetCustomDataToExport( -System.Reflection.MemberInfo memberInfo, Type dataContractType) -{ - return null; -} -public void GetKnownCustomDataTypes( - KnownTypeCollection customDataTypes) -{ - // It does not matter what we do here. - throw new NotImplementedException(); -} -``` - - In this sample, the surrogate is enabled in ServiceModel by an attribute called `AllowNonSerializableTypesAttribute`. Developers would need to apply this attribute on their service contract as shown on the `IPersonnelDataService` service contract above. This attribute implements `IContractBehavior` and sets up the surrogate on operations in its `ApplyClientBehavior` and `ApplyDispatchBehavior` methods. - - The attribute is not necessary in this case - it is used for demonstration purposes in this sample. Users can alternatively enable a surrogate by manually adding a similar `IContractBehavior`, `IEndpointBehavior` or `IOperationBehavior` using code or using configuration. - - The `IContractBehavior` implementation looks for operations that use DataContract by checking if they have a `DataContractSerializerOperationBehavior` registered. If they do, it sets the `DataContractSurrogate` property on that behavior. The following sample code shows how this is done. Setting the surrogate on this operation behavior enables it for serialization and deserialization. - -```csharp -public void ApplyClientBehavior(ContractDescription description, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime proxy) -{ - foreach (OperationDescription opDesc in description.Operations) - { - ApplyDataContractSurrogate(opDesc); - } -} - -public void ApplyDispatchBehavior(ContractDescription description, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.DispatchRuntime dispatch) -{ - foreach (OperationDescription opDesc in description.Operations) - { - ApplyDataContractSurrogate(opDesc); - } -} - -private static void ApplyDataContractSurrogate(OperationDescription description) -{ - DataContractSerializerOperationBehavior dcsOperationBehavior = description.Behaviors.Find(); - if (dcsOperationBehavior != null) - { - if (dcsOperationBehavior.DataContractSurrogate == null) - dcsOperationBehavior.DataContractSurrogate = new AllowNonSerializableTypesSurrogate(); - } -} -``` - - Additional steps need to be taken to plug in the surrogate for use during metadata generation. One mechanism to do this is to provide an `IWsdlExportExtension` which is what this sample demonstrates. Another way is to modify the `WsdlExporter` directly. - - The `AllowNonSerializableTypesAttribute` attribute implements `IWsdlExportExtension` and `IContractBehavior`. The extension can be either an `IContractBehavior` or `IEndpointBehavior` in this case. Its `IWsdlExportExtension.ExportContract` method implementation enables the surrogate by adding it to the `XsdDataContractExporter` used during schema generation for DataContract. The following code snippet shows how to do this. - -```csharp -public void ExportContract(WsdlExporter exporter, WsdlContractConversionContext context) -{ - if (exporter == null) - throw new ArgumentNullException("exporter"); - - object dataContractExporter; - XsdDataContractExporter xsdDCExporter; - if (!exporter.State.TryGetValue(typeof(XsdDataContractExporter), out dataContractExporter)) - { - xsdDCExporter = new XsdDataContractExporter(exporter.GeneratedXmlSchemas); - exporter.State.Add(typeof(XsdDataContractExporter), xsdDCExporter); - } - else - { - xsdDCExporter = (XsdDataContractExporter)dataContractExporter; - } - if (xsdDCExporter.Options == null) - xsdDCExporter.Options = new ExportOptions(); - - if (xsdDCExporter.Options.DataContractSurrogate == null) - xsdDCExporter.Options.DataContractSurrogate = new AllowNonSerializableTypesSurrogate(); -} -``` - - When you run the sample, the client calls AddEmployee followed by a GetEmployee call to check if the first call was successful. The result of the GetEmployee operation request is displayed in the client console window. The GetEmployee operation must succeed in finding the employee and print "found". - -> [!NOTE] -> This sample shows how to plug in a surrogate for serialize, deserialize and metadata generation. It does not show how to plug in a surrogate for code generation from metadata. To see a sample of how a surrogate can be used to plug into client code generation, see the [Custom WSDL Publication](custom-wsdl-publication.md) sample. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\DataContract` diff --git a/docs/framework/wcf/samples/datacontractresolver.md b/docs/framework/wcf/samples/datacontractresolver.md deleted file mode 100644 index bd5aab3d4f27b..0000000000000 --- a/docs/framework/wcf/samples/datacontractresolver.md +++ /dev/null @@ -1,167 +0,0 @@ ---- -description: "Learn more about: DataContractResolver" -title: "DataContractResolver" -ms.date: "03/30/2017" -ms.assetid: 6c200c02-bc14-4b8d-bbab-9da31185b805 ---- -# DataContractResolver - -This sample demonstrates how the serialization and deserialization processes can be customized by using the class. This sample shows how to use a DataContractResolver to map CLR types to and from an xsi:type representation during serialization and deserialization. - -## Sample Details - - The sample defines the following CLR types. - -```csharp -using System; -using System.Runtime.Serialization; - -namespace Types -{ - [DataContract] - public class Customer - { - [DataMember] - public string Name { get; set; } - } - - [DataContract] - public class VIPCustomer : Customer - { - [DataMember] - public string VipInfo { get; set; } - } - - [DataContract] - public class RegularCustomer : Customer - { - } - - [DataContract] - public class PreferredVIPCustomer : VIPCustomer - { - } -} -``` - - The sample loads the assembly, extracts each of these types, and then serializes and deserializes them. The is plugged into the serialization process by passing an instance of the -derived class to the constructor, as shown in the following example. - -```csharp -this.serializer = new DataContractSerializer(typeof(Object), null, int.MaxValue, false, true, null, new MyDataContractResolver(assembly)); -``` - - The sample then serializes the CLR types as shown in the following code example. - -```csharp -Assembly assembly = Assembly.Load(new AssemblyName("Types")); - -public void serialize(Type type) -{ - Object instance = Activator.CreateInstance(type); - - Console.WriteLine("----------------------------------------"); - Console.WriteLine(); - Console.WriteLine("Serializing type: {0}", type.Name); - Console.WriteLine(); - this.buffer = new StringBuilder(); - using (XmlWriter xmlWriter = XmlWriter.Create(this.buffer)) - { - try - { - this.serializer.WriteObject(xmlWriter, instance); - } - catch (SerializationException error) - { - Console.WriteLine(error.ToString()); - } - } - Console.WriteLine(this.buffer.ToString()); -} -``` - - The sample then deserializes the xsi:types as shown in the following code example. - -```csharp -public void deserialize(Type type) -{ - Console.WriteLine(); - Console.WriteLine("Deserializing type: {0}", type.Name); - Console.WriteLine(); - using (XmlReader xmlReader = XmlReader.Create(new StringReader(this.buffer.ToString()))) - { - Object obj = this.serializer.ReadObject(xmlReader); - } -} -``` - - Since the custom is passed in to the constructor, the is called during serialization to map a CLR type to an equivalent `xsi:type`. Similarly the is called during deserialization to map the `xsi:type` to an equivalent CLR type. In this sample, the is defined as shown in the following example. - - The following code example is a class deriving from . - -```csharp -class MyDataContractResolver : DataContractResolver -{ - private Dictionary dictionary = new Dictionary(); - Assembly assembly; - - public MyDataContractResolver(Assembly assembly) - { - this.assembly = assembly; - } - - // Used at deserialization - // Allows users to map xsi:type name to any Type - public override Type ResolveName(string typeName, string typeNamespace, DataContractResolver knownTypeResolver) - { - XmlDictionaryString tName; - XmlDictionaryString tNamespace; - if (dictionary.TryGetValue(typeName, out tName) && dictionary.TryGetValue(typeNamespace, out tNamespace)) - { - return this.assembly.GetType(tNamespace.Value + "." + tName.Value); - } - else - { - return null; - } - } - - // Used at serialization - // Maps any Type to a new xsi:type representation - public override void ResolveType(Type dataContractType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace) - { - string name = dataContractType.Name; - string namesp = dataContractType.Namespace; - typeName = new XmlDictionaryString(XmlDictionary.Empty, name, 0); - typeNamespace = new XmlDictionaryString(XmlDictionary.Empty, namesp, 0); - if (!dictionary.ContainsKey(dataContractType.Name)) - { - dictionary.Add(name, typeName); - } - if (!dictionary.ContainsKey(dataContractType.Namespace)) - { - dictionary.Add(namesp, typeNamespace); - } - } -} -``` - - As part of the sample, the Types project generates the assembly with all the types that are used in this sample. Use this project to add, remove or modify the types that will be serialized. - -#### To use this sample - -1. Using Visual Studio 2012, open the DCRSample.sln solution file. - -2. To run the solution, press F5 - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Contract\Data\DataContractResolver` - -## See also - -- [Using a Data Contract Resolver](../feature-details/using-a-data-contract-resolver.md) diff --git a/docs/framework/wcf/samples/datacontractserializer-datacontractresolver-netdatacontractserializer.md b/docs/framework/wcf/samples/datacontractserializer-datacontractresolver-netdatacontractserializer.md deleted file mode 100644 index 09265448de941..0000000000000 --- a/docs/framework/wcf/samples/datacontractserializer-datacontractresolver-netdatacontractserializer.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -description: "Learn more about: Using DataContractSerializer and DataContractResolver to Provide the Functionality of NetDataContractSerializer" -title: "Using DataContractSerializer and DataContractResolver to Provide the Functionality of NetDataContractSerializer" -ms.date: "03/30/2017" -ms.assetid: 1376658f-f695-45f7-a7e0-94664e9619ff ---- -# Using DataContractSerializer and DataContractResolver to Provide the Functionality of NetDataContractSerializer - -This sample demonstrates how the use of with an appropriate provides the same functionality as . This sample shows how to create the appropriate and how to add it to the . - -## Sample details - - differs from in one important way: includes CLR type information in the serialized XML, whereas does not. Therefore, can be used only if both the serializing and deserializing ends share the same CLR types. However, it is recommended to use because its performance is better than . You can change the information that is serialized in by adding a to it. - - This sample consists of two projects. The first project uses to serialize an object. The second project uses with a to provide the same functionality as the first project. - - The following code example shows the implementation of a custom named `MyDataContractResolver` that is added to the in the DCSwithDCR project. - -```csharp -class MyDataContractResolver : DataContractResolver -{ - private XmlDictionary dictionary = new XmlDictionary(); - - public MyDataContractResolver() - { - } - - // Used at deserialization - // Allows users to map xsi:type name to any Type - public override Type ResolveName(string typeName, string typeNamespace, DataContractResolver knownTypeResolver) - { - Type type = knownTypeResolver.ResolveName(typeName, typeNamespace, null); - type ??= Type.GetType(typeName + ", " + typeNamespace); - return type; - } - - // Used at serialization - // Maps any Type to a new xsi:type representation - public override void ResolveType(Type dataContractType, DataContractResolver knownTypeResolver, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace) - { - knownTypeResolver.ResolveType(dataContractType, null, out typeName, out typeNamespace); - if (typeName == null || typeNamespace == null) - { - XmlDictionary dictionary = new XmlDictionary(); - typeName = dictionary.Add(dataContractType.FullName); - typeNamespace = dictionary.Add(dataContractType.Assembly.FullName); - } - } -} -``` - -#### To use this sample - -1. Using Visual Studio 2012, open the DCRSample.sln solution file. - -2. Right-click the solution file and choose **Properties**. - -3. In the **Solution Property Pages** dialog, under **Common Properties**, **Startup Project**, select **Multiple startup projects:**. - -4. Next to the **DCSwithDCR** project, select **Start** from the **Action** dropdown. - -5. Next to the **NetDCS** project, select **Start** from the **Action** dropdown. - -6. Click **OK** to close the dialog. - -7. To build the solution, press CTRL+SHIFT+B. - -8. To run the solution, press CTRL+F5. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Contract\Data\NetDcSasDcSwithDCR` diff --git a/docs/framework/wcf/samples/datacontractserializer-sample.md b/docs/framework/wcf/samples/datacontractserializer-sample.md deleted file mode 100644 index 5ff3bf689c584..0000000000000 --- a/docs/framework/wcf/samples/datacontractserializer-sample.md +++ /dev/null @@ -1,138 +0,0 @@ ---- -title: "DataContractSerializer Sample" -description: This sample demonstrates DataContractSerializer in WCF, which performs general serialization and deserialization services for the data contract classes. -ms.date: "03/30/2017" -helpviewer_keywords: - - "XML Formatter" -ms.assetid: e0a2fe89-3534-48c8-aa3c-819862224571 ---- -# DataContractSerializer Sample - -The DataContractSerializer sample demonstrates the , which performs general serialization and deserialization services for the data contract classes. The sample creates a `Record` object, serializes it to a memory stream and deserializes the memory stream back to another `Record` object to demonstrate the use of the . The sample then serializes the `Record` object using a binary writer to demonstrate how the writer affects serialization. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The data contract for `Record` is shown in the following sample code. - -```csharp -[DataContract(Namespace="http://Microsoft.ServiceModel.Samples")] -internal class Record -{ - private double n1; - private double n2; - private string operation; - private double result; - - internal Record(double n1, double n2, string operation, double result) - { - this.n1 = n1; - this.n2 = n2; - this.operation = operation; - this.result = result; - } - - [DataMember] - internal double OperandNumberOne - { - get { return n1; } - set { n1 = value; } - } - - [DataMember] - internal double OperandNumberTwo - { - get { return n2; } - set { n2 = value; } - } - - [DataMember] - internal string Operation - { - get { return operation; } - set { operation = value; } - } - - [DataMember] - internal double Result - { - get { return result; } - set { result = value; } - } - - public override string ToString() - { - return $"Record: {n1} {operation} {n2} = {result}"; - } -} -``` - - The sample code creates a `Record` object named `record1` then displays the object. - -```csharp -Record record1 = new Record(1, 2, "+", 3); -Console.WriteLine("Original record: {0}", record1.ToString()); -``` - - The sample then uses the to serialize `record1` into a memory stream. - -```csharp -MemoryStream stream1 = new MemoryStream(); - -//Serialize the Record object to a memory stream using DataContractSerializer. -DataContractSerializer serializer = new DataContractSerializer(typeof(Record)); -serializer.WriteObject(stream1, record1); -``` - - Next, the sample uses the to deserialize the memory stream back into a new `Record` object and displays it. - -```csharp -stream1.Position = 0; - -//Deserialize the Record object back into a new record object. -Record record2 = (Record)serializer.ReadObject(stream1); - -Console.WriteLine("Deserialized record: {0}", record2.ToString()); -``` - - By default, the `DataContractSerializer` encodes objects into a stream using a textual representation of XML. However, you can influence the encoding of the XML by passing in a different writer. The sample creates a binary writer by calling . It then passes the writer and the record object to the serializer when it calls . Finally, the sample flushes the writer and reports on the length of the streams. - -```csharp -MemoryStream stream2 = new MemoryStream(); - -XmlDictionaryWriter binaryDictionaryWriter = XmlDictionaryWriter.CreateBinaryWriter(stream2); -serializer.WriteObject(binaryDictionaryWriter, record1); -binaryDictionaryWriter.Flush(); - -//report the length of the streams -Console.WriteLine("Text Stream is {0} bytes long", stream1.Length); -Console.WriteLine("Binary Stream is {0} bytes long", stream2.Length); -``` - - When you run the sample, the original record and the deserialized record are displayed, followed by the comparison between the length of the text encoding and the binary encoding. Press ENTER in the client window to shut down the client. - -```console -Original record: Record: 1 + 2 = 3 -Deserialized record: Record: 1 + 2 = 3 -Text Stream is 233 bytes long -Binary Stream is 156 bytes long - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample, start the client from the command prompt by typing client\bin\client.exe. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Contract\Data\DataContractSerializer` diff --git a/docs/framework/wcf/samples/dead-letter-queues.md b/docs/framework/wcf/samples/dead-letter-queues.md deleted file mode 100644 index d86a6526f0689..0000000000000 --- a/docs/framework/wcf/samples/dead-letter-queues.md +++ /dev/null @@ -1,359 +0,0 @@ ---- -description: "Learn more about: Dead Letter Queues" -title: "Dead Letter Queues" -ms.date: "03/30/2017" -ms.assetid: ff664f33-ad02-422c-9041-bab6d993f9cc ---- -# Dead Letter Queues - -This sample demonstrates how to handle and process messages that have failed delivery. It is based on the [Transacted MSMQ Binding](transacted-msmq-binding.md) sample. This sample uses the `netMsmqBinding` binding. The service is a self-hosted console application to enable you to observe the service receiving queued messages. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -> [!NOTE] -> This sample demonstrates each application dead letter queue that is only available on Windows Vista. The sample can be modified to use the default system-wide queues for MSMQ 3.0 on Windows Server 2003 and Windows XP. - - In queued communication, the client communicates to the service using a queue. More precisely, the client sends messages to a queue. The service receives messages from the queue. The service and client therefore, do not have to be running at the same time to communicate using a queue. - - Because queued communication can involve a certain amount of dormancy, you may want to associate a time-to-live value on the message to ensure that the message does not get delivered to the application if it has gone past the time. There are also cases, where an application must be informed whether a message failed delivery. In all of these cases, such as when the time-to-live on the message has expired or the message failed delivery, the message is put in a dead letter queue. The sending application can then read the messages in the dead-letter queue and take corrective actions that range from no action to correcting the reasons for failed delivery and resending the message. - - The dead-letter queue in the `NetMsmqBinding` binding is expressed in the following properties: - -- property to express the kind of dead-letter queue required by the client. This enumeration has the following values: - -- `None`: No dead-letter queue is required by the client. - -- `System`: The system dead-letter queue is used to store dead messages. The system dead-letter queue is shared by all applications running on the computer. - -- `Custom`: A custom dead-letter queue specified using the property is used to store dead messages. This feature is only available on Windows Vista. This is used when the application must use its own dead letter queue instead of sharing it with other applications running on the same computer. - -- property to express the specific queue to use as a dead-letter queue. This is available only in Windows Vista. - - In this sample, the client sends a batch of messages to the service from within the scope of a transaction and specifies an arbitrarily low value for "time-to-live" for these messages (about 2 seconds). The client also specifies a custom dead-letter queue to use to enqueue the messages that have expired. - - The client application can read the messages in the dead-letter queue and either retry sending the message or correct the error that caused the original message to be placed in the dead-letter queue and send the message. In the sample, the client displays an error message. - - The service contract is `IOrderProcessor`, as shown in the following sample code. - -```csharp -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] -public interface IOrderProcessor -{ - [OperationContract(IsOneWay = true)] - void SubmitPurchaseOrder(PurchaseOrder po); -} -``` - - The service code in the sample is that of the [Transacted MSMQ Binding](transacted-msmq-binding.md). - - Communication with the service takes place within the scope of a transaction. The service reads messages from the queue, performs the operation and then displays the results of the operation. The application also creates a dead-letter queue for dead-letter messages. - -```csharp -//The service contract is defined in generatedClient.cs, generated from the service by the svcutil tool. - -//Client implementation code. -class Client -{ - static void Main() - { - // Get MSMQ queue name from app settings in configuration - string deadLetterQueueName = ConfigurationManager.AppSettings["deadLetterQueueName"]; - - // Create the transacted MSMQ queue for storing dead message if necessary. - if (!MessageQueue.Exists(deadLetterQueueName)) - MessageQueue.Create(deadLetterQueueName, true); - - // Create a proxy with given client endpoint configuration - OrderProcessorClient client = new OrderProcessorClient("OrderProcessorEndpoint"); - - // Create the purchase order - PurchaseOrder po = new PurchaseOrder(); - po.CustomerId = "somecustomer.com"; - po.PONumber = Guid.NewGuid().ToString(); - - PurchaseOrderLineItem lineItem1 = new PurchaseOrderLineItem(); - lineItem1.ProductId = "Blue Widget"; - lineItem1.Quantity = 54; - lineItem1.UnitCost = 29.99F; - - PurchaseOrderLineItem lineItem2 = new PurchaseOrderLineItem(); - lineItem2.ProductId = "Red Widget"; - lineItem2.Quantity = 890; - lineItem2.UnitCost = 45.89F; - - po.orderLineItems = new PurchaseOrderLineItem[2]; - po.orderLineItems[0] = lineItem1; - po.orderLineItems[1] = lineItem2; - - //Create a transaction scope. - using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) - { - // Make a queued call to submit the purchase order - client.SubmitPurchaseOrder(po); - // Complete the transaction. - scope.Complete(); - } - - client.Close(); - - Console.WriteLine(); - Console.WriteLine("Press to terminate client."); - Console.ReadLine(); - } -} -``` - - The client's configuration specifies a short duration for the message to reach the service. If the message cannot be transmitted within the duration specified, the message expires and is moved to the dead-letter queue. - -> [!NOTE] -> It is possible for the client to deliver the message to the service queue within the specified time. To ensure you see the dead-letter service in action, you should run the client before starting the service. The message times out and is delivered to the dead-letter service. - - The application must define which queue to use as its dead-letter queue. If no queue is specified, the default system-wide transactional dead-letter queue is used to queue dead messages. In this example, the client application specifies its own application dead-letter queue. - -```xml - - - - - - - - - - - - - - - - - - - - - -``` - - The dead-letter message service reads messages from the dead-letter queue. The dead-letter message service implements the `IOrderProcessor` contract. Its implementation however is not to process orders. The dead-letter message service is a client service and does not have the facility to process orders. - -> [!NOTE] -> The dead-letter queue is a client queue and is local to the client queue manager. - - The dead-letter message service implementation checks for the reason a message failed delivery and takes corrective measures. The reason for a message failure is captured in two enumerations, and . You can retrieve the from the as shown in the following sample code: - -```csharp -public void SubmitPurchaseOrder(PurchaseOrder po) -{ - Console.WriteLine("Submitting purchase order did not succeed ", po); - MsmqMessageProperty mqProp = - OperationContext.Current.IncomingMessageProperties[ - MsmqMessageProperty.Name] as MsmqMessageProperty; - Console.WriteLine("Message Delivery Status: {0} ", - mqProp.DeliveryStatus); - Console.WriteLine("Message Delivery Failure: {0}", - mqProp.DeliveryFailure); - Console.WriteLine(); - … -} -``` - - Messages in the dead-letter queue are messages that are addressed to the service that is processing the message. Therefore, when the dead-letter message service reads messages from the queue, the Windows Communication Foundation (WCF) channel layer finds the mismatch in endpoints and does not dispatch the message. In this case, the message is addressed to the order processing service but is received by the dead-letter message service. To receive a message that is addressed to a different endpoint, an address filter to match any address is specified in the `ServiceBehavior`. This is required to successfully process messages that are read from the dead-letter queue. - - In this sample, the dead-letter message service resends the message if the reason for failure is that the message timed out. For all other reasons, it displays the delivery failure, as shown in the following sample code: - -```csharp -// Service class that implements the service contract. -// Added code to write output to the console window. -[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Single, AddressFilterMode=AddressFilterMode.Any)] -public class PurchaseOrderDLQService : IOrderProcessor -{ - OrderProcessorClient orderProcessorService; - public PurchaseOrderDLQService() - { - orderProcessorService = new OrderProcessorClient("OrderProcessorEndpoint"); - } - - [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)] - public void SubmitPurchaseOrder(PurchaseOrder po) - { - Console.WriteLine("Submitting purchase order did not succeed ", po); - MsmqMessageProperty mqProp = OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name] as MsmqMessageProperty; - - Console.WriteLine("Message Delivery Status: {0} ", mqProp.DeliveryStatus); - Console.WriteLine("Message Delivery Failure: {0}", mqProp.DeliveryFailure); - Console.WriteLine(); - - // resend the message if timed out - if (mqProp.DeliveryFailure == DeliveryFailure.ReachQueueTimeout || - mqProp.DeliveryFailure == DeliveryFailure.ReceiveTimeout) - { - // re-send - Console.WriteLine("Purchase order Time To Live expired"); - Console.WriteLine("Trying to resend the message"); - - // reuse the same transaction used to read the message from dlq to enqueue the message to app. queue - orderProcessorService.SubmitPurchaseOrder(po); - Console.WriteLine("Purchase order resent"); - } - } - - // Host the service within this EXE console application. - public static void Main() - { - // Create a ServiceHost for the PurchaseOrderDLQService type. - using (ServiceHost serviceHost = new ServiceHost(typeof(PurchaseOrderDLQService))) - { - // Open the ServiceHostBase to create listeners and start listening for messages. - serviceHost.Open(); - - // The service can now be accessed. - Console.WriteLine("The dead letter service is ready."); - Console.WriteLine("Press to terminate service."); - Console.WriteLine(); - Console.ReadLine(); - } - } -} -``` - - The following sample shows the configuration for a dead-letter message: - -```xml - - - - - - - - - - - - - - - - - - - - - - - -``` - - In running the sample, there are 3 executables to run to see how the dead-letter queue works for each application; the client, service and a dead-letter service that reads from the dead-letter queue for each application and resends the message to the service. All are console applications with output in console windows. - -> [!NOTE] -> Because queuing is in use, the client and service do not have to be up and running at the same time. You can run the client, shut it down, and then start up the service and it still receives its messages. You should start the service and shut it down so that the queue can be created. - - When running the client, the client displays the message: - -```console -Press to terminate client. -``` - - The client attempted to send the message but with a short timeout, the message expired and is now queued in the dead-letter queue for each application. - - You then run the dead-letter service, which reads the message and displays the error code and resends the message back to the service. - -```console -The dead letter service is ready. -Press to terminate service. - -Submitting purchase order did not succeed -Message Delivery Status: InDoubt -Message Delivery Failure: ReachQueueTimeout - -Purchase order Time To Live expired -Trying to resend the message -Purchase order resent -``` - - The service starts and then reads the resent message and processes it. - -```console -The service is ready. -Press to terminate service. - -Processing Purchase Order: 97897eff-f926-4057-a32b-af8fb11b9bf9 - Customer: somecustomer.com - OrderDetails - Order LineItem: 54 of Blue Widget @unit price: $29.99 - Order LineItem: 890 of Red Widget @unit price: $45.89 - Total cost of this order: $42461.56 - Order status: Pending -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -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. - - 2. Expand the **Features** tab. - - 3. Right-click **Private Message Queues**, and select **New**, **Private Queue**. - - 4. Check the **Transactional** box. - - 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](building-the-samples.md). - -4. To run the sample in a single- or cross-computer configuration change queue names appropriately, replacing localhost with full name of the computer and follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -### To run the sample on a computer joined to a workgroup - -1. If your computer is not part of a domain, turn off transport security by setting the authentication mode and protection level to `None` as shown in the following sample configuration: - - ```xml - - - - - - - - ``` - - Ensure the endpoint is associated with the binding by setting the endpoint's `bindingConfiguration` attribute. - -2. Ensure that you change the configuration on the DeadLetterService, server and the client before you run the sample. - - > [!NOTE] - > Setting `security mode` to `None` is equivalent to setting `MsmqAuthenticationMode`, `MsmqProtectionLevel` and `Message` security to `None`. - -## Comments - - By default with the `netMsmqBinding` binding transport, security is enabled. Two properties, `MsmqAuthenticationMode` and `MsmqProtectionLevel`, together determine the type of transport security. By default the authentication mode is set to `Windows` and the protection level is set to `Sign`. For MSMQ to provide the authentication and signing feature, it must be part of a domain. If you run this sample on a computer that is not part of a domain, you receive the following error: "User's internal message queuing certificate does not exist". - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Binding\Net\MSMQ\DeadLetter` diff --git a/docs/framework/wcf/samples/default-message-contract.md b/docs/framework/wcf/samples/default-message-contract.md deleted file mode 100644 index 90f4c16e60571..0000000000000 --- a/docs/framework/wcf/samples/default-message-contract.md +++ /dev/null @@ -1,182 +0,0 @@ ---- -description: "Learn more about: Default Message Contract" -title: "Default Message Contract" -ms.date: "03/30/2017" -helpviewer_keywords: - - "Message Contract" -ms.assetid: 5a200b78-1a46-4104-b7fb-da6dbab33893 ---- -# Default Message Contract - -The Default Message Contract sample demonstrates a service where a custom user-defined message is passed to and from service operations. This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator interface as a typed service. Instead of the individual service operations for addition, subtraction, multiplication, and division used in the [Getting Started](getting-started-sample.md), this sample passes a custom message that contains both the operands and the operator, and returns the result of the arithmetic calculation. - - The client is a console program (.exe) and the service library (.dll) is hosted by Internet Information Services (IIS). Client activity is visible in the console window. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - In the service, a single service operation is defined that accepts and returns custom messages of type `MyMessage`. Although in this sample the request and response messages are of the same type, they could of course be different message contracts if necessary. - -```csharp -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] -public interface ICalculator -{ - [OperationContract(Action="http://test/MyMessage_action", - ReplyAction="http://test/MyMessage_action")] - MyMessage Calculate(MyMessage request); -} -``` - - The custom message `MyMessage` is defined in a class annotated with , and attributes. Only the third constructor is used in this sample. Using message contracts allows you to exercise full control over the SOAP message. In this sample, the attribute is used to put `Operation` in a SOAP header. The operands `N1`, `N2` and the `Result` appear within the SOAP body because they have the attribute applied. - -```csharp -[MessageContract] -public class MyMessage -{ - private string operation; - private double n1; - private double n2; - private double result; - - //Constructor - create an empty message. - - public MyMessage() {} - - //Constructor - create a message and populate its members. - - public MyMessage(double n1, double n2, string operation, - double result) - { - this.n1 = n1; - this.n2 = n2; - this.operation = operation; - this.result = result; - } - - //Constructor - create a message from another message. - - public MyMessage(MyMessage message) - { - this.n1 = message.n1; - this.n2 = message.n2; - this.operation = message.operation; - this.result = message.result; - } - - [MessageHeader] - public string Operation - { - get { return operation; } - set { operation = value; } - } - - [MessageBodyMember] - public double N1 - { - get { return n1; } - set { n1 = value; } - } - - [MessageBodyMember] - public double N2 - { - get { return n2; } - set { n2 = value; } - } - - [MessageBodyMember] - public double Result - { - get { return result; } - set { result = value; } - } -} -``` - - The implementation class contains the code for the `Calculate` service operation. The `CalculateService` class obtains the operands and operator from the request message and creates a response message that contains the result of the requested calculation, as shown in the following sample code. - -```csharp -// Service class which implements the service contract. -public class CalculatorService : ICalculator -{ - // Perform a calculation. - - public MyMessage Calculate(MyMessage request) - { - MyMessage response = new MyMessage(request); - switch (request.Operation) - { - case "+": - response.Result = request.N1 + request.N2; - break; - case "-": - response.Result = request.N1 - request.N2; - break; - case "*": - response.Result = request.N1 * request.N2; - break; - case "/": - response.Result = request.N1 / request.N2; - break; - default: - response.Result = 0.0D; - break; - } - return response; - } -} -``` - - The generated client code for the client was created with the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md) tool. The tool automatically creates message contract types in the generated client code if necessary. The `/messageContract` command option may be specified to force the generation of message contracts. - -```console -svcutil.exe /n:"http://Microsoft.ServiceModel.Samples,Microsoft.ServiceModel.Samples" /o:client\generatedClient.cs http://localhost/servicemodelsamples/service.svc/mex -``` - - The following sample code demonstrates the client using the `MyMessage` message. - -```csharp -// Create a client with given client endpoint configuration -CalculatorClient client = new CalculatorClient(); - -// Perform addition using a typed message. - -MyMessage request = new MyMessage() - { - N1 = 100D, - N2 = 15.99D, - Operation = "+" - }; -MyMessage response = ((ICalculator)client).Calculate(request); -Console.WriteLine("Add({0},{1}) = {2}", request.N1, request.N2, response.Result); -``` - - When you run the sample, the calculations are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - - At this point, custom user-defined messages have passed between the client and the service operation. The message contract defined that the operands and results were in the message body and that the operator was in a message header. Message logging can be configured to observe this message structure. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Contract\Message\Default` diff --git a/docs/framework/wcf/samples/default-nettcpbinding.md b/docs/framework/wcf/samples/default-nettcpbinding.md deleted file mode 100644 index f5cf3947ea403..0000000000000 --- a/docs/framework/wcf/samples/default-nettcpbinding.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -description: "Learn more about: Default NetTcpBinding" -title: "Default NetTcpBinding" -ms.date: "03/30/2017" -helpviewer_keywords: - - "Net profile TCP" -ms.assetid: e8475fe6-0ecd-407a-8e7e-45860561bb74 ---- -# Default NetTcpBinding - -This sample demonstrates the use of the binding. This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. In this sample, the service is self-hosted. Both the client and service are console applications. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Binding\Net\TCP\Default` - - The binding is specified in the configuration files for the client and service. The binding type is specified in the `binding` attribute of the [\](../../configure-apps/file-schema/wcf/endpoint-element.md) element as shown in the following sample configuration. - -```xml - -``` - - The previous sample shows how to configure an endpoint to use the `netTcpBinding` binding with the default settings. If you want to configure the `netTcpBinding` binding and change some of its settings, it is necessary to define a binding configuration. The endpoint must reference the binding configuration by name with a `bindingConfiguration` attribute. In this sample, the binding configuration is named `Binding1` and is defined as shown in the following sample configuration. - -```xml - - - ... - - ... - - - - - - - - - - - - - - -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press ENTER to terminate client. -``` - -### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command. - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - - > [!NOTE] - > Because the server is self-hosted, you must specify an identity in the client's App.config file to run the sample in a cross-machine configuration. - - ```xml - - - - - - - - ``` diff --git a/docs/framework/wcf/samples/default-service-behavior.md b/docs/framework/wcf/samples/default-service-behavior.md deleted file mode 100644 index 6a0e37b90088f..0000000000000 --- a/docs/framework/wcf/samples/default-service-behavior.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -description: "Learn more about: Default Service Behavior" -title: "Default Service Behavior" -ms.date: "03/30/2017" -helpviewer_keywords: - - "service behaviors, defaults" - - "Default Service Behavior Sample [Windows Communication Foundation]" -ms.assetid: 442d4f71-c64e-4c62-816a-a66c38e7d3ec ---- -# Default Service Behavior - -This sample demonstrates how service behavior settings can be configured. The sample is based on the [Getting Started](getting-started-sample.md), which implements the `ICalculator` service contract. This sample explicitly defines service behaviors and operation behaviors using the and attributes. You can configure behaviors in configuration files or imperatively in code (as this sample demonstrates). - - In this sample, the client is a console application (.exe) and the service is hosted by Internet Information Services (IIS). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The service class specifies behaviors with the and the as shown in the following code sample. All values specified are the defaults. - -```csharp -[ServiceBehavior( - AutomaticSessionShutdown=true, - ConcurrencyMode=ConcurrencyMode.Single, - InstanceContextMode=InstanceContextMode.PerSession, - IncludeExceptionDetailInFaults=false, - UseSynchronizationContext=true, - ValidateMustUnderstand=true)] -public class CalculatorService : ICalculator -{ - [OperationBehavior( - TransactionAutoComplete=true, - TransactionScopeRequired=false, - Impersonation=ImpersonationOption.NotAllowed)] - public double Add(double n1, double n2) - { - System.Threading.Thread.Sleep(1600); - return n1 + n2; - } - ... -} -``` - - Service behaviors are specified with the attribute. The following table describes some of these behaviors. - -|Service behavior|Description| -|----------------------|-----------------| -||Automatically shuts down a session at the client's request.| -||Specifies the concurrency mode for each service instance.| -||Specifies the instance context mode.| -||Determines whether to use the provided synchronization context, if one is set. Use this when you want to control whether to use a `WindowsFormsSynchronizationContext` in Windows Forms applications.| -||Determines whether general unhandled execution exceptions are to be converted into a `Fault` and sent as a fault message.| -||Specifies the isolation level for transactions.| -||Determines whether unexpected message headers cause an error condition.| - - Operation behaviors are specified by using the attribute. The following table describes some of these behaviors. - -|Operation Behavior|Description| -|------------------------|-----------------| -||Determines whether service operation completion commits the current transaction.| -||Determines whether the service operation enlists in a client-flowed transaction.| -||Determines whether the service operation impersonates the caller's identity.| -||Determines whether service instances are recycled at the start or end of the service operation call.| - - When you run the sample, the operation requests and responses are displayed in the client console window. The delay between the calls is the result of the calls to `System.Threading.Thread.Sleep()` made in the service operations. The rest of the behavior samples explain these behaviors in more detail. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Behaviors\Default` diff --git a/docs/framework/wcf/samples/design-patterns-list-based-publish-subscribe.md b/docs/framework/wcf/samples/design-patterns-list-based-publish-subscribe.md deleted file mode 100644 index b62f31a434c95..0000000000000 --- a/docs/framework/wcf/samples/design-patterns-list-based-publish-subscribe.md +++ /dev/null @@ -1,158 +0,0 @@ ---- -description: "Learn more about: Design Patterns: List-Based Publish-Subscribe" -title: "Design Patterns: List-Based Publish-Subscribe" -ms.date: "03/30/2017" -ms.assetid: f4257abc-12df-4736-a03b-0731becf0fd4 ---- -# Design Patterns: List-Based Publish-Subscribe - -This sample illustrates the List-based Publish-Subscribe pattern implemented as a Windows Communication Foundation (WCF) program. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The List-based Publish-Subscribe design pattern is described in the Microsoft Patterns & Practices publication, [Integration Patterns](/previous-versions/msp-n-p/ff647309(v=pandp.10)). The Publish-Subscribe pattern passes information to a collection of recipients who have subscribed to an information topic. List-based publish-subscribe maintains a list of subscribers. When there is information to share, a copy is sent to each subscriber on the list. This sample demonstrates a dynamic list-based publish-subscribe pattern, where clients can subscribe or unsubscribe as often as required. - - The List-based Publish-Subscribe sample consists of a client, a service, and a data source program. There can be more than one client and more than one data source program running. Clients subscribe to the service, receive notifications, and unsubscribe. Data source programs send information to the service to be shared with all current subscribers. - - In this sample, the client and data source are console programs (.exe files) and the service is a library (.dll) hosted in Internet Information Services (IIS). Client and data source activity are visible on the desktop. - - The service uses duplex communication. The `ISampleContract` service contract is paired up with an `ISampleClientCallback` callback contract. The service implements Subscribe and Unsubscribe service operations, which clients use to join or leave the list of subscribers. The service also implements the `PublishPriceChange` service operation, which the data source program calls to provide the service with new information. The client program implements the `PriceChange` service operation, which the service calls to notify all subscribers of a price change. - -```csharp -// Create a service contract and define the service operations. -// NOTE: The service operations must be declared explicitly. -[ServiceContract(SessionMode=SessionMode.Required, - CallbackContract=typeof(ISampleClientContract))] -public interface ISampleContract -{ - [OperationContract(IsOneWay = false, IsInitiating=true)] - void Subscribe(); - [OperationContract(IsOneWay = false, IsTerminating=true)] - void Unsubscribe(); - [OperationContract(IsOneWay = true)] - void PublishPriceChange(string item, double price, - double change); -} - -public interface ISampleClientContract -{ - [OperationContract(IsOneWay = true)] - void PriceChange(string item, double price, double change); -} -``` - - The service uses a .NET Framework event as the mechanism to inform all subscribers about new information. When a client joins the service by calling Subscribe, it provides an event handler. When a client leaves, it unsubscribes its event handler from the event. When a data source calls the service to report a price change, the service raises the event. This calls each instance of the service, one for each client that has subscribed, and causes their event handlers to execute. Each event handler passes the information to its client through its callback function. - -```csharp -public class PriceChangeEventArgs : EventArgs - { - public string Item; - public double Price; - public double Change; - } - - // The Service implementation implements your service contract. - [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)] - public class SampleService : ISampleContract - { - public static event PriceChangeEventHandler PriceChangeEvent; - public delegate void PriceChangeEventHandler(object sender, PriceChangeEventArgs e); - - ISampleClientContract callback = null; - - PriceChangeEventHandler priceChangeHandler = null; - - //Clients call this service operation to subscribe. - //A price change event handler is registered for this client instance. - - public void Subscribe() - { - callback = OperationContext.Current.GetCallbackChannel(); - priceChangeHandler = new PriceChangeEventHandler(PriceChangeHandler); - PriceChangeEvent += priceChangeHandler; - } - - //Clients call this service operation to unsubscribe. - //The previous price change event handler is unregistered. - - public void Unsubscribe() - { - PriceChangeEvent -= priceChangeHandler; - } - - //Information source clients call this service operation to report a price change. - //A price change event is raised. The price change event handlers for each subscriber will execute. - - public void PublishPriceChange(string item, double price, double change) - { - PriceChangeEventArgs e = new PriceChangeEventArgs(); - e.Item = item; - e.Price = price; - e.Change = change; - PriceChangeEvent(this, e); - } - - //This event handler runs when a PriceChange event is raised. - //The client's PriceChange service operation is invoked to provide notification about the price change. - - public void PriceChangeHandler(object sender, PriceChangeEventArgs e) - { - callback.PriceChange(e.Item, e.Price, e.Change); - } - - } -``` - - When you run the sample, launch several clients. The clients subscribe to the service. Then run the data source program, which sends information to the service. The service passes on the information to all subscribers. You can see activity on each client console confirming that the information has been received. Press ENTER in the client window to shut down the client. - -### To set up and build the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -### To run the sample on the same machine - -1. Test that you can access the service using a browser by entering the following address: `http://localhost/servicemodelsamples/service.svc`. A confirmation page should be displayed in response. - -2. Run Client.exe from \client\bin\\, from under the language-specific folder. Client activity is displayed on the client console window. Launch several clients. - -3. Run Datasource.exe from \datasource\bin\\, from under the language-specific folder. Data source activity is displayed on the console window. Once the data source sends information to the service, it should be passed on to each client. - -4. If the client, data source, and service programs are not able to communicate, see [Troubleshooting Tips for WCF Samples](/previous-versions/dotnet/netframework-3.5/ms751511(v=vs.90)). - -### To run the sample across machines - -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](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. - - 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. - - 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. - - 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. - -5. On the data source machine, launch Datasource.exe from a command prompt. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Scenario\DesignPatterns/ListBasedPublishSubscribe` diff --git a/docs/framework/wcf/samples/discovery-router-service.md b/docs/framework/wcf/samples/discovery-router-service.md deleted file mode 100644 index 557a7204be60a..0000000000000 --- a/docs/framework/wcf/samples/discovery-router-service.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -description: "Learn more about: Discovery Router Service" -title: "Discovery Router Service" -ms.date: "03/30/2017" -ms.assetid: 3d30af47-b24f-40e5-833a-24d77125c9e6 ---- -# Discovery Router Service - -This sample demonstrates how to forward discovery messages to another endpoint. - -## Demonstrates - - Discovery Routing - -## Discussion - - Discovery routing is useful in a scenario in which a client is looking for a service using a proxy and the proxy is unaware of such a service, but knows of another proxy. This proxy can forward the discovery packet from this client to the second proxy. The second proxy can look for the service and return the responses to the original client. - - In this sample, a client sends a message to a discovery routing component. This message is sent to a specific endpoint on the discovery router. The router then forwards the message to a UDP multicast endpoint. The probe message goes out to the multicast endpoint and a service listening on a UDP multicast address responds to that discovery router. The discovery router collects the responses and sends them back to the client. - -#### To set up, build, and run the sample - -1. Build the sample. - -2. Run the DiscoveryRouter executable. - -3. Run the service executable from the build directory. - -4. Run the client executable. Note that the client locates the service. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Discovery\DiscoveryRouter` diff --git a/docs/framework/wcf/samples/discovery-samples.md b/docs/framework/wcf/samples/discovery-samples.md deleted file mode 100644 index 53e53199494a6..0000000000000 --- a/docs/framework/wcf/samples/discovery-samples.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -description: "Learn more about: Discovery (Samples)" -title: "Discovery (Samples)" -ms.date: "03/30/2017" -ms.assetid: 522a00b4-a789-4e8c-b8d7-a4c3d863a182 ---- -# Discovery (Samples) - -This section contains samples related to the Discovery feature. - -## In This Section - - [Announcements](announcements-sample.md) - Demonstrates how to use announcements with the discovery feature. - - [Basic](basic-sample.md) - Demonstrates how to make a service discoverable programmatically as well as search for that service using the . - - [Configuration](configuration-sample.md) - Demonstrates how to use a configuration file to make a service discoverable as well as how to use a through configuration to look for that service. - - [Discovery with Scopes](discovery-with-scopes-sample.md) - Demonstrates how to use scopes to categorize discoverable endpoints as well how to use to perform an asynchronous search for endpoints. - - [Custom Find Criteria](custom-find-criteria.md) - Demonstrates how to create a custom scope match using logic and how to implement a custom discovery service. - - [Workflow Discovery Sample](workflow-discovery-sample.md) - Demonstrates how to make a workflow service discoverable and how to author a custom code activity that searches for a particular service. - - [Discovery Router Service](discovery-router-service.md) - Demonstrates how to forward discovery messages to another endpoint. diff --git a/docs/framework/wcf/samples/discovery-security-sample.md b/docs/framework/wcf/samples/discovery-security-sample.md deleted file mode 100644 index e646c2d9376ea..0000000000000 --- a/docs/framework/wcf/samples/discovery-security-sample.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -description: "Learn more about: Discovery Security Sample" -title: "Discovery Security Sample" -ms.date: "03/30/2017" -ms.assetid: b8db01f4-b4a1-43fe-8e31-26d4e9304a65 ---- -# Discovery Security Sample - -The Discovery specification does not require that endpoints that participate in the discovery process to be secure. Enhancing the discovery messages with security mitigates various types of attacks (message alteration, denial of service, replay, spoofing). This sample implements custom channels that compute and verify message signatures using the compact signature format (described in Section 8.2 of the WS-Discovery specification). The sample supports both the [2005 Discovery specification](http://specs.xmlsoap.org/ws/2005/04/discovery/ws-discovery.pdf) and the [1.1 version](http://docs.oasis-open.org/ws-dd/discovery/1.1/cs-01/wsdd-discovery-1.1-spec-cs-01.pdf). - - The custom channel is applied on top of the existing channel stack for Discovery and Announcement endpoints. This way, a signature header is applied for every message sent. The signature is verified on received messages and when it does not match or when the messages do not have a signature, the messages are dropped. To sign and verify messages, the sample uses certificates. - -## Discussion - - WCF is extensible and allows users the possibility to customize channels as desired. The sample implements a discovery secure binding element that builds secure channels. The secure channels apply and verify message signatures and are applied on top of the current stack. - - The secure binding element builds secure channel factories and channel listeners. - -## Secure Channel Factory - - The secure channel factory creates output or duplex channels that add a compact signature to message headers. To keep messages as small as possible the compact signature format is used. The structure of a compact signature is shown in the following example. - -```xml - - []? - ... - -``` - -> [!NOTE] -> The `PrefixList` was added in the 2008 Discovery version protocol. - - To compute the signature, the sample determines the expanded signature items. An XML signature (`SignedInfo`) is created, using the `ds` namespace prefix, as required by the WS-Discovery specification. The body and all the headers in discovery and addressing namespaces are referenced in the signature, so they cannot be tampered with. Each referenced element is transformed using the Exclusive Canonicalization (), and then an SHA-1 digest value is computed (). Based on all referenced elements and their digest values, the signature value is computed using the RSA algorithm (). - - The messages are signed with a client-specified certificate. The store location, name, and certificate subject name must be specified when the binding element is created. The `KeyId` in the compact signature represents the key identifier of the signing token and is the Subject Key Identifier (SKI) of the signing token or (if the SKI does not exist) a SHA-1 hash of the public key of the signing token. - -## Secure Channel Listener - - The secure channel listener creates input or duplex channels that verify the compact signature in received messages. To verify the signature, the `KeyId` specified in the compact signature attached to the message is used to select a certificate from the specified store. If the message does not have a signature or the signature check fails, the messages are dropped. To use the secure binding, the sample defines a factory that creates custom and with the added discovery secure binding element. These secure endpoints can be used in discovery announcement listeners and discoverable services. - -## Sample Details - - The sample includes a library and 4 console applications: - -- **DiscoverySecurityChannels**: A library that exposes the secure binding. The library computes and verifies the compact signature for outgoing/incoming messages. - -- **Service**: A service exposing ICalculatorService contract, self hosted. The service is marked as Discoverable. The user specifies the details of the certificate used to sign messages by specifying the store location and name and the subject name or other unique identifier for the certificate, and the store where the client certificates are located (the certificates used to check signature for incoming messages). Based on these details, a UdpDiscoveryEndpoint with added security is built and used. - -- **Client**: This class tries to discover an ICalculatorService and to call methods on the service. Again, a with added security is built and used to sign and verify the messages. - -- **AnnouncementListener**: A self-hosted service that listens for online and offline announcements and uses the secure announcement endpoint. - -> [!NOTE] -> If Setup.bat is run multiple times, the certificate manager prompts you for choosing a certificate to add, as there are duplicate certificates. In that case, Setup.bat should be aborted and Cleanup.bat should be called, because the duplicates have already been created. Cleanup.bat also prompts you to choose a certificate to delete. Select a certificate from the list and continue executing Cleanup.bat until no certificates are remaining. - -#### To use this sample - -1. Execute the Setup.bat script from a Developer Command Prompt for Visual Studio. The sample uses certificates to sign and verify messages. The script creates the certificates using Makecert.exe and then installs them using Certmgr.exe. The script must be run with administrator privileges. - -2. To build and run the sample, open the Security.sln file in Visual Studio and choose **Rebuild All**. Update the solution properties to start multiple projects: select **Start** for all projects except DiscoverySecureChannels. Run the solution normally. - -3. After you are done with the sample, execute the Cleanup.bat script that removes the certificates created for this sample. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Scenario\DiscoveryScenario` diff --git a/docs/framework/wcf/samples/discovery-with-scopes-sample.md b/docs/framework/wcf/samples/discovery-with-scopes-sample.md deleted file mode 100644 index 3da0c957340cd..0000000000000 --- a/docs/framework/wcf/samples/discovery-with-scopes-sample.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -description: "Learn more about: Discovery with Scopes Sample" -title: "Discovery with Scopes Sample" -ms.date: "03/30/2017" -ms.assetid: 6a37a754-6b8c-4ebe-bdf2-d4f0520271d5 ---- -# Discovery with Scopes Sample - -This sample shows how to use scopes to categorize discoverable endpoints as well how to use to perform an asynchronous search for endpoints. On the service, this sample shows how to customize discovery for each endpoint by adding an endpoint discovery behavior and using it to add a scope to the endpoint as well as controlling the endpoint’s discoverability. On the client, the sample goes over how clients can create a and fine tune search parameters to include scopes by adding scopes to the . This sample also shows how clients can restrict responses by adding a termination criterion. - -## Service Features - -This project shows two service endpoints being added to a . Each endpoint has a associated with it. This behavior is used to add URI scopes for both endpoints. Scopes are used to distinguish each of these endpoints so that the clients can fine tune the search. For the second endpoint, the discoverability can be disabled by setting the property to `false`. This ensures that the discovery metadata associated with this endpoint is not sent as part of any discovery messages. - -## Client Features - -The `FindCalculatorServiceAddress()` method shows how to use a and pass in a with two restrictions. A scope is added to the criteria and the property is set to 1. The scope limits the results to only the services that publish the same scope. Setting to 1 limits the responses the waits for to, at most, 1 endpoint. The call is a synchronous operation that blocks the thread until a timeout is reached or one endpoint is found. - -### To use this sample - -1. This sample uses HTTP endpoints and to run this sample, proper URL ACLs must be added. For more information, see [Configuring HTTP and HTTPS](../feature-details/configuring-http-and-https.md). Executing the following command at an elevated privilege should add the appropriate ACLs. You may want to substitute your Domain and Username for the following arguments if the command does not work as is: `netsh http add urlacl url=http://+:8000/ user=%DOMAIN%\%UserName%` - -2. Build the solution. - -3. Run the service executable from the build directory. - -4. Run the client executable. Note that the client is able to locate the service. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Discovery\DiscoveryWithScopes` diff --git a/docs/framework/wcf/samples/dispatch-by-body-element.md b/docs/framework/wcf/samples/dispatch-by-body-element.md deleted file mode 100644 index 5270f9eeff1e1..0000000000000 --- a/docs/framework/wcf/samples/dispatch-by-body-element.md +++ /dev/null @@ -1,179 +0,0 @@ ---- -description: "Learn more about: Dispatch by Body Element" -title: "Dispatch by Body Element" -ms.date: "03/30/2017" -ms.assetid: f64a3c04-62b4-47b2-91d9-747a3af1659f ---- -# Dispatch by Body Element - -This sample demonstrates how to implement an alternate algorithm for assigning incoming messages to operations. - - By default, the service model dispatcher selects the appropriate handling method for an incoming message based on the message's WS-Addressing "Action" header or the equivalent information in the HTTP SOAP request. - - Some SOAP 1.1 Web services stacks that do not follow the WS-I Basic Profile 1.1 guidelines do not dispatch messages based on the Action URI, but rather based on the XML qualified name of the first element inside the SOAP body. Likewise, the client side of these stacks might send messages with an empty or arbitrary HTTP SoapAction header, which was permitted by the SOAP 1.1 specification. - - To change the way messages are dispatched to methods, the sample implements the extensibility interface on the `DispatchByBodyElementOperationSelector`. This class selects operations based on the first element of the message body. - - The class constructor expects a dictionary populated with pairs of `XmlQualifiedName` and strings, whereby the qualified names indicate the name of the first child of the SOAP body and the strings indicate the matching operation name. The `defaultOperationName` is the name of the operation that receives all messages that cannot be matched against this dictionary: - -```csharp -class DispatchByBodyElementOperationSelector : IDispatchOperationSelector -{ - Dictionary dispatchDictionary; - string defaultOperationName; - - public DispatchByBodyElementOperationSelector(Dictionary dispatchDictionary, string defaultOperationName) - { - this.dispatchDictionary = dispatchDictionary; - this.defaultOperationName = defaultOperationName; - } -} -``` - - implementations are very straightforward to build as there is only one method on the interface: . The job of this method is to inspect an incoming message and to return a string that equals the name of a method on the service contract for the current endpoint. - - In this sample, the operation selector acquires an for the incoming message's body using . This method already positions the reader on the first child of the message's body so that it is sufficient to get the current element's name and namespace URI and combine them into an `XmlQualifiedName` that is then used for looking up the corresponding operation from the dictionary held by the operation selector. - -```csharp -public string SelectOperation(ref System.ServiceModel.Channels.Message message) -{ - XmlDictionaryReader bodyReader = message.GetReaderAtBodyContents(); - XmlQualifiedName lookupQName = new - XmlQualifiedName(bodyReader.LocalName, bodyReader.NamespaceURI); - message = CreateMessageCopy(message,bodyReader); - if (dispatchDictionary.ContainsKey(lookupQName)) - { - return dispatchDictionary[lookupQName]; - } - else - { - return defaultOperationName; - } -} -``` - - Accessing the message body with or any of the other methods that provide access to the message's body content causes the message to be marked as "read", which means that the message is invalid for any further processing. Therefore, the operation selector creates a copy of the incoming message with the method shown in the following code. Because the reader's position has not been changed during the inspection, it can be referenced by the newly created message to which the message properties and the message headers are also copied, which results in an exact clone of the original message: - -```csharp -private Message CreateMessageCopy(Message message, - XmlDictionaryReader body) -{ - Message copy = Message.CreateMessage(message.Version,message.Headers.Action,body); - copy.Headers.CopyHeaderFrom(message,0); - copy.Properties.CopyProperties(message.Properties); - return copy; -} -``` - -## Adding an Operation Selector to a Service - - Service dispatch operation selectors are extensions to the Windows Communication Foundation (WCF) dispatcher. For selecting methods on the callback channel of duplex contracts, there are also client operation selectors, which work very much like the dispatch operation selectors described here, but which are not explicitly covered in this sample. - - Like most service model extensions, dispatch operation selectors are added to the dispatcher using behaviors. A *behavior* is a configuration object, which either adds one or more extensions to the dispatch runtime (or to the client runtime) or otherwise changes its settings. - - Because operation selectors have contract scope, the appropriate behavior to implement here is the . Because the interface is implemented on a derived class as shown in the following code, the behavior can be declaratively added to any service contract. Whenever a is opened and the dispatch runtime is built, all behaviors found either as attributes on contracts, operations, and service implementations or as element in the service configuration are automatically added and subsequently asked to contribute extensions or modify the default configuration. - - For brevity, the following code excerpt only shows the implementation of the method , which effects the configuration changes for the dispatcher in this sample. The other methods are not shown because they return to the caller without doing any work. - -```csharp -[AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface)] -class DispatchByBodyElementBehaviorAttribute : Attribute, IContractBehavior -{ - // public void AddBindingParameters(...) - // public void ApplyClientBehavior(...) - // public void Validate(...) -``` - - First, the implementation sets up the lookup dictionary for the operation selector by iterating over the elements in the service endpoint's . Then, each operation description is inspected for the presence of the `DispatchBodyElementAttribute` behavior, an implementation of that is also defined in this sample. While this class is also a behavior, it is passive and does not actively contribute any configuration changes to the dispatch runtime. All of its methods return to the caller without taking any actions. The operation behavior only exists so that the metadata required for the new dispatch mechanism, namely the qualified name of the body element on whose occurrence an operation is selected, can be associated with the respective operations. - - If such a behavior is found, a value pair created from the XML qualified name (`QName` property) and the operation name (`Name` property) is added to the dictionary. - - Once the dictionary is populated, a new `DispatchByBodyElementOperationSelector` is constructed with this information and set as the operation selector of the dispatch runtime: - -```csharp -public void ApplyDispatchBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.DispatchRuntime dispatchRuntime) -{ - Dictionary dispatchDictionary = - new Dictionary(); - foreach( OperationDescription operationDescription in - contractDescription.Operations ) - { - DispatchBodyElementAttribute dispatchBodyElement = - operationDescription.Behaviors.Find(); - if ( dispatchBodyElement != null ) - { - dispatchDictionary.Add(dispatchBodyElement.QName, - operationDescription.Name); - } - } - dispatchRuntime.OperationSelector = - new DispatchByBodyElementOperationSelector( - dispatchDictionary, - dispatchRuntime.UnhandledDispatchOperation.Name); - } -} -``` - -## Implementing the Service - - The behavior implemented in this sample directly affects how messages from the wire are interpreted and dispatched, which is a function of the service contract. Consequently, the behavior should be declared on the service contract level in any service implementation that chooses to use it. - - The sample project service applies the `DispatchByBodyElementBehaviorAttribute` contract behavior to the `IDispatchedByBody` service contract and labels each of the two operations `OperationForBodyA()` and `OperationForBodyB()` with a `DispatchBodyElementAttribute` operation behavior. When a service host for a service that implements this contract is opened, this metadata is picked up by the dispatcher builder as previously described. - - Because the operation selector dispatches solely based on the message body element and ignores the "Action", it is required to tell the runtime not to check the "Action" header on the returned replies by assigning the wildcard "*" to the `ReplyAction` property of . Furthermore, it is required to have a default operation that has the "Action" property set to the wildcard "\*". The default operation receives all messages which cannot be dispatched and does not have a `DispatchBodyElementAttribute`: - -```csharp -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples"), - DispatchByBodyElementBehavior] -public interface IDispatchedByBody -{ - [OperationContract(ReplyAction="*"), - DispatchBodyElement("bodyA","http://tempuri.org")] - Message OperationForBodyA(Message msg); - [OperationContract(ReplyAction = "*"), - DispatchBodyElement("bodyB", "http://tempuri.org")] - Message OperationForBodyB(Message msg); - [OperationContract(Action="*", ReplyAction="*")] - Message DefaultOperation(Message msg); -} -``` - - The sample service implementation is straightforward. Every method wraps the received message into a reply message and echoes it back to the client. - -## Running and Building the Sample - - When you run the sample, the body content of the operation responses are displayed in the client console window similar to the following (formatted) output. - - The client sends three messages to the service whose body content element is named `bodyA`, `bodyB`, and `bodyX`, respectively. As can be deferred from the previous description and the service contract shown, the incoming message with the `bodyA` element is dispatched to the `OperationForBodyA()` method. Because there is no explicit dispatch target for the message with the `bodyX` body element, the message is dispatched to the `DefaultOperation()`. Each of the service operations wraps the received message body into an element specific to the method and returns it, which is done to correlate input and output messages clearly for this sample: - -```xml - - - test - - - - test - - - - test - -``` - -#### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Interop\AdvancedDispatchByBody` diff --git a/docs/framework/wcf/samples/duplex.md b/docs/framework/wcf/samples/duplex.md deleted file mode 100644 index 41f92fbe0ce22..0000000000000 --- a/docs/framework/wcf/samples/duplex.md +++ /dev/null @@ -1,191 +0,0 @@ ---- -description: "Learn more about: Duplex" -title: "Duplex" -ms.date: "03/30/2017" -helpviewer_keywords: - - "Duplex Service Contract" -ms.assetid: bc5de6b6-1a63-42a3-919a-67d21bae24e0 ---- -# Duplex - -The Duplex sample demonstrates how to define and implement a duplex contract. Duplex communication occurs when a client establishes a session with a service and gives the service a channel on which the service can send messages back to the client. This sample is based on the [Getting Started](getting-started-sample.md). A duplex contract is defined as a pair of interfaces—a primary interface from the client to the service and a callback interface from the service to the client. In this sample, the `ICalculatorDuplex` interface allows the client to perform math operations, calculating the result over a session. The service returns results on the `ICalculatorDuplexCallback` interface. A duplex contract requires a session, because a context must be established to correlate the set of messages being sent between the client and the service. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -In this sample, the client is a console application (.exe) and the service is hosted by Internet Information Services (IIS). The duplex contract is defined as follows: - -```csharp -[ServiceContract(Namespace = "http://Microsoft.ServiceModel.Samples", SessionMode=SessionMode.Required, - CallbackContract=typeof(ICalculatorDuplexCallback))] -public interface ICalculatorDuplex -{ - [OperationContract(IsOneWay = true)] - void Clear(); - [OperationContract(IsOneWay = true)] - void AddTo(double n); - [OperationContract(IsOneWay = true)] - void SubtractFrom(double n); - [OperationContract(IsOneWay = true)] - void MultiplyBy(double n); - [OperationContract(IsOneWay = true)] - void DivideBy(double n); -} - -public interface ICalculatorDuplexCallback -{ - [OperationContract(IsOneWay = true)] - void Result(double result); - [OperationContract(IsOneWay = true)] - void Equation(string eqn); -} -``` - -The `CalculatorService` class implements the primary `ICalculatorDuplex` interface. The service uses the instance mode to maintain the result for each session. A private property named `Callback` is used to access the callback channel to the client. The service uses the callback for sending messages back to the client through the callback interface. - -```csharp -[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] -public class CalculatorService : ICalculatorDuplex -{ - double result = 0.0D; - string equation; - - public CalculatorService() - { - equation = result.ToString(); - } - - public void Clear() - { - Callback.Equation($"{equation} = {result}"); - equation = result.ToString(); - } - - public void AddTo(double n) - { - result += n; - equation += $" + {n}"; - Callback.Result(result); - } - - //... - - ICalculatorDuplexCallback Callback - { - get - { - return OperationContext.Current.GetCallbackChannel(); - } - } -} -``` - -The client must provide a class that implements the callback interface of the duplex contract, for receiving messages from the service. In the sample, a `CallbackHandler` class is defined to implement the `ICalculatorDuplexCallback` interface. - -```csharp -public class CallbackHandler : ICalculatorDuplexCallback -{ - public void Result(double result) - { - Console.WriteLine("Result({0})", result); - } - - public void Equation(string equation) - { - Console.WriteLine("Equation({0}", equation); - } -} -``` - -The proxy that is generated for a duplex contract requires a to be provided upon construction. This is used as the site for an object that implements the callback interface and handles messages that are sent back from the service. An is constructed with an instance of the `CallbackHandler` class. This object handles messages sent from the service to the client on the callback interface. - -```csharp -// Construct InstanceContext to handle messages on callback interface. -InstanceContext instanceContext = new InstanceContext(new CallbackHandler()); - -// Create a client. -CalculatorDuplexClient client = new CalculatorDuplexClient(instanceContext); - -Console.WriteLine("Press to terminate client once the output is displayed."); -Console.WriteLine(); - -// Call the AddTo service operation. -double value = 100.00D; -client.AddTo(value); - -// Call the SubtractFrom service operation. -value = 50.00D; -client.SubtractFrom(value); - -// Call the MultiplyBy service operation. -value = 17.65D; -client.MultiplyBy(value); - -// Call the DivideBy service operation. -value = 2.00D; -client.DivideBy(value); - -// Complete equation. -client.Clear(); - -Console.ReadLine(); - -//Closing the client gracefully closes the connection and cleans up resources. -client.Close(); -``` - -The configuration has been modified to provide a binding that supports both session communication and duplex communication. The `wsDualHttpBinding` supports session communication and allows duplex communication by providing dual HTTP connections, one for each direction. On the service, the only difference in configuration is the binding that is used. On the client, you must configure an address that the server can use to connect to the client as shown in the following sample configuration. - -```xml - - - - - - - - - - - -``` - -When you run the sample, you see the messages that are returned to the client on the callback interface that is sent from the service. Each intermediate result is displayed, followed by the entire equation upon the completion of all operations. Press ENTER to shut down the client. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C#, C++, or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - - > [!IMPORTANT] - > When running the client in a cross-machine configuration, be sure to replace "localhost" in both the `address` attribute of the [\ of \](../../configure-apps/file-schema/wcf/endpoint-of-client.md) element and the `clientBaseAddress` attribute of the [\](../../configure-apps/file-schema/wcf/bindings.md) element of the [\](../../configure-apps/file-schema/wcf/wsdualhttpbinding.md) element with the name of the appropriate machine, as shown in the following: - - ```xml - - - - ... - - - - - ``` - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Contract\Service\Duplex` diff --git a/docs/framework/wcf/samples/durable-instance-context.md b/docs/framework/wcf/samples/durable-instance-context.md deleted file mode 100644 index 6f5285429d32b..0000000000000 --- a/docs/framework/wcf/samples/durable-instance-context.md +++ /dev/null @@ -1,458 +0,0 @@ ---- -description: "Learn more about: Durable Instance Context" -title: "Durable Instance Context" -ms.date: "03/30/2017" -ms.assetid: 97bc2994-5a2c-47c7-927a-c4cd273153df ---- -# Durable Instance Context - -This sample demonstrates how to customize the Windows Communication Foundation (WCF) runtime to enable durable instance contexts. It uses SQL Server 2005 as its backing store (SQL Server 2005 Express in this case). However, it also provides a way to access custom storage mechanisms. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -This sample involves extending both the channel layer and the service model layer of the WCF. Therefore it is necessary to understand the underlying concepts before going into the implementation details. - -Durable instance contexts can be found in the real world scenarios quite often. A shopping cart application, for example, has the ability to pause shopping halfway through and continue it on another day. So that when we visit the shopping cart the next day, our original context is restored. It is important to note that the shopping cart application (on the server) does not maintain the shopping cart instance while we are disconnected. Instead, it persists its state into a durable storage media and uses it when constructing a new instance for the restored context. Therefore the service instance that may service for the same context is not the same as the previous instance (that is, it does not have the same memory address). - -Durable instance context is made possible by a small protocol that exchanges a context ID between the client and service. This context ID is created on the client and transmitted to the service. When the service instance is created, the service runtime tries to load the persisted state that corresponds to this context ID from a persistent storage (by default it is a SQL Server 2005 database). If no state is available, the new instance has its default state. The service implementation uses a custom attribute to mark operations that change the state of the service implementation so that the runtime can save the service instance after invoking them. - -By the previous description, two steps can easily be distinguished to achieve the goal: - -1. Change the message that goes on the wire to carry the context ID. - -2. Change the service local behavior to implement custom instancing logic. - -Because the first one in the list affects the messages on the wire, it should be implemented as a custom channel and be hooked up to the channel layer. The latter only affects the service local behavior and therefore can be implemented by extending several service extensibility points. In the next few sections, each of these extensions are discussed. - -## Durable InstanceContext Channel - -The first thing to look at is a channel layer extension. The first step in writing a custom channel is to decide the communication structure of the channel. As a new wire protocol is being introduced, the channel should work with almost any other channel in the channel stack. Therefore it should support all the message exchange patterns. However, the core functionality of the channel is the same regardless of its communication structure. More specifically, from the client it should write the context ID to the messages and from the service it should read this context ID from the messages and pass it to the upper levels. Because of that, a `DurableInstanceContextChannelBase` class is created that acts as the abstract base class for all durable instance context channel implementations. This class contains the common state machine management functions and two protected members to apply and read the context information to and from messages. - -```csharp -class DurableInstanceContextChannelBase -{ - //… - protected void ApplyContext(Message message) - { - //… - } - protected string ReadContextId(Message message) - { - //… - } -} -``` - -These two methods make use of `IContextManager` implementations to write and read the context ID to or from the message. (`IContextManager` is a custom interface used to define the contract for all context managers.) The channel can either include the context ID in a custom SOAP header or in an HTTP cookie header. Each context manager implementation inherits from the `ContextManagerBase` class that contains the common functionality for all context managers. The `GetContextId` method in this class is used to originate the context ID from the client. When a context ID is originated for the first time, this method saves it into a text file whose name is constructed by the remote endpoint address (the invalid file name characters in the typical URIs are replaced with @ characters). - -Later when the context ID is required for the same remote endpoint, it checks whether an appropriate file exists. If it does, it reads the context ID and returns. Otherwise it returns a newly generated context ID and saves it to a file. With the default configuration, these files are placed in a directory called ContextStore, which resides in the current user's temp directory. However this location is configurable using the binding element. - -The mechanism used to transport the context ID is configurable. It could be either written to the HTTP cookie header or to a custom SOAP header. The custom SOAP header approach makes it possible to use this protocol with non-HTTP protocols (for example, TCP or Named Pipes). There are two classes, namely `MessageHeaderContextManager` and `HttpCookieContextManager`, which implement these two options. - -Both of them write the context ID to the message appropriately. For example, the `MessageHeaderContextManager` class writes it to a SOAP header in the `WriteContext` method. - -```csharp -public override void WriteContext(Message message) -{ - string contextId = this.GetContextId(); - - MessageHeader contextHeader = - MessageHeader.CreateHeader(DurableInstanceContextUtility.HeaderName, - DurableInstanceContextUtility.HeaderNamespace, - contextId, - true); - - message.Headers.Add(contextHeader); -} -``` - -Both the `ApplyContext` and `ReadContextId` methods in the `DurableInstanceContextChannelBase` class invoke the `IContextManager.ReadContext` and `IContextManager.WriteContext`, respectively. However, these context managers are not directly created by the `DurableInstanceContextChannelBase` class. Instead it uses the `ContextManagerFactory` class to do that job. - -```csharp -IContextManager contextManager = - ContextManagerFactory.CreateContextManager(contextType, - this.contextStoreLocation, - this.endpointAddress); -``` - -The `ApplyContext` method is invoked by the sending channels. It injects the context ID to the outgoing messages. The `ReadContextId` method is invoked by the receiving channels. This method ensures that the context ID is available in the incoming messages and adds it to the `Properties` collection of the `Message` class. It also throws a `CommunicationException` in case of a failure to read the context ID and thus causes the channel to be aborted. - -```csharp -message.Properties.Add(DurableInstanceContextUtility.ContextIdProperty, contextId); -``` - -Before proceeding, it is important to understand the usage of the `Properties` collection in the `Message` class. Typically, this `Properties` collection is used when passing data from lower to the upper levels from the channel layer. This way the desired data can be provided to the upper levels in a consistent manner regardless of the protocol details. In other words, the channel layer can send and receive the context ID either as a SOAP header or an HTTP cookie header. But it is not necessary for the upper levels to know about these details because the channel layer makes this information available in the `Properties` collection. - -Now with the `DurableInstanceContextChannelBase` class in place all ten of the necessary interfaces (IOutputChannel, IInputChannel, IOutputSessionChannel, IInputSessionChannel, IRequestChannel, IReplyChannel, IRequestSessionChannel, IReplySessionChannel, IDuplexChannel, IDuplexSessionChannel) must be implemented. They resemble every available message exchange pattern (datagram, simplex, duplex, and their sessionful variants). Each of these implementations inherits the base class previously described and calls `ApplyContext` and `ReadContextId` appropriately. For example, `DurableInstanceContextOutputChannel` - which implements the IOutputChannel interface - calls the `ApplyContext` method from each method that sends the messages. - -```csharp -public void Send(Message message, TimeSpan timeout) -{ - // Apply the context information before sending the message. - this.ApplyContext(message); - //… -} -``` - -On the other hand, `DurableInstanceContextInputChannel` - which implements the `IInputChannel` interface - calls the `ReadContextId` method in each method, which receives the messages. - -```csharp -public Message Receive(TimeSpan timeout) -{ - //… - ReadContextId(message); - return message; -} -``` - -Apart from this, these channel implementations delegate the method invocations to the channel below them in the channel stack. However, sessionful variants have a basic logic to make sure that the context ID is sent and is read only for the first message that causes the session to be created. - -```csharp -if (isFirstMessage) -{ -//… - this.ApplyContext(message); - isFirstMessage = false; -} -``` - -These channel implementations are then added to the WCF channel runtime by the `DurableInstanceContextBindingElement` class and `DurableInstanceContextBindingElementSection` class appropriately. See the [HttpCookieSession](httpcookiesession.md) channel sample documentation for more details about binding elements and binding element sections. - -## Service Model Layer Extensions - -Now that the context ID has traveled through the channel layer, the service behavior can be implemented to customize the instantiation. In this sample, a storage manager is used to load and save state from or to the persistent store. As explained previously, this sample provides a storage manager that uses SQL Server 2005 as its backing store. However, it is also possible to add custom storage mechanisms to this extension. To do that a public interface is declared, which must be implemented by all storage managers. - -```csharp -public interface IStorageManager -{ - object GetInstance(string contextId, Type type); - void SaveInstance(string contextId, object state); -} -``` - -The `SqlServerStorageManager` class contains the default `IStorageManager` implementation. In its `SaveInstance` method, the given object is serialized using the XmlSerializer and is saved to the SQL Server database. - -```csharp -XmlSerializer serializer = new XmlSerializer(state.GetType()); -string data; - -using (StringWriter writer = new StringWriter(CultureInfo.InvariantCulture)) -{ - serializer.Serialize(writer, state); - data = writer.ToString(); -} - -using (SqlConnection connection = new SqlConnection(GetConnectionString())) -{ - connection.Open(); - - string update = @"UPDATE Instances SET Instance = @instance WHERE ContextId = @contextId"; - - using (SqlCommand command = new SqlCommand(update, connection)) - { - command.Parameters.Add("@instance", SqlDbType.VarChar, 2147483647).Value = data; - command.Parameters.Add("@contextId", SqlDbType.VarChar, 256).Value = contextId; - - int rows = command.ExecuteNonQuery(); - - if (rows == 0) - { - string insert = @"INSERT INTO Instances(ContextId, Instance) VALUES(@contextId, @instance)"; - command.CommandText = insert; - command.ExecuteNonQuery(); - } - } -} -``` - -In the `GetInstance` method, the serialized data is read for a given context ID and the object constructed from it is returned to the caller. - -```csharp -object data; -using (SqlConnection connection = new SqlConnection(GetConnectionString())) -{ - connection.Open(); - - string select = "SELECT Instance FROM Instances WHERE ContextId = @contextId"; - using (SqlCommand command = new SqlCommand(select, connection)) - { - command.Parameters.Add("@contextId", SqlDbType.VarChar, 256).Value = contextId; - data = command.ExecuteScalar(); - } -} - -if (data != null) -{ - XmlSerializer serializer = new XmlSerializer(type); - using (StringReader reader = new StringReader((string)data)) - { - object instance = serializer.Deserialize(reader); - return instance; - } -} -``` - -Users of these storage managers are not supposed to instantiate them directly. They use the `StorageManagerFactory` class, which abstracts from the storage manager creation details. This class has one static member, `GetStorageManager`, which creates an instance of a given storage manager type. If the type parameter is `null`, this method creates an instance of the default `SqlServerStorageManager` class and returns it. It also validates the given type to make sure that it implements the `IStorageManager` interface. - -```csharp -public static IStorageManager GetStorageManager(Type storageManagerType) -{ -IStorageManager storageManager = null; - -if (storageManagerType == null) -{ - return new SqlServerStorageManager(); -} -else -{ - object obj = Activator.CreateInstance(storageManagerType); - - // Throw if the specified storage manager type does not - // implement IStorageManager. - if (obj is IStorageManager) - { - storageManager = (IStorageManager)obj; - } - else - { - throw new InvalidOperationException( - ResourceHelper.GetString("ExInvalidStorageManager")); - } - - return storageManager; -} -} -``` - -The necessary infrastructure to read and write instances from the persistent storage is implemented. Now the necessary steps to change the service behavior have to be taken. - -As the first step of this process we have to save the context ID, which came through the channel layer to the current InstanceContext. InstanceContext is a runtime component that acts as the link between the WCF dispatcher and the service instance. It can be used to provide additional state and behavior to the service instance. This is essential because in sessionful communication the context ID is sent only with the first message. - -WCF allows extending its InstanceContext runtime component by adding a new state and behavior using its extensible object pattern. The extensible object pattern is used in WCF to either extend existing runtime classes with new functionality or to add new state features to an object. There are three interfaces in the extensible object pattern - IExtensibleObject\, IExtension\, and IExtensionCollection\: - -- The IExtensibleObject\ interface is implemented by objects that allow extensions that customize their functionality. - -- The IExtension\ interface is implemented by objects that are extensions of classes of type T. - -- The IExtensionCollection\ interface is a collection of IExtensions that allows for retrieving IExtensions by their type. - -Therefore an InstanceContextExtension class should be created that implements the IExtension interface and defines the required state to save the context ID. This class also provides the state to hold the storage manager being used. Once the new state is saved, it should not be possible to modify it. Therefore the state is provided and saved to the instance at the time it is being constructed and then only accessible using read-only properties. - -```csharp -// Constructor -public DurableInstanceContextExtension(string contextId, - IStorageManager storageManager) -{ - this.contextId = contextId; - this.storageManager = storageManager; -} - -// Read only properties -public string ContextId -{ - get { return this.contextId; } -} - -public IStorageManager StorageManager -{ - get { return this.storageManager; } -} -``` - -The InstanceContextInitializer class implements the IInstanceContextInitializer interface and adds the instance context extension to the Extensions collection of the InstanceContext being constructed. - -```csharp -public void Initialize(InstanceContext instanceContext, Message message) -{ - string contextId = - (string)message.Properties[DurableInstanceContextUtility.ContextIdProperty]; - - DurableInstanceContextExtension extension = - new DurableInstanceContextExtension(contextId, - storageManager); - instanceContext.Extensions.Add(extension); -} -``` - -As described earlier the context ID is read from the `Properties` collection of the `Message` class and passed to the constructor of the extension class. This demonstrates how information can be exchanged between the layers in a consistent manner. - -The next important step is overriding the service instance creation process. WCF allows implementing custom instantiation behaviors and hooking them up to the runtime using the IInstanceProvider interface. The new `InstanceProvider` class is implemented to do that job. The service type expected from the instance provider is accepted in the constructor. Later this is used to create new instances. In the `GetInstance` implementation, an instance of a storage manager is created looking for a persisted instance. If it returns `null`, then a new instance of the service type is instantiated and returned to the caller. - -```csharp -public object GetInstance(InstanceContext instanceContext, Message message) -{ - object instance = null; - - DurableInstanceContextExtension extension = - instanceContext.Extensions.Find(); - - string contextId = extension.ContextId; - IStorageManager storageManager = extension.StorageManager; - - instance = storageManager.GetInstance(contextId, serviceType); - - instance ??= Activator.CreateInstance(serviceType); - return instance; -} -``` - -The next important step is to install the `InstanceContextExtension`, `InstanceContextInitializer`, and `InstanceProvider` classes into the service model runtime. A custom attribute could be used to mark the service implementation classes to install the behavior. The `DurableInstanceContextAttribute` contains the implementation for this attribute and it implements the `IServiceBehavior` interface to extend the entire service runtime. - -This class has a property that accepts the type of the storage manager to be used. In this way, the implementation enables the users to specify their own `IStorageManager` implementation as parameter of this attribute. - -In the `ApplyDispatchBehavior` implementation, the `InstanceContextMode` of the current `ServiceBehavior` attribute is being verified. If this property is set to Singleton, enabling durable instancing is not possible and an `InvalidOperationException` is thrown to notify the host. - -```csharp -ServiceBehaviorAttribute serviceBehavior = - serviceDescription.Behaviors.Find(); - -if (serviceBehavior != null && - serviceBehavior.InstanceContextMode == InstanceContextMode.Single) -{ - throw new InvalidOperationException( - ResourceHelper.GetString("ExSingletonInstancingNotSupported")); -} -``` - -After this the instances of the storage manager, instance context initializer, and the instance provider are created and installed in the `DispatchRuntime` created for every endpoint. - -```csharp -IStorageManager storageManager = - StorageManagerFactory.GetStorageManager(storageManagerType); - -InstanceContextInitializer contextInitializer = - new InstanceContextInitializer(storageManager); - -InstanceProvider instanceProvider = - new InstanceProvider(description.ServiceType); - -foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers) -{ - ChannelDispatcher cd = cdb as ChannelDispatcher; - - if (cd != null) - { - foreach (EndpointDispatcher ed in cd.Endpoints) - { - ed.DispatchRuntime.InstanceContextInitializers.Add(contextInitializer); - ed.DispatchRuntime.InstanceProvider = instanceProvider; - } - } -} -``` - -In summary so far, this sample has produced a channel that enabled the custom wire protocol for custom context ID exchange and it also overwrites the default instancing behavior to load the instances from the persistent storage. - -What is left is a way to save the service instance to the persistent storage. As discussed previously, there is already the required functionality to save the state in an `IStorageManager` implementation. We now must integrate this with the WCF runtime. Another attribute is required that is applicable to the methods in the service implementation class. This attribute is supposed to be applied to the methods that change the state of the service instance. - -The `SaveStateAttribute` class implements this functionality. It also implements `IOperationBehavior` class to modify the WCF runtime for each operation. When a method is marked with this attribute, the WCF runtime invokes the `ApplyBehavior` method while the appropriate `DispatchOperation` is being constructed. There is a single line of code in this method implementation: - -```csharp -dispatch.Invoker = new OperationInvoker(dispatch.Invoker); -``` - -This instruction creates an instance of `OperationInvoker` type and assigns it to the `Invoker` property of the `DispatchOperation` being constructed. The `OperationInvoker` class is a wrapper for the default operation invoker created for the `DispatchOperation`. This class implements the `IOperationInvoker` interface. In the `Invoke` method implementation, the actual method invocation is delegated to the inner operation invoker. However, before returning the results the storage manager in the `InstanceContext` is used to save the service instance. - -```csharp -object result = innerOperationInvoker.Invoke(instance, - inputs, out outputs); - -// Save the instance using the storage manager saved in the -// current InstanceContext. -InstanceContextExtension extension = - OperationContext.Current.InstanceContext.Extensions.Find(); - -extension.StorageManager.SaveInstance(extension.ContextId, instance); -return result; -``` - -## Using the Extension - -Both the channel layer and service model layer extensions are done and they can now be used in WCF applications. Services must add the channel into the channel stack using a custom binding and then mark the service implementation classes with the appropriate attributes. - -```csharp -[DurableInstanceContext] -[ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)] -public class ShoppingCart : IShoppingCart -{ -//… - [SaveState] - public int AddItem(string item) - { - //… - } -//… - } -``` - -Client applications must add the DurableInstanceContextChannel into the channel stack using a custom binding. To configure the channel declaratively in the configuration file, the binding element section has to be added to the binding element extensions collection. - -```xml - - - - - - - -``` - -Now the binding element can be used with a custom binding just like other standard binding elements: - -```xml - - - - - - - - - - -``` - -## Conclusion - -This sample showed how to create a custom protocol channel and how to customize the service behavior to enable it. - -The extension can be further improved by letting users specify the `IStorageManager` implementation using a configuration section. This makes it possible to modify the backing store without recompiling the service code. - -Furthermore you could try to implement a class (for example, `StateBag`), which encapsulates the state of the instance. That class is responsible for persisting the state whenever it changes. This way you can avoid using the `SaveState` attribute and perform the persisting work more accurately (for example, you could persist the state when the state is actually changed rather than saving it each time when a method with the `SaveState` attribute is called). - -When you run the sample, the following output is displayed. The client adds two items to its shopping cart and then gets the list of items in its shopping cart from the service. Press ENTER in each console window to shut down the service and client. - -```console -Enter the name of the product: apples -Enter the name of the product: bananas - -Shopping cart currently contains the following items. -apples -bananas -Press ENTER to shut down client -``` - -> [!NOTE] -> Rebuilding the service overwrites the database file. To observe state preserved across multiple runs of the sample, be sure not to rebuild the sample between runs. - -#### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!NOTE] -> You must be running SQL Server 2005 or SQL Express 2005 to run this sample. If you are running SQL Server 2005, you must modify the configuration of the service's connection string. When running cross-machine, SQL Server is only required on the server machine. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Instancing\Durable` diff --git a/docs/framework/wcf/samples/durable-issued-token-provider.md b/docs/framework/wcf/samples/durable-issued-token-provider.md deleted file mode 100644 index e7aa3498c0e65..0000000000000 --- a/docs/framework/wcf/samples/durable-issued-token-provider.md +++ /dev/null @@ -1,255 +0,0 @@ ---- -description: "Learn more about: Durable Issued Token Provider" -title: "Durable Issued Token Provider" -ms.date: "03/30/2017" -ms.assetid: 76fb27f5-8787-4b6a-bf4c-99b4be1d2e8b ---- -# Durable Issued Token Provider - -This sample demonstrates how to implement a custom client issued token provider. - -## Discussion - - A token provider in Windows Communication Foundation (WCF) is used to supply credentials to the security infrastructure. The token provider in general examines the target and issues appropriate credentials so that the security infrastructure can secure the message. WCF ships with a CardSpace token provider. Custom token providers are useful in the following cases: - -- If you have a credential store that the built-in token provider cannot operate with. - -- If you want to provide your own custom mechanism for transforming the credentials from the point when the user provides the details to when the WCF client uses the credentials. - -- If you are building a custom token. - - This sample shows how to build a custom token provider that caches tokens issued by a Security Token Service (STS). - - To summarize, this sample demonstrates the following: - -- How a client can be configured with a custom token provider. - -- How issued tokens can be cached and provided to the WCF client. - -- How the server is authenticated by the client using the server's X.509 certificate. - - This sample consists of a client console program (Client.exe), a security token service console program (Securitytokenservice.exe) and a service console program (Service.exe). The service implements a contract that defines a request-reply communication pattern. The contract is defined by the `ICalculator` interface, which exposes math operations (add, subtract, multiply, and divide). The client gets a security token from the Security Token Service (STS) and makes synchronous requests to the service for a given math operation and the service replies with the result. Client activity is visible in the console window. - -> [!NOTE] -> The set-up procedure and build instructions for this sample are located at the end of this topic. - - This sample exposes the ICalculator contract using the [\](../../configure-apps/file-schema/wcf/wshttpbinding.md). The configuration of this binding on the client is shown in the following code. - -```xml - - - - - - - - - - - -``` - - On the `security` element of `wsFederationHttpBinding`, the `mode` value configures which security mode should be used. In this sample, messages security is being used, which is why the `message` element of `wsFederationHttpBinding` is specified inside the `security` element of `wsFederationHttpBinding`. The `issuer` element of `wsFederationHttpBinding` inside the `message` element of `wsFederationHttpBinding` specifies the address and binding for the Security Token Service that issues a security token to the client so that the client can authenticate to the Calculator service. - - The configuration of this binding on the service is shown in the following code. - -```xml - - - - - - - - - - - - - - - -``` - - On the `security` element of `wsFederationHttpBinding`, the `mode` value configures which security mode should be used. In this sample, messages security is being used, which is why the `message` element of `wsFederationHttpBinding` is specified inside the `security` element of `wsFederationHttpBinding`. The `issuerMetadata` element of `wsFederationHttpBinding` inside the `message` element of `wsFederationHttpBinding` specifies the address and identity for an endpoint that can be used to retrieve metadata for the Security Token Service. - - The behavior for the service is shown in the following code. - -```xml - - - - - - - - - - - - -``` - - The `issuedTokenAuthentication` element inside the `serviceCredentials` element allows the service to specify constraints on the tokens it allows clients to present during authentication. This configuration specifies that tokens signed by a certificate whose Subject Name is CN=STS are accepted by the service. - - The Security Token Service exposes a single endpoint using the standard wsHttpBinding. The Security Token Service responds to request from clients for tokens and, provided the client authenticates using a Windows account, issues a token that contains the client's user name as a claim in the issued token. As part of creating the token, the Security Token Service signs the token using the private key associated with the CN=STS certificate. In addition, it creates a symmetric key and encrypts it using the public key associated with the CN=localhost certificate. In returning the token to the client, the Security Token Service also returns the symmetric key. The client presents the issued token to the Calculator service, and proves that it knows the symmetric key by signing the message with that key. - -## Custom Client Credentials and Token Provider - - The following steps show how to develop a custom token provider that caches issued tokens and integrate it with WCF: security. - -### To develop a custom token provider - -1. Write a custom token provider. - - The sample implements a custom token provider that returns a security token retrieved from a cache. - - To perform this task, the custom token provider derives the class and overrides the method. This method tries to get a token from the cache, or if a token cannot be found in the cache, retrieves a token from the underlying provider and then caches that token. In both cases the method returns a `SecurityToken`. - - ```csharp - protected override SecurityToken GetTokenCore(TimeSpan timeout) - { - GenericXmlSecurityToken token; - if (!this.cache.TryGetToken(target, issuer, out token)) - { - token = (GenericXmlSecurityToken) this.innerTokenProvider.GetToken(timeout); - this.cache.AddToken(token, target, issuer); - } - return token; - } - ``` - -2. Write custom security token manager. - - The is used to create a for a specific that is passed to it in the `CreateSecurityTokenProvider` method. Security token manager is also used to create token authenticators and token serializers, but those are not covered by this sample. In this sample, the custom security token manager inherits from the class and overrides the `CreateSecurityTokenProvider` method to return the custom token provider when the passed token requirements indicate that an issued token is requested. - - ```csharp - class DurableIssuedTokenClientCredentialsTokenManager : - ClientCredentialsSecurityTokenManager - { - IssuedTokenCache cache; - - public DurableIssuedTokenClientCredentialsTokenManager ( DurableIssuedTokenClientCredentials creds ): base(creds) - { - this.cache = creds.IssuedTokenCache; - } - - public override SecurityTokenProvider CreateSecurityTokenProvider ( SecurityTokenRequirement tokenRequirement ) - { - if (IsIssuedSecurityTokenRequirement(tokenRequirement)) - { - return new DurableIssuedSecurityTokenProvider ((IssuedSecurityTokenProvider)base.CreateSecurityTokenProvider( tokenRequirement), this.cache); - } - else - { - return base.CreateSecurityTokenProvider(tokenRequirement); - } - } - } - ``` - -3. Write a custom client credential. - - A client credentials class is used to represent the credentials that are configured for the client proxy and creates the security token manager that is used to obtain token authenticators, token providers and token serializers. - - ```csharp - public class DurableIssuedTokenClientCredentials : ClientCredentials - { - IssuedTokenCache cache; - - public DurableIssuedTokenClientCredentials() : base() - { - } - - DurableIssuedTokenClientCredentials ( DurableIssuedTokenClientCredentials other) : base(other) - { - this.cache = other.cache; - } - - public IssuedTokenCache IssuedTokenCache - { - get - { - return this.cache; - } - set - { - this.cache = value; - } - } - - protected override ClientCredentials CloneCore() - { - return new DurableIssuedTokenClientCredentials(this); - } - - public override SecurityTokenManager CreateSecurityTokenManager() - { - return new DurableIssuedTokenClientCredentialsTokenManager ((DurableIssuedTokenClientCredentials)this.Clone()); - } - } - ``` - -4. Implement the token cache. The sample implementation uses an abstract base class through which consumers of a given token cache interact with the cache. - - ```csharp - public abstract class IssuedTokenCache - { - public abstract void AddToken ( GenericXmlSecurityToken token, EndpointAddress target, EndpointAddress issuer); - public abstract bool TryGetToken(EndpointAddress target, EndpointAddress issuer, out GenericXmlSecurityToken cachedToken); - } - // Configure the client to use the custom client credential. - ``` - - For the client to use the custom client credential, the sample deletes the default client credential class and supplies the new client credential class. - - ```csharp - clientFactory.Endpoint.Behaviors.Remove(); - DurableIssuedTokenClientCredentials durableCreds = new DurableIssuedTokenClientCredentials(); - durableCreds.IssuedTokenCache = cache; - durableCreds.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.PeerOrChainTrust; - clientFactory.Endpoint.Behaviors.Add(durableCreds); - ``` - -## Running the sample - - See the following instructions to run the sample. When you run the sample, the request for the security token is shown in the Security Token Service console window. The operation requests and responses are displayed in the client and service console windows. Press ENTER in any of the console windows to shut down the application. - -## The Setup.cmd Batch File - - The Setup.cmd batch file included with this sample allows you to configure the server and security token service with relevant certificates to run a self-hosted application. The batch file creates two certificates both in the CurrentUser/TrustedPeople certificate store. The first certificate has a subject name of CN=STS and is used by the Security Token Service to sign the security tokens that it issues to the client. The second certificate has a subject name of CN=localhost and is used by the Security Token Service to encrypt a secret so that the service can decrypt it. - -### To set up, build, and run the sample - -1. Run the Setup.cmd file to create the required certificates. - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). Ensure that all the projects in the solution are built (Shared, RSTRSTR, Service, SecurityTokenService, and Client). - -3. Ensure that Service.exe and SecurityTokenService.exe are both running with administrator privileges. - -4. Run Client.exe. - -### To clean up after the sample - -1. Run Cleanup.cmd in the samples folder once you have finished running the sample. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Security\DurableIssuedTokenProvider` diff --git a/docs/framework/wcf/samples/etw-tracing.md b/docs/framework/wcf/samples/etw-tracing.md deleted file mode 100644 index 63d3e5262b9eb..0000000000000 --- a/docs/framework/wcf/samples/etw-tracing.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -title: "ETW Tracing" -description: This sample demonstrates how to implement End-to-End (E2E) tracing using Event Tracing for Windows (ETW) and the ETWTraceListener. -ms.date: "03/30/2017" -ms.assetid: ac99a063-e2d2-40cc-b659-d23c2f783f92 ---- -# ETW Tracing - -This sample demonstrates how to implement End-to-End (E2E) tracing using Event Tracing for Windows (ETW) and the `ETWTraceListener` that is provided with this sample. The sample is based on the [Getting Started](getting-started-sample.md) and includes ETW tracing. - -> [!NOTE] -> The set-up procedure and build instructions for this sample are located at the end of this topic. - - This sample assumes that you are familiar with [Tracing and Message Logging](tracing-and-message-logging.md). - - Each trace source in the tracing model can have multiple trace listeners that determine where and how the data is traced. The type of listener defines the format in which trace data is logged. The following code sample shows how to add the listener to configuration. - -```xml - - - - - - - - - - - - - - - - - - - -``` - - Before using this listener, an ETW Trace Session must be started. This session can be started by using Logman.exe or Tracelog.exe. A SetupETW.bat file is included with this sample so that you can set up the ETW Trace Session along with a CleanupETW.bat file for closing the session and completing the log file. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. For more information about these tools, see - - When using the ETWTraceListener, traces are logged in binary .etl files. With ServiceModel tracing turned on, all generated traces appear in the same file. Use [Service Trace Viewer Tool (SvcTraceViewer.exe)](../service-trace-viewer-tool-svctraceviewer-exe.md) for viewing .etl and .svclog log files. The viewer creates an end-to-end view of the system that makes it possible to trace a message from its source to its destination and point of consumption. - - The ETW Trace Listener supports circular logging. To enable this feature, go to **Start**, **Run** and type `cmd` to start a command console. In the following command, replace the `` parameter with the name of your log file. - -```console -logman create trace Wcf -o -p "{411a0819-c24b-428c-83e2-26b41091702e}" -f bincirc -max 1000 -``` - - The `-f` and `-max` switches are optional. They specify the binary circular format and max log size of 1000MB respectively. The `-p` switch is used to specify the trace provider. In our example, `"{411a0819-c24b-428c-83e2-26b41091702e}"` is the GUID for "XML ETW Sample Provider". - - To start the session, type in the following command. - -```console -logman start Wcf -``` - - After you have finished logging, you can stop the session with the following command. - -```console -logman stop Wcf -``` - - This process generates binary circular logs that you can process with your tool of choice, including [Service Trace Viewer Tool (SvcTraceViewer.exe)](../service-trace-viewer-tool-svctraceviewer-exe.md) or Tracerpt. - - You can also review the [Circular Tracing](circular-tracing.md) sample for more information on an alternative listener to perform circular logging. - -### To set up, build, and run the sample - -1. Be sure you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - - > [!NOTE] - > To use the RegisterProvider.bat, SetupETW.bat and CleanupETW.bat commands, you must run under a local administrator account. If you are using Windows Vista or later, you must also run the command prompt with elevated privileges. To do so, right-click the command prompt icon, then click **Run as administrator**. - -3. Before running the sample, run RegisterProvider.bat on the client and server. This sets up the resulting ETWTracingSampleLog.etl file to generate traces that can be read by the Service Trace Viewer. This file can be found in the C:\logs folder. If this folder does not exist, it must be created or no traces are generated. Then, run SetupETW.bat on the client and server computers to begin the ETW Trace Session. The SetupETW.bat file can be found under the CS\Client folder. - -4. To run the sample in a single- or cross-computer configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -5. When the sample is completed, run CleanupETW.bat to complete the creation of the ETWTracingSampleLog.etl file. - -6. Open the ETWTracingSampleLog.etl file from within the Service Trace Viewer. You will be prompted to save the binary formatted file as a .svclog file. - -7. Open the newly created .svclog file from within the Service Trace Viewer to view the ETW and ServiceModel traces. - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Management\AnalyticTrace` - -## See also - -- [AppFabric Monitoring Samples](/previous-versions/appfabric/ff383407(v=azure.10)) diff --git a/docs/framework/wcf/samples/expected-exceptions.md b/docs/framework/wcf/samples/expected-exceptions.md deleted file mode 100644 index fa70a24e04171..0000000000000 --- a/docs/framework/wcf/samples/expected-exceptions.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -description: "Learn more about: Expected Exceptions" -title: "Expected Exceptions" -ms.date: "03/30/2017" -ms.assetid: 299a6987-ae6b-43c6-987f-12b034b583ae ---- -# Expected Exceptions - -This sample demonstrates how to catch expected exceptions when using a typed client. This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. In this sample, the client is a console application (.exe) and the service is hosted by Internet Information Services (IIS). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - This sample demonstrates catching and handling the two expected exception types that correct programs must handle: `TimeoutException` and `CommunicationException`. - - Exceptions that are thrown from communication methods on a Windows Communication Foundation (WCF) client are either expected or unexpected. Unexpected exceptions include catastrophic failures like `OutOfMemoryException` and programming errors like `ArgumentNullException` or `InvalidOperationException`. Typically there is no useful way to handle unexpected errors, so typically you should not catch them when calling a WCF client communication method. - - Expected exceptions from communication methods on a WCF client include `TimeoutException`, `CommunicationException`, and any derived class of `CommunicationException`. These indicate a problem during communication that can be safely handled by aborting the WCF client and reporting a communication failure. Because external factors can cause these errors in any application, correct applications must catch these exceptions and recover when they occur. - - There are several derived classes of `CommunicationException` that a client can throw. In some cases, applications also catch some of these to do special handling, but let the others be handled as a `CommunicationException`. This can be accomplished by catching the more specific exception type first and then catching `CommunicationException` in a later catch-clause. - - Code that calls a client communication method must catch the `TimeoutException` and `CommunicationException`. One way to handle such errors is to abort the client and report the communication failure. - -```csharp -try -{ - ... - double result = client.Add(value1, value2); - ... - client.Close(); -} -catch (TimeoutException exception) -{ - Console.WriteLine("Got {0}", exception.GetType()); - client.Abort(); -} -catch (CommunicationException exception) -{ - Console.WriteLine("Got {0}", exception.GetType()); - client.Abort(); -} -``` - - If an expected exception occurs, the client may or may not be usable afterwards. To determine if the client is still usable, check that the `State` property is `CommunicationState`.Opened. If it is still opened, then it is still usable. Otherwise you should abort the client and release all references to it. - -> [!CAUTION] -> You may observe that clients that have a session are often no longer usable after an exception, and clients that do not have a session are often still usable after an exception. However, neither of these is guaranteed, so if you want to try to continue using the client after an exception your application should check the `State` property to verify the client is still opened. - - When you run the sample, the operation responses and exceptions are displayed in the client console window. - - The client process runs two scenarios, each of which attempts to call `Add` followed by `Divide`. The first scenario simulates a network issue by aborting the client before making the call to `Divide`. The second scenario causes a timeout condition by setting the timeout too short for the method to complete. The expected output from the client process is: - -```output -Add(100,15.99) = 115.99 -Simulated network problem occurs... -Got System.ServiceModel.CommunicationObjectAbortedException -Add(100,15.99) = 115.99 -Set timeout too short for method to complete... -Got System.TimeoutException -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Client\ExpectedExceptions` diff --git a/docs/framework/wcf/samples/extended-protection-policy.md b/docs/framework/wcf/samples/extended-protection-policy.md deleted file mode 100644 index 63565d56ee795..0000000000000 --- a/docs/framework/wcf/samples/extended-protection-policy.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -description: "Learn more about: Extended Protection Policy" -title: "Extended Protection Policy" -ms.date: "03/30/2017" -ms.assetid: e2616a10-317e-4c34-8023-0c015a80a82f ---- -# Extended Protection Policy - -Extended Protection is a security initiative for protecting against man-in-the-middle (MITM) attacks. A MITM attack is a security threat in which a MITM takes a client’s credentials and forwards it to a server. - -## Demonstrates - - Extended protection - -## Discussion - - When applications authenticate using Kerberos, Digest or NTLM using HTTPS, a Transport Level Security (TLS) channel is first established and then authentication takes place using the secure channel. However, there is no binding between the session key generated by SSL and the session key generated during authentication. Any MITM can establish itself between the client and the server and start forwarding the requests from the client, even when the transport channel itself is secure, because the server has no way of knowing whether the secure channel has been established from the client or a MITM. The solution in this scenario is to bind the outer TLS channel with the inner authentication channel such that the server can detect if there is a MITM. - -> [!NOTE] -> This sample only works when hosted on IIS and cannot work on Cassini – Visual Studio Development Server because Cassini does not support HTTPS. - -> [!NOTE] -> This feature is currently only available on Windows 7. The following steps are specific to Windows 7. - -#### To set up, build, and run the sample - -1. Install Internet Information Services from **Control Panel**, **Add/Remove Programs**, **Windows Features**. - -2. Install **Windows Authentication** in **Windows Features**, **Internet Information Services**, **World Wide Web Services**, **Security**, and **Windows Authentication**. - -3. Install **Windows Communication Foundation HTTP Activation** in **Windows Features**, **Microsoft .NET Framework 3.5.1**, and **Windows Communication Foundation HTTP Activation**. - -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. - - 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. - -6. Build the service. This creates a virtual directory in IIS, and copies the .dll, .svc and .config files as required for the service to be Web hosted. - -7. Open IIS Manager. Right-click the virtual directory (**ExtendedProtection**), which was created in the preceding step. Select **Convert to Application**. - -8. Open the **Authentication** module in IIS Manager for this virtual directory and enable **Windows Authentication**. - -9. Open **Advanced Settings** under **Windows Authentication** for this virtual directory and set it to **Required**. - -10. You can test the service by accessing the HTTPS URL from a browser window (Provide a fully-qualified domain name). If you want to access this URL from a remote machine, make sure that the firewall is opened for all incoming HTTP and HTTPS connections. - -11. Open the client configuration file and provide a fully-qualified domain name for the client or endpoint address attribute that replaces `<>`. - -12. Run the client. The client communicates with the service, which establishes a secure channel and uses extended protection. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Security\ExtendedProtection` diff --git a/docs/framework/wcf/samples/extending-control-over-error-handling-and-reporting.md b/docs/framework/wcf/samples/extending-control-over-error-handling-and-reporting.md deleted file mode 100644 index 1b5a5f3fb6e18..0000000000000 --- a/docs/framework/wcf/samples/extending-control-over-error-handling-and-reporting.md +++ /dev/null @@ -1,155 +0,0 @@ ---- -description: "Learn more about: Extending Control Over Error Handling and Reporting" -title: "Extending Control Over Error Handling and Reporting" -ms.date: "03/30/2017" -ms.assetid: 45f996a7-fa00-45cb-9d6f-b368f5778aaa ---- -# Extending Control Over Error Handling and Reporting - -This sample demonstrates how to extend control over error handling and error reporting in a Windows Communication Foundation (WCF) service using the interface. The sample is based on the [Getting Started](getting-started-sample.md) with some additional code added to the service to handle errors. The client forces several error conditions. The service intercepts the errors and logs them in a file. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - Services can intercept errors, perform processing, and affect how errors are reported using the interface. The interface has two methods that can be implemented: and . The method allows you to add, modify, or suppress a fault message that is generated in response to an exception. The method allows error processing to take place in the event of an error and controls whether additional error handling can run. - - In this sample, the `CalculatorErrorHandler` type implements the interface. In the - - method, the `CalculatorErrorHandler` writes a log of the error to an Error.txt text file in c:\logs. Note that the sample logs the fault and does not suppress it, allowing it to be reported back to the client. - -```csharp -public class CalculatorErrorHandler : IErrorHandler -{ - // Provide a fault. The Message fault parameter can be replaced, or set to - // null to suppress reporting a fault. - - public void ProvideFault(Exception error, MessageVersion version, ref Message fault) - { - } - - // HandleError. Log an error, then allow the error to be handled as usual. - // Return true if the error is considered as already handled - - public bool HandleError(Exception error) - { - using (TextWriter tw = File.AppendText(@"c:\logs\error.txt")) - { - if (error != null) - { - tw.WriteLine("Exception: " + error.GetType().Name + " - " + error.Message); - } - tw.Close(); - } - return true; - } -} -``` - - The `ErrorBehaviorAttribute` exists as a mechanism to register an error handler with a service. This attribute takes a single type parameter. That type should implement the interface and should have a public, empty constructor. The attribute then instantiates an instance of that error handler type and installs it into the service. It does this by implementing the interface and then using the method to add instances of the error handler to the service. - -```csharp -// This attribute can be used to install a custom error handler for a service. -public class ErrorBehaviorAttribute : Attribute, IServiceBehavior -{ - Type errorHandlerType; - - public ErrorBehaviorAttribute(Type errorHandlerType) - { - this.errorHandlerType = errorHandlerType; - } - - void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase) - { - } - - void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection endpoints, BindingParameterCollection parameters) - { - } - - void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase) - { - IErrorHandler errorHandler; - - try - { - errorHandler = (IErrorHandler)Activator.CreateInstance(errorHandlerType); - } - catch (MissingMethodException e) - { - throw new ArgumentException("The errorHandlerType specified in the ErrorBehaviorAttribute constructor must have a public empty constructor.", e); - } - catch (InvalidCastException e) - { - throw new ArgumentException("The errorHandlerType specified in the ErrorBehaviorAttribute constructor must implement System.ServiceModel.Dispatcher.IErrorHandler.", e); - } - - foreach (ChannelDispatcherBase channelDispatcherBase in serviceHostBase.ChannelDispatchers) - { - ChannelDispatcher channelDispatcher = channelDispatcherBase as ChannelDispatcher; - channelDispatcher.ErrorHandlers.Add(errorHandler); - } - } -} -``` - - The sample implements a calculator service. The client deliberately causes two errors to occur on the service by providing parameters with illegal values. The `CalculatorErrorHandler` uses the interface to log the errors to a local file and then allows them to be reported back to the client. The client forces a divide by zero and an argument-out-of-range condition. - -```csharp -try -{ - Console.WriteLine("Forcing an error in Divide"); - // Call the Divide service operation - trigger a divide by 0 error. - value1 = 22; - value2 = 0; - result = proxy.Divide(value1, value2); - Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result); -} -catch (FaultException e) -{ - Console.WriteLine("FaultException: " + e.GetType().Name + " - " + e.Message); -} -catch (Exception e) -{ - Console.WriteLine("Exception: " + e.GetType().Name + " - " + e.Message); -} -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. You see the division by zero and the argument-out-of-range conditions being reported as faults. Press ENTER in the client window to shut down the client. - -```console -Add(15,3) = 18 -Subtract(145,76) = 69 -Multiply(9,81) = 729 -Forcing an error in Divide -FaultException: FaultException - Invalid Argument: The second argument must not be zero. -Forcing an error in Factorial -FaultException: FaultException - Invalid Argument: The argument must be greater than zero. - -Press to terminate client. -``` - - The file c:\logs\errors.txt contains the information logged about the errors by the service. Note that for the service to write to the directory you must make sure that the process under which the service is running (typically ASP.NET or Network Service) has permission to write to the directory. - -```txt -Fault: Reason = Invalid Argument: The second argument must not be zero. -Fault: Reason = Invalid Argument: The argument must be greater than zero. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. Ensure you have created the c:\logs directory for the error.txt file. Or modify the file name used in `CalculatorErrorHandler.HandleError`. - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\ErrorHandling` diff --git a/docs/framework/wcf/samples/extending-tracing.md b/docs/framework/wcf/samples/extending-tracing.md deleted file mode 100644 index 6a4f7d1dbb66a..0000000000000 --- a/docs/framework/wcf/samples/extending-tracing.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -description: "Learn more about: Extend tracing" -title: "Extending Tracing" -ms.date: "03/30/2017" -ms.assetid: 2b971a99-16ec-4949-ad2e-b0c8731a873f ---- -# Extend tracing - -This sample demonstrates how to extend the Windows Communication Foundation (WCF) tracing feature by writing user-defined activity traces in client and service code. Writing user-defined activity traces allows the user to create trace activities and group traces into logical units of work. It is also possible to correlate activities through transfers (within the same endpoint) and propagation (across endpoints). In this sample, tracing is enabled for both the client and the service. For more information about how to enable tracing in client and service configuration files, see [Tracing and Message Logging](tracing-and-message-logging.md). - - This sample is based on the [Getting Started](getting-started-sample.md). - -> [!NOTE] -> The set-up procedure and build instructions for this sample are located at the end of this topic. - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Management\ExtendingTracing` - -## Tracing and Activity Propagation - - User-defined activity tracing allows the user to create their own trace activities to group traces into logical units of work, correlate activities through transfers and propagation, and lessen the performance cost of WCF tracing (for example, the disk space cost of a log file). - -### Add custom sources - - User-defined traces can be added to both client and service code. Adding trace sources to the client or service configuration files allows for these custom traces to be recorded and displayed in the [Service Trace Viewer Tool (SvcTraceViewer.exe)](../service-trace-viewer-tool-svctraceviewer-exe.md). The following code shows how to add a user-defined trace source named `ServerCalculatorTraceSource` to the configuration file. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.... -``` - -### Correlate activities - - To correlate activities directly across endpoints, the `propagateActivity` attribute must be set to `true` in the `System.ServiceModel` trace source. Also, to propagate traces without going through WCF activities, ServiceModel Activity Tracing must be turned off. This can be seen in the following code example. - -> [!NOTE] -> Turning off ServiceModel Activity Tracing is not the same as having the trace level, denoted by the `switchValue` property, set to off. - -```xml - - - - - ... - - - - -``` - -### Lessen performance cost - - Setting `ActivityTracing` to off in the `System.ServiceModel` trace source generates a trace file that contains only user-defined activity traces, without any of the ServiceModel activity traces included. Excluding ServiceModel activity traces results in a much smaller log file. However, the opportunity to correlate WCF processing traces is lost. - -## Set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-computer configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -## See also - -- [AppFabric Monitoring Samples](/previous-versions/appfabric/ff383407(v=azure.10)) diff --git a/docs/framework/wcf/samples/extensibility.md b/docs/framework/wcf/samples/extensibility.md deleted file mode 100644 index 9f6ae38edaf67..0000000000000 --- a/docs/framework/wcf/samples/extensibility.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -description: "Learn more about: Extensibility" -title: "Extensibility" -ms.date: "03/30/2017" -ms.assetid: cd7ddffc-a261-44aa-bd50-33c1c74f0df0 ---- -# Extensibility - -This section contains samples that deal with custom extensibility and other features of Windows Communication Foundation (WCF). - -## In This Section - - [Channels Extensibility](channels-extensibility.md) - Demonstrates custom channels. - - [Discovery Extensibility](/previous-versions/dotnet/netframework-4.0/dd807503(v%3dvs.100)) - Demonstrates custom discovery. - - [Instancing Extensibility](instancing-extensibility.md) - Demonstrates custom extensibility. - - [Interop Extensibility](interop-extensibility.md) - Demonstrates custom interoperability. - - [Message Encoder Extensibility](message-encoder-extensibility.md) - Demonstrates custom message encoding. - - [Metadata Extensibility](metadata-extensibility.md) - Demonstrates custom metadata. - - [Security Extensibility](security-extensibility.md) - Demonstrates custom security. - - [Syndication Extensibility Samples](syndication-extensibility-samples.md) - Demonstrates custom syndication. - - [Transport Extensibility](transport-extensibility.md) - Demonstrates custom transports. - - [Operation Formatter and Operation Selector](operation-formatter-and-operation-selector.md) - Demonstrates how extensibility points can consume custom message data formats. - - [Custom Message Filter](custom-message-filter.md) - demonstrates how to replace the message filters that Windows Communication Foundation (WCF) uses to dispatch messages to endpoints. - - [Custom Service Host](custom-service-host.md) - Demonstrates how to use a custom derivative of the class to alter the run-time behavior of a service. - - [DataContract Surrogate](datacontract-surrogate.md) - Demonstrates how processes like serialization, deserialization, schema export, and schema import can be customized using a data contract surrogate class. - - [Extending Control Over Error Handling and Reporting](extending-control-over-error-handling-and-reporting.md) - Demonstrates how to extend control over error handling and error reporting in a WCF service using the interface. - - [Message Inspectors](message-inspectors.md) - Demonstrates how to implement and configure client and service message inspectors. - - [WebContentTypeMapper](webcontenttypemapper-sample.md) - Demonstrates how to map new content types to WCF message body formats. diff --git a/docs/framework/wcf/samples/fault-contract.md b/docs/framework/wcf/samples/fault-contract.md deleted file mode 100644 index e3161f09ff232..0000000000000 --- a/docs/framework/wcf/samples/fault-contract.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -description: "Learn more about: Fault Contract" -title: "Fault Contract" -ms.date: "03/30/2017" -ms.assetid: b31b140e-dc3b-408b-b3c7-10b6fe769725 ---- -# Fault Contract - -The Fault Contract sample demonstrates how to communicate error information from a service to a client. The sample is based on the [Getting Started](getting-started-sample.md), with some additional code added to the service to convert an internal exception to a fault. The client attempts to perform division by zero to force an error condition on the service. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The calculator contract has been modified to include a as shown in the following sample code. - -```csharp -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] -public interface ICalculator -{ - [OperationContract] - int Add(int n1, int n2); - [OperationContract] - int Subtract(int n1, int n2); - [OperationContract] - int Multiply(int n1, int n2); - [OperationContract] - [FaultContract(typeof(MathFault))] - int Divide(int n1, int n2); -} -``` - - The attribute indicates that the `Divide` operation may return a fault of type `MathFault`. A fault can be of any type that can be serialized. In this case, the `MathFault` is a data contract, as follows: - -```csharp -[DataContract(Namespace="http://Microsoft.ServiceModel.Samples")] -public class MathFault -{ - private string operation; - private string problemType; - - [DataMember] - public string Operation - { - get { return operation; } - set { operation = value; } - } - - [DataMember] - public string ProblemType - { - get { return problemType; } - set { problemType = value; } - } -} -``` - - The `Divide` method throws a exception when a divide by zero exception occurs as shown in the following sample code. This exception results in a fault being sent to the client. - -```csharp -public int Divide(int n1, int n2) -{ - try - { - return n1 / n2; - } - catch (DivideByZeroException) - { - MathFault mf = new MathFault(); - mf.operation = "division"; - mf.problemType = "divide by zero"; - throw new FaultException(mf); - } -} -``` - - The client code forces an error by requesting a division by zero. When you run the sample, the operation requests and responses are displayed in the client console window. You see the division by zero being reported as a fault. Press ENTER in the client window to shut down the client. - -```console -Add(15,3) = 18 -Subtract(145,76) = 69 -Multiply(9,81) = 729 -FaultException: Math fault while doing division. Problem: divide by zero - -Press to terminate client. -``` - - The client does this by catching the appropriate `FaultException` exception: - -```csharp -catch (FaultException e) -{ - Console.WriteLine("FaultException: Math fault while doing " + e.Detail.operation + ". Problem: " + e.Detail.problemType); - client.Abort(); -} -``` - - By default, the details of unexpected exceptions are not sent to the client to prevent details of the service implementation from escaping the secure boundary of the service. `FaultContract` provides a way to describe faults in a contract and mark certain types of exceptions as appropriate for transmission to the client. `FaultException` provides the run-time mechanism for sending faults to consumers. - - However, it is useful to see the internal details of a service failure when debugging. To turn off the secure behavior previously described, you can indicate that the details of every unhandled exception on the server should be included in the fault that is sent to the client. This is accomplished by setting to `true`. You can either set it in code, or in configuration as shown in the following sample. - -```xml - - - - - - - - -``` - - Further, the behavior must be associated with the service by setting the `behaviorConfiguration` attribute of the service in the configuration file to "CalculatorServiceBehavior". - - To catch such faults on the client, the non-generic must be caught. - - This behavior should only be used for debugging purposes and should never be enabled in production. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Contract\Service\Faults` diff --git a/docs/framework/wcf/samples/federation-sample.md b/docs/framework/wcf/samples/federation-sample.md deleted file mode 100644 index 7dda1438562c4..0000000000000 --- a/docs/framework/wcf/samples/federation-sample.md +++ /dev/null @@ -1,115 +0,0 @@ ---- -description: "Learn more about: Federation Sample" -title: "Federation Sample" -ms.date: "03/30/2017" -ms.assetid: 7e9da0ca-e925-4644-aa96-8bfaf649d4bb ---- -# Federation Sample - -This sample demonstrates federated security. - -## Sample Details - - Windows Communication Foundation (WCF) provides support for deploying federated security architectures through the `wsFederationHttpBinding`. The `wsFederationHttpBinding` provides a secure, reliable, and interoperable binding that involves the use of HTTP as the underlying transport mechanism for request/reply communication, and Text/XML as the wire format for encoding. For more information about Federation in WCF, see [Federation](../feature-details/federation.md). - - The scenario is made up of 4 pieces: - -- BookStore service - -- BookStore STS - -- HomeRealm STS - -- BookStore Client - - The BookStore service supports two operations, `BrowseBooks` and `BuyBook`. It allows anonymous access to the `BrowseBooks` operation, but requires authenticated access to access the `BuyBooks` operation. The authentication takes the form of a token issued by the BookStore STS. The configuration file for the BookStore Service points clients to the BookStore STS using the `wsFederationHttpBinding`. - -```xml - - - - - - - - - - - - - - -``` - - The BookStore STS then requires that clients authenticate using a token issued by the HomeRealm STS. Again, the configuration file for the BookStore STS points clients to the HomeRealm STS using the `wsFederationHttpBinding`. - -```xml - - - - - - - - - - - - - - -``` - - The sequence of events when accessing the `BuyBook` operation is as follows: - -1. The client authenticates to the HomeRealm STS using Windows credentials. - -2. The HomeRealm STS issues a token that can be used to authenticate to the BookStore STS. - -3. The client authenticates to the BookStore STS using the token issued by the HomeRealm STS. - -4. The BookStore STS issues a token that can be used to authenticate to the BookStore Service. - -5. The client authenticates to the BookStore service using the token issued by the BookStore STS. - -6. The client accesses the `BuyBook` operation. - - See the following instructions about how to set up and run this sample. - -> [!NOTE] -> You must have Write permissions to the **wwwroot** directory to run this sample. - -#### To set up, build, and run the sample - -1. Open the SDK command window. In the sample path, run Setup.bat. This creates the virtual directories required for the sample and installs the required certificates with appropriate permissions. - - > [!NOTE] - > The Setup.bat batch file is designed to be run from a Windows SDK Command Prompt. It requires that the MSSDK environment variable point to the directory where the SDK is installed. This environment variable is automatically set within a Windows SDK Command Prompt. On Windows Vista, you must ensure that IIS 6.0 Management Compatibility is installed because the set up uses IIS administrator scripts. Running the set-up script on Windows Vista requires administrator privileges. - -2. Open FederationSample.sln in Visual Studio and select **Build Solution** from the **Build** menu. This builds the common project files, Bookstore service, Bookstore STS, HomeRealm STS, and deploys them in IIS. This also builds the Bookstore client application and places the executable BookStoreClient.exe in the FederationSample\BookStoreClient\bin\Debug folder. - -3. Double-click BookStoreClient.exe. The BookStoreClient window is displayed. - -4. You can browse the books available in the bookstore by clicking **Browse Books**. - -5. To purchase a particular book, select the book in the list and click **Buy Book**. The application starts up and authenticates using Windows authentication with the HomeRealm Security Token Service. - - The sample is configured to allow users to purchase books that cost $15 or less. Attempting to buy books that cost more than $15 results in the client getting an Access Denied message from the Book Store Service. - - > [!NOTE] - > The sample does not update the user’s credit limit after a purchase. You can repeatedly purchase books within the user’s (fixed) credit limit. - -#### To clean up - -1. Run Cleanup.bat. This deletes the virtual directories that were created during set up and also removes the certificates installed during setup. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Scenario\Federation` diff --git a/docs/framework/wcf/samples/feed-formatter-json.md b/docs/framework/wcf/samples/feed-formatter-json.md deleted file mode 100644 index 5782acf8a18d4..0000000000000 --- a/docs/framework/wcf/samples/feed-formatter-json.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -description: "Learn more about: Feed Formatter (JSON)" -title: "Feed Formatter (JSON)" -ms.date: "03/30/2017" -ms.assetid: f9c0b295-55e7-48ea-b308-ba51c7d31143 ---- -# Feed Formatter (JSON) - -This sample shows how to serialize an instance of a class in JavaScript Object Notation (JSON) format by using a custom and the . - -## Architecture of the Sample - - The sample implements a class named `JsonFeedFormatter` that inherits from . The `JsonFeedFormatter` class relies on the to read and write the data in JSON format. Internally, the formatter uses a custom set of data contract types named `JsonSyndicationFeed` and `JsonSyndicationItem` to control the format of the JSON data produced by the serializer. These implementation details are hidden from the end user, allowing calls to be made against the standard and classes. - -## Writing JSON feeds - - Writing a JSON feed can be accomplished by using the `JsonFeedFormatter` (implemented in this sample) with the as shown in the following sample code. - -```csharp -//Basic feed with sample data -SyndicationFeed feed = new SyndicationFeed("Custom JSON feed", "A Syndication extensibility sample", null); -feed.LastUpdatedTime = DateTime.Now; -feed.Items = from s in new string[] { "hello", "world" } -select new SyndicationItem() -{ - Summary = SyndicationContent.CreatePlaintextContent(s) -}; - -//Write the feed out to a MemoryStream in JSON format -DataContractJsonSerializer writeSerializer = new DataContractJsonSerializer(typeof(JsonFeedFormatter)); -writeSerializer.WriteObject(stream, new JsonFeedFormatter(feed)); -``` - -## Reading a JSON feed - - Obtaining a from a stream of JSON-formatted data can be accomplished with the `JsonFeedFormatter` as show in the following code. - - `//Read in the feed using the DataContractJsonSerializer` - - `DataContractJsonSerializer readSerializer = new DataContractJsonSerializer(typeof(JsonFeedFormatter));` - - `JsonFeedFormatter formatter = readSerializer.ReadObject(stream) as JsonFeedFormatter;` - - `SyndicationFeed feedRead = formatter.Feed;` - -#### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Syndication\JsonFeeds` diff --git a/docs/framework/wcf/samples/findprivatekey.md b/docs/framework/wcf/samples/findprivatekey.md deleted file mode 100644 index 566983dc5ccbd..0000000000000 --- a/docs/framework/wcf/samples/findprivatekey.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -description: "Learn more about: FindPrivateKey sample" -title: "FindPrivateKey sample" -ms.date: "12/04/2017" -helpviewer_keywords: - - "FindPrivateKey" -ms.assetid: 16b54116-0ceb-4413-af0c-753bb2a785a6 ---- -# FindPrivateKey sample - -It can be difficult to find the location and name of the private key file associated with a specific X.509 certificate in the certificate store. The FindPrivateKey.exe tool facilitates this process. - -> [!IMPORTANT] -> FindPrivateKey is a sample that needs to be compiled prior to use. See the [To build the FindPrivateKey project](#to-build-the-findprivatekey-project) section for instructions on how to build the FindPrivateKey tool. - -X.509 certificates are installed by an Administrator or any user in the machine. However, the certificate may be accessed by a service running under a different account. For example, the NETWORK SERVICE account. - -This account may not have access to the private key file because the certificate was not installed by it originally. The FindPrivateKey tool gives you the location of a given X.509 Certificate's private key file. You can add permissions or remove permissions to this file once you know the location of the particular X.509 certificates' private key file. - -The samples that use certificates for security use the FindPrivateKey tool in the *Setup.bat* file. Once the private key file has been found, you can use other tools such as *Cacls.exe* to set the appropriate access rights onto the file. - -When running a Windows Communication Foundation (WCF) service under a user account, such as a self-hosted executable, ensure that the user account has read-only access to the file. When running a WCF service under Internet Information Services (IIS) the default accounts that the service runs under are the NETWORK SERVICE on IIS 7 and earlier versions, or Application Pool Identity on IIS 7.5 and later versions. For more information, see [Application Pool Identities](/iis/manage/configuring-security/application-pool-identities). - -## Examples - -When accessing a certificate for which the process doesn't have read privilege, you see an exception message similar to the following example: - -```output -System.ArgumentException was unhandled -Message="The certificate 'CN=localhost' must have a private key that is capable of key exchange. The process must have access rights for the private key." -Source="System.ServiceModel" -``` - -When this occurs, use the FindPrivateKey tool to find the private key file, and then set the access right for the process that the service is running under. For example, this can be done with the Cacls.exe tool as shown in the following example: - -```console -cacls.exe "C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys\8aeda5eb81555f14f8f9960745b5a40d_38f7de48-5ee9-452d-8a5a-92789d7110b1" /E /G "NETWORK SERVICE":R -``` - -#### To build the FindPrivateKey project - -To download the project, visit [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459). - -1. Open File Explorer and navigate to the *WF_WCF_Samples\WCF\Setup\FindPrivateKey\CS* folder under the directory location where you installed the sample. - -2. Double-click the .sln file icon to open the file in Visual Studio. - -3. In the **Build** menu, select **Rebuild Solution**. - -4. Building the solution generates the file: FindPrivateKey.exe. - -## Conventions—Command-Line entries - - "[*option*]" represents an optional set of parameters. - - "{*option*}" represents a mandatory set of parameters. - - "*option1* | *option2*" represents a choice between sets of options. - - "\<*value*>" represents a parameter value to be entered. - -## Usage - -```console -FindPrivateKey [{ {-n } | {-t } } [-f | -d | -a]] -``` - -Where: - -| Parameter | Description | -|-----------------|-----------------------------------------------------------------------------------| -| `` | The subject name of the certificate | -| `` | The thumbprint of the certificate (You can use the Certmgr.exe tool to find this) | -| `-f` | output file name only | -| `-d` | output directory only | -| `-a` | output absolute file name | - -If no parameters are specified at the command prompt, then help text with this information is displayed. - -## Examples - -This example finds the filename of the certificate with a subject name of "CN=localhost", in the Personal store of the Current User. - -```console -FindPrivateKey My CurrentUser -n "CN=localhost" -``` - -This example finds the filename of the certificate with a subject name of "CN=localhost", in the Personal store of the Current User and output the full directory path. - -```console -FindPrivateKey My CurrentUser -n "CN=localhost" -a -``` - -This example finds the filename of the certificate with a thumbprint of "03 33 98 63 d0 47 e7 48 71 33 62 64 76 5c 4c 9d 42 1d 6b 52", in the Personal store of the Local Computer. - -```console -FindPrivateKey My LocalMachine -t "03 33 98 63 d0 47 e7 48 71 33 62 64 76 5c 4c 9d 42 1d 6b 52" -``` diff --git a/docs/framework/wcf/samples/firewall-instructions.md b/docs/framework/wcf/samples/firewall-instructions.md deleted file mode 100644 index e20604bb2b562..0000000000000 --- a/docs/framework/wcf/samples/firewall-instructions.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: "Firewall Instructions" -description: Learn how to enable ports or programs in the firewall for WCF samples. Use one of these procedures, depending on your requirements and security environment. -ms.date: "03/30/2017" -ms.assetid: a7dc429f-65ac-4faf-974a-77d5fb977fe1 ---- -# Firewall instructions - -You must enable several ports or programs in the firewall so that the Windows Communication Foundation (WCF) samples can function. Many of the samples communicate by using ports in the range 8000-8003, and port 9000. The firewall is turned on by default and prevents access to these ports. To enable the firewall for the samples, complete one of the following procedures, depending on your requirements and security environment: - -- Option 1: Interactively enable samples while running. Make no advance changes to your firewall configuration and proceed to start building and running the samples. When a sample is run, a **Windows Security Alert** dialog box appears. The sample program in question can then be added interactively to an unblocked list. With this procedure, you may have to then restart the sample. - -- Option 2: Enable sample programs in advance. Start the **Windows Firewall Control Panel** applet and enable the sample programs you plan to run. You must build the programs first so the executable files exist. You can find more detailed instructions in the following procedure. - -- Option 3: Enable a port range in advance. Start the **Windows Firewall Control Panel** applet and enable ports 80, 443, 8000-8003 and 9000, which are used by the samples. You can find more detailed instructions in the following procedure. This option is less secure than the others because it allows any program to use these ports, not just the samples. - -If you are unsure of which procedure to use, choose the first option. If you are running a firewall from another vendor, you might need to make similar changes. - -> [!IMPORTANT] -> Changing your firewall configuration affects your security. It is recommended that you record the changes you make and remove them when you are finished working with the samples. - -## Enable samples programs in advance - -1. Build the sample. - -2. Choose **Start** > **Run**, and enter `firewall.cpl`. This opens the **Windows Firewall Control Panel** applet. - - > [!NOTE] - > You must have permission to change the Firewall settings to run samples that require the ability to communicate through the Windows Firewall. If some firewall settings are unavailable and your computer is connected to a domain, your system administrator might be controlling these settings through Group Policy. - -3. Complete one of the following operating-specific steps to allow a program through the Windows Firewall: - - - On Windows 7 or Windows Server 2008 R2, click **Allow a program or feature through Windows Firewall**. Click **Change Settings** > **Allow Another Program**. - - - On Windows Vista or Windows Server 2008, click **Allow a program through Windows Firewall**. - -4. On the **Exceptions** tab, click **Add Program**. - -5. Click the **Browse** button and select the executable file of the sample you plan to run. - -6. Repeat steps 4 and 5 until you have added the executable files of all the samples you plan to run. - -7. Click **OK** to close the firewall applet. - -## Enable a port range in advance - -1. Choose **Start** > **Run**, and enter `firewall.cpl`. This opens the **Windows Firewall Control Panel** applet. - -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. - - 2. Click **Inbound Rules** in the left column. - - 3. Click **New Rules** in the right column. - - 4. Select **Port** and click **next**. - - 5. Select **TCP** and enter `8000, 8001, 8002, 8003, 9000, 80, 443` in the **Specific local ports** field. - - 6. Click **Next**. - - 7. Select **Allow the connection**, and click **Next** . - - 8. Select **Domain** and **Private**, and click **Next**. - - 9. Name this rule `WCF-WF 4.0 Samples`, and click **Finish**. - - 10. Click **Outbound Rules** and repeat steps c to h. - -3. On Windows Vista or Windows Server 2008, follow these steps. - - 1. Click **Allow a program through Windows Firewall**. - - 2. On the **Exceptions** tab, click **Add Port**. - - 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**. - - 5. Repeat steps b to d for ports 8001, 8002, 8003, 9000, 80, and 443. - -4. Click **OK** to close the firewall applet. - -> [!NOTE] -> Remove any firewall exceptions when you are finished working with the samples. To do so, open the **Windows Firewall Control Panel** applet and remove any programs or port entries that were added by the previous procedures. diff --git a/docs/framework/wcf/samples/getting-started-sample.md b/docs/framework/wcf/samples/getting-started-sample.md deleted file mode 100644 index 741aeeed57695..0000000000000 --- a/docs/framework/wcf/samples/getting-started-sample.md +++ /dev/null @@ -1,285 +0,0 @@ ---- -title: "Getting Started Sample" -description: Learn how to implement a typical service and a typical client using WCF. This sample is the basis for all other basic technology samples. -ms.date: "03/30/2017" -dev_langs: - - "csharp" - - "vb" -helpviewer_keywords: - - "basic samples [WCF], getting started" -ms.assetid: 967a3d94-0261-49ff-b85a-20bb07f1af20 ---- - -# Getting Started Sample - -The Getting Started sample demonstrates how to implement a typical service and a typical client using Windows Communication Foundation (WCF). This sample is the basis for all other basic technology samples. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\GettingStarted\GettingStarted` - -The service describes the operations it performs in a service contract that it exposes publicly as metadata. The service also contains the code to implement the operations. - -The client contains a definition of the service contract and a proxy class for accessing the service. The proxy code is generated from the service metadata using the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md). - -On Windows Vista, the service is hosted in the Windows Activation Service (WAS). On Windows XP and Windows Server 2003, it is hosted by Internet Information Services (IIS) and ASP.NET. Hosting a service in IIS or WAS allows the service to be activated automatically when it is accessed for the first time. - -> [!NOTE] -> If you would prefer to get started with a sample that hosts the service in a console application instead of IIS, see the [Self-Host](self-host.md) sample. - -The service and client specify access details in configuration file settings, which provide flexibility at the time of deployment. This includes an endpoint definition that specifies an address, binding, and contract. The binding specifies transport and security details for how the service is to be accessed. - -The service configures a run-time behavior to publish its metadata. - -The service implements a contract that defines a request-reply communication pattern. The contract is defined by the `ICalculator` interface, which exposes math operations (add, subtract, multiply, and divide). The client makes requests to a given math operation and the service replies with the result. The service implements an `ICalculator` contract that is defined in the following code. - -```vb -' Define a service contract. - - Public Interface ICalculator - - Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double - - Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double - - Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double - - Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double - End Interface -``` - -```csharp -// Define a service contract. -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] -public interface ICalculator -{ - [OperationContract] - double Add(double n1, double n2); - [OperationContract] - double Subtract(double n1, double n2); - [OperationContract] - double Multiply(double n1, double n2); - [OperationContract] - double Divide(double n1, double n2); -} -``` - -The service implementation calculates and returns the appropriate result, as shown in the following example code. - -```vb -' Service class which implements the service contract. -Public Class CalculatorService -Implements ICalculator -Public Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Add -Return n1 + n2 -End Function - -Public Function Subtract(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Subtract -Return n1 - n2 -End Function - -Public Function Multiply(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Multiply -Return n1 * n2 -End Function - -Public Function Divide(ByVal n1 As Double, ByVal n2 As Double) As Double Implements ICalculator.Divide -Return n1 / n2 -End Function -End Class -``` - -```csharp -// Service class that implements the service contract. -public class CalculatorService : ICalculator -{ - public double Add(double n1, double n2) - { - return n1 + n2; - } - public double Subtract(double n1, double n2) - { - return n1 - n2; - } - public double Multiply(double n1, double n2) - { - return n1 * n2; - } - public double Divide(double n1, double n2) - { - return n1 / n2; - } -} -``` - -The service exposes an endpoint for communicating with the service, defined using a configuration file (Web.config), as shown in the following sample configuration. - -```xaml - - - - - ... - - -``` - -The service exposes the endpoint at the base address provided by the IIS or WAS host. The binding is configured with a standard , which provides HTTP communication and standard Web service protocols for addressing and security. The contract is the `ICalculator` implemented by the service. - -As configured, the service can be accessed at `http://localhost/servicemodelsamples/service.svc` by a client on the same computer. For clients on remote computers to access the service, a fully-qualified domain name must be specified instead of localhost. - -The framework does not expose metadata by default. As such, the service turns on the and exposes a metadata exchange (MEX) endpoint at `http://localhost/servicemodelsamples/service.svc/mex`. The following configuration demonstrates this. - -```xaml - - - - ... - - - - - - - - - - - - - - - -``` - -The client communicates using a given contract type by using a client class that is generated by the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md). This generated client is contained in the file generatedClient.cs or generatedClient.vb. This utility retrieves metadata for a given service and generates a client for use by the client application to communicate using a given contract type. The hosted service must be available to generate the client code, because the service is used to retrieve the updated metadata. - - Run the following command from the SDK command prompt in the client directory to generate the typed proxy: - -```console -svcutil.exe /n:"http://Microsoft.ServiceModel.Samples,Microsoft.ServiceModel.Samples" http://localhost/servicemodelsamples/service.svc/mex /out:generatedClient.cs -``` - -To generate client in Visual Basic type the following from the SDK command prompt: - -`Svcutil.exe /n:"http://Microsoft.ServiceModel.Samples,Microsoft.ServiceModel.Samples" http://localhost/servicemodelsamples/service.svc/mex /l:vb /out:generatedClient.vb` - -By using the generated client, the client can access a given service endpoint by configuring the appropriate address and binding. Like the service, the client uses a configuration file (App.config) to specify the endpoint with which it wants to communicate. The client endpoint configuration consists of an absolute address for the service endpoint, the binding, and the contract, as shown in the following example. - -```xaml - - - -``` - -The client implementation instantiates the client and uses the typed interface to begin communicating with the service, as shown in the following example code. - -```vb -' Create a client -Dim client As New CalculatorClient() - -' Call the Add service operation. - Dim value1 = 100.0R - Dim value2 = 15.99R - Dim result = client.Add(value1, value2) -Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result) - -' Call the Subtract service operation. -value1 = 145.00R -value2 = 76.54R -result = client.Subtract(value1, value2) -Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result) - -' Call the Multiply service operation. -value1 = 9.00R -value2 = 81.25R -result = client.Multiply(value1, value2) -Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result) - -' Call the Divide service operation. -value1 = 22.00R -value2 = 7.00R -result = client.Divide(value1, value2) -Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result) - -'Closing the client gracefully closes the connection and cleans up resources -``` - -```csharp -// Create a client. -CalculatorClient client = new CalculatorClient(); - -// Call the Add service operation. -double value1 = 100.00D; -double value2 = 15.99D; -double result = client.Add(value1, value2); -Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); - -// Call the Subtract service operation. -value1 = 145.00D; -value2 = 76.54D; -result = client.Subtract(value1, value2); -Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result); - -// Call the Multiply service operation. -value1 = 9.00D; -value2 = 81.25D; -result = client.Multiply(value1, value2); -Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result); - -// Call the Divide service operation. -value1 = 22.00D; -value2 = 7.00D; -result = client.Divide(value1, value2); -Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result); - -//Closing the client releases all communication resources. -client.Close(); -``` - -When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```output -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -The Getting Started sample shows the standard way to create a service and client. The other [Basic](basic-sample.md) build on this sample to demonstrate specific product features. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-computer configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -## See also - -- [How to: Host a WCF Service in a Managed Application](../how-to-host-a-wcf-service-in-a-managed-application.md) -- [How to: Host a WCF Service in IIS](../feature-details/how-to-host-a-wcf-service-in-iis.md) diff --git a/docs/framework/wcf/samples/hello-world-with-the-routing-service.md b/docs/framework/wcf/samples/hello-world-with-the-routing-service.md deleted file mode 100644 index 18063ffd87d3f..0000000000000 --- a/docs/framework/wcf/samples/hello-world-with-the-routing-service.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -description: "Learn more about: Hello World with the Routing Service" -title: "Hello World with the Routing Service" -ms.date: "03/30/2017" -ms.assetid: 0f4b0d5b-6522-4ad5-9f3a-baa78316d7d1 ---- -# Hello World with the Routing Service - -This sample demonstrates the Windows Communication Foundation (WCF) Routing Service. The Routing Service is a WCF component that makes it easy to include a content-based router in your application. This sample adapts the standard WCF Calculator Sample to communicate using the Routing Service. In this sample, the Calculator client is configured to send messages to an endpoint exposed by the router. The Routing Service is configured to accept all messages sent to it and to forward them to an endpoint that corresponds to the Calculator service. Thus messages sent from the client are received by the router and re-routed to the actual Calculator service. Messages from the Calculator service are sent back to the router, which in turn passes them back to the Calculator client. - -### To use this sample - -1. Using Visual Studio 2012, open HelloRoutingService.sln. - -2. Press F5 or CTRL+SHIFT+B. - - > [!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) - -3. Press ENTER to start the client. - - You should see the following output: - - ```console - Add(100,15.99) = 115.99 - - Subtract(145,76.54) = 68.46 - - Multiply(9,81.25) = 731.25 - - Divide(22,7) = 3.14285714285714 - ``` - -## Configurable via Code or App.Config - - The sample ships configured to use an App.config file to define the router’s behavior. You can also change the name of the App.config file to something else so that it is not recognized and uncomment the method call to ConfigureRouterViaCode(). Either method results in the same behavior from the router. - -### Scenario - - This sample demonstrates the router acting as a basic message pump. The routing service acts as a transparent proxy node configured to pass messages directly to a preconfigured set of destination endpoints. - -### Real World Scenario - - Contoso wants to increase the flexibility it has in the naming, addressing, configuration, and security of its services. To do this, they place a basic message pump in front of their services to act as a public facing endpoint. This allows them to place additional security in front of their actual services and make it easier to implement scaled out solutions or service versioning at a later date. - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\RoutingServices\HelloRoutingService` - -## See also - -- [AppFabric Hosting and Persistence Samples](/previous-versions/appfabric/ff383418(v=azure.10)) diff --git a/docs/framework/wcf/samples/hosting.md b/docs/framework/wcf/samples/hosting.md deleted file mode 100644 index f1e0cfbe5cf4d..0000000000000 --- a/docs/framework/wcf/samples/hosting.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -description: "Learn more about: Hosting" -title: "WCF hosting samples" -ms.date: "03/30/2017" -ms.assetid: 8a6ec5d4-d191-49cc-bb0f-a07639dc60d4 ---- -# Hosting - -This section contains samples that demonstrate hosting Windows Communication Foundation (WCF) services. - -## In This Section - - [Windows Process Activation](windows-process-activation.md) - Demonstrates service activation through network protocols. - - [SystemWebRouting Integration Sample](systemwebrouting-integration-sample.md) - Demonstrates the hosting layer’s integration with the classes in the namespace. - - [ASP.NET Compatibility](aspnet-compatibility.md) - Demonstrates how to enable ASP.NET Compatibility mode in WCF. - - [IIS Hosting Using Inline Code](iis-hosting-using-inline-code.md) - Demonstrates how to implement a service hosted by Internet Information Services (IIS), where the service code is contained in-line in a .svc file and is compiled on demand. - - [Windows Service Host](windows-service-host.md) - Demonstrates a WCF service hosted in a managed Windows Service. - - [Self-Host](self-host.md) - Demonstrates how to implement a self-hosted service in a console application. diff --git a/docs/framework/wcf/samples/httpcookiesession.md b/docs/framework/wcf/samples/httpcookiesession.md deleted file mode 100644 index 5e852b24f44aa..0000000000000 --- a/docs/framework/wcf/samples/httpcookiesession.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -description: "Learn more about: HttpCookieSession" -title: "HttpCookieSession" -ms.date: "03/30/2017" -ms.assetid: 101cb624-8303-448a-a3af-933247c1e109 ---- -# HttpCookieSession - -This sample demonstrates how to build a custom protocol channel to use HTTP cookies for session management. This channel enables communication between Windows Communication Foundation (WCF) services and ASMX clients or between WCF clients and ASMX services. - - When a client calls a Web method in an ASMX Web service that is session-based, the ASP.NET engine does the following: - -- Generates a unique ID (session ID). - -- Generates the session object and associates it with the unique ID. - -- Adds the unique ID to a Set-Cookie HTTP response header and sends it to the client. - -- Identifies the client on subsequent calls based on the session ID it sends to it. - - The client includes this session ID in its subsequent requests to the server. The server uses the session ID from the client to load the appropriate session object for the current HTTP context. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Channels\HttpCookieSession` - -## HttpCookieSession Channel Message Exchange Pattern - - This sample enables sessions for ASMX-like scenarios. At the bottom of our channel stack, we have the HTTP transport that supports and . It is the job of the channel to provide sessions to the higher levels of the channel stack. The sample implements two channels, ( and ) that support sessions. - -## Service Channel - - The sample provides a service channel in the `HttpCookieReplySessionChannelListener` class. This class implements the interface and converts the channel from lower in the channel stack to a . This process can be divided into the following parts: - -- When the channel listener is opened, it accepts an inner channel from its inner listener. Because the inner listener is a datagram listener and the lifetime of an accepted channel is decoupled from the lifetime of the listener, we can close the inner listener and only hold on to the inner channel - - ```csharp - this.innerChannelListener.Open(timeoutHelper.RemainingTime()); - this.innerChannel = this.innerChannelListener.AcceptChannel(timeoutHelper.RemainingTime()); - this.innerChannel.Open(timeoutHelper.RemainingTime()); - this.innerChannelListener.Close(timeoutHelper.RemainingTime()); - ``` - -- When the open process completes, we set up a message loop to receive messages from the inner channel. - - ```csharp - IAsyncResult result = BeginInnerReceiveRequest(); - if (result != null && result.CompletedSynchronously) - { - // do not block the user thread - this.completeReceiveCallback ??= new WaitCallback(CompleteReceiveCallback); - ThreadPool.QueueUserWorkItem(this.completeReceiveCallback, result); - } - ``` - -- When a message arrives, the service channel examines the session identifier and de-multiplexes to the appropriate session channel. The channel listener maintains a dictionary that maps the session identifiers to the session channel instances. - - ```csharp - Dictionary channelMapping; - ``` - - The `HttpCookieReplySessionChannel` class implements . Higher levels of the channel stack call the method to read requests for this session. Each session channel has a private message queue that is populated by the service channel. - -```csharp -InputQueue requestQueue; -``` - - In the case when someone calls the method and there are no messages in the message queue, the channel waits for a specified amount of time before shutting itself down. This cleans up the session channels created for non-WCF clients. - - We use the `channelMapping` to track the `ReplySessionChannels`, and we do not close our underlying `innerChannel` until all the accepted channels have been closed. This way `HttpCookieReplySessionChannel` can exist beyond the lifetime of `HttpCookieReplySessionChannelListener`. We also do not have to worry about the listener getting garbage collected underneath us because the accepted channels keep a reference to their listener through the `OnClosed` callback. - -## Client channel - - The corresponding client channel is in the `HttpCookieSessionChannelFactory` class. During channel creation, the channel factory wraps the inner request channel with an `HttpCookieRequestSessionChannel`. The `HttpCookieRequestSessionChannel` class forwards the calls to the underlying request channel. When the client closes the proxy, `HttpCookieRequestSessionChannel` sends a message to the service that indicates that the channel is being closed. Thus, the service channel stack can gracefully shutdown the session channel that is in use. - -## Binding and Binding Element - - After creating the service and client channels, the next step is to integrate them into the WCF runtime. Channels are exposed to WCF through bindings and binding elements. A binding consists of one or many binding elements. WCF offers several system-defined bindings; for example, BasicHttpBinding or WSHttpBinding. The `HttpCookieSessionBindingElement` class contains the implementation for the binding element. It overrides the channel listener and channel factory creation methods to do the necessary channel listener or channel factory instantiations. - - The sample uses policy assertions for the service description. This allows the sample to publish its channel requirements to other clients that can consume the service. For example, this binding element publishes policy assertions to let potential clients know that it supports sessions. Because the sample enables the `ExchangeTerminateMessage` property in the binding element configuration, it adds the necessary assertions to show that the service supports an extra message exchange action to terminate the session conversation. Clients can then use this action. The following WSDL code shows the policy assertions created from the `HttpCookieSessionBindingElement`. - -```xml - - - - - - - - -``` - - The `HttpCookieSessionBinding` class is a system-provided binding that uses the binding element described previously. - -## Adding the Channel to the Configuration System - - The sample provides two classes that expose the sample channel through configuration. The first is a for the `HttpCookieSessionBindingElement`. The bulk of the implementation is delegated to the `HttpCookieSessionBindingConfigurationElement`, which derives from . The `HttpCookieSessionBindingConfigurationElement` has properties that correspond to the properties on `HttpCookieSessionBindingElement`. - -### Binding Element Extension Section - - The section `HttpCookieSessionBindingElementSection` is a that exposes `HttpCookieSessionBindingElement` to the configuration system. With a few overrides the configuration section name, the type of the binding element and how to create the binding element are defined. We can then register the extension section in a configuration file as follows: - -```xml - - - - - - - - - - - - - - - - - - - -``` - -## Test Code - - Test code for using this sample transport is available in the Client and Service directories. It consists of two tests—one test uses a binding with `allowCookies` set to `true` on the client. The second test enables explicit shutdown (using the terminate message exchange) on the binding. - - When you run the sample, you should see the following output: - -```console -Simple binding: -AddItem(10000,2): ItemCount=2 -AddItem(10550,5): ItemCount=7 -RemoveItem(10550,2): ItemCount=5 -Items -10000, 2 -10550, 3 -Smart binding: -AddItem(10000,2): ItemCount=2 -AddItem(10550,5): ItemCount=7 -RemoveItem(10550,2): ItemCount=5 -Items -10000, 2 -10550, 3 - -Press to terminate client. -``` - -#### To set up, build, and run the sample - -1. Install ASP.NET 4.0 using the following command. - - ```console - %windir%\Microsoft.NET\Framework\v4.0.XXXXX\aspnet_regiis.exe /i /enable - ``` - -2. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -3. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -4. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). diff --git a/docs/framework/wcf/samples/iis-hosting-using-inline-code.md b/docs/framework/wcf/samples/iis-hosting-using-inline-code.md deleted file mode 100644 index 0329fe4e90eaa..0000000000000 --- a/docs/framework/wcf/samples/iis-hosting-using-inline-code.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -description: "Learn more about: IIS Hosting Using Inline Code" -title: "IIS Hosting Using Inline Code" -ms.date: "03/30/2017" -helpviewer_keywords: - - "Web hosted service" - - "IIS Hosting Using Inline Code Sample [Windows Communication Foundation]" -ms.assetid: 56fe3687-a34b-4661-8e30-b33770f413fa ---- -# IIS Hosting Using Inline Code - -This sample demonstrates how to implement a service hosted by Internet Information Services (IIS), where the service code is contained in-line in a .svc file and is compiled on demand. Service code can also be implemented directly in source code files located in the application's \App_Code directory, or compiled into assembly deployed in \bin. This sample does not demonstrate these techniques. - -> [!NOTE] -> The set-up procedure and build instructions for this sample are located at the end of this topic. - -> [!IMPORTANT] -> The samples may already be installed on your computer. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Hosting\WebHost\InlineCode` - -The sample demonstrates a typical service that implements a contract that defines a request-reply communication pattern. The service is hosted in IIS and the service code is entirely contained in the Service.svc file. The service is host-activated and compiled on-demand by the first message sent to the service. There is no pre-compilation necessary. The service implements an `ICalculator` contract as defined in the following code: - -```csharp -// Define a service contract. -[ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples")] - public interface ICalculator -{ - [OperationContract] - double Add(double n1, double n2); - [OperationContract] - double Subtract(double n1, double n2); - [OperationContract] - double Multiply(double n1, double n2); - [OperationContract] - double Divide(double n1, double n2); -} -``` - -The service implementation calculates and returns the appropriate result. - -`<%@ServiceHost language=c# Debug="true" Service="Microsoft.ServiceModel.Samples.CalculatorService" %>` - -```csharp -// Service class that implements the service contract. -public class CalculatorService : ICalculator -{ - public double Add(double n1, double n2) - { - return n1 + n2; - } - public double Subtract(double n1, double n2) - { - return n1 - n2; - } - public double Multiply(double n1, double n2) - { - return n1 * n2; - } - public double Divide(double n1, double n2) - { - return n1 / n2; - } -} -``` - -When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. After the solution has been built, run setup.bat to set up the ServiceModelSamples Application in IIS 7.0. The ServiceModelSamples directory should now appear as an IIS 7.0 Application. - -4. To run the sample in a single- or cross-computer configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). For an example on how to create a client application that can call this service, see [How to: Create a Client](../how-to-create-a-wcf-client.md). - -## See also - -- [AppFabric Hosting and Persistence Samples](/previous-versions/appfabric/ff383418(v=azure.10)) diff --git a/docs/framework/wcf/samples/iis-server-certificate-installation-instructions.md b/docs/framework/wcf/samples/iis-server-certificate-installation-instructions.md deleted file mode 100644 index f74c270bf84f2..0000000000000 --- a/docs/framework/wcf/samples/iis-server-certificate-installation-instructions.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -description: "Learn more about: Internet Information Services (IIS) Server Certificate Installation Instructions" -title: "Internet Information Services (IIS) Server Certificate Installation Instructions" -ms.date: "03/30/2017" -ms.assetid: 11281490-d2ac-4324-8f33-e7714611a34b ---- -# Internet Information Services (IIS) Server Certificate Installation Instructions - -To run the samples that securely communicate with Internet Information Services (IIS), you must create and install a server certificate. - -## Step 1. Creating Certificates - - To create a certificate for your computer, open a Developer Command Prompt for Visual Studio with administrator privileges and run the Setup.bat that is included in each of the samples that use secure communication with IIS. Ensure that the path includes the folder that contains Makecert.exe before you run this batch file. The following command is used to create the certificate in Setup.bat. - -```console -makecert -sr LocalMachine -ss My -n CN=ServiceModelSamples-HTTPS-Server -sky exchange -sk ServiceModelSamples-HTTPS-Key -``` - -## Step 2. Installing Certificates - - The steps required to install the certificates you just created depend on which version of IIS you are using. - -#### To install IIS on IIS 5.1 (Windows XP) and IIS 6.0 (Windows Server 2003) - -1. Open the Internet Information Services Manager MMC Snap-In. - -2. Right-click the default Web site and select **Properties**. - -3. Select the **Directory Security** tab. - -4. Click the **Server Certificate** button. The Web Server Certificate Wizard starts. - -5. Complete the wizard. Select the option to assign a certificate. Select the ServiceModelSamples-HTTPS-Server certificate from the list of certificates that are displayed. - - ![IIS Certificate Wizard](media/iiscertificate-wizard.GIF "IISCertificate_Wizard") - -6. Test access to the service in a browser by using the HTTPS address `https://localhost/servicemodelsamples/service.svc`. - -#### If SSL was previously configured by using Httpcfg.exe - -1. Use Makecert.exe (or run Setup.bat) to create the server certificate. - -2. Run the IIS manager and install the certificate according to the previous steps. - -3. Add the following line of code to the client program. - -> [!IMPORTANT] -> This code is only required for test certificates such as those created by Makecert.exe. It is not recommended for production code. - -```csharp -PermissiveCertificatePolicy.Enact("CN=ServiceModelSamples-HTTPS-Server"); -``` - -#### To install IIS on IIS 7.0 (Windows Vista and Windows Server 2008) - -1. From the **Start** menu, click **Run**, then type **inetmgr** to open the Internet Information Services (IIS) MMC snap-in. - -2. Right-click the **Default Web Site** and select **Edit Bindings…** - -3. Click the **Add** button of the **Site Bindings** dialog box. - -4. Select **HTTPS** from the **Type** drop-down list. - -5. Select the **ServiceModelSamples-HTTPS-Server** from the **SSL certificate** drop-down list and click **OK**. - -6. Test access to the service in a browser by using the HTTPS address `https://localhost/servicemodelsamples/service.svc`. - -> [!NOTE] -> Because the test certificate you have just installed is not a trusted certificate, you may encounter additional Internet Explorer security warnings when browsing to local Web addresses secured with this certificate. - -## Removing Certificates - -- Use the Internet Information Services Manager as previously directed, but remove the certificate or binding instead of adding it. - -- Remove the computer certificate by using the following command. - - ```console - httpcfg delete ssl -i 0.0.0.0:443 - ``` diff --git a/docs/framework/wcf/samples/imperative.md b/docs/framework/wcf/samples/imperative.md deleted file mode 100644 index 888aa48ed22ca..0000000000000 --- a/docs/framework/wcf/samples/imperative.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -description: "Learn more about: Imperative" -title: "Imperative" -ms.date: "03/30/2017" -ms.assetid: 4f7ce807-c0e4-407a-92a6-22abafb40b51 ---- -# Imperative - -This sample demonstrates how to define a for a service using code, instead of defining the `wsHttpBinding` binding in configuration. This sample is based on the [Getting Started](getting-started-sample.md) that implements a calculator service. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -The following code demonstrates how to define a binding imperatively in code. - -```csharp -public static void Main() -{ - WSHttpBinding binding = new WSHttpBinding(); - binding.Name = "binding1"; - binding.HostNameComparisonMode = - HostNameComparisonMode.StrongWildcard; - binding.Security.Mode = SecurityMode.Message; - binding.ReliableSession.Enabled = false; - binding.TransactionFlow = false; - - Uri baseAddress = - new Uri("http://localhost:8000/servicemodelsamples/service"); - - // Create a ServiceHost for the CalculatorService type and provide the base address. - using(ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress)) - { - serviceHost.AddServiceEndpoint(typeof(ICalculator), - binding, baseAddress); - // Open the ServiceHostBase to create listeners and start listening for messages. - serviceHost.Open(); - - // The service can now be accessed. - Console.WriteLine("The service is ready."); - Console.WriteLine("Press to terminate service."); - Console.WriteLine(); - Console.ReadLine(); - // Close the ServiceHostBase to shutdown the service. - serviceHost.Close(); - } -} -``` - - The client creates a channel to communicate with the service as shown in the following sample code. - -```csharp -WSHttpBinding binding = new WSHttpBinding(); -binding.Name = "binding1"; -binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; -binding.Security.Mode = SecurityMode.Message; -binding.ReliableSession.Enabled = false; -binding.TransactionFlow = false; - -String url = "http://localhost:8000/servicemodelsamples/service"; -EndpointAddress address = new EndpointAddress(url); -ChannelFactory channelFactory = new ChannelFactory(binding,address); -ICalculator channel = channelFactory.CreateChannel(); -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -## To set up, build, and run the sample - -1. Be sure you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Imperative` diff --git a/docs/framework/wcf/samples/impersonating-the-client.md b/docs/framework/wcf/samples/impersonating-the-client.md deleted file mode 100644 index 4f0af9cad7acc..0000000000000 --- a/docs/framework/wcf/samples/impersonating-the-client.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -description: "Learn more about: Impersonating the Client" -title: "Impersonating the Client" -ms.date: "03/30/2017" -helpviewer_keywords: - - "service behaviors, impersonation sample" - - "Impersonating the Client Sample [Windows Communication Foundation]" - - "impersonation, Windows Communication Foundation sample" -ms.assetid: 8bd974e1-90db-4152-95a3-1d4b1a7734f8 ---- -# Impersonating the Client - -The Impersonation sample demonstrates how to impersonate the caller application at the service so that the service can access system resources on behalf of the caller. - - This sample is based on the [Self-Host](self-host.md) sample. The service and client configuration files are the same as that of the [Self-Host](self-host.md) sample. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The service code has been modified such that the `Add` method on the service impersonates the caller using the as shown in the following sample code. - -```csharp -[OperationBehavior(Impersonation = ImpersonationOption.Required)] -public double Add(double n1, double n2) -{ - double result = n1 + n2; - Console.WriteLine("Received Add({0},{1})", n1, n2); - Console.WriteLine("Return: {0}", result); - DisplayIdentityInformation(); - return result; -} -``` - - As a result, the security context of the executing thread is switched to impersonate the caller before entering the `Add` method and reverted on exiting the method. - - The `DisplayIdentityInformation` method shown in the following sample code is a utility function that displays the caller's identity. - -```csharp -static void DisplayIdentityInformation() -{ - Console.WriteLine("\t\tThread Identity :{0}", - WindowsIdentity.GetCurrent().Name); - Console.WriteLine("\t\tThread Identity level :{0}", - WindowsIdentity.GetCurrent().ImpersonationLevel); - Console.WriteLine("\t\thToken :{0}", - WindowsIdentity.GetCurrent().Token.ToString()); - return; -} -``` - - The `Subtract` method on the service impersonates the caller using imperative calls as shown in the following sample code. - -```csharp -public double Subtract(double n1, double n2) -{ - double result = n1 - n2; - Console.WriteLine("Received Subtract({0},{1})", n1, n2); - Console.WriteLine("Return: {0}", result); - Console.WriteLine("Before impersonating"); - DisplayIdentityInformation(); - - if (ServiceSecurityContext.Current.WindowsIdentity.ImpersonationLevel == TokenImpersonationLevel.Impersonation || - ServiceSecurityContext.Current.WindowsIdentity.ImpersonationLevel == TokenImpersonationLevel.Delegation) - { - // Impersonate. - using (ServiceSecurityContext.Current.WindowsIdentity.Impersonate()) - { - // Make a system call in the caller's context and ACLs - // on the system resource are enforced in the caller's context. - Console.WriteLine("Impersonating the caller imperatively"); - DisplayIdentityInformation(); - } - } - else - { - Console.WriteLine("ImpersonationLevel is not high enough to perform this operation."); - } - - Console.WriteLine("After reverting"); - DisplayIdentityInformation(); - return result; -} -``` - - Note that in this case the caller is not impersonated for the entire call but is only impersonated for a portion of the call. In general, impersonating for the smallest scope is preferable to impersonating for the entire operation. - - The other methods do not impersonate the caller. - - The client code has been modified to set the impersonation level to . The client specifies the impersonation level to be used by the service, by using the enumeration. The enumeration supports the following values: , , , and . To perform an access check when accessing a system resource on the local machine that is protected using Windows ACLs, the impersonation level must be set to , as shown in the following sample code. - -```csharp -// Create a client with given client endpoint configuration -CalculatorClient client = new CalculatorClient(); - -client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; -``` - - When you run the sample, the operation requests and responses are displayed in both the service and client console windows. Press ENTER in each console window to shut down the service and client. - -> [!NOTE] -> The service must either run under an administrative account or the account it runs under must be granted rights to register the `http://localhost:8000/ServiceModelSamples` URI with the HTTP layer. Such rights can be granted by setting up a [Namespace Reservation](/windows/win32/http/namespace-reservations-registrations-and-routing) using the [Httpcfg.exe tool](/windows/win32/http/httpcfg-exe). - -> [!NOTE] -> On computers running Windows Server 2003, impersonation is supported only if the Host.exe application has the Impersonation privilege. (By default, only administrators have this permission.) To add this privilege to an account the service is running as, go to **Administrative Tools**, open **Local Security Policy**, open **Local Policies**, click **User Rights Assignment**, and select **Impersonate a Client after Authentication** and double-click **Properties** to add a user or group. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -4. To demonstrate that the service impersonates the caller, run the client under a different account than the one the service is running under. To do so, at the command prompt, type: - - ```console - runas /user:\ client.exe - ``` - - You are then prompted for a password. Enter the password for the account you previously specified. - -5. When you run the client, note the identity before and after running it with different credentials. diff --git a/docs/framework/wcf/samples/index.md b/docs/framework/wcf/samples/index.md deleted file mode 100644 index 7597f497801c2..0000000000000 --- a/docs/framework/wcf/samples/index.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Windows Communication Foundation (WCF) samples" -description: Download Windows Communication Foundation (WCF) samples for .NET Framework 4. The samples provide instruction on various aspects of WCF. -ms.date: 09/24/2018 -ms.assetid: 89d4efce-7832-4dd5-82a8-0e574b3302f9 ---- -# Windows Communication Foundation (WCF) samples - -You can download [Windows Communication Foundation (WCF) samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459). The samples provide instruction on various aspects of Windows Communication Foundation (WCF). - -> [!TIP] -> The articles in this section describe some of the samples in the download package. For a complete documentation set that covers all of the samples, check the [.NET Framework 4 documentation for WCF samples](/previous-versions/dotnet/netframework-4.0/dd483346(v=vs.100)). - -The Windows Workflow Foundation (WF) [application](../../windows-workflow-foundation/samples/application.md) samples also demonstrate several WCF features. - -## In this section - -[Basic](basic.md) - Samples that illustrate basic WCF functionality. - -[Extensibility](extensibility.md) - Samples that are related to the discovery feature. - -[Scenario](scenario.md) - Demonstrates a WCF scenario. diff --git a/docs/framework/wcf/samples/installing-message-queuing-msmq.md b/docs/framework/wcf/samples/installing-message-queuing-msmq.md deleted file mode 100644 index 8da64e074222c..0000000000000 --- a/docs/framework/wcf/samples/installing-message-queuing-msmq.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: "Installing Message Queuing (MSMQ)" -description: Learn how to install Message Queuing 4.0 and Message Queuing 3.0 to use with WFC samples as part of a one-time setup procedure. -ms.date: "03/30/2017" -ms.assetid: 7ddcd497-3e04-427e-bc04-3610ad98b01e ---- -# Installing Message Queuing (MSMQ) - -The following procedures show how to install Message Queuing 4.0 and Message Queuing 3.0. - -> [!NOTE] -> Message Queuing 4.0 is not available in Windows XP and Windows Server 2003. - -#### To install Message Queuing 4.0 on Windows Server 2008 or Windows Server 2008 R2 - -1. In Server Manager, click **Features**. - -2. In the right-hand pane under **Features Summary**, click **Add Features**. - -3. In the resulting window, expand **Message Queuing**. - -4. Expand **Message Queuing Services**. - -5. Click **Directory Services Integration** (for computers joined to a Domain), then click **HTTP Support**. - -6. Click **Next**,then click **Install**. - -#### To install Message Queuing 4.0 on Windows 7 or Windows Vista - -1. Open **Control Panel**. - -2. Click **Programs** and then, under **Programs and Features**, click **Turn Windows Features on and off**. - -3. Expand Microsoft Message Queue (MSMQ) Server, expand Microsoft Message Queue (MSMQ) Server Core, and then select the check boxes for the following Message Queuing features to install: - - - MSMQ Active Directory Domain Services Integration (for computers joined to a Domain). - - - MSMQ HTTP Support. - -4. Click **OK**. - -5. If you are prompted to restart the computer, click **OK** to complete the installation. - -#### To install Message Queuing 3.0 on Windows XP and Windows Server 2003 - -1. Open **Control Panel**. - -2. Click **Add Remove Programs** and then click **Add Windows Components**. - -3. Select Message Queuing and click **Details**. - - > [!NOTE] - > If you are running Windows Server 2003, select Application Server to access Message Queuing. - -4. Ensure that the option MSMQ HTTP Support is selected on the details page. - -5. Click **OK** to exit the details page, and then click **Next**. Complete the installation. - -6. If you are prompted to restart the computer, click **OK** to complete the installation. - -## See also - -- [Set-Up Instructions](set-up-instructions.md) diff --git a/docs/framework/wcf/samples/instancing-extensibility.md b/docs/framework/wcf/samples/instancing-extensibility.md deleted file mode 100644 index 05797645ee439..0000000000000 --- a/docs/framework/wcf/samples/instancing-extensibility.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -description: "Learn more about: Instancing Extensibility" -title: "Instancing Extensibility" -ms.date: "03/30/2017" -ms.assetid: 7a2f8b51-472b-4b71-8602-d3dbc6e1cb07 ---- -# Instancing Extensibility - -This section contains samples that demonstrate custom instancing. - -## In This Section - - [Durable Instance Context](durable-instance-context.md) - Demonstrates how to customize the WCF runtime to enable durable instance contexts. - - [Custom Lifetime](custom-lifetime.md) - Demonstrates how to write a WCF extension to provide custom lifetime services for shared WCF service instances. - - [Instancing Initialization](instancing-initialization.md) - Demonstrates how to customize the initialization of an object. - - [Pooling](pooling.md) - Demonstrates how to extend Windows Communication Foundation (WCF) to support object pooling. diff --git a/docs/framework/wcf/samples/instancing-initialization.md b/docs/framework/wcf/samples/instancing-initialization.md deleted file mode 100644 index 7f9ff66ff0a62..0000000000000 --- a/docs/framework/wcf/samples/instancing-initialization.md +++ /dev/null @@ -1,266 +0,0 @@ ---- -description: "Learn more about: Instancing Initialization" -title: "Instancing Initialization" -ms.date: "03/30/2017" -ms.assetid: 154d049f-2140-4696-b494-c7e53f6775ef ---- -# Instancing Initialization - -This sample extends the [Pooling](pooling.md) sample by defining an interface, `IObjectControl`, which customizes the initialization of an object by activating and deactivating it. The client invokes methods that return the object to the pool and that do not return the object to the pool. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - -## Extensibility Points - - The first step in creating a Windows Communication Foundation (WCF) extension is to decide the extensibility point to use. In WCF, the term *EndpointDispatcher* refers to a run-time component responsible for converting incoming messages into method invocations on the user’s service and for converting return values from that method to an outgoing message. A WCF service creates an EndpointDispatcher for each endpoint. - - The EndpointDispatcher offers endpoint scope (for all messages received or sent by the service) extensibility using the class. This class allows you to customize various properties that control the behavior of the EndpointDispatcher. This sample focuses on the property that points to the object that provides the instances of the service class. - -## IInstanceProvider - - In WCF, the EndpointDispatcher creates instances of a service class by using an instance provider that implements the interface. This interface has only two methods: - -- : When a message arrives, the Dispatcher calls the method to create an instance of the service class to process the message. The frequency of the calls to this method is determined by the property. For example if the property is set to , a new instance of service class is created to process each message that arrives, so is called whenever a message arrives. - -- : When the service instance finishes processing the message, the EndpointDispatcher calls the method. As in the method, the frequency of the calls to this method is determined by the property. - -## The Object Pool - - The `ObjectPoolInstanceProvider` class contains the implementation for the object pool. This class implements the interface to interact with the service model layer. When the EndpointDispatcher calls the method, instead of creating a new instance, the custom implementation looks for an existing object in an in-memory pool. If one is available, it is returned. Otherwise, `ObjectPoolInstanceProvider` checks whether the `ActiveObjectsCount` property (number of objects returned from the pool) has reached the maximum pool size. If not, a new instance is created and returned to the caller and `ActiveObjectsCount` is subsequently incremented. Otherwise an object creation request is queued for a configured period of time. The implementation for `GetObjectFromThePool` is shown in the following sample code. - -```csharp -private object GetObjectFromThePool() -{ - bool didNotTimeout = - availableCount.WaitOne(creationTimeout, true); - if(didNotTimeout) - { - object obj = null; - lock (poolLock) - { - if (pool.Count != 0) - { - obj = pool.Pop(); - activeObjectsCount++; - } - else if (pool.Count == 0) - { - if (activeObjectsCount < maxPoolSize) - { - obj = CreateNewPoolObject(); - activeObjectsCount++; - - #if (DEBUG) - WritePoolMessage( - ResourceHelper.GetString("MsgNewObject")); - #endif - } - } - idleTimer.Stop(); - } - // Call the Activate method if possible. - if (obj is IObjectControl) - { - ((IObjectControl)obj).Activate(); - } - return obj; -} -throw new TimeoutException( -ResourceHelper.GetString("ExObjectCreationTimeout")); -} -``` - - The custom `ReleaseInstance` implementation adds the released instance back to the pool and decrements the `ActiveObjectsCount` value. The EndpointDispatcher can call these methods from different threads, and therefore synchronized access to the class level members in the `ObjectPoolInstanceProvider` class is required. - -```csharp -public void ReleaseInstance(InstanceContext instanceContext, object instance) -{ - lock (poolLock) - { - // Check whether the object can be pooled. - // Call the Deactivate method if possible. - if (instance is IObjectControl) - { - IObjectControl objectControl = (IObjectControl)instance; - objectControl.Deactivate(); - - if (objectControl.CanBePooled) - { - pool.Push(instance); - - #if(DEBUG) - WritePoolMessage( - ResourceHelper.GetString("MsgObjectPooled")); - #endif - } - else - { - #if(DEBUG) - WritePoolMessage( - ResourceHelper.GetString("MsgObjectWasNotPooled")); - #endif - } - } - else - { - pool.Push(instance); - - #if(DEBUG) - WritePoolMessage( - ResourceHelper.GetString("MsgObjectPooled")); - #endif - } - - activeObjectsCount--; - - if (activeObjectsCount == 0) - { - idleTimer.Start(); - } - } - - availableCount.Release(1); -} -``` - - The `ReleaseInstance` method provides a *clean up initialization* feature. Normally the pool maintains a minimum number of objects for the lifetime of the pool. However, there can be periods of excessive usage that require creating additional objects in the pool to reach the maximum limit specified in the configuration. Eventually when the pool becomes less active those surplus objects can become an extra overhead. Therefore when the `activeObjectsCount` reaches zero an idle timer is started that triggers and performs a clean-up cycle. - -```csharp -if (activeObjectsCount == 0) -{ - idleTimer.Start(); -} -``` - - ServiceModel layer extensions are hooked up using the following behaviors: - -- Service Behaviors: These allow for the customization of the entire service runtime. - -- Endpoint Behaviors: These allow for the customization of a particular service endpoint, including the EndpointDispatcher. - -- Contract Behaviors: These allow for the customization of either or classes on the client or the service respectively. - -- Operation Behaviors: These allow for the customization of either or classes on the client or the service respectively. - - For the purpose of an object pooling extension, either an endpoint behavior or a service behavior can be created. In this example, we use a service behavior, which applies object pooling ability to every endpoint of the service. Service behaviors are created by implementing the interface. There are several ways to make the ServiceModel aware of the custom behaviors: - -- Using a custom attribute. - -- Imperatively adding it to the service description’s behaviors collection. - -- Extending the configuration file. - - This sample uses a custom attribute. When the is constructed, it examines the attributes used in the service’s type definition and adds the available behaviors to the service description’s behaviors collection. - - The interface has three methods: `,` `,` and . These methods are called by WCF when the is being initialized. is called first; it allows the service to be inspected for inconsistencies. is called next; this method is only required in very advanced scenarios. is called last and is responsible for configuring the runtime. The following parameters are passed into : - -- `Description`: This parameter provides the service description for the entire service. This can be used to inspect description data about the service’s endpoints, contracts, bindings, and other data associated with the service. - -- `ServiceHostBase`: This parameter provides the that is currently being initialized. - - In the custom implementation, a new instance of `ObjectPoolInstanceProvider` is instantiated and assigned to the property in each that is attached to the . - -```csharp -public void ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase) -{ - if (enabled) - { - // Create an instance of the ObjectPoolInstanceProvider. - instanceProvider = new ObjectPoolInstanceProvider(description.ServiceType, - maxPoolSize, minPoolSize, creationTimeout); - - // Assign our instance provider to Dispatch behavior in each - // endpoint. - foreach (ChannelDispatcherBase cdb in serviceHostBase.ChannelDispatchers) - { - ChannelDispatcher cd = cdb as ChannelDispatcher; - if (cd != null) - { - foreach (EndpointDispatcher ed in cd.Endpoints) - { - ed.DispatchRuntime.InstanceProvider = instanceProvider; - } - } - } - } -} -``` - - In addition to an implementation the `ObjectPoolingAttribute` class has several members to customize the object pool using the attribute arguments. These members include `MaxSize`, `MinSize`, `Enabled` and `CreationTimeout`, to match the object pooling feature set provided by .NET Enterprise Services. - - The object pooling behavior can now be added to a WCF service by annotating the service implementation with the newly created custom `ObjectPooling` attribute. - -```csharp -[ObjectPooling(MaxSize=1024, MinSize=10, CreationTimeout=30000] -public class PoolService : IPoolService -{ - // … -} -``` - -## Hooking Activation and Deactivation - - The primary objective of object pooling is to optimize short-lived objects with relatively expensive creation and initialization. Therefore it can give a dramatic performance boost to an application if properly used. Because the object is returned from the pool, the constructor is called only once. However, some applications require some level of control so that they can initialize and clean-up the resources used during a single context. For example, an object being used for a set of calculations can reset its private fields before processing the next calculation. Enterprise Services enabled this kind of context-specific initialization by letting the object developer override `Activate` and `Deactivate` methods from the base class. - - The object pool calls the `Activate` method just before returning the object from the pool. `Deactivate` is called when the object returns back to the pool. The base class also has a `boolean` property called `CanBePooled`, which can be used to notify the pool whether the object can be pooled further. - - To mimic this functionality, the sample declares a public interface (`IObjectControl`) that has the aforementioned members. This interface is then implemented by service classes intended to provide context specific initialization. The implementation must be modified to meet these requirements. Now, each time you get an object by calling the `GetInstance` method, you must check whether the object implements `IObjectControl.` If it does, you must call the `Activate` method appropriately. - -```csharp -if (obj is IObjectControl) -{ - ((IObjectControl)obj).Activate(); -} -``` - - When returning an object to the pool, a check is required for the `CanBePooled` property before adding the object back to the pool. - -```csharp -if (instance is IObjectControl) -{ - IObjectControl objectControl = (IObjectControl)instance; - objectControl.Deactivate(); - if (objectControl.CanBePooled) - { - pool.Push(instance); - } -} -``` - - Because the service developer can decide whether an object can be pooled, the object count in the pool at a given time can go below the minimum size. Therefore you must check whether the object count has gone below the minimum level and perform the necessary initialization in the clean-up procedure. - -```csharp -// Remove the surplus objects. -if (pool.Count > minPoolSize) -{ - // Clean the surplus objects. -} -else if (pool.Count < minPoolSize) -{ - // Reinitialize the missing objects. - while(pool.Count != minPoolSize) - { - pool.Push(CreateNewPoolObject()); - } -} -``` - - When you run the sample, the operation requests and responses are displayed in both the service and client console windows. Press Enter in each console window to shut down the service and client. - -#### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Extensibility\Instancing\Initialization` diff --git a/docs/framework/wcf/samples/instancing.md b/docs/framework/wcf/samples/instancing.md deleted file mode 100644 index 7978ab70720ea..0000000000000 --- a/docs/framework/wcf/samples/instancing.md +++ /dev/null @@ -1,136 +0,0 @@ ---- -description: "Learn more about: Instancing" -title: "Instancing" -ms.date: "03/30/2017" -helpviewer_keywords: - - "service behaviors, instancing sample" - - "Instancing Sample [Windows Communication Foundation]" -ms.assetid: c290fa54-f6ae-45a1-9186-d9504ebc6ee6 ---- -# Instancing - -The Instancing sample demonstrates the instancing behavior setting, which controls how instances of a service class are created in response to client requests. The sample is based on the [Getting Started](getting-started-sample.md), which implements the `ICalculator` service contract. This sample defines a new contract, `ICalculatorInstance`, which inherits from `ICalculator`. The contract specified by `ICalculatorInstance` provides three additional operations for inspecting the state of the service instance. By altering the instancing setting, you can observe the change in behavior by running the client. - - In this sample, the client is a console application (.exe) and the service is hosted by Internet Information Services (IIS). - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - The following instancing modes are available: - -- : A new service instance is created for each client request. - -- : A new instance is created for each new client session, and maintained for the lifetime of that session (requires a binding that supports session). - -- : A single instance of the service class handles all client requests for the lifetime of the application. - - The service class specifies instancing behavior with the `[ServiceBehavior(InstanceContextMode=)]` attribute as shown in the code sample that follows. By changing which lines are commented out, you can observe the behavior of each of the instance modes. Remember to rebuild the service after changing the instancing mode. There are no instancing-related settings to specify on the client. - -```csharp -// Enable one of the following instance modes to compare instancing behaviors. - [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)] - -// PerCall creates a new instance for each operation. -//[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] - -// Singleton creates a single instance for application lifetime. -//[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] -public class CalculatorService : ICalculatorInstance -{ - static Object syncObject = new object(); - static int instanceCount; - int instanceId; - int operationCount; - - public CalculatorService() - { - lock (syncObject) - { - instanceCount++; - instanceId = instanceCount; - } - } - - public double Add(double n1, double n2) - { - operationCount++; - return n1 + n2; - } - - public double Subtract(double n1, double n2) - { - Interlocked.Increment(ref operationCount); - return n1 - n2; - } - - public double Multiply(double n1, double n2) - { - Interlocked.Increment(ref operationCount); - return n1 * n2; - } - - public double Divide(double n1, double n2) - { - Interlocked.Increment(ref operationCount); - return n1 / n2; - } - - public string GetInstanceContextMode() - { // Return the InstanceContextMode of the service - ServiceHost host = (ServiceHost)OperationContext.Current.Host; - ServiceBehaviorAttribute behavior = host.Description.Behaviors.Find(); - return behavior.InstanceContextMode.ToString(); - } - - public int GetInstanceId() - { // Return the id for this instance - return instanceId; - } - - public int GetOperationCount() - { // Return the number of ICalculator operations performed - // on this instance - lock (syncObject) - { - return operationCount; - } - } -} - -static void Main() -{ - // Create a client. - CalculatorInstanceClient client = new CalculatorInstanceClient(); - string instanceMode = client.GetInstanceContextMode(); - Console.WriteLine("InstanceContextMode: {0}", instanceMode); - DoCalculations(client); - - // Create a second client. - CalculatorInstanceClient client2 = new CalculatorInstanceClient(); - - DoCalculations(client2); - - Console.WriteLine(); - Console.WriteLine("Press to terminate client."); - Console.ReadLine(); -} -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. The instance mode the service is running under is displayed. After each operation, the instance ID and operation count are displayed to reflect the behavior of the instancing mode. Press ENTER in the client window to shut down the client. - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Services\Behaviors\Instancing` diff --git a/docs/framework/wcf/samples/internet-information-service-hosting-instructions.md b/docs/framework/wcf/samples/internet-information-service-hosting-instructions.md deleted file mode 100644 index 08bf9ef6aae46..0000000000000 --- a/docs/framework/wcf/samples/internet-information-service-hosting-instructions.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -description: "Learn more about: Internet Information Service Hosting Instructions" -title: "Internet Information Service Hosting Instructions" -ms.date: "03/30/2017" -ms.assetid: 959a21c8-9d9d-4757-b255-4e57793ae9d6 ---- -# Internet Information Service Hosting Instructions - -To run the samples that are hosted by Internet Information Services (IIS), you must make sure that IIS is properly installed and is running. - -### To install IIS version 7.5 on Windows Server 2008 R2 - -1. From **Server Manager**, select **Roles.** Under **Roles Summary**, click **Add Roles**. - -2. Click **Next** to display the **Select Server Roles** dialog. - -3. Select **Application Server** from the **Roles** list, and then click **Next** twice to display the **Select Role Services** dialog for the Application Server role. - -4. Select the **Web Server (IIS)** check box. If you are prompted to install additional role services and features, click **Add Required Features**. Click **Next** twice to display the **Select Role Services** dialog for the Web Server (IIS) role. - -5. Expand **Management Tools**, and then expand **IIS 6 Management Compatibility**. Select **IIS 6 Scripting Tools**. If you are prompted to install additional role services and features, click **Add Required Role Services**. Click **Next**. - -6. If the summary of selections is correct, click **Install**. - -7. When installation completes, click **Close**. - -### To install IIS version 7.5 on Windows 7 - -1. Click **Start**, and then click **Control Panel**. - -2. Open the **Programs** group. - -3. Under **Programs and Features**, click **Turn Windows Features on or off**. - -4. The **User Account Control** dialog is displayed. Click **Continue**. - -5. The **Windows Features** dialog is displayed. Expand the item labeled **Internet Information Services**. - -6. Expand the item labeled **World Wide Web Services**. - -7. Expand the item labeled **Application Development Features**. - -8. Make sure the following items are selected: - - 1. **.NET Extensibility** - - 2. **ASP.NET** - - 3. **ISAPI Extensions** - - 4. **ISAPI Filters** - -9. Under the item labeled **World Wide Web Services**, expand **Common Http Features**. - -10. Make sure **Static Content** is selected. - -11. Under the item labeled **World Wide Web Services**, expand **Security**. - -12. Make sure that **Windows Authentication** is selected. - -13. Under the **Internet Information Services** directory, expand the item labeled **Web Management Tools**, and then select **IIS Management Console**. - -14. Expand the item labeled **IIS 6 Management Compatibility**, and then select **IIS 6 Scripting Tools**. - -15. Under the **Internet Information Services** directory, expand the item labeled **Microsoft .NET Framework 3.5.1**, and then select **Windows Communication Foundation Http Activation**. - -16. Click **OK**. - -### To install IIS version 7.0 on Windows Server 2008 - -1. From **Server Manager**, select **Roles**. Under **Roles Summary**, click **Add Roles**. - -2. Click **Next** to display the **Select Server Roles** dialog. - -3. Select **Application Server** from the **Roles** list, and then click **Next** twice to display the **Select Role Services** dialog for the Application Server role. - -4. Select **Web Server (IIS)** check box. If you are prompted to install additional role services and features, click **Add Required Features**. Click **Next** twice to display the **Select Role Services** dialog for the Web Server (IIS) role. - -5. Expand **Management Tools**, and then expand **IIS 6 Management Compatibility**. Select **IIS 6 Scripting Tools**. If you are prompted to install additional role services and features, click **Add Required Role Services**. Click **Next**. - -6. If the summary of selections is correct, click **Install**. - -7. When installation completes, click **Close**. - -### To install IIS version 7.0 on Windows Vista - -1. Click Start, and then click Control Panel. - -2. Select the **Programs** group. - -3. Under **Programs and Features**, click **Turn Windows Features on or off**. - -4. The **User Account Control** dialog is displayed. Click **Continue**. - -5. The **Windows Features** dialog is displayed. Expand the item labeled **Internet Information Services**. - -6. Expand the item labeled **World Wide Web Services**. - -7. Expand the item labeled **Application Development Features**. - -8. Make sure the following items are selected: - - 1. **.NET Extensibility** - - 2. **ASP.NET** - - 3. **ISAPI Extensions** - - 4. **ISAPI Filters** - -9. Expand the item labeled **Web Management Tools**, and then select **IIS Management Console**. - -10. Under the item labeled **World Wide Web Services**, expand **Common Http Features**. - -11. Make sure **Static Content** is selected. - -12. Under the item labeled **World Wide Web Services**, expand **Security**. - -13. Make sure **Windows Authentication** is selected. - -14. Expand the item labeled **IIS 6 Management Compatibility**, and then select **IIS 6 Scripting Tools**. - -15. Expand the item labeled **Microsoft .NET Framework 3.0**, and then select **Windows Communication Foundation Http Activation**. - -16. Click **OK**. - -### To install IIS version 6.0 on Windows Server 2003 - -1. From **Manage Your Server**, click **Add or remove a role**, and then click **Next**. - -2. Select **Application server (IIS, ASP.NET)** from the **Server Role** list, and then click **Next**. - -3. Select **Enable ASP.NET** check box, and then click **Next**. - -4. If the summary of selections is correct, click Next. - -### To install IIS version 5.1 on Windows XP with Service Pack 2 and Service Pack 3 installed - -1. In Control Panel, click **Add or Remove Programs**. - -2. In the **Add or Remove Programs** dialog box, click **Add/Remove Windows Components**. - -3. In the **Windows Components Wizard**, select the **Internet Information Services (IIS)** check box, and then click **Next**. - -4. If the **Files Needed** dialog box is displayed, insert your operating system installation disc, browse to the i386 folder, and then click **OK**. - -5. When installation completes, click **Finish**. - -6. Close the **Add or Remove Programs** dialog box, and then close **Control Panel**. - -### To verify the installation of IIS and ASP.NET - -1. Save the HTML file found at the end of this topic in the root \InetPub\wwwroot directory and name it Default.aspx. - -2. Open a browser window. - -3. Type `http://localhost/Default.aspx` in the address box, and then press ENTER. - -4. A Web page with the text "Hello World" should appear. - -> [!NOTE] -> Each time you install a new version of the .NET Framework, you must re-register aspnet_isapi as a Web service extension for IIS. To do so, issue the `aspnet_regiis –I –enable` command. - -## Sample Code - -```xml - - -
-

Hello World -

-
- - -``` diff --git a/docs/framework/wcf/samples/interop-extensibility.md b/docs/framework/wcf/samples/interop-extensibility.md deleted file mode 100644 index 33a5f99b67f14..0000000000000 --- a/docs/framework/wcf/samples/interop-extensibility.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -description: "Learn more about: Interop Extensibility" -title: "Interop Extensibility" -ms.date: "03/30/2017" -ms.assetid: 384a012a-d92d-40d1-b1a5-9c18ca932fcc ---- -# Interop Extensibility - -This section contains samples that demonstrate custom interoperability. - -## In This Section - - [Dispatch by Body Element](dispatch-by-body-element.md) - Demonstrates how to implement an alternate algorithm for assigning incoming messages to operations. - - [Route by Body](route-by-body.md) - Demonstrates how to implement a service that accepts message objects with any SOAP action. diff --git a/docs/framework/wcf/samples/interoperating-with-asmx-web-services.md b/docs/framework/wcf/samples/interoperating-with-asmx-web-services.md deleted file mode 100644 index 72ff160b3468c..0000000000000 --- a/docs/framework/wcf/samples/interoperating-with-asmx-web-services.md +++ /dev/null @@ -1,128 +0,0 @@ ---- -description: "Learn more about: Interoperating with ASMX Web Services" -title: "Interoperating with ASMX Web Services" -ms.date: "03/30/2017" -ms.assetid: a7c11f0a-9e68-4f03-a6b1-39cf478d1a89 ---- -# Interoperating with ASMX Web Services - -This sample demonstrates how to integrate a Windows Communication Foundation (WCF) client application with an existing ASMX Web service. - -> [!NOTE] -> The setup procedure and build instructions for this sample are located at the end of this topic. - - This sample consists of a client console program (.exe) and a service library (.dll) hosted by Internet Information Services (IIS). The service is an ASMX Web Service that implements a contract that defines a request-reply communication pattern. The service exposes math operations (`Add`, `Subtract`, `Multiply`, and `Divide`). The client makes synchronous requests to a math operation and the service replies with the result. Client activity is visible in the console window. - - The ASMX Web service implementation shown in the following sample code calculates and returns the appropriate result. - -```csharp -[WebService(Namespace="http://Microsoft.ServiceModel.Samples")] -public class CalculatorService : System.Web.Services.WebService - { - [WebMethod] - public double Add(double n1, double n2) - { - return n1 + n2; - } - [WebMethod] - public double Subtract(double n1, double n2) - { - return n1 - n2; - } - [WebMethod] - public double Multiply(double n1, double n2) - { - return n1 * n2; - } - [WebMethod] - public double Divide(double n1, double n2) - { - return n1 / n2; - } - } -``` - - As configured, the service can be accessed at `http://localhost/servicemodelsamples/service.asmx` by a client on the same machine. For clients on remote machines to access the service, a qualified domain name must be specified instead of localhost. - - Communication is done through a client generated by the [ServiceModel Metadata Utility Tool (Svcutil.exe)](../servicemodel-metadata-utility-tool-svcutil-exe.md). The client is contained in the file generatedClient.cs. The ASMX service must be available to generate the proxy code, because it is used to retrieve the updated metadata. Run the following command from a command prompt in the client directory to generate the typed proxy. - -```console -svcutil.exe /n:http://Microsoft.ServiceModel.Samples,Microsoft.ServiceModel.Samples http://localhost/servicemodelsamples/service.svc?wsdl /out:generatedClient.cs -``` - - By using the generated client, you can access a service endpoint by configuring the appropriate address and binding. Like the service, the client uses a configuration file (App.config) to specify the endpoint to communicate with. The client endpoint configuration consists of an absolute address for the service endpoint, the binding, and the contract, as shown in the following sample configuration. - -```xml - - - -``` - - The client implementation constructs an instance of the generated client. The generated client can then be used to communicate with the service. - -```csharp -// Create a client. -CalculatorServiceSoapClient client = new CalculatorServiceSoapClient(); - -// Call the Add service operation. -double value1 = 100.00D; -double value2 = 15.99D; -double result = client.Add(value1, value2); -Console.WriteLine("Add({0},{1}) = {2}", value1, value2, result); - -// Call the Subtract service operation. -value1 = 145.00D; -value2 = 76.54D; -result = client.Subtract(value1, value2); -Console.WriteLine("Subtract({0},{1}) = {2}", value1, value2, result); - -// Call the Multiply service operation. -value1 = 9.00D; -value2 = 81.25D; -result = client.Multiply(value1, value2); -Console.WriteLine("Multiply({0},{1}) = {2}", value1, value2, result); - -// Call the Divide service operation. -value1 = 22.00D; -value2 = 7.00D; -result = client.Divide(value1, value2); -Console.WriteLine("Divide({0},{1}) = {2}", value1, value2, result); - -//Closing the client gracefully closes the connection and cleans up resources. -client.Close(); - -Console.WriteLine(); -Console.WriteLine("Press to terminate client."); -Console.ReadLine(); -``` - - When you run the sample, the operation requests and responses are displayed in the client console window. Press ENTER in the client window to shut down the client. - -```console -Add(100,15.99) = 115.99 -Subtract(145,76.54) = 68.46 -Multiply(9,81.25) = 731.25 -Divide(22,7) = 3.14285714285714 - -Press to terminate client. -``` - -### To set up, build, and run the sample - -1. Ensure that you have performed the [One-Time Setup Procedure for the Windows Communication Foundation Samples](one-time-setup-procedure-for-the-wcf-samples.md). - -2. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -3. To run the sample in a single- or cross-machine configuration, follow the instructions in [Running the Windows Communication Foundation Samples](running-the-samples.md). - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Client\Interop\ASMX` diff --git a/docs/framework/wcf/samples/json-serialization.md b/docs/framework/wcf/samples/json-serialization.md deleted file mode 100644 index ac2e7af45cc01..0000000000000 --- a/docs/framework/wcf/samples/json-serialization.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -description: "Learn more about: DataContractJsonSerializer sample" -title: "DataContractJsonSerializer sample" -ms.date: "03/30/2017" -ms.assetid: 3c2c4747-7510-4bdf-b4fe-64f98428ef4a ---- -# DataContractJsonSerializer sample - -> [!NOTE] -> This sample is for . For most scenarios that involve serializing and deserializing JSON, we recommend the APIs in the [System.Text.Json namespace](../../../standard/serialization/system-text-json-overview.md). - - supports the same types as . The JSON data format is especially useful when writing Asynchronous JavaScript and XML (AJAX)-style Web applications. AJAX support in Windows Communication Foundation (WCF) is optimized for use with ASP.NET AJAX through the ScriptManager control. For examples of how to use Windows Communication Foundation (WCF) with ASP.NET AJAX, see the [AJAX Samples](ajax.md). - -The set-up procedure and build instructions for this sample are located at the end of this topic. - -The sample uses a `Person` data contract to demonstrate serialization and deserialization. - -```csharp -[DataContract] -class Person -{ - [DataMember] - internal string name; - - [DataMember] - internal int age; -} -``` - - To serialize an instance of the `Person` type to JSON, create the first and use the `WriteObject` method to write JSON data to a stream. - -```csharp -Person p = new Person(); -//Set up Person object... -MemoryStream stream1 = new MemoryStream(); -DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Person)); -ser.WriteObject(stream1, p); -``` - - The memory stream contains valid JSON data. - -```json -{"age":42,"name":"John"} -``` - - The sample demonstrates deserializing from JSON data into an object. You then rewind the stream and call `ReadObject`. - -```csharp -Person p2 = (Person)ser.ReadObject(stream1); -``` - - Examining the `p2` object reveals that the JSON data has been deserialized correctly. - -> [!IMPORTANT] -> The samples may already be installed on your machine. Check for the following (default) directory before continuing. -> -> `:\WF_WCF_Samples` -> -> If this directory does not exist, go to [Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) Samples for .NET Framework 4](https://www.microsoft.com/download/details.aspx?id=21459) to download all Windows Communication Foundation (WCF) and [!INCLUDE[wf1](../../../../includes/wf1-md.md)] samples. This sample is located in the following directory. -> -> `:\WF_WCF_Samples\WCF\Basic\Ajax\JsonSerialization` - -#### To set up, build and run the sample - -1. Build the solution JsonSerialization.sln as described in [Building the Windows Communication Foundation Samples](building-the-samples.md). - -2. Run the resulting console application. diff --git a/docs/framework/wcf/samples/jsonp.md b/docs/framework/wcf/samples/jsonp.md deleted file mode 100644 index f850c1c83576a..0000000000000 --- a/docs/framework/wcf/samples/jsonp.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -description: "Learn more about: JSONP" -title: "JSONP" -ms.date: "03/30/2017" -ms.assetid: c13b4d7b-dac7-4ffd-9f84-765c903511e1 ---- -# JSONP - -This sample demonstrates how to support JSON with Padding (JSONP) in WCF REST services. JSONP is a convention used to invoke cross-domain scripts by generating script tags in the current document. The result is returned in a specified callback function. JSONP is based on the idea that tags such as `