Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8445343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:38:03+00:00 2026-06-10T09:38:03+00:00

I am working on a WCF webservice. I need to create a Post service

  • 0

I am working on a WCF webservice.
I need to create a Post service that returns a Json stringhe service is declared as follows:

[WebInvoke(UriTemplate = "GetMatAnalysis",  ResponseFormat = WebMessageFormat.Json, 
                                                RequestFormat = WebMessageFormat.Json, 
                                                BodyStyle = WebMessageBodyStyle.WrappedRequest, 
                                                Method = "POST")]
string GetMatAnalysis(Stream image);

in this message I am serializing object with using JavaScriptSerializer().Serialize()
and then return it.

however when I get the responce there is a extra Double-Quote at the start and at the end of the string. For example I am getting: "{"results" : 10 }" instead of {"results" : 10 }

I tried to change the return type to System.ServiceModel.Channels.Message I get this error:

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior contract: http://tempuri.org/:IMyWebServices ----> System.InvalidOperationException: The operation 'GetMatAnalysis' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.

How can I make it return a json string without the double quotes?

Additional information:

When I use GET request like this:

[OperationContract(Name = "Messages")]
[WebGet(UriTemplate = "Messages/GetMessage", ResponseFormat = WebMessageFormat.Json)]
Message GetAdvertisment();

The return type is message and it works correctly. The Json string received is correct.

Any help is greatly appreciated.
Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:38:05+00:00Added an answer on June 10, 2026 at 9:38 am

    Since ResponseFormat = WebMessageFormat.Json, WCF service serializes your returned object as Json. You also use JavaScriptSerializer().Serialize() and you get double serialization.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im working on a Web-Application (MyWebApp). I have a Service-Reference to a WCF-Webservice. The
I'm working on a WCF service that requires Membership and Profile access. I got
We need to implement a WCF service on a machine that can only run
I'm trying to make a WCF service that will work with JSON-P (long-story short,
I'm currently working on a wcf service that does some lookups in a database
I am looking to create a WCF (possibly WebApi) web service that sits on
I have a working WCF service. I want to deploy it on Windows Azure.
I have a very strange problem. I have a working WCF service. [ServiceContract] public
I am working with WCF .NET 3.5 SP1 and have read that one does
I have a working .Net WCF HTTP service. If I put the URL into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.