Accessing COM+ from a different machine

Hi Guys,
I need to access a COM+ which is located on a different machine. What is the correct procedure to do it ?
I tried exporting the COM+ as an MSI file, and installed it on my comp, and from dotnet when i try to add a reference to the COM object(which i installed on my comp), an error is shown saying 'Type Library was exported from a CLR assembly and cannot be re-imported as a CLR assembly'.
How do i reference to that COM+, is there a programatic way of accessing the COM+ and its methods ?
does any have an idea abt this ?

regards,
abhi

[574 byte] By [MeMyselfNDotnet] at [2007-12-16]
# 1
Hello MeMyselfNDotnet,

I think you lost me on the description of your repro steps. I was able to create a simple HelloWorld.dll (VB6 - unmanaged), install it into COM+ on server one, create app proxy and install proxy on server 2, and then from a .NET application add a reference to the COM objects application proxy, and it correctly adds a reference.

In your scenario, is the component hosted in COM+ on server 1 a ServicedComponent written in .NET?

-Todd

ToddFoust at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 2

Ok,

I was able to reproduce the problem, so you were using a servicedcomponent :)

The error message you are getting is by design. The .NET Framework does not allow you to generate an assembly from a TLB file that was generated from an assembly. So .Net dll --> to .tlb file > back to .NET dll = is not allowed.

When you reference the COM tab in the Add Reference box, you are able to select the 'COM' object because it's type library is registered. What you should do instead on the COM tab is to select Browse. Then browse to C:\Program Files\ComPlus Applications\{AppGuid}\YourAssembly.dll and select the actual .NET assembly, instead of the TLB file, in that directory.

Hope this helps
-Todd Foust

ToddFoust at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 3
Hi Todd,
thanks for the reply,
but when i create a COM+ in my computer, i cannot see any applicationID in the C:\Program Files\ComPlus Applications. Only if i install an MSI file(which has been exported from another PC), i can see its applicationID in the folder and can also add the dll file.
The way im creating my COM+ is , in dotnet project properties, im selecting the option of 'Register for COM Interop' to true. Hence when i compile, a tlb file is created, and i drag this tlb file into the component Services. This is how im creating the COM+. Is there anything wrong with this procedure ? is that why i cannot see it in the ComPlus Applications folder ?

regards,
abhi

MeMyselfNDotnet at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 4

Abhi,

No, you're right. You'll only find the tlb/dll file located in C:\Program Files\ComPlus Applications\ directory after you have installed an application proxy MSI package.

What is your end goal here? Do you want to expose your .NET Assembly to COM clients? Do you simply want to create a .NET assembly to be hosted in COM+? If the latter is true then please review the System.EnterpriseServices namespace, specifically the ServicedComponent class.

I just don't understand why you would first create a .NET assembly, generate it's tlb file, host the tlb file into COM+, and then have another .NET assembly add a reference to the 'COM+' .net assembly. If this is what you are going for then replace these steps with 1. create a .NET ServicedComponent 2. run regsvcs.exe to register it with COM+ 3. create a second .net dll/project that references the first .NET assembly.

Let me know if this clears up anything.

-Todd Foust

ToddFoust at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 5
Hi Todd,
Let me give a clear picture of what im trying to achieve.
This whole project is using 2 dotnet projects and one COM+ component.
Project A (has the layers, business logic, sql layer etc), Project Admin (is the admin module, which does transactions and has web pages).
The Project A assembly has to be exposed to the COM+, and the Project Admin uses COM+. The server settings in the clients place can be such that, Project A, Project Admin and COM+ are all hosted on different pc's.

Does that make my question clear now ?

when i host the COM+ on a different pc, and generate and application proxy, which i install on my pc, and when i try to access that COM+ class, i get a 'The RPC server is unavailable. ' error.

Please help..

regards,
abhi

MeMyselfNDotnet at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 6
Hello Abhi,

Sounds like any DCOM call is failing b/w these two machines. There are a couple things to consider

1. Name resolution, make sure that both machine correctly resolve to each other using NetBios name
2. Firewall. You've said that you've disabled them so we might be able to rule this out
3. RPC ports - you might be out of RPC client or server ports depending on configurations
875357 Troubleshooting Windows Firewall settings in Windows XP Service Pack 2
http://support.microsoft.com/?id=875357

DCOM Firewall Whitepaper
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndcom/html/msdn_dcomfirewall.asp

I think at this point we'd need to do some extensive troubleshooting Abhi. You might want to go ahead and call into to create a support case. http://support.microsoft.com or call 1-800-MICROSOFT (1-800-642-7676)

Thanks
-Todd Foust

ToddFoust at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 7
Hello,
How to use the NetBios ?
could you please guide me as to how to create a support case in the microsoft support ? Do we have to pay for it ? i went to the link which u sent, http://support.microsoft.com, but was lost very soon. Please advice

regards,
abhi

MeMyselfNDotnet at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...
# 8
Just ping the netbios name of the machines.

1. Right click on your My Computer icon and come down to properties
2. Select Computer Name tab and then you'll see the computer name
3. open a command prompt on the other machine and then at the command prompt type in "ping computernameFromStep2"
4. Repeat steps in other direction

Yes it is paid support, but you might qualify for warranty-free support. The site will walk you through it. Just start at this site http://support.microsoft.com/gp/assistsupport and select the developer tool you are working with. Wizard goes from there.

hth
-Todd

ToddFoust at 2007-9-9 > top of Msdn Tech,.NET Development,ASMX Web Services and XML Serialization...

.NET Development

Site Classified