2010-02-16 78 views
4

我正在嘗試爲現有的WCF服務啓用額外的net.tcp端點(它使用用戶名認證)。該服務託管在IIS7中。WCF Net.TCP服務引發模糊錯誤

針對服務執行客戶端會返回套接字連接中止的錯誤。啓用跟蹤對服務發現以下異常被拋出:

System.ArgumentOutOfRangeException
這個參數的值必須爲正。
參數名:maxAccepts
實際值是0

我很困惑,因爲最好的,我可以告訴端口共享應由配置被禁用(見下文),但它仍然通過端口共享調用代碼(再次,盡我所知)。無論如何,我找不到任何方法來指定此maxAccepts值; Google不知道任何關於它的信息,並且maxPendingAccepts值似乎沒有做到。我該如何解決錯誤?

服務的配置文件中包含的net.tcp終結點以下:

<bindings> 
    <customBinding> 
    <binding name="netTcp"> 
     <security authenticationMode="UserNameOverTransport" /> 
     <windowsStreamSecurity /> 
     <tcpTransport portSharingEnabled="false" listenBacklog="10" maxPendingAccepts="10" maxPendingConnections="10" /> 
    </binding> 
    </customBinding> 
</bindings> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="netTcp"> 
     <serviceDebug includeExceptionDetailInFaults="false" /> 
     <serviceMetadata/> 
     <serviceCredentials> 
     <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Asi.Soa.ServiceModelEx.NullUserNamePasswordValidator, Asi.Soa.ServiceModelEx" /> 
     <clientCertificate> 
      <authentication certificateValidationMode="None"/> 
     </clientCertificate> 
     </serviceCredentials> 
     <serviceAuthorization principalPermissionMode="Custom"> 
     <authorizationPolicies> 
      <add policyType="Asi.Soa.ServiceModelEx.ClaimsAuthorizationPolicy, Asi.Soa.ServiceModelEx" /> 
     </authorizationPolicies> 
     </serviceAuthorization> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 

完整的異常堆棧跟蹤是:

System.ServiceModel.Channels.ConnectionAcceptor..ctor(IConnectionListener listener, Int32 maxAccepts, Int32 maxPendingConnections, ConnectionAvailableCallback callback, ErrorCallback errorCallback) 
System.ServiceModel.Channels.ConnectionDemuxer..ctor(IConnectionListener listener, Int32 maxAccepts, Int32 maxPendingConnections, TimeSpan channelInitializationTimeout, TimeSpan idleTimeout, Int32 maxPooledConnections, TransportSettingsCallback transportSettingsCallback, SingletonPreambleDemuxCallback singletonPreambleCallback, ServerSessionPreambleDemuxCallback serverSessionPreambleCallback, ErrorCallback errorCallback) 
System.ServiceModel.Channels.SharedTcpTransportManager.CreateConnectionDemuxer() 
System.ServiceModel.Channels.SharedTcpTransportManager.OnDuplicatedVia(Uri via, Int32&amp; connectionBufferSize) 
System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.HandleOnVia(DuplicateContext duplicateContext) 
System.ServiceModel.Channels.SharedConnectionListener.SharedListenerProxy.System.ServiceModel.Activation.IConnectionDuplicator.BeginDuplicate(DuplicateContext duplicateContext, AsyncCallback callback, Object state) 
AsyncInvokeBeginBeginDuplicate(Object , Object[] , AsyncCallback , Object) 
System.ServiceModel.Dispatcher.AsyncMethodInvoker.InvokeBegin(Object instance, Object[] inputs, AsyncCallback callback, Object state) 
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc) 
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc) 
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc) 
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc&amp; rpc) 
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc) 
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc&amp; rpc) 
System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) 
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.Dispatch(MessageRpc&amp; rpc, Boolean isOperationContextSet) 
System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext) 
System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext) 
System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result) 
System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result) 
System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) 
System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously) 
System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result) 
System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result) 
System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously) 
System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state) 
System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state) 
System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback() 
System.ServiceModel.Channels.TracingConnection.WaitCallback(Object state) 
System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes) 
System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32 error, UInt32 numBytes, NativeOverlapped* nativeOverlapped) 
System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped) 
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP) 

編輯:我已經安裝了非HTTP WCF激活組件,運行ServiceModelReg.exe,將net.tcp和net.pipe添加到IIS管理器中已啓用的協議列表等。沒有喜悅。

我也寫一個快速的Windows服務來託管服務(不是我們理想的長期解決方案),以及網絡TCP連接的工作原理有細,所以不會出現任何東西在我的配置或代碼,這意味着有些東西在IIS中不正確。應用程序的應用程序池是否必須在集成模式下運行?我嘗試了兩種方式,它似乎沒有什麼區別,但我們的應用程序目前安裝在經典模式。

回答

2

,盡我所能決定,這個問題很簡單,.NET不喜歡在同一個IIS應用程序託管兩種服務時,一個是Soap11端點,一個是NetTcp終點。刪除Soap11端點允許NetTcp端點無誤地工作。

我們移動到我們使用的是Windows服務來託管NetTcp端點的模型,並在IIS離開Soap11端點。

如果有人數字如何同時託管在IIS同一應用程序NetTcp和Soap11服務,我很樂意聽到它。

+0

對於同一個IIS主機中的SOAP端點和net.pipe端點似乎也有問題。 – Polyfun 2014-05-27 14:45:42