Programmatically connecting to Virtual Server using Visual Studio, in Virtual Server 2005
ASP Developer Network - Brought to you by Steve Radich and BitShop, Inc. - http://www.bitshop.com

Menu

ASPDeveloper.Net / VirtualServerFAQ.COM

Make sure you go to our home page for:

* Virtual Server 2005 FAQ
* ASP.Net 2.0 Information
* ASP.Net 2.0 Streaming Tutorials
* ASP.Net 2.0 HTML based Tutorials

Made possible by Business Internet Technology Shop (BitShop)



View :  Show duplicate posts
Virtual Server 2005

Recent Virtual Server 2005 posts

VMWare or Virtual Server?
Network connectivity problem..repost
Vista beta 2 build July 2006 on Virtuals Server R2
Booting VS with a DVD CD
The virtual hard disk "c:\vhds\xyz.vhd" could not be compacted.
Com1
VS2005 in XP, no access to Web Admin
DVD/CD ROM and Secondary SCSI Drive Mappings Incorrect at Start Up
Don"t know how to get connectivity from virtual image
New VM Additions for Windows Vista
"Search Paths" not functioning!
Server Disaster Recovery ?
Swapping out disk
3 OS"s in one box?
Virtual Server 2005
How to get internet in a virtual server
Virtual Server 2005 / W2K3 Guest OS / HTA"s Don"t Work
High Virtual Machine CPU Utilization
Access to files on host
Linked Virtual Hard Disk
Add Solution

Latest Topics

Table Of Contents


Post Reply |  This is Spam! | Mark as Spam

Programmatically connecting to Virtual Server using Visual Studio

Source: microsoft.public.virtualserver
Sent: 07/27/2006
From: dgmiller81
Message:

I've got a section of code that works fine with Visual Studios 2003, but
errors out when using Visual Studios 2005. My first guess is that DCOM Type
or how you declare them has changed with the new .NET framework, but I am not
certain.

Anyway, here is the code that I am having troubles with (Straight from the
Virtual Server SDK):

---------------------------------------[ Start of Code
]----------------------------

' Get VMVirtualServerClass instance from a remote server using DCOM
Public Function GetVMVirtualServerClass(ByVal server As String) _
As VMVirtualServerClass
Dim typeVSClass As Type
Dim typeDCOM As Type
Dim objDCOM As Object

typeVSClass = GetType(VMVirtualServerClass)
typeDCOM = Type.GetTypeFromCLSID(typeVSClass.GUID, server, True)
objDCOM = Activator.CreateInstance(typeDCOM)

GetVMVirtualServerClass = CType( _
Marshal.CreateWrapperOfType(objDCOM, typeVSClass), _
VMVirtualServerClass)
End Function

'Get VMVirtualServerClass instance from local server using COM
Public Function GetVMVirtualServerClass() As VMVirtualServerClass
GetVMVirtualServerClass = New VMVirtualServerClass
End Function

---------------------------------------------------[ End of Code
]-------------

Anyway, the probem is when it attempts to make a connection to Virtual
Server it throws an InvalidCastException when calling the function
"GetVMVirtualServerClass." Error message says "Source object cannot be
converted to the destination type since it does not support all the required
interfaces."

Again, that error tells me something changed with either the Framework or
Visual Studios 2005 itself. However, I'm posting this here, because it has
to deal with connecting to Virtual Server 2005.

Anyway, any possible help on this would be GREATLY appreciated. Thanks!



Post Reply |  This is Spam! | Mark as Spam

Related Messages


Post Reply |  This is Spam! | Mark as Spam


Table Of Contents



Other groups

 
Virtual PC (Mac)(3592) Virtual PC(12844) Virtual PC (French)(496)
Virtual Server 2005(6245)
Search
in:
Our Sponsors
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
Virtual Server 2005 Info Here!
http://www.aspdeveloper.net
rss Wiki rss Blogs rss Articles rss Image galleries rss File galleries rss Forums rss Maps rss Directories
ASP Developer Network (since 1996) - Brought to you by Steve Radich and BitShop, Inc. - http://www.bitshop.com
Copyright © 1997-2005 by BitShop, Inc. All Rights Reserved.
No content may be reproduced in any form without written permission from BitShop, Inc.
We will be honored to assist with reproduction rights on our material if you contact us.
We also can provide print articles for your magazine, private training seminars at your site, and conference presentations.

Thank you for visiting. Please bookmark our site if you found it useful!
If you wish to make a donation it will help further the development of these free resources: