Compartilhar via


Application configuration file

The application configuration file (app.config) contains settings that control how the application will communicate with the native endpoint for the Dynamics GP service. The settings in the app.config file are added when you create the service reference.

Warning: Due to the large size of the Dynamics GP service, the connection settings for the app.config are not always generated when a service reference is added to the project. If this situation occurs, you will need to manually add entries to the app.config file. A sample app.config file can be found later in this section. You can also generate the configuration settings using the svcutil.exe, which is described in Using SvcUtil.exe.

Buffer sizes

Due to the large document sizes and the quantity of data that can be sent to and retrieved from the Dynamics GP service, some of the default buffer size values must be increased to their maximum values. Make the following adjustments in the app.config file:

In the <binding> node:

maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"

In the <readerQuotas> node:

maxNameTableCharCount="2147483647"

Client settings

The <client> node specifies the URL of the native endpoint that your application is accessing. When your application is installed, this URL will need to be adjusted to point to the native endpoint of the Dynamics GP service.

Within the <identity> node you will find the <userPrincipalName> node. This node is important when configuring security for the native endpoint. To allow the most secure access to the endpoint, the <userPrincipalName> node must be set to the fully-qualified domain name of the user that is running the Microsoft Dynamics GP Service Host on the server that is running Web Services for Microsoft Dynamics GP.

If both the client machine accessing web services and the user running the Dynamics GP Service Host have been registered as Service Principal Names (SPNs) by the domain administrator, then Kerberos authentication will be used. If SPNs have not been registered, or the value in the <userPrincipalName> node isn't a valid fully-qualified domain name, then authentication will fall back to the less secure NTLM.

The <userPrincipalName> must contain a value that is in the format "machine\user", even if Kerberos authentication isn't being used. If the user principal name is missing or is formatted incorrectly, your application will not be able to access the native endpoint of the Dynamics GP service.

Sample app.config file

The following is a sample app.config file that contains the settings for a service reference to the native endpoint of the Dynamics GP service. You can use this sample when you need to manually add the connection information to the app.config file. Be sure to set the URL in the <endpoint> node. You should also set the <userPrincipalName> node if you plan to use Kerberos authentication.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="GPWebService" closeTimeout="00:01:00"
           openTimeout="00:01:00" receiveTimeout="00:10:00"
           sendTimeout="00:01:00" bypassProxyOnLocal="false"
           transactionFlow="false" hostNameComparisonMode="StrongWildcard"
           maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
           messageEncoding="Text" textEncoding="utf-8"
           useDefaultWebProxy="true" allowCookies="false">
           <readerQuotas maxDepth="32" maxStringContentLength="8192"
               maxArrayLength="16384" maxBytesPerRead="4096"
               maxNameTableCharCount="2147483647" />
           <reliableSession ordered="true" inactivityTimeout="00:10:00"
               enabled="false" />
           <security mode="Message">
               <transport clientCredentialType="Windows"
                   proxyCredentialType="None" realm="" />
               <message clientCredentialType="Windows"
                   negotiateServiceCredential="true" algorithmSuite="Default"
                   establishSecurityContext="true" />
           </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://server:48620/Dynamics/GPService/GPService"
        binding="wsHttpBinding" bindingConfiguration="GPWebService"
        contract="DynamicsGPService.DynamicsGP" name="GPWebService">
        <identity>
          <userPrincipalName value="machine\user" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>