Dim host As New ServiceHost(GetType(Service1),
New Uri("http://contoso:81/Service1"))
Dim healthBehavior As ServiceHealthBehavior =
host.Description.Behaviors.Find(Of ServiceHealthBehavior)()
If healthBehavior Is Nothing Then
healthBehavior = New ServiceHealthBehavior()
End If
host.Description.Behaviors.Add(healthBehavior)

Un code d’état de réponse HTTP 455 est retourné lorsque l’état de l’un des répartiteurs de canal est supérieur à CommunicationState.Opened.A 455 HTTP response status code is returned when the state of any of the channel dispatchers is greater than CommunicationState.Opened.

Un code d’état de réponse HTTP 465 est retourné lorsque l’état de l’un des écouteurs de canal est supérieur à CommunicationState.Opened.A 465 HTTP response status code is returned when the state of any of the channel listeners is greater than CommunicationState.Opened.

Le nom du fichier de ressources localisées se présente sous la forme DataAnnotation.Localization.{nom}.resx, où nom est le nom de culture au format code_languepays-code_région ou code_langue.The name of the localized resources file has the form DataAnnotation.Localization.{name}.resx, where name is a culture name in the format languageCode-country/regionCode or languageCode.

Public Shared Function SignDataDsaSha384(data As Byte(), cert As X509Certificate2) As Byte()
Using DSA As DSA = cert.GetDSAPrivateKey()
Return DSA.SignData(data, HashAlgorithmName.SHA384)
End Using
End Function

Public Shared Function VerifyDataDsaSha384(data As Byte(), signature As Byte(), cert As X509Certificate2) As Boolean
Using dsa As DSA = cert.GetDSAPublicKey()
Return dsa.VerifyData(data, signature, HashAlgorithmName.SHA384)
End Using
End Function

Public Shared Function EncryptDataWithPersistedKey(data As Byte(), iv As Byte()) As Byte()
Using Aes As Aes = New AesCng("AesDemoKey", CngProvider.MicrosoftSoftwareKeyStorageProvider)
Aes.IV = iv
' Using the zero-argument overload Is required to make use of the persisted key
Using encryptor As ICryptoTransform = Aes.CreateEncryptor()
If Not encryptor.CanTransformMultipleBlocks Then
Throw New InvalidOperationException("This is a sample, this case wasn’t handled...")
End If
Return encryptor.TransformFinalBlock(data, 0, data.Length)
End Using
End Using
End Function

Les programmes qui ont inscrit un gestionnaire SignatureDescription personnalisé dans CryptoConfig dans le but d’ajouter la prise en charge de ces algorithmes continueront de fonctionner comme par le passé. Cependant, comme il y a désormais les valeurs par défaut de la plateforme, l’inscription CryptoConfig n’est plus nécessaire.Any programs that have registered a custom SignatureDescription handler into CryptoConfig to add support for these algorithms will continue to function as they did in the past, but since there are now platform defaults, the CryptoConfig registration is no longer necessary.

WCF propose un nouveau paramètre d’application qui peut être défini sur les applications clientes de telle sorte qu’elles se connectent systématiquement au service écoutant l’URI qui correspond le mieux à celui qu’elles demandent.WCF has a new app setting that can be set on client applications to ensure they always connect to the service listening on the URI that best matches the one that they request.Dans la mesure où ce paramètre d’application est défini sur false (valeur par défaut), les clients utilisant NetNamedPipeBinding peuvent tenter de se connecter à un service écoutant un URI qui est une sous-chaîne de l’URI demandé.With this app setting set to false (the default), it is possible for clients using NetNamedPipeBinding to attempt to connect to a service listening on a URI that is a substring of the requested URI.

Par exemple, un client tente de se connecter à un service à l’écoute de net.pipe://localhost/Service1, mais un autre service de cet ordinateur s’exécutant avec des privilèges d’administrateur écoute net.pipe://localhost.For example, a client tries to connect to a service listening at net.pipe://localhost/Service1, but a different service on that machine running with administrator privilege is listening at net.pipe://localhost.Si ce paramètre d’application est défini sur false, le client tente de se connecter au mauvais service.With this app setting set to false, the client would attempt to connect to the wrong service.Une fois le paramètre d’application défini sur true, le client se connecte systématiquement au service le plus approprié.After setting the app setting to true, the client will always connect to the best matching service.

Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.X509Certificates
Public Class Net461Code
Public Shared Function SignECDsaSha512(data As Byte(), cert As X509Certificate2) As Byte()
Using privateKey As ECDsa = cert.GetECDsaPrivateKey()
Return privateKey.SignData(data, HashAlgorithmName.SHA512)
End Using
End Function
Public Shared Function SignECDsaSha512(data As Byte, privateKey As ECDsa) As Byte()
Return privateKey.SignData(data, HashAlgorithmName.SHA512)
End Function
End Class

using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
public class Net46Code
{
public static byte[] SignECDsaSha512(byte[] data, X509Certificate2 cert)
{
// This would require using cert.Handle and a series of p/invokes to get at the
// underlying key, then passing that to a CngKey object, and passing that to
// new ECDsa(CngKey). It's a lot of work.
throw new Exception("That's a lot of work...");
}
public static byte[] SignECDsaSha512(byte[] data, ECDsa privateKey)
{
// This way works, but SignData probably better matches what you want.
using (SHA512 hasher = SHA512.Create())
{
byte[] signature1 = privateKey.SignHash(hasher.ComputeHash(data));
}
// This might not be the ECDsa you got!
ECDsaCng ecDsaCng = (ECDsaCng)privateKey;
ecDsaCng.HashAlgorithm = CngAlgorithm.Sha512;
return ecDsaCng.SignData(data);
}
}

Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.X509Certificates
Public Class Net46Code
Public Shared Function SignECDsaSha512(data As Byte(), cert As X509Certificate2) As Byte()
' This would require using cert.Handle and a series of p/invokes to get at the
' underlying key, then passing that to a CngKey object, and passing that to
' new ECDsa(CngKey). It's a lot of work.
Throw New Exception("That's a lot of work...")
End Function
Public Shared Function SignECDsaSha512(data As Byte(), privateKey As ECDsa) As Byte()
' This way works, but SignData probably better matches what you want.
Using hasher As SHA512 = SHA512.Create()
Dim signature1 As Byte() = privateKey.SignHash(hasher.ComputeHash(data))
End Using
' This might not be the ECDsa you got!
Dim ecDsaCng As ECDsaCng = CType(privateKey, ECDsaCng)
ecDsaCng.HashAlgorithm = CngAlgorithm.Sha512
Return ecDsaCng.SignData(data)
End Function
End Class

WPF inclut un package NuGet qui fournit de nouvelles implémentations de D3DImage facilitant l’interaction avec du contenu DX10 et Dx11.WPF includes a NuGet package that provides new implementations of D3DImage that make it easy for you to interoperate with DX10 and Dx11 content.Le code de ce package a été mis en open source et est disponible sur GitHub.The code for this package has been open sourced and is available on GitHub.

if (!AppContext.TryGetSwitch("Switch.AmazingLib.ThrowOnException", out shouldThrow))
{
// This is the case where the switch value was not set by the application.
// The library can choose to get the value of shouldThrow by other means.
// If no overrides nor default values are specified, the value should be 'false'.
// A false value implies the latest behavior.
}
// The library can use the value of shouldThrow to throw exceptions or not.
if (shouldThrow)
{
// old code
}
else
{
// new code
}

If Not AppContext.TryGetSwitch("Switch.AmazingLib.ThrowOnException", shouldThrow) Then
' This is the case where the switch value was not set by the application.
' The library can choose to get the value of shouldThrow by other means.
' If no overrides nor default values are specified, the value should be 'false'.
' A false value implies the latest behavior.
End If
' The library can use the value of shouldThrow to throw exceptions or not.
If shouldThrow Then
' old code
Else
' new code
End If

Operation 'Request3|{http://tempuri.org/}IService' on service instance with identifier '2b0667b6-09c8-4093-9d02-f6c67d534292' cannot be performed at this time. Please ensure that the operations are performed in the correct order and that the binding in use provides ordered delivery guarantees.

C'est le même message que vous recevez en cas d'opération exceptionnelle et d'absence de signet non-protocole.This is the same message that you receive if an out-of-order operation message is received and there are no non-protocol bookmarks.

Vous pouvez maintenant inclure l'identificateur de transaction distribuée pour la transaction ayant provoqué la levée d'une exception dérivée de TransactionException.You can now include the distributed transaction identifier for the transaction that has caused an exception derived from TransactionException to be thrown.Pour ce faire, ajoutez la clé suivante à la section appSettings de votre fichier app.config :You do this by adding the following key to the appSettings section of your app.config file:

<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name:="FullTrust")>
public Function PromoteAndEnlistDurable(GresourceManagerIdentifier As Guid,
promotableNotification As IPromotableSinglePhaseNotification,
enlistmentNotification As ISinglePhaseNotification,
enlistmentOptions As EnlistmentOptions) As Enlistment

Possibilité de définir la durée qui doit s'écouler entre les modifications de propriété et les mises à jour de la source de données.Ability to set the amount of time that should elapse between property changes and data source updates.

Modifications des valeurs de propriété de transport par défaut pour réduire la probabilité d'avoir à les définir.Changes in default transport property values to reduce the likelihood that you will have to set them.

Possibilité de créer automatiquement une activité de séquence lorsqu'une deuxième activité enfant est ajoutée à une activité de conteneur, et d'inclure les deux activités dans l'activité de séquence.Ability to automatically create a Sequence activity when a second child activity is added to a container activity, and to include both activities in the Sequence activity.