Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Name resolving problem with DTC (Distributed Transaction Coordinator)

, 7 Jan 2012
Rate this:
Please Sign up or sign in to vote.
A solution for the name resolving problem with DTC.

If you have two servers (or more) in different networks and the DNS is not configured, does not exist, or is not used for any other case (like security or restrict access), you have a problem with the DTC when you try to INSERT, UPDATE, or DELETE data on a database server (or any other case).

The explanation for this is: imagine you have three layers of testing software environment of your software as in the example below:

Server 1 (Database server, for the example SQL SERVER)
ip address: 192.168.1.1
name: DBSERVER
 
Server 2 (Application Server, IIS 7, 7,5)
ip address: 10.150.40.21
name: APPSERVER

Client (your PC) both servers and your application are configured to use DTC.

If you try to execute the application hosted in server 2, the SELECT instructions work fine, but if you try to INSERT, DELETE, or UPDATE on the database, your application throws an unknown error related to a service, a method, or something in your applicattion. This error is provocated by DTC, because DTC uses a name resolving for communication with the other server if the operation tries to modify, add, or delete data.

In that case, you need to configure your DNS to quickly solve the problem. In case your network doesn't have a DNS server or the server (or both of them) doesn't have a DNS configured on the NIC's for any reason, you have a simple solution.

You need to modify two files in Windows (networks and hosts), on this path:

%WINDIR%\System32\Drivers\etc

In the networks file, you have a structure like this:

-----------------------------------------------------------------------
# Copyright (c) 1993-1999 Microsoft Corp.
#
# This file contains network name/network number mappings for 
# local networks. Network numbers are recognized in dotted decimal form.
#
# Format:
#
# <network name="">  <network number="">     [aliases...]  [#<comment>]
#
# For example:
#
#    loopback     127
#    campus       284.122.107
#    london       284.122.108
 
loopback                 127
-----------------------------------------------------------------------

In DBSERVER, at the bottom of the file, you need to add a new network with the IP address of the other server, without the last octect of the IP address like this:

DBNETWORK 10.150.40

DBNETWORK is the name of the network (any other can work, you don't need to use the original network name to do this) and 10.150.40 is the range of this network.

Save and close the file, and then you need to edit the hosts file, this file has a structure like this:

-----------------------------------------------------------------------
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
 
# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost
 
127.0.0.1       localhost
---------------------------------------------------------------------

In this file, you need to add the IP address and the name of the other server at the bottom of the file like this:

10.150.40.21  APPSERVER

You need to use the real name server in this case. Save and close the file, and next, do the same on the APPSERVER with the configuration of the DBSERVER. The network name on the other server, setup as APPNETWORK (or any other name).

Save these files on the other server and try to ping, and that's OK. Ping to the other server (with name server) is now working, with this, DTC can resolve locally the name of the other server without DNS.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Oscar Arros González
Software Developer (Senior) DirecTV S.A.
Chile Chile
Developer with experice in .NET 2005/2008/2010 (VB, C#)
SQL Server 2000/2005/2008.
Oracle 10g/11g
Java ADT (Eclipse)
I was working on software development the last 6 years, before that, i programming on different languages and work as System Administrator (System-V unix, Linux, Windows).

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 7 Jan 2012
Article Copyright 2012 by Oscar Arros González
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid