p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   .net remoting problem while hosting in public IIS (http://p2p.wrox.com/showthread.php?t=55163)

dotnetpranker March 9th, 2007 12:08 PM

.net remoting problem while hosting in public IIS
  I am struggling with .net remoting for two weeks.i need some one's help very badly please.Ill describe my problem.
  I am in developing a chat server in remoting.I devloped it with basic funtionalities.i hosted server as windows service and in IIS.both worked perfectly in my LAN.Now with that confidence i tried to host my server in a public server. Now my app is not working as am expected.

I will paste the code here am using in Application_start method in global.cs in hosted web application.

HttpChannel chnl;
SoapServerFormatterSinkProvider ServProv=new SoapServerFormatterSinkProvider();

ServProv.TypeFilterLevel=System.Runtime.Serializat ion.Formatters.TypeFilterLevel.Full;
SoapClientFormatterSinkProvider ClientProv=new SoapClientFormatterSinkProvider();

IDictionary props=new Hashtable();
props["typeFilterLevel"] = System.Runtime.Serialization.Formatters.TypeFilter Level.Full;
chnl=new HttpChannel(props,ClientProv,ServProv);

RemotingConfiguration.RegisterWellKnownServiceType (typeof(Remoting.Remotableobject),"Remotableobject .soap",WellKnownObjectMode.Singleton);

//Code in my windows app to connect to server

string server=@"http://www.sumesh.somee.com:1234/Remotableobject.soap";
IDictionary props=new Hashtable();
SoapServerFormatterSinkProvider serv=new SoapServerFormatterSinkProvider();
SoapClientFormatterSinkProvider cl=new SoapClientFormatterSinkProvider();
serv.TypeFilterLevel=System.Runtime.Serialization. Formatters.TypeFilterLevel.Full;
props["typeFilterLevel"] = TypeFilterLevel.Full;
chnl=new HttpChannel(props,cl,serv);

rem= (Remoting.Remotableobject) Activator.GetObject(typeof(Remoting.Remotableobjec t),server);

MessageBox.Show(rem.checkConnectivity());//returns ip address of server
rem.eventRxText+=new ReceieveText(callback.rem_eventRxText);
rem.eventGtUsers+=new getusers(callback.rem_eventGtUsers);
rem.TestEvent+=new Testdel(callback.rem_TestEvent);

If i run my client app ill get a connection time out exceptionwhen at this code statement

Now if i replace
string server=@"http://www.sumesh.somee.com:1234/Remotableobject.soap";
string server=@"http://www.sumesh.somee.com/Remotableobject.soap";

I will get the ip address from
but at next statement, that is
rem.eventRxText+=new ReceieveText(callback.rem_eventRxText); i get exception
Type System.DelegateSerializationHolder and the types derived from it (such as System.DelegateSerializationHolder) are not permitted to be deserialized at this security level.

now again if comment the line props["port"]=1234; on server and run the client with the url
string server=@"http://www.sumesh.somee.com/Remotableobject.soap";
ill get NO error on these four statements
rem.eventRxText+=new ReceieveText(callback.rem_eventRxText);
rem.eventGtUsers+=new getusers(callback.rem_eventGtUsers);
rem.TestEvent+=new Testdel(callback.rem_TestEvent);

but when i call a method in remote object, say
rem.login(username,pass) which contains firing of an event, that is like this

//this is in remoteobject
public bool login(string uname,string pwd)
return true;

An exception is thrown here on statement
that is:object reference not set to an instance of an object

The thing is that the same remoteobject without any change in code will work perfectly if i host my server in my local IIS with setting port number on server and using this url on client

but sometimes here also i get the error
object reference not set to an instance of an object while firnig event in remote object.

can anybody help me on this please??

dotnetpranker March 12th, 2007 01:20 AM

  i tried the same application without any change from my home..for my surprise its working randomnly.the event is firing without fail.sometimes it is showing the same error as i satated above..what could be the problem..do i need to change server?or something is blocking it to work from my office?

joefawcett March 12th, 2007 05:34 AM

Perhaps your company has a firewall with port 1234 closed. (You might want to read this on port numbers http://www.iana.org/assignments/port-numbers)


Joe (Microsoft MVP - XML)

dotnetpranker March 19th, 2007 07:05 AM

Thanks for th reply..but if use url without port like
"http://www.sumesh.somee.com/Remotableobject.soap" also its not working from my office, but sometimes working from my home..I cant understand..any idea

All times are GMT -4. The time now is 06:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.