We were seeing the following unhandled exception on Jenkins:
````
Unhandled exceptions:
1) MonoTests.System.ServiceModel.OperationContextTest.Current : System.NullReferenceException: Object reference not set to an instance of an object
at System.ServiceModel.Channels.NetTcp.TcpReplyChannel.OnClose (TimeSpan timeout) [0x00000] in /media/ssd/jenkins/workspace/test-mono-mainline/label/debian-armhf/mcs/class/System.ServiceModel/System.ServiceModel.Channels.NetTcp/TcpReplyChannel.cs:141
at System.ServiceModel.Channels.CommunicationObject.Close (TimeSpan timeout) [0x0001c] in /media/ssd/jenkins/workspace/test-mono-mainline/label/debian-armhf/mcs/class/System.ServiceModel/System.ServiceModel.Channels/CommunicationObject.cs:140
at System.ServiceModel.Channels.CommunicationObject.Close () [0x00000] in /media/ssd/jenkins/workspace/test-mono-mainline/label/debian-armhf/mcs/class/System.ServiceModel/System.ServiceModel.Channels/CommunicationObject.cs:131
at System.ServiceModel.Dispatcher.ListenerLoopManager.TryReceiveRequestDone (IAsyncResult result) [0x00027] in /media/ssd/jenkins/workspace/test-mono-mainline/label/debian-armhf/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChannelDispatcher.cs:583
```
This happens because multiple threads can call OnClose() and so `client` can be null.
Fixed this by taking code from HttpReplyChannel.OnClose which handled this already and also fixed the race condition there (the checks need to happen under a lock).
HttpListenerManagerTable always looked up HttpListerManager instances using the full URI
while it should have disregarded the /operation?parameters part of the request in order
to match the service endpoint's base address.
There were several issues here:
- The IChannelDispatcherBoundListener was defined twice, in two different namespaces, and it caused code in
ChannelDispatcher.Attach not to set its associated listener's ChannelDispatcher property to the correct value.
This, in turn, caused incorrect HttpListenerManagerTable operation, where it would put the "/js" and "/jsdebug"
dispatchers in separate HttpListenerManagers, instead of in the main (base) service's one.
- After fixing the above, it turned out that SvcHttpHandler selected the manager based on the host's base address,
when it should first try to find one whose URL matches the current request exactly.
Service is invoked in the context of the System.Web pipeline and closing the response before the final
output stream flush causes the generated response not to ever reach the client. This patch makes sure
the System.Web pipeline takes care of all the response housekeeping.
* BinaryMessageEncoder.cs, MessageEncoder.cs:
The default content type value is null, not the ContentType value.
* HttpReplyChannel.cs : pass HTTP ContentType header value to
MessageEncoder.ReadMessage().
svn path=/trunk/mcs/; revision=160376
* HttpStandaloneReplyChannel.cs, HttpChannelListenerEntry.cs,
HttpContextInfo.cs, HttpListenerManager.cs,
HttpStandaloneRequestContext.cs, HttpListenerManagerTable.cs:
Fixed wsdl support in the new codebase, so enabled it again, and
made significant changes for ASP.NET integration. Now ASP.NET
implementation switched to the new one.
* SvcHttpHandler.cs : add required code for new ASP.NET HTTP stack.
Support for new and old stack (both) are temporarily enabled.
* HttpTransportBindingElement.cs : switch to new ASP.NET stack.
svn path=/trunk/mcs/; revision=159907
* HttpStandaloneReplyChannel.cs, HttpStandaloneRequestContext.cs:
add more code that the asp.net stuff will become like.
* SvcHttpHandlerFactory.cs : remove unused code.
* SvcHttpHandler.cs : ditto. Add some code for what new asp.net
support will look like.
svn path=/trunk/mcs/; revision=159818
* HttpStandaloneReplyChannel.cs, HttpListenerManager.cs,
HttpStandaloneRequestContext.cs :
refactoring, to add ASP.NET implementation. (not in use yet)
svn path=/trunk/mcs/; revision=159817
* HttpContextInfo.cs, HttpListenerManager.cs,
HttpListenerManagerTable.cs : add implementation for ASP.NET, not
in use yet.
svn path=/trunk/mcs/; revision=159811
* HttpListenerManager.cs : finish pending wait handle when closing
a listener. Fixed the issue on closing host/listener/channels.
svn path=/trunk/mcs/; revision=159490
* HttpStandaloneChannelListener.cs
HttpStandaloneReplyChannel.cs
HttpStandaloneRequestContext.cs
HttpListenerManagerTable.cs
HttpChannelListenerEntry.cs
HttpContextInfo.cs
HttpListenerManager.cs :
Refresh implementation for HTTP channel listener in new namespace,
which works fine with throttling.
It still has some issue in closing channels or listeners, so it
does not replace existing implementation yet.
svn path=/trunk/mcs/; revision=159439