0

I get this error trying call my service in WcfTestClient

My config:

 <services>
      <service behaviorConfiguration="MetadataBehavior" name="ServiceModel.Service">
        <endpoint address="soap" binding="basicHttpBinding" name="Soap"
          contract="ServiceModel.IService"  />
        <endpoint address="rest" behaviorConfiguration="jsonBehavior"
          binding="webHttpBinding" bindingConfiguration="webHttpBindingSettings"
          name="Json" contract="ServiceModel.IService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://dev.add.com/Service.svc/" />
          </baseAddresses>
        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MetadataBehavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="jsonBehavior">
          <webHttp automaticFormatSelectionEnabled="true" helpEnabled="true"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>

Why I get this error, it is connected with this property set for json endpoint ?

netmajor
  • 6,507
  • 14
  • 68
  • 100
  • There is not enough info in this question to diagnose your problem. However, this looks very much like the config from another question you asked (http://stackoverflow.com/questions/7675739/the-message-with-action-cannot-be-processed-at-the-receiver-due-to-a-contract). From that question it is clear that you have implementation details polluting your contract and are attempting to manually populate message requests. Please provide details of the calls you are making and provide a stack trace for the exception. – Phil Degenhardt Oct 06 '11 at 21:31

1 Answers1

1

My mistake. I was checking that REST response Message contains AutomatedFormatSelectionContentTypePropertyName property, but in SOAP call it not contains it and fire error.

so I change this

if (OperationContext.Current.OutgoingMessageProperties.ContainsKey("AutomatedFormatSelectionContentTypePropertyName"))
            {

            }

to this

if (OperationContext.Current.OutgoingMessageProperties != null && OperationContext.Current.OutgoingMessageProperties.ContainsKey("AutomatedFormatSelectionContentTypePropertyName"))
            {

            }
netmajor
  • 6,507
  • 14
  • 68
  • 100