none
InnerException: error 415 Unsupported Media Type. RRS feed

  • Question

  • OS: win7 32bit

    tool:Visual studio 2010

    solution: wpf+wcf

    when I debug my software, I get this Exception 

    Exception:Content Type application/soap+xml; charset=utf-8 was not supported by service url  The client and service bindings may be mismatched.
    Inner Exception:The remote server returned an error: (415) Unsupported Media Type.

    StackTrace: at System.Net.HttpWebRequest.GetResponse()\r\n   
                      at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.
    WaitForReply(TimeSpan timeout)

    my wcf architecture: create svc file which reference the Message Contract

    and its configure file :

      

    <system.serviceModel> <services> <service name="SMSUS.WebService.SVC.Service1" behaviorConfiguration="metadataBehavior"> <endpoint address="" binding="wsHttpBinding" contract="SMSUS.WebService.Contracts.IMessageService"> <identity> <dns value="localhost" /> </identity> </endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name="metadataBehavior"> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> my wpf app.config:

         <system.serviceModel>
        <client>
          <endpoint address="http://localhost:51952/MessageService.svc"
                    binding="wsHttpBinding"
                    contract="SMSUS.WebService.Contracts.IMessageService"></endpoint>
        </client>
      </system.serviceModel>

    Please help me, thank you.
    Wednesday, May 31, 2017 7:40 AM

Answers

  • I solve the problem, just change the wsHttpBinding to the basicWsHttpBinding.

    the svc run very well on my machine

    Thursday, June 1, 2017 8:32 AM

All replies

  • Could you share us a simple demo which could reproduce your issue?

    Per to this error, it is usually caused by different bindings in client and service side which means WSHttpBinding uses SOAP 1.2, BasicHttpBinding uses SOAP 1.1.

    According your configuration and I made a test with the same configuration, it works correctly at my side. Both client and server use the wsHttpBinding.

    How did you implement client? I assume the only difference is client code.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, June 1, 2017 2:58 AM
  • I solve the problem, just change the wsHttpBinding to the basicWsHttpBinding.

    the svc run very well on my machine

    Thursday, June 1, 2017 8:32 AM