Back: CSharp Reference Implementation

The Direct Dns Reponder Windows Service reads settings from DirectDnsResponderSvc.exe.config.

You can find sample settings in csharp\windows services\dnsresponder.winsrv\App.config. App.config is compiled into a DirectDnsResponderSvc.exe.config file. When deploying the service binaries, replace the default with your own config file - using a deployment script.

ServiceSettings Config Sections


The Dns Server uses custom config section group. Make sure you place the following in your config file.

/configuration/configSections/ServiceSettingsGroup (Required)

<configuration>
  <configSections>
    <sectionGroup name="ServiceSettingsGroup">
      <section name="RecordRetrievalServiceSettings" type="Health.Direct.Config.Client.ClientSettingsSection, Health.Direct.Config.Client"
        allowLocation="true"
        allowDefinition="Everywhere" />
      <section name="DnsServerSettings" type="Health.Direct.DnsResponder.DnsServerSettingsSection, Health.Direct.DnsResponder"
        allowLocation="true"
        allowDefinition="Everywhere" />
    </sectionGroup>
 

Record Retrieval Service


You store actual Dns Records are in the backend (Sql) configuration store. The store is fronted by the Dns middle-tier Record Retrieval web service. You configure your Dns Server to access this web service - typically, by supplying the service Url.

/ServiceSettingsGroup/RecordRetrievalServiceSettings (Required)
<configuration>
  <configSections>
    ...
    <ServiceSettingsGroup>
       <RecordRetrievalServiceSettings Url="http://localhost/DnsService/RecordRetrievalService.svc/Records" />
    ...

Attribute
Required
Type
Default
Description
Url
Yes
url
http://localhost/DnsService/RecordRetrievalService.svc/Records
Url to the record retrieval middle tier service
ReceiveTimeout
No
int
WCF defaults
How long the WCF proxy waits to receive a response from the record service.
SendTimeout
No
int
WCF defaults
How long the WCF proxy waits to messages for the record service to accept a request.
MaxReceivedMessageSize
No
int
int.MaxValue
Maximum size of a response from the record service

Server Settings

/ServiceSettingsGroup/DnsServerSettings (Required)

<configuration>
  <configSections>
    ...
    <ServiceSettingsGroup>
        <DnsServerSettings Address="0.0.0.0" Port="53" DefaultTTL="3600">
          <UdpServerSettings MaxOutstandingAccepts="8" MaxActiveRequests="32" SendTimeout="5000" ReceiveTimeout="5000"/>
          <TcpServerSettings MaxOutstandingAccepts="8" MaxActiveRequests="32" SendTimeout="5000" ReceiveTimeout="5000" SocketCloseTimeout="2000"/>
        </DnsServerSettings>
<ServiceSettingsGroup>

Attributes

Attribute
Required
Type
Default
Description
Address
Yes
string
0.0.0.0
IP Address the server accepts requests on. 0.0.0.0 (Any) listens on ALL available IPs, including localhost
Port
No
int
53
Port the server listens - both TCP & UDP
Default TTL
No
int
3600 ms
Default TTL in milliseconds for records with no TTL assigned in record store


TCPServerSettings

/ServiceSettingsGroup/DnsServerSettings/TcpServerSettings (Required)

Attribute
Required
Type
Default
Description
MaxActiveRequests
No
int
64
Maximum number of simultaneous TCP requests the server will accept
SendTimeout
No
int
15000
Milliseconds before server times out a Send to the the client. In case of a a timeout, the server will immediately close the connection. Use short timeouts.
ReceiveTimeout
No
int
15000
Milliseconds before server times out a Read from the client. In case of a a timeout, the server will immediately close the connection. Use short timeouts
SocketCloseTimeout
No
int
5000
Milliseconds socket will wait to send pending data before closing the connection. Use short timeouts.
MaxOutstandingAccepts
No
int
16
Maximum number of pending asynchronous Socket connection Accept operations. An accepted connection This setting minimizes resource usage and should typically be less than MaxActiveRequests.

UDPServerSettings

/ServiceSettingsGroup/DnsServerSettings/UdpServerSettings (Required)


Attribute
Required
Type
Default
Description
MaxActiveRequests
No
int
64
Maximum number of simultaneous UDP requests the server will accept
SendTimeout
No
int
15000
Milliseconds before server times out a Send to the the client. In case of a a timeout, the server will immediately close the connection. Use short timeouts
ReceiveTimeout
No
int
15000
Milliseconds before server times out a Read from the client. In case of a a timeout, the server will immediately close the connection. Use short timeouts
SocketCloseTimeout
No
int
5000
Milliseconds socket will wait to send pending data before closing the connection. Use short timeouts.
MaxOutstandingAccepts
No
int
16
Maximum number of pending asynchronous Socket Async Receives. This setting minimizes resource usage and should typically be less than MaxActiveRequests.

Logging

Dns Server uses a standard Direct logging config section.