1

I have a VS2010 MVC3 solution calling 2 WCF services. Everything works fine on my first computer. I have another computer where I installed the same OS, same VS, same SQL Server Express, Same IIS, ... I copied source code of my solution on this second computer. Everything works fine when running the solution.

BUT on this second computer:

  • I cannot browse to the service URL !? (1)

  • I cannot do a "Update service reference" !? (2)

(1) When I browse to http://localhost/PLATONServices/RequestService.svc I got a HTTP400 BAD REQUEST error.

(2) I got a THE REQUEST FAILED WITH HTTP STATUS 400: BAD REQUEST METADATE CONTAINS REFERENCE THAT CANNOT BE RESOLVED: 'http://localhost/PLATONServices/RequestService.svc'.

Any idea?

Because code source is the same on both computers and everything is OK on the first computer, the problem is somewhere else. I use IIS6 on both computers but I cannot see any differences.

I searched all day long without success.

Thanks.


UPDATE

Here is the trace of WCF:

<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="2012-05-13T08:33:37.1384484Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{5d80ddb2-6cf8-4e65-bc9b-3f4b7b880605}" />
<Execution ProcessName="w3wp" ProcessID="5280" ThreadID="13" />
<Channel />
<Computer>THINKPAD</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/fr-BE/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>/LM/W3SVC/1/ROOT/PLATONServices-2-129813716146273047</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>
Rajesh
  • 7,766
  • 5
  • 22
  • 35
Bronzato
  • 9,438
  • 29
  • 120
  • 212
  • Are the WCF related components installed on the second machine? These are configured from the "Turn Windows features on or off" dialog, which can be found in "Add/Remove Programs" in Windows. They are under the "Microsoft .Net Framework 3.5.1" section generally. – GCaiazzo May 13 '12 at 06:22
  • I installed exactly the same as my other computer. I also try to install "WCF HTTP Activation" under "Microsoft .Net Framework 3.5.1" in "Turn Windows Features on or off" but without correcting the problem. Thanks anyway. – Bronzato May 13 '12 at 06:39
  • Have you turned on/looked at the service tracing logs? That should tell you what is failing – SCB May 13 '12 at 07:31
  • Yes I have turned on the service trace logs. I update my question to show traces. – Bronzato May 13 '12 at 08:46
  • @Bronzato check this post out http://stackoverflow.com/questions/3934209/wcf-service-returning-400-error-the-body-of-the-message-cannot-be-read-because – SCB May 13 '12 at 23:12
  • Have you checked the app pool under which this WCF Service runs and the associated .NET Framework with it? – Rajesh May 14 '12 at 09:05

1 Answers1

0

Make sure the service is setup within an application as outlined in this post

WCF Service returning 400 error: The body of the message cannot be read because it is empty

Community
  • 1
  • 1
SCB
  • 3,034
  • 2
  • 25
  • 24