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 8176601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:15:15+00:00 2026-06-06T23:15:15+00:00

I have a WCF Service like this: [ServiceContract] public class SomeService { [WebInvoke(UriTemplate =

  • 0

I have a WCF Service like this:

[ServiceContract]
public class SomeService
{
    [WebInvoke(UriTemplate = "/test", Method = "POST")]
    public string Test()
    {
        using (var reader = OperationContext.Current.RequestContext.RequestMessage.GetReaderAtBodyContents())
        {
            var content = reader.ReadOuterXml().Replace("<Binary>", "").Replace("</Binary>", "");
            return content;
        }
    }
}

And has a config file like this:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="Project.SomeService">
        <endpoint address="" binding="webHttpBinding" contract="Project.SomeService"
                  bindingConfiguration="webHttpBinding_SomeService" behaviorConfiguration="endpointBehavior_SomeService" />
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="webHttpBinding_SomeService">
          <security mode="None"></security>
        </binding>
      </webHttpBinding>
    </bindings>
    <behaviors>
      <endpointBehaviors>
        <behavior name="endpointBehavior_SomeService">
          <webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

But when I call it using fiddler with this url with POST method:

http://localhost:1111/SomeService.svc/Test

with the body:

asdasd

it returns YXNkYXNk instead, why was it like this?

My Code is in C#, framework 4, build in VS2010Pro.

Please help. Thanks in advance.

  • 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-06T23:15:20+00:00Added an answer on June 6, 2026 at 11:15 pm

    Something is base64-encoding either the result or the request. The ASCII bytes for asdasd come out as YXNkYXNk when base64-encoded.

    It’s not clear how you’re providing the body, but I suggest you look at the exact request/response using WireShark or Fiddler to work out where the base64-encoding is happening, then work out why, then fix it.

    EDIT: Now I’ve had a closer look at your code, it seems reasonably clear.

    Your request is meant to include binary data, presumably – which is why you’ve got a Binary tag within the XML. You’re deciding to ignore that, and just treat the XML representation of the binary data as text – but you shouldn’t. Binary data is represented in XML via base64. So, you should:

    • Parse the XML as XML rather than getting the outer XML as a string and then performing string operations
    • Fetch the contents of the Binary tag as a string
    • Use Convert.FromBase64String to get the original binary data
    • If you believe that binary data was originally text, use Encoding.GetString to convert it back
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wcf service defined like this: [OperationContract] [WebInvoke(Method = POST, ResponseFormat =
I have a web service that looks something like this: [ServiceContract] public class MyService
Hello I have a simple wcf service like this, with a test method which
My WCF Service in C# looks like this. [ServiceContract] public class MySecretService { [OperationContract]
I have something like this: MathServiceLibrary (WCF Service Library) [ServiceContract] public interface IMathService {
I have a WCF service code like this: [ServiceContract] [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode =
I have a WCF service which has one method returning a stream. [ServiceContract] public
Say I have WCF service contract like this [ServiceContract(CallbackContract = typeof(ICallback1), SessionMode = SessionMode.Required)]
I have a very simples Hello World WCF Service, that looks like this: namespace
Ok so I have two objects that look like this in my WCF service.

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.