<?xml version="1.0" encoding="utf-8" ?>
<configuration>

    <configSections>

        <!--Register service's custom configruation sections and group-->
        <sectionGroup name="microsoft.Hpc.Session.ServiceRegistration"
                      type="Microsoft.Hpc.Scheduler.Session.Configuration.ServiceRegistration, Microsoft.Hpc.Scheduler.Session, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
            <section name="service"
                     type="Microsoft.Hpc.Scheduler.Session.Configuration.ServiceConfiguration, Microsoft.Hpc.Scheduler.Session, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                     allowDefinition="Everywhere"
                     allowExeDefinition="MachineToApplication"
               />
        </sectionGroup>

        <sectionGroup name="microsoft.Hpc.Broker"
                      type="Microsoft.Hpc.Scheduler.Session.Configuration.BrokerConfigurations, Microsoft.Hpc.Scheduler.Session, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
            <section name="monitor"
                     type="Microsoft.Hpc.Scheduler.Session.Configuration.BrokerMonitorConfiguration, Microsoft.Hpc.Scheduler.Session, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                     allowDefinition="Everywhere"
                     allowExeDefinition="MachineToApplication"
               />
            <section name="services"
                     type="Microsoft.Hpc.Scheduler.Session.Configuration.BrokerServicesConfiguration, Microsoft.Hpc.Scheduler.Session, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                     allowDefinition="Everywhere"
                     allowExeDefinition="MachineToApplication"
               />
            <section name="loadBalancing"
                     type="Microsoft.Hpc.Scheduler.Session.Configuration.LoadBalancingConfiguration, Microsoft.Hpc.Scheduler.Session, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                     allowDefinition="Everywhere"
                     allowExeDefinition="MachineToApplication"
               />
        </sectionGroup>

    </configSections>

    <microsoft.Hpc.Session.ServiceRegistration>
        <service assembly="C:\ServicesR2\EchoService.dll"
                 includeExceptionDetailInFaults="true"
                 maxConcurrentCalls="0"
                 >
            <!--Below is a sample for adding environment variables to the service-->
            <environmentVariables>
                <add name="myname1" value="myvalue1"/>
                <add name="myname2" value="myvalue2"/>
            </environmentVariables>
        </service>
    </microsoft.Hpc.Session.ServiceRegistration>

    <!--Service broker's configuration-->
    <microsoft.Hpc.Broker>
        <!--configuration to control broker's monitoring behavior-->
        <monitor messageThrottleStartThreshold="4096"
                 messageThrottleStopThreshold="3072"
                 loadSamplingInterval="1000"
                 allocationAdjustInterval="30000"
                 clientIdleTimeout="300000"
                 clientConnectionTimeout="300000"
                 sessionIdleTimeout="0"
                 statusUpdateInterval="15000"/>
        <services>
            <!--Address templates used for Broker service-->
            <brokerServiceAddresses>
                <!--
            Two configuration is done to enable broker listen on this URI:
            1. Port 9087 is added to firewall exceptions
            2. Users group is allowed to register with NetTcp port sharing service
        -->
                <add baseAddress="net.tcp://localhost/Broker"/>
                <!--Before using HTTP transport, make sure:
                1. The HTTP URI is correctly reserved for the user who is going to starts the session 
                   (using "netsh http add urlacl")and evaluate risk of allowing the user to listen on that URL
                2. Open the port in firewall
        -->
                <add baseAddress="http://localhost/Broker"/>
                <!--Before using HTTPS transport, make sure 
                1. The HTTPS URI is correctly reserved for the user who is going to starts the session 
                   (using "netsh http add urlacl") and evaluate risk of allowing the user to listen on that URL
                2. Open the port in firewall
                3. Valid certificate is installed for the machine
                4. the certificate is registered with HTTP listener ("netsh http add sslcert")
        -->
                <add baseAddress="https://localhost/Broker"/>
            </brokerServiceAddresses>
        </services>
        <loadBalancing messageResendLimit="3"
                       serviceOperationTimeout="86400000"
                       endpointNotFoundRetryCountLimit="10"
                       endpointNotFoundRetryPeriod="5000"/>
    </microsoft.Hpc.Broker>

    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <!--binding used by broker's front end service with security-->
                <binding name="Microsoft.Hpc.SecureNetTcpBrokerBinding">
                    <security mode="Transport"/>
                </binding>

                <!--binding used by broker's front end service with no security-->
                <binding name="Microsoft.Hpc.UnsecureNetTcpBrokerBinding">
                    <security mode="None"/>
                </binding>

                <!--binding used by broker's backend-->
                <binding name="Microsoft.Hpc.BackEndBinding">
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="None"/>
                    </security>
                </binding>
            </netTcpBinding>

            <basicHttpBinding>
                <!--binding used by broker's front end service with security-->
                <binding name="Microsoft.Hpc.SecureHttpBrokerBinding">
                    <security mode="TransportWithMessageCredential">
                        <message clientCredentialType="UserName"/>
                        <transport clientCredentialType="None"/>
                    </security>
                </binding>

                <!--binding used by broker's front end service with no security-->
                <binding name="Microsoft.Hpc.UnsecureHttpBrokerBinding">
                    <security mode="None"/>
                </binding>
            </basicHttpBinding>
        </bindings>
    </system.serviceModel>
</configuration>