Convert the Calc app to use .Net Remoting

Download the Remoting Warmup Exercise
- Extract to a location on your local hard drive.
- The instructor will provide you with the password.

1. Add a new Class Library project to the solution.
- Name the project CalcCommon
- Include just one method:
int AddInts(int a, int b)

2. Add a Console application to the solution.
- Call the project CalcServer
- Copy server.config file to bin\Debug
- Enter data into config file:

application="CalcService"
wellknown type="CalcServer.Calc, CalcServer"
mode="SingleCall" objectUri="CalcEndPoint"
channel ref="tcp" port="999"

- Configure the server:
RemotingConfiguration.Configure("server.config", false);

- Stick in a Console.ReadLine to keep the app running.

3. Reference the CalcCommon project from both
CalcClient and CalcServer.

4. Copy the Calc class from CalcClient to CalcServer.
- You can just drag it from one project to the other.
- After copying it, REMOVE calc.cs from CalcClient.
- Change the namespace from CalcClient to CalcServer.
- Make Calc public, derive Calc from MarshalByRefObject and implement ICalc
public class Calc : MarshalByRefObject, ICalc (...)
- Add a constructor to Calc with:
Console.WriteLine("Calc has been created");

5. Modify CalcClient.
- Right-click Client.cs and select View Code.
- Add an ICalc private field:
ICalc _calc;

- In contructor, specify the remote object url:
string url = "tcp://localhost:999/CalcService/CalcEndPoint";

- In contructor, connect to the remote object as ICalc:
_calc = (ICalc)RemotingServices.Connect(typeof(ICalc), url);

- In the addButton_Click handler:
Comment out: Calc c = new Calc();
Invoke AddInts on _calc