There are some known issues with what you are trying to do. The first one
is getting the config file. You can find information about that here:
a security exception. To get around that, you will need to set some
security permissions on the client. See this example:
touch deploy unless you are explicitly trying to do a Assembly.LoadFrom().
"Ken Cooper" <_k.a.cooper@shu.ac.uk_> wrote in message
news:%23hpGe%23jnDHA.964@TK2MSFTNGP10.phx.gbl...
> Hi All
>
> Over the last few days I have been trying to build a sample app to call a
> remote component.
>
> I am trying to prove that Windows Forms using Zero Touch Deployment and
..NET
> Remoting is the best way to proceed on a new fairly substantial project.
>
> However, I keep hitting a brick wall when making a call to the remote
> component.
>
> I get the following error:
>
> "An unhandled exception of type 'System.IO.FileNotFoundException' occurred
> in system.windows.forms.dll
>
> Additional information: File or assembly name RemoteLibrary, or one of its
> dependencies, was not found."
>
>
>
> I feel like I am so close but some key setting or missing step is
preventing
> me from accessing the remote object.
>
>
>
> Some questions:
>
> Should the remote config file be named remoting.config or remoting.cfg?
>
> Should the first xml line be removed from the config file?
>
> Should the config file be installed in the bin directory or the directory
> above?
>
> Does the error imply the communication channel has been opened and the
> remote server is denying access to the assembly or that the communication
> channel may not be open?
>
> If tcp port 1234 is not actually available to me to use how could I tell?
>
> Are there any other steps I should be making to register the assembly in
the
> GAC?
>
>
>
> Step by Step this is what I have done:
>
>
>
> Create a VB.Net Class Library
> a.. Create a new VS.NET project of type ClassLibrary called
RemoteLibrary
> b.. Rename the default class to DateTimeFunctions
> c.. Derive this class from MarshalByRefObject and create a new method eg
> CurrentTime which returns the present time.
> <Serializable()> Public Class DateTimeFunctions
>
> Inherits MarshalByRefObject
>
>
>
> Public Function CurrentTime() As String
>
> Return Format(Now, "HH:mm")
>
> End Function
>
>
>
> End Class
>
>
>
> This is the simple class which will be installed on a remote server and
> referenced locally. I have included the serializable attribute but I am
not
> sure if this is necessary as the object will be referenced remotely, but
not
> itself passed as a parameter in a method call.
>
>
>
> a.. Edit the Assembly Information File (In Solution Explorer, click on
the
> project and then Show All Files)
> Select the AssemblyInfo.vb file
> Enter an Assembly Version and other optional information. The key file
can
> be created using the Strong Name Tool.
> <Assembly: AssemblyVersion("1.0.0.0")>
>
> <Assembly: AssemblyCulture("neutral")>
>
> <Assembly: AssemblyKeyFile("K:\Certificates\SCBKC.snk")>
>
>
>
> Add an Application Configuration File named remoting.config
> Remove the first line <?xml version="1.0" encoding="utf-8" ?>
> Add the following information
> <configuration>
>
> <system.runtime.remoting>
>
> <application>
>
> <service>
>
> <wellknown
>
> mode="SingleCall"
> type="RemoteLibrary.DateTimeFunctions,
>
> RemoteLibrary"
> objectUri="DateTimeFunctions"/>
>
> </service>
>
> <channels>
>
> <channel ref="tcp" port="1234"/>
>
> </channels>
>
> </application>
>
> </system.runtime.remoting>
>
> </configuration>
>
> (
http://www.15seconds.com/issue/030225.htm)
> Rename the file to remoting.cfg (Colour disappears)
> This file will need to be installed on the remote server.
>
> a.. Build the solution
> b.. From the command line run the sn tool to create a strong name for
the
> assembly
> C:\SHU\RemoteLibrary\bin>
> sn -R RemoteLibrary.dll K:\Certificates\SCBKC.snk (Previously created
> KeyFile)
> c.. Create a directory on the remote server named RemoteLibrary and a
> subdirectory named bin
> Copy remoting.cfg to RemoteLibrary
> Copy RemoteLibrary.dll to bin
> Grant Full Control rights to everyone (to ensure permissions is not
> causing the error)
> d.. On the remote server, drag RemoteLibrary.dll into WINNT\Assembly
> This will register the assembly in the Global Assembly Cache (GAC)
> e.. Double check that the assembly is registered using .NET Framework
> Configuration in Administrative Tools
>
>
> Create a VB.NET WinForms Application
> a.. In VS.Net create a new Windows Forms Application name WinForm
> b.. In the project References, add a .NET reference - browse to
> RemoteLibrary.dll on the remote server
> In the properties of the newly added reference, ensure that Copy Local
is
> set to False
> c.. Add an Application Configuration file to the project and enter the
> following information
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
>
> <system.runtime.remoting>
>
> <application name="WinForm">
>
> <client>
>
> <wellknown
>
> type="Remoting.DateTimeFunctions,Remoting"
> url="tcp://ntchamaeleon:1234/DateTimeFunctions">
>
> </wellknown>
>
> </client>
>
> <channels>
>
> <channel ref="tcp"></channel>
>
> </channels>
>
> </application>
>
> </system.runtime.remoting>
>
> </configuration>
>
>
>
> a.. Add 2 buttons to Form1 - Call and End
> b.. In the click event handler for "End" type End to end the application
> c.. In the click event handler for Call enter
> Dim dtf As New RemoteLibrary.DateTimeFunctions
> MsgBox(dtf.CurrentTime)
>
>
> Run the application and click on the Call button
>
>
>
> "An unhandled exception of type 'System.IO.FileNotFoundException' occurred
> in system.windows.forms.dll
>
> Additional information: File or assembly name RemoteLibrary, or one of its
> dependencies, was not found."
>
>
>
>
>
> Tantalisingly close but not there yet! (this proof of concept excercise is