How to Configure More than one class in Web.config for Remoting


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How to Configure More than one class in Web.config for Remoting

  1. #1
    Join Date
    Jan 2005
    Location
    INDIA
    Posts
    42

    Question How to Configure More than one class in Web.config for Remoting

    Hi,

    I have a small doubt on Remoting.

    If I have more than one class(In same Solution or Assembly) implementing Remoting.

    How shall I Configure it in Web.config for both client and server side?

    I am giving a snippet for one class:

    Server Side:
    <wellknown mode="Singleton" objectUri="Server.rem" type="Server.Class1, Server"
    />

    Client Side:
    <wellknown
    url="http://Remoteserver/VirtualDirectory/Server.rem"
    type="Server.Class1, Server"
    />

    Now If I have another class (Class2) which is also implementing Remoting Concept in the same Solution file Server then how to configure in the configuration file.

    I tried giving another <well known> tag but it didn't work rather it ruined the functionality of the first class too.

    Please Help.
    Thanks & Regards,
    Bala

  2. #2
    Join Date
    Feb 2005
    Posts
    13
    The config files can be picky sometimes. If there is a missing / tag or anything else syntactically wrong it will fail everything.

    I have done this on several projects with mutiple classes in the same assembly.

    Here is the server code snipit (web.config)
    Code:
    <system.runtime.remoting>
       <application>
    
    <channels>
    		<channel ref="http" >		
    			<serverProviders>			
    				<provider ref="wsdl" />			
    				<formatter ref="soap" typeFilterLevel="Full" />			
    				<formatter ref="binary" typeFilterLevel="Full" />
    			</serverProviders>
    			<clientProviders>
    				<formatter ref="binary" />
    			</clientProviders>
    		</channel>
       </channels>
                
      
      
           <service>
                <wellknown 
                   mode="SingleCall" objectUri="CustomerMaster.rem" 
                   type="SupportLib.CustomerMaster,SupportLib"/>
             </service>
             
             <service>
                <wellknown 
                   mode="SingleCall" objectUri="BuyerMaster.rem" 
                   type="SupportLib.BuyerMaster,SupportLib"/>
             </service>
    	
        </application>
      </system.runtime.remoting>
    Here is the app config(client)

    Code:
    <system.runtime.remoting>
       <application>
    
        
            <channels>
                <channel ref="http">
                   <clientProviders>
                      <formatter ref="binary" />
                   </clientProviders>
                </channel>
           </channels>
    
            <client>
                <wellknown 
                   url="http://bigg:80/dashboardserver/BuyerMaster.rem"
                   type="SupportLib.BuyerMaster,SupportLib"
                />
            </client>
            
            <client>
                <wellknown 
                   url="http://bigg:80/dashboardserver/CustomerMaster.rem"
                   type="SupportLib.CustomerMaster,SupportLib"
                />
            </client >
    
    
    
    		
        </application>
      </system.runtime.remoting>

    A quick way to test if your server config file doesn' have syntax errors is to create a basic aspx page and put it on the remoting server (assuming you are using IIS as the remoting server). If there is anything wrong in the config file the page will fail.

    sample: http://bigg/dashboardserver/test.aspx

    All you need is a single aspx page like this. test.aspx

    Code:
    <%
    Response.Write("Test it")
    %>

  3. #3
    Join Date
    Sep 2004
    Posts
    9

    Remoting in web.config

    Hi there,

    Basically,you have

    Server Side:
    <wellknown mode="Singleton" objectUri="Server.rem" type="Server.Class2, Server"
    />

    Client Side:
    <wellknown
    url="http://Remoteserver/VirtualDirectory/Server.Class2.rem"
    type="Server.Class2, Server"
    />

    or maybe

    Server Side:
    <wellknown mode="Singleton" objectUri="Class2.rem" type="Server.Class2, Server"
    />

    Client Side:
    <wellknown
    url="http://Remoteserver/VirtualDirectory/Server.Class2.rem"
    type="Server.Class2, Server"
    />


    which are in 2 web.configs. One goes at the root of the virtual dir of the calling web app, and the other in the root of the virtual dir of the receiving class lib dll. I just went thru this, these last 2 days. You need in the global.asax.* where * is either vb, cs, etc, a call to some method of System.Runtime.Remoting.RemotingConfiguration... in the Application_Start event.
    Now, I know this trick: to know if in the application virtual dir, the dll component is well declared, you would type in a web browser (in your case):

    http://Remoteserver/VirtualDirectory...lass2.rem?wsdl

    or

    http://Remoteserver/VirtualDirectory/Class2.rem?wsdl

    whichever is right in your case.

    If you see the description in a wellformed xml output, with a lot of different colors you are close to be in this remoting business.This basically means that the <service></service> section with objectUri is well constructed. Also, there is a wizard for web.config files in VS.Net 2005 Beta, that I still haven't tried. If this wizard does remoting too, please reply with a few hints about it.

    By the way, for most cases, it is better to use SingleCall.

    Tonci Korsano "What you think doesn't matter. What matters is evidence!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center