.NET Remoting crashes IIS

Viper

Member
Joined
Aug 27, 2004
Messages
17
Location
South Africa
Programming Experience
5-10
Hi

I'm busy developing a .NET remoting application. Tcp remoting with a binary formatter is used. The user can specify on the client configuration whether to connect to the hosted Singleton or SingleCall objects. The application consists out of the following:
- Shared assembly
This contains serializable classes that are shared between the server and client applications. This also includes interfaces for the server classes.
- Server assembly
This assembly implements the various interfaces from the Shared assembly and communicates directly with the database. Assembly is hosted in a Windows service.
- General assembly
This assembly contains proxy classes and serves as a link between the client applications and the server assembly. When an application starts, it creates an instance of the General class which in turn creates proxy classes to the server classes.
Each proxy class, on creation, calls the RegisterWellKnownServiceType for the respective server class. This keeps everything in one place. This assembly also provides the Login functionality for all applications.
- Client Applications
The client applications have no reference to the Server assembly. When the client application starts, an instance of the General class from the General assembly is created, which automatically prompts with the login screen and configure the remoting classes.
The client application can then just call a function on the correct proxy.
E.g. The Employee Management Module can call the My.MainObj.EmployeeProxy.Save(EmployeeObj). (MainObj is the General class and EmployeeObj is a serializable class from the Shared assembly)

Up to this point... Everything works great. The problem comes in with the web application which also uses the General assembly's proxy classes.
When I use the web for the first time, it works fine. If I however close Internet Explorer and try to access the site again (or try to access the site from another computer), I get the following error:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:
Line 8: Public Sub New(ByVal Parent As General.GeneralClient)
Line 9: _General = Parent
Line 10: RemotingConfiguration.RegisterWellKnownServiceType( _
Line 11: GetType(ServerInterfaces.IEmployeeManagement), _
Line 12: String.Format(_General.ServerUrl, My.Settings.IEmployeeManagement), _
Line 13: My.Settings.RemoteAccessMode)

In the code above, ServerInterfaces.IEmployeeManagement is the interface from the Shared assembly. _General.ServerUrl is the full url to the object which is initialized when retrieving the settings for the client application (e.g. tcp://10.0.0.10:1921/{0}.rem). My.Settings.IEmployeeManagement is the name of the class being hosted (for Singleton, it will be "EmployeeManagement". SingleCall will be "EmployeeManagement_SC"). My.Settings.RemoteAccessMode will be either Singleton or SingleCall.
After this error, the IIS process or something actuallly crashes. If I refresh then, it works again.

Any ideas on how to solve this?
Thanks
 
Hard to tell without more information, but I'd guess that you aren't clearing something up properly before you try and re-create it.
 
Back
Top