tags:

views:

2783

answers:

3

This has happened a couple of times to me know. If I add to many OperationContract's to a ServiceContract, the WCF Test Client app throws an exception:

"Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata."

In the details it continues:

Error: Cannot obtain Metadata from . The request failed with HTTP status 400: Bad Request.

If I remove a couple of operation contracts then everything is fine. Outside of the test client is also fine.

A: 

Could you be more specific about what kinds of operations you have to remove from the service contract to make it work?

Here are some known limitations in the WcfTestClient.exe tool that comes with the .NET Framework 3.5 SDK. Note that all of these issues have been fixed in the version that ships with .NET 3.5 SP1.

  • The client does not maintain a session with the invoked service. All calls are made on new proxy instances
  • The auto-generated configuration file for the client proxy can be viewed but not edited
  • Services using the XML Serializer instead of of the Data Contract Serializer cannot be invoked
  • Services using Message Contracts cannot be invoked
Enrico Campidoglio
A: 

This is what i had to add to my devenv.exe.config in order to get my WCF Test Client to work with a very large service. I then had to restart my IDE. This may not be what you are looking for, but i hope it helps.

<system.serviceModel>
 <bindings>
  <customBinding>
   <binding name="MyBinding">
    <textMessageEncoding>
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
    </textMessageEncoding>
    <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"/>
   </binding>
  </customBinding>
 </bindings>
 <client>
  <endpoint binding="customBinding" bindingConfiguration="MyBinding" contract="IMetadataExchange" name="http"/>
 </client>
</system.serviceModel>
Mike_G
A: 

Thanks for the responses.

These were the offending lines:

<OperationContract(), FaultContract(GetType(WcfService.Common.DefaultFaultContract))> _
Function GetJobSubTypesForJobTypeList(ByVal jobTypeList As Dictionary(Of Integer, String)) As List(Of JobSubTypeOfJobTypeDTO)

<OperationContract(), FaultContract(GetType(WcfService.Common.DefaultFaultContract))> _
Function GetActivityTypesForJobTypeList(ByVal jobTypeList As Dictionary(Of Integer, String)) As List(Of ActivityTypeOfJobTypeDTO)

It turned out that we were missing setters in the return types (DTO) and a default constructor.

Kevin