Tag Archives: BizTalk

The start of the Scripting Series – How to load IP Addresses into your hosts file through script

I have been doing a lot of work with windows  scripts (cmd/bat files, windows shell commands, vb scripts, etc) and wanted to share some of the things I have learned. I will be referring to bat files from here on out but you could also give your files the .cmd extension. Use whatever your comfortable with as there really is no difference on Windows XP and above.

How to load IP Addresses into your hosts file through script

The first thing your going to need if your going to work with bat files is a good editor. I haven’t found what I would consider to be an IDE for bat files (if you have any recommendations leave them in the comments) but the best text editor that I have found for bat files is NotePad++. I use the portable version and it at least provides syntax color coding for some of the basic elements of your bat files.

Now you can copy the following into a new text file and save it as ModifyHosts.bat

:: Misc Variables
SET IIS-Server_IP=
SET SQL-Server_IP=

echo Load hosts file entries
echo %IIS-Server_IP% IIS-Server>> %SYSTEMROOT%\SYSTEM32\drivers\etc\hosts
echo %SQL-Server_IP% SQL-Server>> %SYSTEMROOT%\SYSTEM32\drivers\etc\hosts

The basic idea is that you create variables that store the IP address for each server your going to need to reference in your configuration files for your applications. Some common examples would be:

  • web.config for an IIS web application
  • Application bindings for BizTalk
  • Connection strings in an application.config for a .Net application
  • Etc

I follow the convention of <ServerName>_IP for these variables and set them before executing a build script against a newly provisioned server.

What this allows you to do is to abstract which actual server is being referred to in the configurations of your various applications. We have used this to maintain a single source controlled web.config for a production website that is deployed to development, test, and staging environments without having to change the web.config. The only settings that have to change are the ip addresses for the associated server names listed in the hosts file and that is all done by this script.

This also allows us to source control our BizTalk application’s bindings and then be able to deploy the same set of bindings to development, test, and staging environments. All of the bindings refer to server names that are set in the hosts files of each of the individual BizTalk servers.

Hope you find this useful. I will add additional tips as I have time. Thanks

Tagged , , ,

Getting Started with ASP.Net

I have just begun working on an established codebase for an eCommerce site that uses utilizese Commerce Server 2007, BizTalk 2006, and Dynamics NAV (Navision 4.0). The site is written in C# and ASP.Net and so I have been getting up to speed on the related technologies and how to work with them and I figured I would share some ASP.Net related links that I found today.

ASP.NET Web Server Control Event Model


ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0


ASP.NET Page Life Cycle Overview


ASP.NET Session State Overview


ASP.NET State Management Overview


ASP.NET State Management Recommendations


I have not been involved in web development before and many of the paradigms are new to me so I found it very helpful to familiarize myself with how an ASP.Net application actually lives and breathes.

Tagged , , , ,