Article ID: 307445 - Last Review: March 29, 2007 - Revision: 5.6 How to create a remote server by using Microsoft Visual C#This article was previously published under Q307445 On This PageSUMMARY This article illustrates how to create a simple, remote
server that another application can access. The application that accesses this
server can be located on the same computer, on a different computer, or on a
different network. The remote server is broken into two parts: the server
object and the server application. The server object is the object that the
client communicates with, and the server application is used to register the
server object with the Remoting run-time framework. RequirementsThe following list outlines the recommended hardware, software, network infrastructure, and service packs that you will need:
Creating the remote server objectThe first step in creating the server application is to create a server object. The server object is what the client application instantiates and communicates with on the server computer. The client application does this through a proxy object that is created on the client. In this sample, the server object resides in a Class Library (DLL) and is called myRemoteClass.
Creating the remote server applicationAfter you have created the server object that the client will communicate with, you must register this object with the Remoting framework. When you register the object, you must also start the server and have the server listen on a port for clients to connect to that port. To do this, you need a project type that outputs an executable file.The reason to include the server object in a separate project is so that you can easily reference the server object from the client project. If you include it in this project you cannot reference it, because references can only be set to DLL files.
Testing the server objectFor additional information about how to create a client application that communicates with the server object that you just created, click the following article number to view the article in the Microsoft Knowledge Base:300943
(http://support.microsoft.com/kb/300943/
)
How to create client access to remote server by using Visual Basic .NET
REFERENCESFor additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:301116
(http://support.microsoft.com/kb/301116/
)
How to marshal an object to a remote server by reference by using Visual Basic .NET
301112
(http://support.microsoft.com/kb/301112/
)
How to marshal an object to a remote server by reference by using Visual Basic .NET
For additional information about the TcpChannel class, visit the following Microsoft Developer Network (MSDN) Web
site:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeRemotingChannelsTcpTcpChannelClassTopic.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeRemotingChannelsTcpTcpChannelClassTopic.asp)
For additional information about the RemotingConfiguration.RegisterWellKnownServiceType method, visit the following MSDN Web site:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeRemotingRemotingConfigurationClassRegisterWellKnownServiceTypeTopic.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeRemotingRemotingConfigurationClassRegisterWellKnownServiceTypeTopic.asp)
For an overview of .NET Remoting, see the .NET Framework
Developer's Guide documentation.For additional information about MSDN Discussion Groups and Visual C# .NET from the Usenet newsgroup, visit the following Microsoft Web site: microsoft.public.dotnet.languages.csharp
(http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.dotnet.languages.csharp&lang=en&cr=US)
| Article Translations
|
Back to the top
