PDA

View Full Version : Problem accessing serviced components


hakangranstedt
05-21-2007, 04:12 PM
Hmm, am I missing something here or have I missunderstod everything?

I'm trying to setup an environment with serviced components on a server (named myServer running W2003) that I will access from a couple of client computers running W2K.

I have used the calculator example to set it up and when I run both the client and the server components on my development machine (W2K) or on the server it works ok, but when I try to access the server components on the server from a client computer it doesn't work. In the eventlog on the client I get:

DCOM was unable to communicate with the computer myServer using any of the configured protocols.

My server config file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>

<spring>
<context>
<resource uri="config://spring/objects" />
</context>

<objects xmlns="http://www.springframework.net">
<description>Definitions of objects to be registered.</description>

<object id="myService" name="myService" type="Test.myFacade, MyAssembly" singleton="false" />

<object id="myComponent" name="myComponent" type="Spring.EnterpriseServices.ServicedComponentExporte r, Spring.Services">
<property name="TargetName" value="myService" />
<property name="TypeAttributes">
<list>
<object type="System.EnterpriseServices.TransactionAttribute, System.EnterpriseServices" >
<constructor-arg index="0" value="Supported" />
</object>
</list>
</property>
<property name="MemberAttributes">
<dictionary>
<entry key="*">
<list>
<object type="System.EnterpriseServices.AutoCompleteAttribute, System.EnterpriseServices" />
</list>
</entry>
</dictionary>
</property>
</object>

<object type="Spring.EnterpriseServices.EnterpriseServicesExport er, Spring.Services">
<property name="ApplicationName">
<value>MyComPlusApp</value>
</property>
<property name="Description">
<value>My test</value>
</property>
<property name="ActivationMode">
<value>Server</value>
</property>

<property name="AccessControl">
<object type="System.EnterpriseServices.ApplicationAccessControl Attribute, System.EnterpriseServices">
<constructor-arg name="val" value="false"/>

<property name="AccessChecksLevel">
<value>ApplicationComponent</value>
</property>
</object>
</property>

<property name="Components">
<list>
<ref object="myComponent" />
</list>
</property>

<property name="Assembly">
<value>TestEnterpriseServices</value>
</property>
</object>
</objects>
</spring>
</configuration>

My client config file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
<section name="parsers" type="Spring.Context.Support.ConfigParsersSectionHandler , Spring.Core" />
</sectionGroup>
</configSections>

<spring>
<parsers>
<parser type="Spring.Remoting.RemotingConfigParser, Spring.Services" />
</parsers>

<context>
<resource uri="config://spring/objects" />
</context>

<objects xmlns="http://www.springframework.net">
<object id="myService" name="myService" type="Spring.EnterpriseServices.ServicedComponentFactory , Spring.Services">
<property name="Name" value="myComponent" />
<property name="Server" value="myServer" />
</object>
</objects>
</spring>
</configuration>

One funny thing is that when I run the client app on the server and access the server components on my development machine it works... until I unregister the server components on the server with RegAsm.exe /unregister....

Bruno Baia
05-22-2007, 09:32 AM
Hi,

Spring just uses Type.GetTypeFromProgID method (http://msdn2.microsoft.com/en-us/library/etz83z76.aspx) in the client.

After Googling the error seems to not be related to Spring :
Google results for 'DCOM was unable to communicate with the computer' (http://www.google.fr/search?hl=fr&q=%22DCOM+was+unable+to+communicate+with+the+compu ter%22&meta=)

HTH,
Bruno

hakangranstedt
05-23-2007, 09:36 AM
I have found the problem, it was a permission thing. My account on the client didn't have any launch and activation rights in the DCOM configuration on the server (I log on to the server with another user).

But I still have a problem that the server component generated by Spring must be registered on the client. Read more here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=127026&SiteID=1

I have used regmon from sysinternals both on the client and the server to see what happens when calling Type.GetTypeFromProgID and Activator.CreateInstance. When the Spring generated assembly is registered on the client, the GUID seems to be looked up in the client registry and the GUID is used to create the object on the server. Is this the intended functionality?

If the component isn't registered on the client, Type.GetTypeFromProgID will return null.

Maybe I have to use remoting instead...