CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: Fairly simple .NET Remoting scenario but problematic

  1. #1
    Join Date
    Sep 2005
    Cracow, Poland

    Question Fairly simple .NET Remoting scenario but problematic


    I implemented this simple scenario containing 3 assemblies:

    - TL (Transport Layer) assembly that contains only one class 'Class1':

    public class Class1 : MarshalByRefObject { public int MyProperty { get; set; } }

    and one interface:

    public interface Interface1 { Class1 Get(int i); }

    - BLL (Business Logic Layer) application that will act as a server in my remoting scenario. This assembly has reference to TL assembly and contains 2 files:
    BLL Manager:

    class BLLManager : Interface1 { public Class1 Get(int i) { return new Class1() { MyProperty = i - 1 }; } }

    And an xml file:

    <?xml version="1.0" encoding="utf-8" ?><configuration> <system.runtime.remoting> <application> <channels> <channel ref = "tcp" port = "5001" /> </channels> <service> <wellknown mode = "SingleCall" type = "TL, Interface1" objectUri = "Uri1" /> </service> </application> </system.runtime.remoting></configuration>

    The BLL assembly is a Windows Service. In the OnStart method I included the following code:

    protected override void OnStart(string[] args) { RemotingConfiguration.Configure(@"C:\somefolder\BLL\bin\Debug\Config.xml", false); }

    I installed this service and started it.

    Third assembly is a simple Web application that acts as a .NET Remoting client here; it contains reference to TL as well. This assembly contains config file 'Web.config':

    <?xml version="1.0"?>...
    <system.runtime.remoting> <application> <client> <wellknown type = "TL.Interface1, Uri1" url="tcp://lsrv01:5001/BLL" /> < </client> <channels> <channel ref="tcp" port="0"/> </channels> </application> </system.runtime.remoting></configuration>

    It also contains Default.aspx, which has the following C# code:

    RemotingConfiguration.Configure(@"C:\/*some path*/\Web.config", false);
    Interface1 obj = (Interface1)Activator.GetObject(typeof(Interface1), "tcp://lsrv01:5001/BLL");
    var i = obj.Get(5);

    However I`m getting RemoteException in the last line. It say: "Server encountered an internal error. For more information, turn off customErrors in the server's .config file." In my web application I modified the web.config file accordingly:

    <authentication mode="Windows"/> <customErrors mode="Off" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors>

    But it didn't make any difference. Could you please help me to try to figure out what is wrong in my scenario?

    Thank you very much for any useful help.
    Last edited by yoyosh; April 16th, 2010 at 11:03 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)