DaFou
asked on
How to include remoting configuration
Ola,
I have this client in C# that makes use of remoting. The remtoing gets configerd by an external xml file to make ti more dynamic after the program has been compiled.
But now I dont need the program to be dynamic and I want to have everything included in this 1 client.cs file so that I can easily use this code from ASP.NET aswell.
here is the client.cs:
// console app
using System;
using System.Configuration;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Ac tivation;
class Client
{
static void Main()
{
RemotingConfiguration.Conf igure("cli ent.exe.co nfig");
ICalc c = (ICalc)
RemotingServices.Connect(t ypeof(ICal c), ConfigurationSettings.AppS ettings["c alcURL"]);
Console.WriteLine("c.AppDo mainName (Calc) = {0}", c.AppDomainName);
Console.ReadLine();
}
}
and this is the application configuartion file ( app.config ):
<!-- xml -->
<configuration>
<appSettings>
<add key="calcURL" value="http://localhost:999/calcsrv/calc"/>
</appSettings>
<system.runtime.remoting>
<application name="client">
<channels>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
<serverProviders>
<formatter ref="binary" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
I have this client in C# that makes use of remoting. The remtoing gets configerd by an external xml file to make ti more dynamic after the program has been compiled.
But now I dont need the program to be dynamic and I want to have everything included in this 1 client.cs file so that I can easily use this code from ASP.NET aswell.
here is the client.cs:
// console app
using System;
using System.Configuration;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Ac
class Client
{
static void Main()
{
RemotingConfiguration.Conf
ICalc c = (ICalc)
RemotingServices.Connect(t
Console.WriteLine("c.AppDo
Console.ReadLine();
}
}
and this is the application configuartion file ( app.config ):
<!-- xml -->
<configuration>
<appSettings>
<add key="calcURL" value="http://localhost:999/calcsrv/calc"/>
</appSettings>
<system.runtime.remoting>
<application name="client">
<channels>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
<serverProviders>
<formatter ref="binary" />
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.