Configurare le impostazioni di FabricTransport per Reliable ActorsConfigure FabricTransport settings for Reliable Actors

Ecco le impostazioni che possono essere configurate:Here are the settings that you can configure:

È possibile modificare la configurazione predefinita di FabricTransport nei modi seguenti.You can modify the default configuration of FabricTransport in following ways.

Attributo assemblyAssembly attribute

L'attributo FabricTransportActorRemotingProvider deve essere applicato negli assembly del client attore e del servizio attore.The FabricTransportActorRemotingProvider attribute needs to be applied on the actor client and actor service assemblies.

L'esempio seguente illustra come modificare il valore predefinito delle impostazioni OperationTimeout di FabricTransport:The following example shows how to change the default value of FabricTransport OperationTimeout settings:

  using Microsoft.ServiceFabric.Actors.Remoting.FabricTransport;
  [assembly:FabricTransportActorRemotingProvider(OperationTimeoutInSeconds = 600)]

Il secondo esempio modifica i valori predefiniti di FabricTransport MaxMessageSize e OperationTimeoutInSeconds.Second example changes default Values of FabricTransport MaxMessageSize and OperationTimeoutInSeconds.

  using Microsoft.ServiceFabric.Actors.Remoting.FabricTransport;
  [assembly:FabricTransportActorRemotingProvider(OperationTimeoutInSeconds = 600,MaxMessageSize = 134217728)]

Pacchetto di configurazioneConfig package

È possibile usare un pacchetto di configurazione per modificare la configurazione predefinita.You can use a config package to modify the default configuration.

Configurare le impostazioni di FabricTransport per il servizio attoreConfigure FabricTransport settings for the actor service

Aggiungere una sezione TransportSettings nel file settings.xml.Add a TransportSettings section in the settings.xml file.

Per impostazione predefinita, il codice attore cerca il nome sezione "<ActorName>TransportSettings".By default, actor code looks for SectionName as "<ActorName>TransportSettings". Se non viene trovato, cerca il SectionName "TransportSettings".If that's not found, it checks for SectionName as "TransportSettings".

<Section Name="MyActorServiceTransportSettings">
     <Parameter Name="MaxMessageSize" Value="10000000" />
     <Parameter Name="OperationTimeoutInSeconds" Value="300" />
     <Parameter Name="SecurityCredentialsType" Value="X509" />
     <Parameter Name="CertificateFindType" Value="FindByThumbprint" />
     <Parameter Name="CertificateFindValue" Value="4FEF3950642138446CC364A396E1E881DB76B48C" />
     <Parameter Name="CertificateRemoteThumbprints" Value="b3449b018d0f6839a2c5d62b5b6c6ac822b6f662" />
     <Parameter Name="CertificateStoreLocation" Value="LocalMachine" />
     <Parameter Name="CertificateStoreName" Value="My" />
     <Parameter Name="CertificateProtectionLevel" Value="EncryptAndSign" />
     <Parameter Name="CertificateRemoteCommonNames" Value="ServiceFabric-Test-Cert" />
 </Section>

Configurare le impostazioni di FabricTransport per l'assembly del client attoreConfigure FabricTransport settings for the actor client assembly

Se il client non è in esecuzione come parte di un servizio, è possibile creare un file XML "<Nome EXE client>.settings.xml" nello stesso percorso in cui si trova il file client .exe.If the client is not running as part of a service, you can create a "<Client Exe Name>.settings.xml" file in the same location as the client .exe file. Aggiungere quindi una sezione TransportSettings in tale file.Then add a TransportSettings section in that file. SectionName deve essere "TransportSettings".SectionName should be "TransportSettings".

<?xml version="1.0" encoding="utf-8"?>
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Section Name="TransportSettings">
    <Parameter Name="SecurityCredentialsType" Value="X509" />
    <Parameter Name="OperationTimeoutInSeconds" Value="300" />
    <Parameter Name="CertificateFindType" Value="FindByThumbprint" />
    <Parameter Name="CertificateFindValue" Value="b3449b018d0f6839a2c5d62b5b6c6ac822b6f662" />
    <Parameter Name="CertificateRemoteThumbprints" Value="4FEF3950642138446CC364A396E1E881DB76B48C" />
    <Parameter Name="OperationTimeoutInSeconds" Value="300" />
    <Parameter Name="CertificateStoreLocation" Value="LocalMachine" />
    <Parameter Name="CertificateStoreName" Value="My" />
    <Parameter Name="CertificateProtectionLevel" Value="EncryptAndSign" />
    <Parameter Name="CertificateRemoteCommonNames" Value="WinFabric-Test-SAN1-Alice" />
  </Section>
</Settings>
  • Configurazione delle impostazioni di FabricTransport per il client/servizio Actor protetto con certificato secondario.Configuring FabricTransport Settings for Secure Actor Service/Client With Secondary Certificate. È possibile aggiungere informazioni sul certificato secondario aggiungendo il parametro CertificateFindValuebySecondary.Secondary certificate information can be added by adding parameter CertificateFindValuebySecondary. L'esempio seguente riguarda TransportSettings del listener.Below is the example for the Listener TransportSettings.

    <Section Name="TransportSettings">
    <Parameter Name="SecurityCredentialsType" Value="X509" />
    <Parameter Name="CertificateFindType" Value="FindByThumbprint" />
    <Parameter Name="CertificateFindValue" Value="b3449b018d0f6839a2c5d62b5b6c6ac822b6f662" />
    <Parameter Name="CertificateFindValuebySecondary" Value="h9449b018d0f6839a2c5d62b5b6c6ac822b6f690" />
    <Parameter Name="CertificateRemoteThumbprints" Value="4FEF3950642138446CC364A396E1E881DB76B48C,a9449b018d0f6839a2c5d62b5b6c6ac822b6f667" />
    <Parameter Name="CertificateStoreLocation" Value="LocalMachine" />
    <Parameter Name="CertificateStoreName" Value="My" />
    <Parameter Name="CertificateProtectionLevel" Value="EncryptAndSign" />
    </Section>
    

    L'esempio seguente riguarda TransportSettings del client.Below is the example for the Client TransportSettings.

    <Section Name="TransportSettings">
    <Parameter Name="SecurityCredentialsType" Value="X509" />
    <Parameter Name="CertificateFindType" Value="FindByThumbprint" />
    <Parameter Name="CertificateFindValue" Value="4FEF3950642138446CC364A396E1E881DB76B48C" />
    <Parameter Name="CertificateFindValuebySecondary" Value="a9449b018d0f6839a2c5d62b5b6c6ac822b6f667" />
    <Parameter Name="CertificateRemoteThumbprints" Value="b3449b018d0f6839a2c5d62b5b6c6ac822b6f662,h9449b018d0f6839a2c5d62b5b6c6ac822b6f690" />
    <Parameter Name="CertificateStoreLocation" Value="LocalMachine" />
    <Parameter Name="CertificateStoreName" Value="My" />
    <Parameter Name="CertificateProtectionLevel" Value="EncryptAndSign" />
    </Section>
    
    • Configurazione delle impostazioni di FabricTransport per il client/servizio Actor protetto usando il nome oggetto.Configuring FabricTransport Settings for Securing Actor Service/Client Using Subject Name. L'utente deve fornire findType come FindBySubjectName e aggiungere i valori di CertificateIssuerThumbprints e CertificateRemoteCommonNames.User needs to provide findType as FindBySubjectName,add CertificateIssuerThumbprints and CertificateRemoteCommonNames values. L'esempio seguente riguarda TransportSettings del listener.Below is the example for the Listener TransportSettings.

      <Section Name="TransportSettings">
      <Parameter Name="SecurityCredentialsType" Value="X509" />
      <Parameter Name="CertificateFindType" Value="FindBySubjectName" />
      <Parameter Name="CertificateFindValue" Value="CN = WinFabric-Test-SAN1-Alice" />
      <Parameter Name="CertificateIssuerThumbprints" Value="b3449b018d0f6839a2c5d62b5b6c6ac822b6f662" />
      <Parameter Name="CertificateRemoteCommonNames" Value="WinFabric-Test-SAN1-Bob" />
      <Parameter Name="CertificateStoreLocation" Value="LocalMachine" />
      <Parameter Name="CertificateStoreName" Value="My" />
      <Parameter Name="CertificateProtectionLevel" Value="EncryptAndSign" />
      </Section>
      

      L'esempio seguente riguarda TransportSettings del client.Below is the example for the Client TransportSettings.

     <Section Name="TransportSettings">
    <Parameter Name="SecurityCredentialsType" Value="X509" />
    <Parameter Name="CertificateFindType" Value="FindBySubjectName" />
    <Parameter Name="CertificateFindValue" Value="CN = WinFabric-Test-SAN1-Bob" />
    <Parameter Name="CertificateStoreLocation" Value="LocalMachine" />
    <Parameter Name="CertificateStoreName" Value="My" />
    <Parameter Name="CertificateRemoteCommonNames" Value="WinFabric-Test-SAN1-Alice" />
    <Parameter Name="CertificateProtectionLevel" Value="EncryptAndSign" />
    </Section>