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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:13:07+00:00 2026-05-18T12:13:07+00:00

I have a WCF service and when i call it the string is coming

  • 0

I have a WCF service and when i call it the string is coming back null and i cant figure out why!

this is the calling code:

new Thread(() =>
            {
                string returned = _client.Service.GetString();
                this.Dispatcher.BeginInvoke((Action)(() => MessageBox.Show(returned)));
            }).Start();

This is the service implementation:

    [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)]
class MyService: ServiceBase, IMyService
{
    public string GetString()
    {
        return "Returned";
    }

And this is the Interface:

    [ServiceContract]
public interface IMyService: IServiceBase
{
    [OperationContract]
    string GetString();
}

The calling code is just coming back with null but the client is connecting to the service fine, am I missing something?

  • 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-05-18T12:13:08+00:00Added an answer on May 18, 2026 at 12:13 pm

    If you haven’t already you can configure tracing for WCF and get a lot out of the log files. Not knowing exactly what the config looks like or how _client is built I can’t say what is wrong. The code that you have posted here looks like it should work fine.

    <configuration>
       <system.diagnostics>
          <sources>
                <source name="System.ServiceModel" 
                        switchValue="Information, ActivityTracing"
                        propagateActivity="true">
                <listeners>
                   <add name="traceListener" 
                       type="System.Diagnostics.XmlWriterTraceListener" 
                       initializeData= "WcfTraces.svclog" />
                </listeners>
             </source>
          </sources>
       </system.diagnostics>
    </configuration>
    

    Adding this to your app.config or web.config will create a WcfTraces.svclog file in the same directory as the config file with all kinds of data. You should be able to just double click the log file to open it with the Microsoft Service Trace Viewer.

    Configure WCF Tracing

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

Sidebar

Related Questions

Here is the scenario, I have a WCF service call that takes one string
I have a WCF service implemented with a call back contract that I am
I have a WCF service, this is a method which I'd to call: [OperationContract]
I have a WCF service code like this: [ServiceContract] [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode =
I have a WCF service that I need to call in a ASP.NET web
Problem: I have a WCF service setup to be an endpoint for a call
I have a service exposed as WCF via NServiceBus. Ultimately, I'd like to call
I'm new here and I hope anyonte can help me. I have WCF Service
I have a wcf service defined like this: [OperationContract] [WebInvoke(Method = POST, ResponseFormat =
I have a WCF REST Service which accepts a JSON string One of the

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.