all groups > dotnet component services > july 2003 >
You're in the

dotnet component services

group:

Failed to access Queued Component remotelly


Failed to access Queued Component remotelly Valery Romanov
7/24/2003 9:02:28 PM
dotnet component services: Greetings!

I'm triying to access ServicedComponent via MSMQ:

IQComponent iQc =
(IQComponent)Marshal.BindToMoniker(@"queue:/new:MSMQTestServer.QComponent");
iQc.DisplayMessage (msg);

It works fine as long as the caller and the component are installed on the
same machine. When I specify another computer in the moniker initialization
string:

@"queue:formatname=direct=os:test\PRIVATE$\msmqtestsvr/new:MSMQTestServer.QC
omponent"

BindToMoniker fails with the exception: "Invalid Syntax". Stack trace
exhibit MkParseDisplayName function as source of the exception.

MSMQ is installed in "workgroup" mode on the both machines.

MSDN advices using "formatname=direct=..." syntax.
(http://support.microsoft.com/default.aspx?scid=kb;en-us;247394)

I specify init string with "formatname=" as in the examle exactly, but it
fails.

What's wrong with moniker string or MSMQ settings?

Thanx in advance.



Re: Failed to access Queued Component remotelly Valery Romanov
7/25/2003 1:08:23 PM

Greetings!

It seems we've caught the problem. The SERVER party COM+ component
(MSMQTestServer.QC
omponent) hadn't been installed on the CLIENT (caller) side! After we had
registered the component on the both sides, communication worked fine!
Why does the server component need to be registered on the client also (it's
public interface definition is not enough)? May be the moniker need
definitions of object public methods to create a proxy for remote calls?
Could we create a simple stub assembly with the same name and interface as
remote COM+ object and register it on the client instead of the object
itself, since the moniker string contains only name of the object:
queue:.../new:MSMQTestServer.QC
omponent? Server side assemblies may have different implementations and we
don't want to register them all on the client.

Actually we've got 3 assemblies:

Client Party:
TestClient.exe - Win32 application to invoke Queued Component
Shared.dll - definition of Queued Component public interface

Server Party:
QComponent.dll - the COM+ component itself
Shared.dll - the same definition of interfaces

It doesn't seem to be enough. It seems we need QComponent.dll on the client
also.

TestClient.exe:
private void _SendMessage(string msg)
{
IQComponent iQc = (IQComponent)Marshal.BindToMoniker
(@"queue:formatname=direct=OS:ComputerName\PRIVATE$\msmqtestsvr/new:MSMQTest
Server.QComponent");

iQc.DisplayMessage (msg);
}

shared.dll:
public interface IQComponent
{
void DisplayMessage(string msg);
}

QComponent.dll:

[InterfaceQueuing(Interface = "IQComponent")]
public class QComponent : ServicedComponent, IQComponent
{
public void DisplayMessage(string msg)
{
MessageBox.Show(msg, "Processing message");
}
}

Does it make sense? What would be the best approach in our case?

Thanks

Valery,
MCSD.NET, MCSD




Re: Failed to access Queued Component remotelly Mike Moroney [MSFT]
7/28/2003 9:32:32 AM
Hi Valery,

One thing you can do is to export your server application as a proxy
application, which can then be installed on the client machines. The proxy
application will contain all the type libraries and proxy code, and it will
also be configured properly in the COM+ catalog with the proper queueing
attributes. You might be able to do all these things manually, but this is
what the proxy application is for.

Here's an article on COM+ proxy applications:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cossdk/htm/
pgdeployingapplications_65gz.asp

Mike Moroney
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.





[quoted text, click to view]

AddThis Social Bookmark Button