Sorry for the lengthy responses. I think my problem is on the Server Host side. Actually the code works if I keep the "MyRemotableObject" in the same folder as the Host app (client app doesn't have a copy on the same folder except in GAC). I am posting my host snippet again, so you don't have read all the way to figure out what I was doing. On this side I want to use typeinfo as string so I can avoid any dependency to "MyRemotableObject" or an interface.
inI have a generic Remoting Server Host application which registers my remotable object with the code below.
IChannel chnl = new TcpServerChannel("MyRemoteServer", 8228);
string typeinfo = "MyRemotableObject.FooObj, MyRemotableObject, Version=3.0.1.0, Culture=neutral, PublicKeyToken=034567812341234a"
Type typ = Type.GetType(typeinfo); RemotingConfiguration.RegisterWellKnownServiceType(typ, "MyRemoteServer", WellKnownObjectMode.SingleCall); Above seems to work fine, no exception even when my remotable assembly is
the GAC. My client can successfully connect if my remotable object is notin
GAC.
-----Original Message----- From: "ayse ayse" <[EMAIL PROTECTED]> Sent: Thursday, June 19, 2003 2:25 PM To: 'Moderated discussion of advanced .NET topics.' Subject: RE: [ADVANCED-DOTNET] Remoting GAC
Rick,
Thanks for looking up.
typeof(IMyinterface)".Instead of doing "typ = Type.GetType(typeinfo)" on the client, you probably just want "typ =
I prefered typeinfo since it is a string and allowed no prior knowledge (this is a wrapper). But Interface would work as well. I have just tried with the interface but still same exception below.
I don't see how putting the assembly in the GAC or not would make a
difference. I didn't think so either, except GAC requires signature public key, version...
Are you talking about the GAC on the server or on the client?Both in GAC
Also, try looking at the fusion log (fuslogvw.exe) after the exception is
thrown for details of the problem. Not much help there. Attached at the end. But interesting the Fusion log is thrown for for the host application not Client.
System.IO.FileNotFoundException: File or assembly name RemotableTestObject, or one of its dependencies, was not found. File name: "RemotableTestObject"
Server stack trace: at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark) at System.Reflection.Assembly.Load(String assemblyString) at System.Runtime.Remoting.RemotingConfigInfo.LoadType(String typeName, String assemblyName) at System.Runtime.Remoting.RemotingConfigInfo.StartupWellKnownObject(String asmName, String svrTypeName, String URI, WellKnownObjectMode mode, Boolean fReplace) at System.Runtime.Remoting.RemotingConfigInfo.StartupWellKnownObject(String URI) at System.Runtime.Remoting.RemotingConfigHandler.CreateWellKnownObject(String uri) at System.Runtime.Remoting.IdentityHolder.CasualResolveIdentity(String uri) at System.Runtime.Remoting.Messaging.MethodCall.ResolveType() at System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean bThrowIfNotResolved) at System.Runtime.Remoting.Messaging.MethodCall..ctor(Object handlerObject, BinaryMethodCallMessage smuggledMsg) at System.Runtime.Serialization.Formatters.Binary.BinaryMethodCall.ReadArray(Object[] callA, Object handlerObject) 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.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding) at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
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 RemotableTestObject.RemotableObject.Run() at Class1.Main(String[] args) in S:\main\class1.cs:line 117
Fusion log follows: === Pre-bind state information === LOG: DisplayName = RemotableTestObject (Partial) LOG: Appbase = S:\bin\ LOG: Initial PrivatePath = NULL Calling assembly : (Unknown). ===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: RemotableTestObject LOG: Attempting download of new URL file:///S:/bin/RemotableTestObject.DLL. LOG: Attempting download of new URL file:///S:/bin/RemotableTestObject/RemotableTestObject.DLL. LOG: Attempting download of new URL file:///S:/bin/RemotableTestObject.EXE. LOG: Attempting download of new URL file:///S:/bin/RemotableTestObject/RemotableTestObject.EXE.
FUSION LOG !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! *** Assembly Binder Log Entry (6/19/2003 @ 2:10:10 PM) ***
The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\WINNT\Microsoft.NET\Framework\v1.0.3705\fusion.dll Running under executable S:\bin\RemotingHostApp.exe --- A detailed error log follows.
=== Pre-bind state information === LOG: DisplayName = RemotableTestObject (Partial) LOG: Appbase = S:\bin\ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = NULL Calling assembly : (Unknown). ===
LOG: Processing DEVPATH. LOG: DEVPATH is not set. Falling through to regular bind. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: RemotableTestObject LOG: Attempting download of new URL file:///S:/bin/RemotableTestObject.DLL. LOG: Attempting download of new URL file:///S:/bin/RemotableTestObject/RemotableTestObject.DLL. LOG: Attempting download of new URL file:///S:/bin/RemotableTestObject.EXE. LOG: Attempting download of new URL file:///S:/bin/RemotableTestObject/RemotableTestObject.EXE. LOG: All probing URLs attempted and failed.
-----Original Message----- From: Rick Byers [mailto:[EMAIL PROTECTED] Sent: Thursday, June 19, 2003 12:36 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Remoting GAC
On the client, if you're going to use 'Connect' to access your remote object (as opposed to 'new MyRemotableObject'), then you can access it using an interface (which you appear to want to do anyway). Instead of doing "typ = Type.GetType(typeinfo)" on the client, you probably just want "typ = typeof(IMyinterface)". I assume that RemotableObject implements IMyinterface (since thats what you're casting the proxy to on the client), right? By connecting using the interface type, you're requiring only the interface assembly (not the implementation) to be present on your client.
I don't see how putting the assembly in the GAC or not would make a difference. Are you talking about the GAC on the server or on the client? Also, try looking at the fusion log (fuslogvw.exe) after the exception is thrown for details of the problem.
Rick
----- Original Message ----- From: "ayse ayse" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 19, 2003 1:24 PM Subject: Re: Remoting GAC
I am having a bit of a trouble with remoting assemblies from GAC.GAC.
I need to support remoting regardless if my remotable object is in the
All the code below works fine if I don't use GAC!in
I have a generic Remoting Server Host application which registers my remotable object with the code below.
IChannel chnl = new TcpServerChannel("MyRemoteServer", 8228);
string typeinfo = "MyRemotableObject.FooObj, MyRemotableObject, Version=3.0.1.0, Culture=neutral, PublicKeyToken=034567812341234a"
Type typ = Type.GetType(typeinfo); RemotingConfiguration.RegisterWellKnownServiceType(typ, "MyRemoteServer", WellKnownObjectMode.SingleCall); Above seems to work fine, no exception even when my remotable assembly is
the GAC. My client can successfully connect if my remotable object is notin
GAC.But
My client:
string uri = "tcp://MyRemotemachine:8228/MyRemoteServer"; string typeinfo = "MyRemotableObject.FooObj, MyRemotableObject, Version=3.0.1.0, Culture=neutral, PublicKeyToken=034567812341234a"
IChannel chnl = new TcpClientChannel(); Type typ = Type.GetType(typeinfo);
IMyinterface rem_o = (IMyinterface)RemotingServices.Connect(typ, uri);
This creates the proxy and works fine if RemotableObject is not in GAC.
if in GAC throws "System.IO.FileNotFound" with "either the assemebly... or one of it's dependencies not found" exception as soon as I call a method even rem_o.ToString().
MyRemotableObject: public class RemotableObject:MarshalByRefObject { public RemotableObject() ....
}
Any quick catches or suggestions? I don't want to use App.config and activate programmaticaly allowing my clients to create a remote or local instance as they choose. Thanks.
_________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
This message was scanned for viruses.
_________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
