Rashim's Blog

IIS virtual directory creation fails on IIS 7.0 / windows server 2008 using Nant build script in TeamCity

Posted on: January 7, 2013

When I tried to create a virtual directory in the remote server using Nant build script It did not create and showed the error message below:

The webservice at 'remote_machine' does not exist or is not reachable

I am afraid to say that I spent a full working day to find out the proper solution for that and finally solved it. I hope it would also help those who are facing similar kind of weird problems as well. Having said that the OS of my remote server  is windows server 2008 r2 and IIS version is 7. Anyway let’s start with that,

First thing first, you need to check that you are able to connect to the remote server from IIS Manager of your local machine/current server. To do that, please follow the instructions given below.

1. Go to the IIS Manager of local machine/Current server
2. File->Connect to a Server
3. Put Remote Server name and Credentials and then try to connect

Well, Could you connect to the remote server? I suspect you might not be able also it might show a warning message like that


Okay.Lets move to fix it up. What you require to repair this issue is to enable the Management Service of remote server so that it would allow Remote Connection. For doing this you could follow this link.

Or you could follow the instructions given below,

1.Run the following command

     Dism /online /enable-feature /featurename:IIS-ManagementService

2. Go to the registry editor and,

     Set EnableRemoteManagement to 1
     under HKEY_LOCAL_MACHINE\Software\Microsoft\WebManagement\Server

3. Finally run the command again

      Net start wmsvc

Now try to connect to the remote server again from IIS Manager of your local machine/current server. This is Okay now right? 🙂

What next….

You should run the TeamCity Build Agent under the Administrative privileges. To ensure that you need to create a domain user account and have to give it the administrative privileges and finally use this account for TeamCity Build Agent. After creating a domain user account which has a administrative privileges you need to follow the instructions,

1. Open Services Management Console
2. Stop the TeamCity Build Agent Manually
3. Select TeamCity Build Agent and go to its Properties window
4. On the Properties window, select LogOn tab.
5. Select this account(not Local system) and then put the credential
6. Start the TeamCity Build Agent

Which might look like this figure


That’s it. Try to deploy your project with TeamCity again. Problem Solved right??

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog Stats

  • 189,442 hits


%d bloggers like this: