zoukankan      html  css  js  c++  java
  • wcf异常汇总

    1.确保客户端可以接收到服务端的异常

    2.部署wcf出错,http错误404.3

    3.无法自动调试 未能调试远程过程。这通常说明未在服务器上启用调试 WCF 托管在IIS上

    4.ChannelFactory.Endpoint 上的地址属性为空。ChannelFactory 的终结点必须指定一个有效的地址。

    5.WCF中的由于目标计算机积极拒绝,无法连接

    Could not connect to net.tcp://localhost/LISA_50_Dev_InternalService/AdminWeb.svc. The connection attempt lasted for a time span of 00:00:02.0251907. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:808. 

    https://stackoverflow.com/questions/3188618/enabling-net-tcp-in-iis7

    You need to add net.tcp to the enabled protocols of your site. Go to IIS Manager, right-click on your website, go to 'Manage Web Site' or 'Manage Application', then to 'Advanced Settings...'. There you see 'Enabled Protocols'. It probably says http. Change it to http,net.tcp.

    6....处带有协定“"IObtainData"”的 ChannelDispatcher 无法打开其 IchannelListener。

    7.在服务 ...实现的协定列表中找不到协定名称 "IMetadataExchange"。将 ServiceMetadataBehavior 添加到配置文件或直接添加到 ServiceHost,以启用对该协定的支持。

    8.此集合已经采用方案 http 的地址。此集合中每个方案中最多只能包含一个地址。如果服务承载于 IIS 中,则可以通过

    9.未能加载文件或程序集“ZBMYunCoreLib.DLL”或它的某一个依赖项。找不到指定的模块。

    10.wcf双工通讯遇到的问题

    11.发送到 net.tcp://192.168.1.18:8732/CallbackService 的请求操作在配置的超时(00:00:59.9879994)内未收到回复。

    分配给此操作的时间可能已经是更长超时的一部分。这可能由于服务仍在处理操作或服务无法发送回复消息。

    12.让iis支持net.tcp

    13. 访问的时候,提示未激活

    13.1多个internalservice,需要移除一个?   但是实际测试,似乎又没有问题了

    The requested service, 'net.tcp://localhost/LISA_50_Dev_InternalService/AdminWeb.svc' could not be activated. See the server's diagnostic trace logs for more information.

    有可能是项目没有编译,重新编译一下解决方案,确保所需要的dll都成功生成了

    13.2 iisrest  这个必须要试一下,非常有效

    13.3如果是真的有问题的话,可以参考Service Trace Viewer Tool (SvcTraceViewer.exe) https://stackoverflow.com/questions/1933956/wcf-tracing-how-i-can-get-the-exact-reason-for-closing-connection

    svc trace viewer也可以配置在wcf的客户端  WCF Tracing can also be used on the Client

    14.通过http添加service reference的时候,出现503错误

    There was an error downloading 'http://localhost:8082/Service/WindowsServiceManager.svc/$metadata'.
    The request failed with HTTP status 503: Service Unavailable.
    Metadata contains a reference that cannot be resolved: 'http://localhost:8082/Service/WindowsServiceManager.svc'.
    The HTTP service located at http://localhost:8082/Service/WindowsServiceManager.svc is unavailable. This could be because the service is too busy or because no endpoint was found listening at the specified address. Please ensure that the address is correct and try accessing the service again later.
    The remote server returned an error: (503) Server Unavailable.
    If the service is defined in the current solution, try building the solution and adding the service reference again.

    需要去application中启用http protocol,在高级设置中

    15.

    [ArgumentException: An item with the same key has already been added.]
    System.Runtime.AsyncResult.End(IAsyncResult result) +594083
    System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +238
    System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +178

    因为没有在配置文件中配置service和bindings

    16.

    The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/Test/AdminWeb.svc' is unavailable for the protocol of the address.

    发现是忘记编译wcf项目了,因为是clone的一个新的repository

    有时候iisreset也可以解决这个问题

    https://stackoverflow.com/questions/7393210/wcf-the-message-could-not-be-dispatched-because-the-service-at-the-endpoint-ad

    可以考虑安装.net 4.8里面的wcf

    17.https://stackoverflow.com/questions/1793119/could-not-find-a-base-address-that-matches-scheme-net-tcp

    Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

     Step 2: IIS > WCF Host Web Site > Manage Application > advanced Settings > Enabled Protocols > Set the value to HTTP,NET.TCP

    [WCF Errors] : Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding

    However the solution for this error is pretty simple, so don worry, basically all you have to do is that you probably forgot to install or activate the feature that enables you to host your WCF Services on IIS.

    Regarding the steps to install or activate the feature for enable you to host WCF, you can follow the below article:
    How to: Install and Configure WCF Activation Components

    To install the WCF non-HTTP activation components

    1. Click the Start button, and then click Control Panel.

    2. Click Programs, and then click Programs and Features.

    3. On the Tasks menu, click Turn Windows features on or off.

    4. Find the WinFX node, select and then expand it.

    5. Select the WCF Non-Http Activation Components box and save the setting.

    找不到具有绑定 NetTcpBinding 的终结点的与方案 net.tcp 匹配的基址。注册的基址方案是 [http]

    也可能是新建的iis web application的高级设置里面,Enabled protocols没有配置net.tcp

    18.

    An existing connection was forcibly closed by the remote host

    System.ServiceModel.Channels.SocketConnection.HandleReceiveAsyncCompleted()
    System.ServiceModel.Channels.SocketConnection.BeginReadCore(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.SocketConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.PreReadConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.DelegatingConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.DelegatingConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.TracingConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)
    System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()
    System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
    System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
    System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
    System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10675199.02:48:05.4775807'.

    System.ServiceModel.Channels.SocketConnection.ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException, TransferOperation transferOperation, Boolean aborted, String timeoutErrorString, TransferOperation timeoutErrorTransferOperation, SocketConnection socketConnection, TimeSpan remainingTime)
    System.ServiceModel.Channels.SocketConnection.ConvertReceiveException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout)
    System.ServiceModel.Channels.SocketConnection.BeginReadCore(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.SocketConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.PreReadConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.DelegatingConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.DelegatingConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.TracingConnection.BeginRead(Int32 offset, Int32 size, TimeSpan timeout, WaitCallback callback, Object state)
    System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)
    System.ServiceModel.Channels.TracingConnection.TracingConnectionState.ExecuteCallback()
    System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
    System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
    System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
    System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    The communication object, System.ServiceModel.Channels.ServerSessionPreambleConnectionReader+ServerFramingDuplexSessionChannel, cannot be used for communication because it is in the Faulted state.

    System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)
    System.ServiceModel.Dispatcher.ErrorHandlingReceiver.Close()
    System.ServiceModel.Dispatcher.ChannelHandler.HandleReceiveComplete(RequestContext context)
    System.ServiceModel.Dispatcher.ChannelHandler.EndTryReceive(IAsyncResult result, RequestContext& requestContext)
    System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)
    System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result)
    System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
    System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
    System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)
    System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
    System.Runtime.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.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
    System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
    System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
    System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

    https://stackoverflow.com/questions/3441844/the-socket-connection-was-aborted-communicationexception

    This error can be caused by a number of things. While it was a timing issue in this case, it usually has nothing to do with timings, especially if the error is received immediately. Possible reasons are:

    • The objects used as parameters or return types in your contract don't have parameterless constructors and are not decorated with the DataContract attribute. Check the classes used as parameters or return types, but also all the types used by the public properties of those classes. If you implement a constructor with parameters for one of those classes, the compiler will not add the default parameterless constructor for you anymore, so you will need to add that yourself.
    • The default limits defined in service configuration are too low (MaxItemsInObjectGraph, MaxReceivedMessageSize, MaxBufferPoolSize, MaxBufferSize, MaxArrayLength).
    • Some public properties of your DataContract objects are read-only. Make sure all public properties have both getters and setters.

    https://www.codeproject.com/Questions/633699/Socket-Exception-WCF

    1. Added these behaviors at both service and client config.

    <behaviors>
    <endpointBehaviors>
      <behavior name="endpointBehavior">
        <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      </behavior>
    </endpointBehaviors>
    </behaviors>

    2. Update these values to maximum size in both Client and Server config.

    <binding name="tcpBinding" receiveTimeout="00:15:00" sendTimeout="00:15:00"  maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
              <security mode="None">
                <transport clientCredentialType="None" protectionLevel="None" />
                <message clientCredentialType="None" />
              </security>
            </binding>

    a. maxReceivedMessageSize
    b. maxBufferSize
    c. maxBufferPoolSize

    https://stackoverflow.com/questions/2582036/an-existing-connection-was-forcibly-closed-by-the-remote-host

    This generally means that the remote side closed the connection (usually by sending a TCP/IP RST packet). If you're working with a third-party application, the likely causes are:

    • You are sending malformed data to the application
    • The network link between the client and server is going down for some reason
    • You have triggered a bug in the third-party application that caused it to crash
    • The third-party application has exhausted system resources

    It's likely that the first case is what's happening.

    You can fire up Wireshark to see exactly what is happening on the wire to narrow down the problem.

    Without more specific information, it's unlikely that anyone here can really help you much.

    Using TLS 1.2 solved this error.
    You can force your application using TLS 1.2 with this (make sure to execute it before calling your service):

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

    19. net.tcp的808端口没有监听

    1.windows service没有启动

    2. wcf出现内部异常,导致application pool崩溃

     20.

  • 相关阅读:
    iOS开发之使用 infer静态代码扫描工具
    iOS 组件化开发之使用CocoaPod制作自己的远程私有库
    WKWebView 使用的坑
    iOS 自动化打包发布(Fastlane+ Jenkins+蒲公英)
    Flutter 开发入门实践
    【读书笔记】--《编写高质量iOS与OS X代码的52个有效方法》
    iOS 10.3+ 动态修改 App 图标
    ubuntu16.04 安装 caffe cuda 相关流程
    ubuntu 休眠后窗口边缘出现花边的解决方案
    c++实现二叉树的非递归创建以及非递归先序、中序、后序遍历
  • 原文地址:https://www.cnblogs.com/chucklu/p/4785282.html
Copyright © 2011-2022 走看看