Remoting crashes IIS

Remoting crashes IIS

am 15.01.2008 13:43:54 von William

This is a multi-part message in MIME format.

------=_NextPart_000_0043_01C85785.0D5B1900
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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.=20
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.=20

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

Source Error:=20

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

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

------=_NextPart_000_0043_01C85785.0D5B1900
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Diso-8859-1">






Hi prefix =
o ns =3D "urn:schemas-microsoft-com:office:office" =
/>


I'm busy =
developing a .NET=20
remoting application.  Tcp remoting with a binary formatter=20
is used.  The user can specify on the client configuration =
whether to=20
connect to the hosted Singleton or SingleCall objects.  The =
application=20
consists out of the following:


- Shared=20
assembly
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">


This contains =
serializable=20
classes that are shared between the server and client =
applications.  This=20
also includes interfaces for the server classes.


- Server=20
assembly
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">


This assembly =
implements=20
the various interfaces from the Shared assembly and communicates =
directly with=20
the database.  Assembly is hosted in a Windows=20
service.


- General =

assembly
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">


This assembly =
contains=20
proxy classes and serves as a link between the client applications =
and the=20
server assembly.  When an application starts, it creates an =
instance of the=20
General class which in turn creates proxy classes to the server=20
classes.


Each proxy class, =
on=20
creation, calls the RegisterWellKnownServiceType for the respective =
server=20
class.  This keeps everything in one place.  This assembly =
also=20
provides the Login functionality for all =
applications.


- Client=20
Applications
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">


The client =
applications=20
have no reference to the Server assembly.  When the client =
application=20
starts, an instance of the General class from the General assembly is =
created,=20
which automatically prompts with the login screen and configure the =
remoting=20
classes.


The client =
application can=20
then just call a function on the correct proxy.


E.g. The Employee =

Management Module can call the style=3D"COLOR: =
navy">My.MainObj.EmployeeProxy.Save(EmployeeObj)
. =20
(MainObj is the General class and =

EmployeeObj is a serializable class from the Shared=20
assembly
)


Up to this =
point...=20
Everything works great.  The problem comes in with the web =
application=20
which also uses the General assembly's proxy =
classes.


When I use the =
web for the=20
first time, it works fine.  If I however close Internet Explorer =
and try to=20
access the site again (or try to access the site from another computer), =
I get=20
the following error:


Arial">


Arial">Object=20
reference not set to an instance of an object.
style=3D"FONT-FAMILY: Arial">


style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">Description: =
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">An unhandled exception =
occurred=20
during the execution of the current web request. Please review the stack =
trace=20
for more information about the error and where it originated in the =
code.=20


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

Source =
Error:
=20


style=3D"BACKGROUND: #ffffcc; WIDTH: 100%; mso-cellspacing: 1.5pt" =
cellPadding=3D0=20
width=3D"100%" border=3D0>

mso-yfti-lastrow: yes">
style=3D"BORDER-RIGHT: #ece9d8; PADDING-RIGHT: 0.75pt; BORDER-TOP: =
#ece9d8; PADDING-LEFT: 0.75pt; PADDING-BOTTOM: 0.75pt; BORDER-LEFT: =
#ece9d8; PADDING-TOP: 0.75pt; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: =
transparent">
Line 8:
yes">          =
Public Sub New(ByVal Parent As =
General.GeneralClient)
Line =
9: yes">           &n=
bsp; 
_General =3D Parent

style=3D"COLOR: red">Line 10:
yes">           &n=
bsp;
RemotingConfiguration.RegisterWellKnownServiceType( =
_
Line 11:
style=3D"mso-spacerun: =
yes">           &n=
bsp;           &nb=
sp;           &nbs=
p;     =
GetType(ServerInterfaces.IEmployeeManagement), =
_
Line 12:
style=3D"mso-spacerun: =
yes">           &n=
bsp;           &nb=
sp;           &nbs=
p;    
String.Format(_General.ServerUrl, =
My.Settings.IEmployeeManagement), _

size=3D2>Line 13:
yes">           &n=
bsp;           &nb=
sp;           &nbs=
p;     =
My.Settings.RemoteAccessMode)
BODY>

In the code =
above,=20
ServerInterfaces.IEmployeeManagement is the interface from the Shared=20
assembly.  _General.ServerUrl is the full url to the object which =
is=20
initialized when retrieving the settings for the client=20
application (e.g.  style=3D"COLOR: maroon">tcp://10.0.0.10:1921/{0}.rem
). =20
My.Settings.IEmployeeManagement is the name of the class being hosted=20
(for Singleton, it will be "EmployeeManagement".  =
SingleCall will=20
be "EmployeeManagement_SC").  My.Settings.RemoteAccessMode will be =
either=20
Singleton or SingleCall.


After this error, =
the IIS=20
process or something actuallly crashes.  If I refresh then, it =
works=20
again.


Arial">


Any ideas on how =
to solve=20
this?


style=3D"mso-spacerun: =
yes">Thanks



------=_NextPart_000_0043_01C85785.0D5B1900--