Hello All,
I have been searching for a solution for the last 2 days. As a last
resort, I am turning to this group. Please help.
I have an assembly called "RemoteObjectsInterfaces.dll" that has an
interface called "IHelloWorldInterface". I have another assembly called
"RemoteObjects.dll" that has a class called "HelloWorldRemoteObject"
that inherits from MarshalByRefObject and implements
"IHelloWorldInterface".
I have created a folder on the server in C:\Inetpub\wwwroot called
"RemoteObjects" that has a "bin" folder that holds
"RemoteObjectsInterfaces.dll" and "RemoteObjects.dll". I have created a
virtual directory in IIS6.0 called "RemoteObjectsVirDir" that points to
C:\Inetpub\wwwroot\RemoteObjects.
C:\Inetpub\wwwroot\RemoteObjects\web.config is as follows:
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall"
type="RemoteObjects.HelloWorldRemoteObject, RemoteObjects"
objectUri="MyHelloWorld.rem"/>
</service>
</application>
</system.runtime.remoting>
<system.web>
<customErrors mode="Off" />
<httpRuntime executionTimeout="1800" maxRequestLength="40960" />
</system.web>
</configuration>
My client test app does the following on a button click:
HttpChannel h = new HttpChannel();
ChannelServices.RegisterChannel(h,true);
IHelloWorldInterface o =
(IHelloWorldInterface)Activator.GetObject(
typeof(RemoteObjectsInterfaces.IHelloWorldInterface),
"http://10.17.173.161/RemoteObjectsVirDir/MyHelloWorld.rem");
if (o != null)
{
label1.Text = o.HelloWorld("ABC");
}
I get the following error:
Attempted to call a method declared on type
'RemoteObjectsInterfaces.IHelloWorldInterface' on an object which
exposes 'RemoteObjects.HelloWorldRemoteObject'.
I'm pretty sure it's something trivial...
Thanks much in advance!!!
Amit - 27 Oct 2006 19:13 GMT
Duh! All I had to do was specify the namespace in the client side code.
RemoteObjectInterfaces.IHelloWorldInterface o =
(RemoteObjectInterfaces.IHelloWorldInterface)Activator.GetObject(
typeof(RemoteObjectInterfaces.IHelloWorldInterface),
"http://ipaddress/RemotObjectsVirDir/MyHelloWorld.rem");