I use SocketIO4Net for connecting to Socket.IO with C#, but when I try to emit an object to clients, my C# application suddenly gets closed (I have an MVC3 project)
I read Event Viewer and there’s 3 errors:
1)
A Webhost unhandled exception occurred.
Sender Information: System.AppDomain/26995560
Exception: System.Runtime.FatalException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
2)
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/2/ROOT
Process ID: 3696
Exception: System.Runtime.FatalException
Message: Object reference not set to an instance of an object.
3)
Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.FatalException
Stack:
at System.Runtime.Fx+IOCompletionThunk.UnhandledExceptionFrame(UInt32, UInt32, System.Threading.NativeOverlapped*)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32, UInt32, System.Threading.NativeOverlapped*)
What’s wrong with my project? Is there any bug in SocketIO4NET?
Finally I found answer, this is because the version of .NET (I use .NET 4) and the WCF duplexChannel.
You should add this attribute on the top of WCF wrapper class:
Thanks to Cauldwell.net for the answer: http://www.cauldwell.net/patrick/blog/CategoryView,category,CodeGen.aspx
From cauldwell.net:
Special thanks to James