All, Need some clarification/guidance. Using Castle dynamic proxy v3.1.0.23772 and .NET 4. Occasionally after a period of inactivity - timeout is 10 minutes - getting the following exception:
Exception type: System.ServiceModel.ProtocolException Message: This channel can no longer be used to send messages as the output session was auto-closed due to a server-initiated shutdown. Either disable auto-close by setting the DispatchRuntime.AutomaticInputSessionShutdown to false, or consider modifying the shutdown protocol with the remote server. The callstack: 12abe4a0 54fddf13 System.ServiceModel.Channels.ServiceChannel.PrepareCall(System.ServiceModel.Dispatcher.ProxyOperationRuntime, Boolean, System.ServiceModel.Dispatcher.ProxyRpc ByRef) 12abe508 54421bdd System.ServiceModel.Channels.ServiceChannel.Call(System.String, Boolean, System.ServiceModel.Dispatcher.ProxyOperationRuntime, System.Object[], System.Object[], System.TimeSpan) 12abe650 54421a29 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(System.Runtime.Remoting.Messaging.IMethodCallMessage, System.ServiceModel.Dispatcher.ProxyOperationRuntime) 12abe678 54421175 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(System.Runtime.Remoting.Messaging.IMessage) 12abe6bc 078300b4 Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.InvokeRealProxy(System.Runtime.Remoting.Proxies.RealProxy, Castle.Facilities.WcfIntegration.WcfInvocation) 12abe6d4 0782ff82 Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor+<>c__DisplayClass1.<PerformInvocation>b__0(Castle.Facilities.WcfIntegration.WcfInvocation) 12abe6e4 0782faab Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.ApplyChannelPipeline(Int32, Castle.Facilities.WcfIntegration.WcfInvocation, System.Action`1<Castle.Facilities.WcfIntegration.WcfInvocation>) 12abe704 0782ff34 Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor+<>c__DisplayClass4.<ApplyChannelPipeline>b__3() 12abe70c 0782fed8 Castle.Facilities.WcfIntegration.WcfInvocation.Proceed() 12abe73c 0782fb5d Castle.Facilities.WcfIntegration.RepairChannelPolicy.Apply(Castle.Facilities.WcfIntegration.WcfInvocation) 12abe770 0782fafb Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.ApplyChannelPipeline(Int32, Castle.Facilities.WcfIntegration.WcfInvocation, System.Action`1<Castle.Facilities.WcfIntegration.WcfInvocation>) 12abe790 0782fa37 Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.PerformInvocation(Castle.DynamicProxy.IInvocation, System.Action`1<Castle.Facilities.WcfIntegration.WcfInvocation>) 12abe7a8 0782f9e0 Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.PerformInvocation(Castle.DynamicProxy.IInvocation) 12abe7bc 0782f959 Castle.Facilities.WcfIntegration.Async.WcfRemotingAsyncInterceptor.PerformInvocation(Castle.DynamicProxy.IInvocation) 12abe7cc 0782f91b Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.Intercept(Castle.DynamicProxy.IInvocation) 12abe7d4 07820e05 Castle.DynamicProxy.AbstractInvocation.Proceed() 12abe818 0782f896 ZZZ.Client.PerformanceInterceptor.Intercept(Castle.DynamicProxy.IInvocation) 12abe838 07820e05 Castle.DynamicProxy.AbstractInvocation.Proceed() 12abe87c 0b1b2293 Castle.Proxies.IImageServerProxy.GetImages(Int64, Int32, com.ZZZ.server.SecurityToken) Below are properties of the ServiceChannel that is being used. In particular, the state is 2 (Open), and hasChannelStartedAutoClosing flag is true. It seems like prior to making a call on the channel, Castle examines the state of it using WcfUtils's IsCommunicationObjectReady method, sees that the channel is not in Closed, Closing, or Faulted state, and proceeds to make a call on it. Then later on, in .NET's System.ServiceModel.dll, ServiceChannel class' PrepareCall() method, .NET framework checks whether the hasChannelStartedAutoClosing property of the channel is set to true and if so, throws the above mentioned protocol exception. Not sure at what point in time the value of hasChannelStartedAutoClosing flag is set to true and what it is at the time Castle checks the state of the channel's. Are setting DispatchRuntime.AutomaticInputSessionShutdown to false (would require code to close the channel) or generating a new proxy object for each call (possible performance hits) my only two options here? Thanks, VM ServiceChannel properties at the time of the exception: 59a86820 4000072 28 System.Boolean 1 instance 0 aborted 59a86820 4000073 29 System.Boolean 1 instance 0 closeCalled 54ea9628 4000074 4 ...ct+ExceptionQueue 0 instance 00000000 exceptionQueue 59a7f7dc 4000075 8 System.Object 0 instance 02fb6d84 mutex 59a86820 4000076 2a System.Boolean 1 instance 0 onClosingCalled 59a86820 4000077 2b System.Boolean 1 instance 0 onClosedCalled 59a86820 4000078 2c System.Boolean 1 instance 1 onOpeningCalled 59a86820 4000079 2d System.Boolean 1 instance 1 onOpenedCalled 59a86820 400007a 2e System.Boolean 1 instance 0 raisedClosed 59a86820 400007b 2f System.Boolean 1 instance 0 raisedClosing 59a86820 400007c 30 System.Boolean 1 instance 0 raisedFaulted 59a86820 400007d 31 System.Boolean 1 instance 0 traceOpenAndClose 59a7f7dc 400007e c System.Object 0 instance 02fb6ea4 eventSender 54e08e64 400007f 24 System.Int32 1 instance 2 state 59a72ac8 4000080 10 System.EventHandler 0 instance 00000000 Closed 59a72ac8 4000081 14 System.EventHandler 0 instance 00000000 Closing 59a72ac8 4000082 18 System.EventHandler 0 instance 00000000 Faulted 59a72ac8 4000083 1c System.EventHandler 0 instance 00000000 Opened 59a72ac8 4000084 20 System.EventHandler 0 instance 00000000 Opening 59a82b6c 4002d23 7c System.Int32 1 instance 0 activityCount 59a86820 4002d24 32 System.Boolean 1 instance 1 allowInitializationUI 59a86820 4002d25 33 System.Boolean 1 instance 0 allowOutputBatching 59a86820 4002d26 80 System.Boolean 1 instance 1 autoClose 544947d0 4002d27 34 ...l+CallOnceManager 0 instance 00000000 autoDisplayUIManager 544947d0 4002d28 38 ...l+CallOnceManager 0 instance 00000000 autoOpenManager 5449bd7c 4002d29 3c ...er.IChannelBinder 0 instance 02fb6c90 binder 5448a088 4002d2a 40 ...ChannelDispatcher 0 instance 00000000 channelDispatcher 5449a428 4002d2b 44 ...her.ClientRuntime 0 instance 0272634c clientRuntime 59a86820 4002d2c 81 System.Boolean 1 instance 1 closeBinder 59a86820 4002d2d 82 System.Boolean 1 instance 0 closeFactory 59a86820 4002d2e 83 System.Boolean 1 instance 0 didInteractiveInitialization 59a86820 4002d2f 84 System.Boolean 1 instance 1 doneReceiving 5448a518 4002d30 48 ...ndpointDispatcher 0 instance 00000000 endpointDispatcher 59a86820 4002d31 85 System.Boolean 1 instance 1 explicitlyOpened 54ee7fc4 4002d32 4c ...em.ServiceModel]] 0 instance 00000000 extensions 54493b7c 4002d33 50 ...iceChannelFactory 0 instance 0272809c factory 59a86820 4002d34 86 System.Boolean 1 instance 1 hasSession 5448e874 4002d35 54 ...essionIdleManager 0 instance 00000000 idleManager 5448c10c 4002d36 58 ...l.InstanceContext 0 instance 00000000 instanceContext 54486004 4002d37 5c ...r.ServiceThrottle 0 instance 00000000 instanceContextServiceThrottle 59a86820 4002d38 87 System.Boolean 1 instance 0 isPending 59a86820 4002d39 88 System.Boolean 1 instance 0 isReplyChannel 54495930 4002d3a 60 ...l.EndpointAddress 0 instance 026a8624 localAddress 5449e428 4002d3b 64 ...ls.MessageVersion 0 instance 02643074 messageVersion 59a86820 4002d3c 89 System.Boolean 1 instance 1 openBinder 59a7b0d0 4002d3d 90 System.TimeSpan 1 instance 02fb6d78 operationTimeout 59a7f7dc 4002d3e 68 System.Object 0 instance 02fb6ea4 proxy 54486004 4002d3f 6c ...r.ServiceThrottle 0 instance 00000000 serviceThrottle 59a7fba0 4002d40 70 System.String 0 instance 00000000 terminatingOperationName 5448c10c 4002d41 74 ...l.InstanceContext 0 instance 00000000 wmiInstanceContext 59a86820 4002d42 8a System.Boolean 1 instance 1 hasChannelStartedAutoClosing 59a86820 4002d43 8b System.Boolean 1 instance 0 hasIncrementedBusyCount 59a86820 4002d44 8c System.Boolean 1 instance 0 hasCleanedUpChannelCollections 54e743c8 4002d45 78 ...em.ServiceModel]] 0 instance 00000000 unknownMessageReceived -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/castle-project-users. For more options, visit https://groups.google.com/d/optout.
