VMware {code} Community
sradhakr
Contributor
Contributor

No connection could be made because the target machine actively refused it

I have Virtual Center Server and Client installed. When I connect from Client to server, I can connect successfully. When I use the sample SDK program to programatically connect to the server, I get this error. I am using the correct username and password. What am I missing?

0 Kudos
11 Replies
BennyJ
Contributor
Contributor

Can you connect to the Virtual Center server in a browser and display the Web Access page? The VI Client uses port 902 and 903 while the SDK uses 443 by default. I didn't actually think the VI Client used ports 80/443 as well but looking at the netstat results now it does indeed seem to.

sradhakr
Contributor
Contributor

You are right. I cannot connect through a browser either. How do I make the SDK connect through a different port?

0 Kudos
LarryZio
Contributor
Contributor

Some questions:

1. Which sample are you trying to use?

2. Which URL are you passing to the sample? You should be using https://your_FQDN_servername/sdk or try https://your_FQDN_servername/webService

3. Can you connect to the managed object browser on the web service? Try that. The URL is https://your_FQDN_servername/mob

0 Kudos
sradhakr
Contributor
Contributor

Thanks for taking the time to help me out.

1. I am trying the connect2005 sample.

2 & 3. I am passing . I also tried the /mob and the /webService.

The firewall is turned off.

The credentials work with the VirtualCenter Client UI.

The security certificate file was installed correctly.

Still no luck connecting...

0 Kudos
BennyJ
Contributor
Contributor

You should be able to alter vpxd.cfg located at C:\Documents and Setting\All Users\Application Data\Vmware\Vmware VirtualCenter to change the port being used.

If you log on to the Virtual Center server itself can you connect via a browser? If you can, it sounds like there could be a firewall issue between you and the VC server.

0 Kudos
sradhakr
Contributor
Contributor

I modified the port number and now I don't get the "No connection .... " error. Instead I get the error:

************

A certification chain processed correctly, but terminated in a root certificate which isn't trusted by the trust provider.

The certificate's CN name does not match the passed value.

*********

Sounds like progress Smiley Happy, but I am not there yet Smiley Sad.

0 Kudos
LarryZio
Contributor
Contributor

Sounds definitely like a server-cert issue. Which version of VirtualCenter are you running? Also, do you have complete control over the VC server? Is it a production system, or just one you're playing around with? You might consider configuring the server for HTTP (and avoid this whole SSL thang). VMware published a new guide for SDK 2.0.1 a while ago, which i've been using. There's a chapter on certificates in this book:

Also, there's more information about VirtualCenter Server certs, and some issues that you may be having, in this paper:

Good luck to you, hope this helps.

lz

0 Kudos
sradhakr
Contributor
Contributor

The VC Server is in a sandbox environment, not production. So I wanted to take your advice and make it non-ssl. But the documentation asks to edit the file vpxd.cfg. I looked for this file on the VC Service/ Webservice machine and could not find it. Is the method different for VC 1.4.1?

0 Kudos
LarryZio
Contributor
Contributor

Okay, so it's 1.4.x, not 2.0.1, so the configuration file is different. Here are some instructions in this FAQ:

Hope this helps,

lz

sradhakr
Contributor
Contributor

Thanks. That was very useful. Does the fact that it is 1.4 affect the commandline parameters to the sample code?

Now I have configured the VC Server for non-ssl communication. But the sample code still does not work for me. The readme.txt for the sdk says we need to pass the url ( username password ) as command line args. I did so. But it is throwing an exception with an empty string for message.

The stack trace shows the following.

StackTrace " at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)\r\n at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)\r\n at VimApi.VimService.RetrieveServiceContent(ManagedObjectReference this)\r\n at ClientUtils.SvcConnection.Connect(String url, String username, String password) in C:
Documents and Settings
sunandini
Desktop
VirtualCenter
vi-sdk-2.0.1-32042
SDK
samples
2_0
DotNet
cs
ClientUtils
SvcConnection.cs:line 49\r\n at ClientUtils.ServiceUtil.ClientConnect() in C:
Documents and Settings
sunandini
Desktop
VirtualCenter
vi-sdk-2.0.1-32042
SDK
samples_2_0
DotNet
cs
ClientUtils
ServiceUtil.cs:line 29"

Should I be passing some other url for 1.4?

0 Kudos
LarryZio
Contributor
Contributor

Sorry, but you have just exceeded my knowledge banks on this stuff. I'm not really familiar with the 1.4.1 VC stuff, and I'm not a .net person at all--just Java. Just familiar with some of the FAQs and such. Hopefully, someone from VMware can help you with this question.

0 Kudos