Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 9th, 2007, 12:08 PM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dotnetpranker
Default .net remoting problem while hosting in public IIS

Hello,
  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["port"]=1234;
props["name"]="abc";
props["typeFilterLevel"] = System.Runtime.Serialization.Formatters.TypeFilter Level.Full;
chnl=new HttpChannel(props,ClientProv,ServProv);
ChannelServices.RegisterChannel(chnl);

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;
props["name"]="abc";
props["port"]=0;
chnl=new HttpChannel(props,cl,serv);
ChannelServices.RegisterChannel(chnl);

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
MessageBox.Show(rem.checkConnectivity());

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

I will get the ip address from
MessageBox.Show(rem.checkConnectivity());
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
MessageBox.Show(rem.checkConnectivity());
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)
{
currentusers.Add(uname);
TestEvent();
return true;
}

An exception is thrown here on statement
TestEvent();
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
"http://localhost:1234/Remotableobject.soap"

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??




Reply With Quote
  #2 (permalink)  
Old March 12th, 2007, 01:20 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dotnetpranker
Default

hi
  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?
Reply With Quote
  #3 (permalink)  
Old March 12th, 2007, 05:34 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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)
Reply With Quote
  #4 (permalink)  
Old March 19th, 2007, 07:05 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dotnetpranker
Default

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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Events with IIS hosted remoting koraykazgan C# 1 May 1st, 2007 03:49 PM
NET Remoting problem baga General .NET 0 March 23rd, 2007 12:58 AM
Flash Remoting Hosting JonnyRPI Flash (all versions) 1 January 5th, 2007 12:59 AM
.Net Remoting Problem farhan_iac General .NET 0 June 11th, 2004 03:13 AM
Hosting ASP .NET pages outside IIS sureshsundar007 General .NET 6 June 9th, 2004 12:09 AM



All times are GMT -4. The time now is 03:45 AM.


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