[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Re: Frustrating COM+/Remoting Service Issue

Sunny

7/15/2004 4:01:00 PM

Looks like it fails to find an assembly. When you host your object in a
COM+ app, it is running as part of the prcess of that app. So the
working path, etc., take the values from the hosting app.

Try to capture AppDomain.AssemblyResolve event to see if this i sthe
problem.

Also, you can attach the debugger to the running host app process, and
capture any exceptions thrown.

Sunny

In article <9297AD3B-2E77-4740-808A-8118F0E3C381@microsoft.com>,
Mark@discussions.microsoft.com says...
> I continue to get the following error:
> Insufficient state to deserialize the object. More information is needed.
>
> I have a Windows Service hosting a .NET Remoting object. The component implements an interface (IService) and the client calls via the interface. I am using SAO SingleCall and TCP binary formatter. When I test using a simple .NET exe everything works fine. I get the error when hosting a client object via COM Interop in a COM+ application. The interface and COM Interop dlls are in the GAC. Through logging I can determine that the SAO completes successfully with a
result of about 4k, so it is definitely on the client side that the error occurs. I started by returning a byte[], then tried boxing that to an object, then tried using a serializable custom object containing a byte[], all result in the error. The .NET test exe is a simple console application that calls the remoting SAO and gets a result using the same method as the COM Interop component, the only difference is the COM Interop and all that goes with a COM+ app.
>
> COM+ application settings (setting: various options tried if applicable);
> Activation: Server
> Security: Access checks disabled
> Authentication Level for Calls: None, Connect, Packet
> Impersonation Level: Impersonate, Delegate
> Identity: local administrator account, 'Local System'
> Activation: Server
> Transactions: disabled
> Activation Context: Don't force..., Must be activated in the default context
> Concurrency: Required when Activation Context = Don't force..
>
> Server Config;
> <system.runtime.remoting>
> <application name="srv">
> <service>
> <wellknown mode="SingleCall" type="MyObject, MyAssembly" objectUri="MyObject"/>
> </service>
> <channels>
> <channel name="MyObject TCP port 49512" ref="tcp" port="49512" bindTo="127.0.0.1">
> <serverProviders>
> <formatter ref="binary" typeFilterLevel="Full"/>
> </serverProviders>
> </channel>
> </channels>
> </application>
> </system.runtime.remoting>
>
> Interface Definition: (pseudocode)
> enum e1{..}
> enum e2{..}
> [Serializable]
> public ResultObject{public byte[] Results;}
>
> public interface IServer{
> (Various options tried)...
> byte[] Method(e1 type, string def, e2 format);
> void Method(e1 type, string def, e2 format, out byte[] results);
> ResultObject Method(e1 type, string def, e2 format);
> object Method(e1 type, string def, e2 format);
>
>
>
> COM Interop Code:
> IService s = (IService)Activator.GetObject(typeof(IService), IReportServiceURI);
> //byte[] version
> byte[] results = s.Method(e1var, strDef, e2var);
> //byte[] out version
> byte[] results = null;
> s.Method(e1var, strDef, e2var, results);
> //object version
> byte[] results = (byte[])s.method(e1var, strDef, e2var);
> //ResultObject version
> ResultObject results = s.Method(e1var, strDef, e2var);
>
> Stack Trace:
> Server stack trace:
> at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
> at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)
> at System.Runtime.Serialization.ObjectManager.DoFixups()
> at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
> at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage)
> at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
> at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
>
> Exception rethrown at [0]:
> at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
> at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
> at Reports.NET.Engine.Interfaces.IService.Method(DefinitionType DefType, String def, Format format, Hashtable parameters)
> at RemotingComponent.Method(String sXML, String DesiredFormat, Object Parameters)
>
>
>
2 Answers

Mark

7/15/2004 6:06:00 PM

0

I did load up fuslogvw and it doesn''t show any resolve errors. If I don''t place the interface or COM Interop assembly in the GAC I get resolve errors, but those result in different exceptions. I haven''t gotten around to debugging the dllhost process as I don''t think it will show me anything (seeing as it is failing in remoting internals), but I may give that a shot. Theoretically there are only 2 non-system assemblies, the COM interop and interface assemblies, and it is calling the SAO so it can resolve the interface, and it has obviously loaded the COM Interop assembly. Since the return value is a byte[] there shouldn''t be a problem ''deserializing'' the byte[]. I am also going to try to add a method that returns a string to see if that works and narrow down the problem.

Thanks for your response,

mark

"Sunny" wrote:

> Looks like it fails to find an assembly. When you host your object in a
> COM+ app, it is running as part of the prcess of that app. So the
> working path, etc., take the values from the hosting app.
>
> Try to capture AppDomain.AssemblyResolve event to see if this i sthe
> problem.
>
> Also, you can attach the debugger to the running host app process, and
> capture any exceptions thrown.
>
> Sunny
>
> In article <9297AD3B-2E77-4740-808A-8118F0E3C381@microsoft.com>,
> Mark@discussions.microsoft.com says...
> > I continue to get the following error:
> > Insufficient state to deserialize the object. More information is needed.
> >
> > I have a Windows Service hosting a .NET Remoting object. The component implements an interface (IService) and the client calls via the interface. I am using SAO SingleCall and TCP binary formatter. When I test using a simple .NET exe everything works fine. I get the error when hosting a client object via COM Interop in a COM+ application. The interface and COM Interop dlls are in the GAC. Through logging I can determine that the SAO completes successfully with a
> result of about 4k, so it is definitely on the client side that the error occurs. I started by returning a byte[], then tried boxing that to an object, then tried using a serializable custom object containing a byte[], all result in the error. The .NET test exe is a simple console application that calls the remoting SAO and gets a result using the same method as the COM Interop component, the only difference is the COM Interop and all that goes with a COM+ app.
> >
> > COM+ application settings (setting: various options tried if applicable);
> > Activation: Server
> > Security: Access checks disabled
> > Authentication Level for Calls: None, Connect, Packet
> > Impersonation Level: Impersonate, Delegate
> > Identity: local administrator account, ''Local System''
> > Activation: Server
> > Transactions: disabled
> > Activation Context: Don''t force..., Must be activated in the default context
> > Concurrency: Required when Activation Context = Don''t force..
> >
> > Server Config;
> > <system.runtime.remoting>
> > <application name="srv">
> > <service>
> > <wellknown mode="SingleCall" type="MyObject, MyAssembly" objectUri="MyObject"/>
> > </service>
> > <channels>
> > <channel name="MyObject TCP port 49512" ref="tcp" port="49512" bindTo="127.0.0.1">
> > <serverProviders>
> > <formatter ref="binary" typeFilterLevel="Full"/>
> > </serverProviders>
> > </channel>
> > </channels>
> > </application>
> > </system.runtime.remoting>
> >
> > Interface Definition: (pseudocode)
> > enum e1{..}
> > enum e2{..}
> > [Serializable]
> > public ResultObject{public byte[] Results;}
> >
> > public interface IServer{
> > (Various options tried)...
> > byte[] Method(e1 type, string def, e2 format);
> > void Method(e1 type, string def, e2 format, out byte[] results);
> > ResultObject Method(e1 type, string def, e2 format);
> > object Method(e1 type, string def, e2 format);
> >
> >
> >
> > COM Interop Code:
> > IService s = (IService)Activator.GetObject(typeof(IService), IReportServiceURI);
> > //byte[] version
> > byte[] results = s.Method(e1var, strDef, e2var);
> > //byte[] out version
> > byte[] results = null;
> > s.Method(e1var, strDef, e2var, results);
> > //object version
> > byte[] results = (byte[])s.method(e1var, strDef, e2var);
> > //ResultObject version
> > ResultObject results = s.Method(e1var, strDef, e2var);
> >
> > Stack Trace:
> > Server stack trace:
> > at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
> > at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)
> > at System.Runtime.Serialization.ObjectManager.DoFixups()
> > at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
> > at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage)
> > at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
> > at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
> >
> > Exception rethrown at [0]:
> > at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
> > at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
> > at Reports.NET.Engine.Interfaces.IService.Method(DefinitionType DefType, String def, Format format, Hashtable parameters)
> > at RemotingComponent.Method(String sXML, String DesiredFormat, Object Parameters)
> >
> >
> >
>

Chuck Haeberle

7/15/2004 6:10:00 PM

0

I did load up fuslogvw and it doesn''t show any resolve errors. If I
don''t place the interface or COM Interop assembly in the GAC I get
resolve errors, but those result in different exceptions. I haven''t
gotten around to debugging the dllhost process as I don''t think it will
show me anything (seeing as it is failing in remoting internals), but I
may give that a shot. Theoretically there are only 2 non-system
assemblies, the COM interop and interface assemblies, and it is calling
the SAO so it can resolve the interface, and it has obviously loaded the
COM Interop assembly. Since the return value is a byte[] there shouldn''t
be a problem ''deserializing'' the byte[]. I am also going to try to add
a method that returns a string to see if that works and narrow down the
problem.

Thanks for your response,

mark

Sunny wrote:

>Looks like it fails to find an assembly. When you host your object in a
>COM+ app, it is running as part of the prcess of that app. So the
>working path, etc., take the values from the hosting app.
>
>Try to capture AppDomain.AssemblyResolve event to see if this i sthe
>problem.
>
>Also, you can attach the debugger to the running host app process, and
>capture any exceptions thrown.
>
>Sunny
>
>In article <9297AD3B-2E77-4740-808A-8118F0E3C381@microsoft.com>,
>Mark@discussions.microsoft.com says...
>
>
>>I continue to get the following error:
>>Insufficient state to deserialize the object. More information is needed.
>>
>>I have a Windows Service hosting a .NET Remoting object. The component implements an interface (IService) and the client calls via the interface. I am using SAO SingleCall and TCP binary formatter. When I test using a simple .NET exe everything works fine. I get the error when hosting a client object via COM Interop in a COM+ application. The interface and COM Interop dlls are in the GAC. Through logging I can determine that the SAO completes successfully with a
>>
>>
>result of about 4k, so it is definitely on the client side that the error occurs. I started by returning a byte[], then tried boxing that to an object, then tried using a serializable custom object containing a byte[], all result in the error. The .NET test exe is a simple console application that calls the remoting SAO and gets a result using the same method as the COM Interop component, the only difference is the COM Interop and all that goes with a COM+ app.
>
>
>>COM+ application settings (setting: various options tried if applicable);
>>Activation: Server
>>Security: Access checks disabled
>>Authentication Level for Calls: None, Connect, Packet
>>Impersonation Level: Impersonate, Delegate
>>Identity: local administrator account, ''Local System''
>>Activation: Server
>>Transactions: disabled
>>Activation Context: Don''t force..., Must be activated in the default context
>>Concurrency: Required when Activation Context = Don''t force..
>>
>>Server Config;
>> <system.runtime.remoting>
>> <application name="srv">
>> <service>
>> <wellknown mode="SingleCall" type="MyObject, MyAssembly" objectUri="MyObject"/>
>> </service>
>> <channels>
>> <channel name="MyObject TCP port 49512" ref="tcp" port="49512" bindTo="127.0.0.1">
>> <serverProviders>
>> <formatter ref="binary" typeFilterLevel="Full"/>
>> </serverProviders>
>> </channel>
>> </channels>
>> </application>
>> </system.runtime.remoting>
>>
>>Interface Definition: (pseudocode)
>>enum e1{..}
>>enum e2{..}
>>[Serializable]
>>public ResultObject{public byte[] Results;}
>>
>>public interface IServer{
>> (Various options tried)...
>> byte[] Method(e1 type, string def, e2 format);
>> void Method(e1 type, string def, e2 format, out byte[] results);
>> ResultObject Method(e1 type, string def, e2 format);
>> object Method(e1 type, string def, e2 format);
>>
>>
>>
>>COM Interop Code:
>>IService s = (IService)Activator.GetObject(typeof(IService), IReportServiceURI);
>> //byte[] version
>> byte[] results = s.Method(e1var, strDef, e2var);
>> //byte[] out version
>> byte[] results = null;
>> s.Method(e1var, strDef, e2var, results);
>> //object version
>> byte[] results = (byte[])s.method(e1var, strDef, e2var);
>> //ResultObject version
>> ResultObject results = s.Method(e1var, strDef, e2var);
>>
>>Stack Trace:
>>Server stack trace:
>> at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
>> at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)
>> at System.Runtime.Serialization.ObjectManager.DoFixups()
>> at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
>> at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage)
>> at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMessage(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
>> at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
>>
>>Exception rethrown at [0]:
>> at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
>> at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
>> at Reports.NET.Engine.Interfaces.IService.Method(DefinitionType DefType, String def, Format format, Hashtable parameters)
>> at RemotingComponent.Method(String sXML, String DesiredFormat, Object Parameters)
>>
>>
>>
>>
>>