I've got a .NET application that uses Remoting between an Administration Console and a Server application.
During a particularly long running remoting call, I will get an error message, displayed below.
I have added the Sponsor to the client to prevent the Remoting connection from being closed, and I have verified the Renew() method is being called.
I've googled the error, but nothing much comes up. I'm not really sure what's the issue here, so any help is appreciated.
Value cannot be null.
Parameter name: returnHeaders
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.ArgumentNullException: Value cannot be null.
Parameter name: returnHeaders
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: returnHeaders]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +7596735
Well, having a look at the Shared Source found on syncfusion.com, and checking the SecurityPermissions attribute here, and I can guess that either the BinaryFormatter (you did not say which?) failed to de-serialize the object in question.
Since you mentioned that it is particularly a long call, it might be worth your while to wrap up the remoting call in a try/catch block and enclose a full stack to see exactly where it is failing...even better, if the InnerException is not null, include that.... Or do something like this...Ok, it may sound hackish... and may fail...
On the server side, create a dummy method...for instance
void FuBar(void){
int foo = 3, bar = 4, baz = 0;
baz = foo + bar;
}
When you call the long running procedure, spawn a thread in the background to repetitively call the FuBar method to ensure that the remoting server does not expire and when the call finishes, kill off the thread...
My guess, is that after a period of time, the remoting call fails, despite renewing the sponsor...
Or it could be the socket is timing out? I'm out of ideas...
Hope this helps,
Best regards,
Tom.
Related
I am logging the connection status events with the wcf relay, and I'm seeing something like this in the logs.
1/26 06:47:12 ERROR Service Bus ConnectionStatus: 'Reconnecting' Event. [(null)][42]
LastError: System.ServiceModel.CommunicationException: Exception of type 'System.ServiceModel.CommunicationException' was thrown. ---> Microsoft.ServiceBus.Messaging.Amqp.AmqpException: An AMQP error occurred (condition='amqp:unauthorized-access').
--- End of inner exception stack trace ---
This exception doesn't show up in the list on this microsoft page, and the only other post I can find anywhere related to this error message is here. However, that post does not have any recent comments or a resolution or workaround for the issue. Also, the exception doesn't have any stacktrace, so how am I supposed to troubleshoot this error?
I guess as a follow-up, I would ask whether this is anything to actually worry about if the wcf connection is never faulting.
Apparently, the token that the relay keeps refreshing to stay active requires the time on the server to match the azure service that it is connecting with, and if not, this type of error will show up. We were able to fix it by correcting the server time.
I run .exe through windows service which reads the message from Private Queue. The service is all good and stable but at times the service stops (it actually does not stop, but it is not processing anything. Service status is still "Started", I need to manually restart it).
This one doesn't show up often but analyzing the memory dump of the .exe file, I found that so many threads encountered below exception.
Exception object: 0000000001436120
Exception type: System.Messaging.MessageQueueException
Message: External component has
thrown an exception.
System.Messaging.MessageQueueException- External component has thrown an exception
System.Messaging.MessageQueue.ReceiveCurrent(System.TimeSpan, Int32, System.Messaging.Interop.CursorHandle, System.Messaging.MessagePropertyFilter, System.Messaging.MessageQueueTransaction, System.Messaging.MessageQueueTransactionType)
System.Messaging.MessageQueue.Peek(System.TimeSpan)
Any idea why service encounters this exception?? Thanks in advance
I'm working on an asp.net application which communicates with web services. However quite often of late, the services have been down. I don't want to throw a generic Exception but rather a very specific one. What is the Exception name that handles 'connection timed out'. Thank you!
The correct one to throw is TimeoutException. The default message is The operation has timed-out
From MSDN:
The exception that is thrown when the time allotted for a process or operation has expired.
I have application web based net 1.1 Every three or four hour I have the restart my iis server because the performance becomes so slow , nothing will function with message memory leak. I traced the problem to the w3wp.exe in windows server 2003, Using the task manager, I can watch as memory is being added to this exe each time I open or refresh my web pages, but I never see memory released. Eventually there will be so much memory consumed, the web server will slow right down to nothing with display error memory leak and other message.
I don't know about solve that, I needed for monitoring memory used w3wp.exe so I can to release memory normal.
This Message
Server Error in '/myserver' Application.
Exception of type System.OutOfMemoryException was thrown.
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.OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[OutOfMemoryException: Exception of type System.OutOfMemoryException was thrown.]
Version Information: Microsoft .NET Framework Version:1.1.4322.2443; ASP.NET Version:1.1.4322.2470
Unfortunately, it isn't likely to be the w3wp.exe process itself, but the assemblies that it loads to run your application. I would check through your source code and make sure that you are releasing unmanaged resources, closing connections and disposing of IDisposable types.
I have the following WCF client code:
string add = String.Format("http://localhost:{0}/ServiceRequestRest",accessPort);
var cf = new ChannelFactory<IServiceRequestRest>(new WebHttpBinding(), add);
cf.Endpoint.Behaviors.Add(new WebHttpBehavior());
busService = cf.CreateChannel();
busService.DoMyStuff("hello",null);
When I have "first chance exception break" activated, that last line of code throws a series of exceptions. The first exception is this:
System.InvalidOperationException occurred
Message="Envelope Version 'EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)' does not support adding Message Headers."
Source="System.ServiceModel"
StackTrace:
at System.ServiceModel.Channels.MessageHeaders.ValidateHeaderKind(HeaderKind headerKind)
I am not aware that I am trying to "add Message Headers", but I choose to continue execution and immediately get the next exception:
System.Net.WebException occurred
Message="The underlying connection was closed: The connection was closed unexpectedly."
Source="System"
StackTrace:
at System.Net.HttpWebRequest.GetResponse()
With all that said, I'm having difficulty understanding what the problem is. Any clues?
Update: The return type of my REST call could not be serialized, as I learned from another site. That alone could cause this problem, but after I fixed it I still had the same problem. When I use a regular catch block for the exception, all I get is "the connection was closed unexpectedly." What else could I be missing?
Update2: I think I found the final problem. I was getting interference from Skype. The code is working now. :)
The main problem that I see is that you are trying to use a WCF Channel to communicate using WebHttpBinding.
IMHO the entire purpose of WebHttpBinding was so that the client did not have to use the WCF stack to communicate with it. You simply use any HTTP stack to make the requests.