协议异常Wcf

协议异常Wcf,wcf,web-services,Wcf,Web Services,我想知道您是否可以帮助解决wcf的问题,这是我的web.config <?xml version="1.0" encoding="utf-8"?> <configuration> <!--Diagnostics section, we will only catch error and warning in production--> <system.diagnostics> <trace autoflush="true"

我想知道您是否可以帮助解决wcf的问题,这是我的web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <!--Diagnostics section, we will only catch error and warning in production-->

  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source propagateActivity="true" name="System.ServiceModel" switchValue="Error, Warning">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="ITLocal.OlapWcfServiceBrowser2005">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging" switchValue="Error, Warning">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="ITLocal.OlapWcfServiceBrowser2005">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <!--This is our path in the production server: D:\Sitios\ITLocal.OlapWcfServiceBrowser2005\Log\-->
      <add initializeData="C:\Users\tmxidsggutie\Desktop\ITLocal.OlapWcfServiceBrowser2005_web_tracelog.svclog" 
              type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
              name="ServiceModelTraceListener" 
              traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, Callstack">
        <filter type="" />
      </add>
      <add initializeData="C:\Users\tmxidsggutie\Desktop\ITLocal.OlapWcfServiceBrowser2005_web_messages.svclog" 
              type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
              name="ServiceModelMessageLoggingListener" 
              traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, Callstack">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="2147483646" />
  </system.web>

  <!--For all the services we will aply the following service and endpoint behaviors-->

  <system.serviceModel>
    <diagnostics>
      <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
      <endToEndTracing activityTracing="false" />
    </diagnostics>
    <behaviors>

      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483646" />
          <serviceTimeouts transactionTimeout="02:00:00" />
          <serviceDiscovery></serviceDiscovery>
        </behavior>
      </serviceBehaviors>

      <endpointBehaviors>
        <behavior>
          <endpointDiscovery enabled="true"></endpointDiscovery>
          <dataContractSerializer maxItemsInObjectGraph="2147483646" />          
        </behavior>
      </endpointBehaviors>

    </behaviors>


    <!--All the FEMSA's clients are .net, so we will use the proprietary binary message encoding to reduce the message's size -->

    <bindings>
      <customBinding>
        <binding name="wsHttpBindingBynaryEncoding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="01:00:00" sendTimeout="01:00:00">
          <binaryMessageEncoding>
            <readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="2147483646" maxBytesPerRead="4096" maxNameTableCharCount="5242880" />
          </binaryMessageEncoding>
          <httpTransport allowCookies="false" transferMode="Buffered" maxBufferPoolSize="2147483646" maxReceivedMessageSize="2147483646">
          </httpTransport>
        </binding>
      </customBinding>
    </bindings>

    <!-- In case you want to scale this service -->

    <standardEndpoints>
      <udpDiscoveryEndpoint>
        <standardEndpoint name="adhocDiscoveryEndpointConfiguration" discoveryMode="Adhoc" discoveryVersion="WSDiscovery11" maxResponseDelay="00:00:10">
        </standardEndpoint>
      </udpDiscoveryEndpoint>


      <announcementEndpoint>
        <standardEndpoint name="UdpAnnouncementEndpoint" discoveryVersion="WSDiscovery11" />
      </announcementEndpoint>

    </standardEndpoints>

    <services>
      <service name="ITLocal.Analysis2005.Analysis2005">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8081/Analysis2005Browser.svc/"/>
          </baseAddresses>
        </host>
        <endpoint name="Rules" address="Rules" binding="customBinding" bindingConfiguration="wsHttpBindingBynaryEncoding" contract="ITLocal.Contracts.Olap.ISSASRulesContract"></endpoint>        
        <endpoint name="udpDiscovery" kind="udpDiscoveryEndpoint" endpointConfiguration="adhocDiscoveryEndpointConfiguration" />
        <endpoint name="Mex" address="Mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

  </system.serviceModel>

  <system.webServer>
    <directoryBrowse enabled="true"/>
    <handlers>
      <remove name="svc-Integrated"/>
    </handlers>
  </system.webServer>

</configuration>

正如您所看到的,我正在跟踪我的服务,tracelog和messagelog,我面临的问题是,我得到了协议异常,但只有在我的客户机中添加服务引用时,所以如果我添加URI[http://localhost:8081/Analysis2005Browser.svc/mex]我在我的tracelog中看到:

<Exception>
<ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There is a problem with the XML that was received from the network. See inner exception for more details.</Message>
<StackTrace>
at System.Runtime.Diagnostics.EtwDiagnosticTrace.WriteExceptionToTraceString(XmlTextWriter xml, Exception exception, Int32 remainingLength, Int32 remainingAllowedRecursionDepth)
at System.Runtime.Diagnostics.EtwDiagnosticTrace.ExceptionToTraceString(Exception exception, Int32 maxTraceStringLength)
at System.Runtime.Diagnostics.EtwDiagnosticTrace.GetSerializedPayload(Object source, TraceRecord traceRecord, Exception exception, Boolean getServiceReference)
at System.Runtime.TraceCore.ThrowingException(EtwDiagnosticTrace trace, String param0, String param1, Exception exception)
at System.Runtime.ExceptionTrace.TraceException[TException](TException exception, String eventSource)
at System.Runtime.ExceptionTrace.AsError(Exception exception)
at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.CompleteParseAndEnqueue(IAsyncResult result)
at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.HandleParseIncomingMessage(IAsyncResult result)
at System.Runtime.AsyncResult.SyncContinue(IAsyncResult result)
at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult..ctor(ReplyChannelAcceptor acceptor, Action dequeuedCallback, HttpPipeline pipeline, AsyncCallback callback, Object state)
at System.ServiceModel.Channels.HttpPipeline.EmptyHttpPipeline.BeginProcessInboundRequest(ReplyChannelAcceptor replyChannelAcceptor, Action dequeuedCallback, AsyncCallback callback, Object state)
at System.ServiceModel.Channels.HttpChannelListener`1.HttpContextReceivedAsyncResult`1.ProcessHttpContextAsync()
at System.ServiceModel.Channels.HttpChannelListener`1.BeginHttpContextReceived(HttpRequestContext context, Action acceptorCallback, AsyncCallback callback, Object state)
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
at System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)
at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace>
<ExceptionString>System.ServiceModel.ProtocolException: There is a problem with the XML that was received from the network. See inner exception for more details. ---&gt; System.Xml.XmlException: The body of the message cannot be read because it is empty.
   --- End of inner exception stack trace ---</ExceptionString>
<InnerException>
<Exception>
<ExceptionType>System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The body of the message cannot be read because it is empty.</Message>
<StackTrace>
at System.Runtime.Diagnostics.EtwDiagnosticTrace.WriteExceptionToTraceString(XmlTextWriter xml, Exception exception, Int32 remainingLength, Int32 remainingAllowedRecursionDepth)
at System.Runtime.Diagnostics.EtwDiagnosticTrace.GetInnerException(Exception exception, Int32 remainingLength, Int32 remainingAllowedRecursionDepth)
at System.Runtime.Diagnostics.EtwDiagnosticTrace.WriteExceptionToTraceString(XmlTextWriter xml, Exception exception, Int32 remainingLength, Int32 remainingAllowedRecursionDepth)
at System.Runtime.Diagnostics.EtwDiagnosticTrace.ExceptionToTraceString(Exception exception, Int32 maxTraceStringLength)
at System.Runtime.Diagnostics.EtwDiagnosticTrace.GetSerializedPayload(Object source, TraceRecord traceRecord, Exception exception, Boolean getServiceReference)
at System.Runtime.TraceCore.ThrowingException(EtwDiagnosticTrace trace, String param0, String param1, Exception exception)
at System.Runtime.ExceptionTrace.TraceException[TException](TException exception, String eventSource)
at System.Runtime.ExceptionTrace.AsError(Exception exception)
at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.CompleteParseAndEnqueue(IAsyncResult result)
at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.HandleParseIncomingMessage(IAsyncResult result)
at System.Runtime.AsyncResult.SyncContinue(IAsyncResult result)
at System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult..ctor(ReplyChannelAcceptor acceptor, Action dequeuedCallback, HttpPipeline pipeline, AsyncCallback callback, Object state)
at System.ServiceModel.Channels.HttpPipeline.EmptyHttpPipeline.BeginProcessInboundRequest(ReplyChannelAcceptor replyChannelAcceptor, Action dequeuedCallback, AsyncCallback callback, Object state)
at System.ServiceModel.Channels.HttpChannelListener`1.HttpContextReceivedAsyncResult`1.ProcessHttpContextAsync()
at System.ServiceModel.Channels.HttpChannelListener`1.BeginHttpContextReceived(HttpRequestContext context, Action acceptorCallback, AsyncCallback callback, Object state)
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
at System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)
at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace>
<ExceptionString>System.Xml.XmlException: The body of the message cannot be read because it is empty.</ExceptionString>
</Exception>
</InnerException>
</Exception>

System.ServiceModel.ProtocolException,System.ServiceModel,版本=4.0.0.0,区域性=中性,PublicKeyToken=b77a5c561934e089
从网络接收的XML有问题。有关详细信息,请参阅内部异常。
在System.Runtime.Diagnostics.EtwDiagnosticTrace.WriteExceptionToTraceString(XmlTextWriter xml,异常异常,Int32 remainingAllowedRecursionDepth,Int32 remainingAllowedRecursionDepth)
在System.Runtime.Diagnostics.EtwDiagnosticTrace.ExceptionToTraceString(异常异常,Int32 maxTraceStringLength)
在System.Runtime.Diagnostics.EtwDiagnosticTrace.GetSerializedPayload(对象源、跟踪器记录跟踪器记录、异常、布尔getServiceReference)
at System.Runtime.TraceCore.ThrowingException(EtwDiagnosticTrace跟踪,字符串param0,字符串param1,异常)
在System.Runtime.ExceptionTrace.TraceeException[TException](TException异常,字符串eventSource)
在System.Runtime.ExceptionTrace.AsError时(异常)
位于System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.CompleteParseAndEnqueue(IAsyncResult结果)
位于System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.HandleParseIncomingMessage(IAsyncResult结果)
在System.Runtime.AsyncResult.SyncContinue(IAsyncResult结果)时
位于System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult..ctor(ReplyChannelAcceptor acceptor,Action dequeuedCallback,HttpPipeline管道,AsyncCallback回调,对象状态)
位于System.ServiceModel.Channels.HttpPipeline.EmptyHttpPipeline.BeginProcessInboundRequest(ReplyChannelAcceptor ReplyChannelAcceptor,Action dequeuedCallback,AsyncCallback回调,对象状态)
位于System.ServiceModel.Channels.HttpChannelListener`1.HttpContextReceivedAsyncResult`1.ProcessHttpContextAsync()
位于System.ServiceModel.Channels.HttpChannelListener`1.BeginHttpContextReceived(HttpRequestContext上下文、操作acceptorCallback、AsyncCallback回调、对象状态)
位于System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult结果)
在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandlerRequest()中
在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()中
位于System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(对象状态)
位于System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback回调,对象状态)
位于System.ServiceModel.Activation.HostedHttPrequestStatAsyncResult.OnBeginRequestWithFlow(对象状态)
在System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32错误代码,UInt32个字节,NativeOverlapped*NativeOverlapped)
在System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32错误,UInt32字节读取,NativeOverlapped*NativeOverlapped)
在System.Threading.\u IOCompletionCallback.PerformiCompletionCallback(UInt32错误代码,UInt32个字节,本机重叠*pOVERLAP)
System.ServiceModel.ProtocolException:从网络接收的XML存在问题。有关详细信息,请参阅内部异常。--System.Xml.XmlException:无法读取消息体,因为它是空的。
---内部异常堆栈跟踪的结束---
System.Xml.XmlException,System.Xml,版本=4.0.0.0,区域性=neutral,PublicKeyToken=b77a5c561934e089
无法读取邮件正文,因为它是空的。
在System.Runtime.Diagnostics.EtwDiagnosticTrace.WriteExceptionToTraceString(XmlTextWriter xml,异常异常,Int32 remainingAllowedRecursionDepth,Int32 remainingAllowedRecursionDepth)
在System.Runtime.Diagnostics.EtwDiagnosticTrace.GetInnerException(异常异常、Int32 remainingLength、Int32 remainingAllowedRecursionDepth)
在System.Runtime.Diagnostics.EtwDiagnosticTrace.WriteExceptionToTraceString(XmlTextWriter xml,异常异常,Int32 remainingAllowedRecursionDepth,Int32 remainingAllowedRecursionDepth)
在System.Runtime.Diagnostics.EtwDiagnosticTrace.ExceptionToTraceString(异常异常,Int32 maxTraceStringLength)
在System.Runtime.Diagnostics.EtwDiagnosticTrace.GetSerializedPayload(对象源、跟踪器记录跟踪器记录、异常、布尔getServiceReference)
at System.Runtime.TraceCore.ThrowingException(EtwDiagnosticTrace跟踪,字符串param0,字符串param1,异常)
在System.Runtime.ExceptionTrace.TraceeException[TException](TException异常,字符串eventSource)
在System.Runtime.ExceptionTrace.AsError时(异常)
位于System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.CompleteParseAndEnqueue(IAsyncResult结果)
位于System.ServiceModel.Channels.HttpPipeline.EnqueueMessageAsyncResult.HandleParseIncomingMessage(IAsyncResult结果)
在System.Runtime.AsyncResult.SyncCont
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"><System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"><EventID>262155</EventID><Type>3</Type><SubType Name="Error">0</SubType><Level>2</Level><TimeCreated SystemTime="2013-05-04T22:09:47.8030567Z" /><Source Name="System.ServiceModel" /><Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" /><Execution ProcessName="w3wp" ProcessID="3596" ThreadID="26" /><Channel /><Computer>FEMXDMSCONTR1A</Computer></System><ApplicationData><TraceData><DataItem><TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"><TraceIdentifier>http://msdn.microsoft.com/es-MX/library/System.ServiceModel.Channels.HttpChannelMessageReceiveFailed.aspx</TraceIdentifier><Description>Failed to lookup a channel to receive an incoming message. Either the endpoint or the SOAP action was not found.</Description><AppDomain>/LM/W3SVC/6/ROOT-1-130121789629535720</AppDomain><Source>System.ServiceModel.Activation.HostedHttpTransportManager/43776817</Source><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/StringTraceRecord"><IsRecycling>False</IsRecycling></ExtendedData></TraceRecord></DataItem></TraceData><System.Diagnostics xmlns="http://schemas.microsoft.com/2004/08/System.Diagnostics"><LogicalOperationStack></LogicalOperationStack><Timestamp>7122556802571</Timestamp><Callstack>   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at System.Diagnostics.TraceEventCache.get_Callstack()
   at System.Diagnostics.XmlWriterTraceListener.WriteFooter(TraceEventCache eventCache)
   at System.Diagnostics.XmlWriterTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
   at System.Diagnostics.TraceSource.TraceData(TraceEventType eventType, Int32 id, Object data)
   at System.ServiceModel.Diagnostics.LegacyDiagnosticTrace.TraceEvent(TraceEventType type, Int32 code, String msdnTraceCode, String description, TraceRecord trace, Exception exception, Object source)
   at System.ServiceModel.Diagnostics.TraceUtility.TraceEvent(TraceEventType severity, Int32 traceCode, String traceDescription, TraceRecord extendedData, Object source, Exception exception)
   at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
   at System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)
   at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)</Callstack></System.Diagnostics></ApplicationData></E2ETraceEvent>
<MessageLogTraceRecord>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<a:Action s:mustUnderstand="1" xmlns:a="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</a:Action>
<a:MessageID xmlns:a="http://www.w3.org/2005/08/addressing">urn:uuid:b60bf2b8-f798-471f-a9da-295168061277</a:MessageID>
<a:ReplyTo xmlns:a="http://www.w3.org/2005/08/addressing">
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1" xmlns:a="http://www.w3.org/2005/08/addressing">http://localhost:8081/Analysis2005Browser.svc/mex/mex</a:To>
</s:Header>
</s:Envelope>
</MessageLogTraceRecord>