Strange Remoting Error

Posted on 2010-03-31
Medium Priority
Last Modified: 2013-11-07
I'm getting the following errors when I try to make a remote call to an application server I have. The error doesn't always comes up, just seems to be at random times.

Here is the error I'm getting:

Error:   Server stack trace:      
at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)    
at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset, Int32 count)    
at System.Runtime.Remoting.Channels.SocketHandler.ReadFromSocket(Byte[] buffer, Int32 offset, Int32 count)    
at System.Runtime.Remoting.Channels.SocketHandler.Read(Byte[] buffer, Int32 offset, Int32 count)    
at System.Runtime.Remoting.Channels.SocketHandler.ReadAndMatchFourBytes(Byte[] buffer)    
at System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadAndMatchPreamble()    
at System.Runtime.Remoting.Channels.Tcp.TcpSocketHandler.ReadVersionAndOperation(UInt16& operation)    
at System.Runtime.Remoting.Channels.Tcp.TcpClientSocketHandler.ReadHeaders()    
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)    
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)    
Exception rethrown at [0]:      
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)    
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)    
at MyAppServer.SendMail.SendConfirmEmails(Int32 invId, Boolean sendPromotionalPartnerEmail, Int32 refId, String serverSetting)    
at MyWebSite.reg.SendConfirmEmails(Object sendParams) in d:\HTTP\MyWebSite\reg.aspx.cs:line 706

Here is the code that is calling it:

MyAppServer.SendMail appServ= (MyAppServer.SendMail)Activator.GetObject(typeof(MyAppServer.SendMail), "tcp://" + wbAppIP.wvValue + "/SendMail");

sent = appServ.SendConfirmEmails((int)sndParams["InvId"], (bool)sndParams["SendPromo"], (int)sndParams["RefId"], hostEnvironment);

I've stepped through this and made sure that all the variables I'm using have the correct values in them. So, I'm not sure what is causing this problem.

Also, here is the entry in my web.config that allows me to call the AppServer from my website:
I've changed the tcp url to 999.99.999.999:999 for this example, so that I don't give away my app server url in this question text.
            <wellknown url="tcp://999.99.999.999:999/SendMail" type="MyAppServer.SendMail, MyAppServer"/>
            <channel type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting" ref="tcp" secure="true" protectionLevel="EncryptAndSign" tokenImpersonationLevel="impersonation" useDefaultCredentials="False" timeout="5" username="My_Services" password="11111111">
                        <formatter ref="binary"/>
Question by:quanmac
  • 2
  • 2
LVL 23

Accepted Solution

Roshan Davis earned 2000 total points
ID: 29234020
give timeout="5000" for 5 seconds

timeout = 5 means giving timeout of 5 milliseconds I believe

Author Comment

ID: 29234692
For some reason, I thought that the timeout was in minutes. I'll set it to timeout for 10 seconds and I will let you know if that works.
LVL 23

Expert Comment

by:Roshan Davis
ID: 29235065
it should work. All the best!

Author Comment

ID: 29235941
Thanks, the error has gone away and it looks like its working.

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Suggested Courses
Course of the Month4 days, 23 hours left to enroll

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question