Compartilhar via


Closing the service instance

After your application has finished using the service instance for the native endpoint, it is important that you close the instance. This allows the Dynamics GP service to release the resources used for the connection. The following C# code shows how to close the service instance.

// Close the service
if (wsDynamicsGP.State != CommunicationState.Faulted)
{
    wsDynamicsGP.Close();
}

Warning: If applications do not close the service instance for the native endpoint when they are finished using it, the native endpoint can be left in a condition where it is unable to make new connections.