Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I am working on an old .net application.

Which implemented with .net remoting and hosted in IIS.

URL of .net remote object is like "http://serverName:12345/ClassNameOFRemoteObject.rem"

I am trying to replicate it in my local system for debugging purpose but not able to succeeded.

Therefore, I have created three projects here

Interface library (ClassLibrary1)
namespace ClassLibrary1

{ public interface IMyObj

{ string returnSomething();

}

}

"TestingRemoting" project has remote object which implemented above interface.
namespace TestingRemoting

{ public class myObj : MarshalByRefObject, IMyObj

{ public string returnSomething()

{

RemotingConfiguration.Configure("web.config",false);

return "HI";

}

}

}

Created virtual directory in IIS10 with name “ACD_BusinessLogic” and pointed to directory “C:\myRemoteObject\bin” where my TestingRemoting.dll and ClassLibrary1.dll resides
Added web.config file in “C:\myRemoteObject”
<system.runtime.remoting>

<application>

<channels>

<channel ref="http" >



<service>

<wellknown mode="Singleton" type="TestingRemoting.myObj, TestingRemoting"

objectUri="myObj.rem" />







After this if I tried to browse it, the message on the browser “System.Runtime.Remoting.RemotingException: Requested Service not found“ for the URL “http://localhost/ACD_BusinessLogic/myObj.rem”.Even add web reference couldn't able to resolve.


"Test" Client project
static void Main(string[] args)

{

String filename =

AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

RemotingConfiguration.Configure(filename,false);

IMyObj mgr = (IMyObj)RemotingHelper.CreateProxy(typeof(IMyObj));

string sd = mgr.returnSomething();

}

RemotingHelper.cs

private static IDictionary _wellKnownTypes;

public static Object CreateProxy(Type type)

{

if (_wellKnownTypes == null) InitTypeCache();

WellKnownClientTypeEntry entr =

(WellKnownClientTypeEntry)_wellKnownTypes[type];

if (entr == null)

{

throw new RemotingException("Type not found!");

}

return Activator.GetObject(entr.ObjectType, entr.ObjectUrl);

}

public static void InitTypeCache()

{

Hashtable types = new Hashtable();

foreach (WellKnownClientTypeEntry entr in

RemotingConfiguration.GetRegisteredWellKnownClientTypes())

{

if (entr.ObjectType == null)

{

throw new RemotingException("A configured type could not " +

"be found. Please check spelling in your configuration file.");

}

types.Add(entr.ObjectType, entr);

}

_wellKnownTypes = types;

}

Client App.config

<system.runtime.remoting>

<application>

<client>

<!-- This entry only works with the RemotingHelper class -->

<wellknown type="ClassLibrary1.IMyObj, ClassLibrary1"

url="http://localhost/ACD_BusinessLogic/myObj.rem" />







Then I tried to run client app, I am getting runtime exception “An unhandled exception of type 'System.Runtime.Remoting.RemotingException' occurred in mscorlib.dll. Additional information: System.Runtime.Remoting.RemotingException: Requested Service not found” at string sd = mgr.returnSomething();

Please help me.

What I have tried:

I tried changing config files with different combinations.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900