WCF: Server Not Found - from trace Empty Message when run async but works fine from console app?

Posted by MrTortoise on Stack Overflow See other posts from Stack Overflow or by MrTortoise
Published on 2010-06-07T14:38:55Z Indexed on 2010/06/07 14:42 UTC
Read the original article Hit count: 928

Todays cause of hair loss has been the following scenario:

I have a service that takes 2 strings and returns another. This service uses basicHttpBinding

<basicHttpBinding>
  <binding name="basicHttpNoSec">
    <security mode="None" />
  </binding>
</basicHttpBinding>

Anyway, it works fine from a console test app.

I have a silverlight app sat on top which implements another basicHttpBinding service that simply reuses the contract in the other service and the silverlight App uses this service.

I have a console app that confirms that this service is working and set up with basichttpbinding.

I have all the clientAccessPolicy stuff in place.

when I run the silverlight app the difference is that it runs everything async ... as such the only message i directly get back rom wcf is server not found.

When i enable tracing I dig down to this message - as I know the methods work and the parameteres i pass in will return a valid string i am really puzzled at to what the cause is. any help much appreciated.

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
 <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
  <EventID>131075</EventID>
  <Type>3</Type>
  <SubType Name="Error">0</SubType>
  <Level>2</Level>
  <TimeCreated SystemTime="2010-06-07T14:17:40.6639249Z" />
  <Source Name="System.ServiceModel" />
  <Correlation ActivityID="{8ea9530e-12f4-4a82-9c26-dd2e23264c3c}" />
  <Execution ProcessName="aspnet_wp" ProcessID="4616" ThreadID="6" />
  <Channel />
  <Computer>5JC2Y2J</Computer>
</System>
<ApplicationData>
 <TraceData>
  <DataItem>
   <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
    <TraceIdentifier>http://msdn.microsoft.com/en-GB/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
    <Description>Throwing an exception.</Description>
    <AppDomain>/LM/w3svc/1/ROOT/CopSilverlight.Web-1-129203938565564172</AppDomain>
    <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.ServiceModel.Channels.HttpRequestContext.CreateMessage()
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
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.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>
      <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.ServiceModel.Channels.HttpRequestContext.CreateMessage()
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
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.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>
      </InnerException>
     </Exception>
    </TraceRecord>
   </DataItem>
  </TraceData>
 </ApplicationData>
</E2ETraceEvent>

© Stack Overflow or respective owner

Related posts about wcf

Related posts about Silverlight