using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

public class Server
{
    public static void Main(string[] args)
    {
        // Create the server channel.
        HttpServerChannel serverChannel = new HttpServerChannel(9090);

        // Register the server channel.
        ChannelServices.RegisterChannel(serverChannel);

        // Expose an object for remote calls.
        RemotingConfiguration.RegisterWellKnownServiceType(
            typeof(RemoteObject), "RemoteObject.rem",
            WellKnownObjectMode.Singleton);

        // Wait for the user prompt.
        Console.WriteLine("Press ENTER to exit the server.");
        Console.ReadLine();
        Console.WriteLine("The server is exiting.");
    }
}

for this i am getting this error what should i do

Error 1 The type or namespace name 'Http' does not exist in the namespace 'System.Runtime.Remoting.Channels' (are you missing an assembly reference?) C:\Documents and Settings\praktykant\Moje dokumenty\Visual Studio 2005\Projects\ConsoleApplication4\ConsoleApplication4\Program.cs 5 40 ConsoleApplication4

Edited 3 Years Ago by Dani: Formatting fixed

Hi there Jacobpauls and welcome to DaniWeb :). To solve your problem try right clicking the icon of your project (in solution browser) and select add reference. Then select System.Runtime.Remoting. Its under the .net tab of the add references form. The "using" statements are merely a convenience to eliminate typing long
namespace strings, they do not pull in all of the requisite assemblies. Hope this helps and fixes your problem!

This article has been dead for over six months. Start a new discussion instead.