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

  • Home
  • SEARCH
  • 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 6338131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:23:04+00:00 2026-05-24T19:23:04+00:00

This is about how to make the freaking WCF auto-generated client work. Easy to

  • 0

This is about how to make the freaking WCF auto-generated client work. Easy to reproduce, all elements are here, just to be copied and pasted, just a command prompt needed.

In cmd.exe:

: set up environment
"%VS100COMNTOOLS%"\vsvars32.bat
: create test directory
md wsc
cd wsc
set url=http://xsc-demo.xlogics.eu/DEMO/XTraceWCF/XTrace.svc?wsdl
svcutil /language:cs /config:app.config %url%
notepad app.config
: change client/endpoint/@name to "Gurke" (or whatever)
copy ..\Test.cs .
csc /appconfig:app.config XTrace.cs Test.cs

Where Test.cs is:

class Test {
    static void Main() {
        XTraceClient client;
        // client = new XTraceClient();
        client = new XTraceClient( "Gurke" ); // match app.config
        client.Close();
    }
}

Leaves you with the following files:

  1.501 app.config
    193 Test.cs
 31.744 Test.exe
 69.284 XTrace.cs

And the (I think) relevant section from the generated client code:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://xlogics.eu/xtrace", ConfigurationName="IXTrace")]
public interface IXTrace

As you can see, it has ConfigurationName="IXTrace" and public interface IXTrace.

Running Test.exe produces the following exception:

System.InvalidOperationException:
Could not find endpoint element with name 'Gurke'
and contract 'IXTrace'in the ServiceModel client
configuration section. This might be because no
configuration file was found for your application,
or because no endpoint element matching this name
could be found in the client element.

However, my app.config seems to be matching (irrelevant parts left out for readability):

<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="XTrace" ... >
                    <readerQuotas ... />
                    <security mode="None">
                        <transport ... />
                        <message ... />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint
              address="http://xsc-demo.xlogics.eu/DEMO/XTraceWCF/XTrace.svc"
              binding="basicHttpBinding"
              bindingConfiguration="XTrace"
              contract="IXTrace"
              name="Gurke" />
        </client>
    </system.serviceModel>
</configuration>

As you can see, the @contract is IXTrace and the @name is Gurke. So whence the mismatch?

Changing ConfigurationName="IXTrace" to ConfigurationName="Gurke" and recompiling does not solve the issue: same error.

So much for this particular problem. The larger question is to understand how the bits and pieces are supposed to play together so you can stop working in how-to mode and banging your head against the wall of configuration problems (which are not infrequent, if Google is any indicator). Pointers welcome.

Update

In app.config:

<endpoint name="Heinz" contract="moin.moin.IXTrace" ...

In XTrace.cs:

namespace moin.moin {

[System.CodeDom.Compiler.GeneratedCodeAttribute(
   "System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(
   Namespace="http://xlogics.eu/xtrace",
   ConfigurationName="moin.moin.IXTrace")]
public interface IXTrace { ...

And the test program:

using moin.moin;

class Test {
    static void Main() {
        XTraceClient client = new XTraceClient( "Heinz" );
        client.Close();
    }
}

Why does it not work?

Update 2

The solution is in the comments to Sixto’s answer. It didn’t work because the freaking config file had the wrong name and wasn’t consulted. In fact, I didn’t need it for compilation, a simple csc Test.cs XTrace.cs would have been good enough. The config file just has to match the EXE name, so with Test.exe it should have been Test.exe.config.

  • 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-24T19:23:04+00:00Added an answer on May 24, 2026 at 7:23 pm

    Make sure that the contract attribute (in the system.serviceModel/client/endpoint element) contains the fully qualified namespace of the IXTrace interface. Search the XTrace.cs file for a C# namespace declaration. The contract attribute should contain “YourService.IXTrace” if the interface is declared as in the following code:

    namespace YourService
    {
        [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
        [System.ServiceModel.ServiceContractAttribute(
            Namespace="http://xlogics.eu/xtrace",
            ConfigurationName="IXTrace")]
        public interface IXTrace
        {
        //Rest of generated code
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Follow up to this question about GNU make : I've got a directory, flac
i'm wondering about this possibility. Is it possible to make our code written in
When I make a query, I often wonder about this: Is it better to
i'm trying to make the following routes .. and currently i'm going about this
This question is about Why does autoboxing make some calls ambiguous in Java? But
I just noticed this about a week ago. I'm storing data about the current
hopefully this is a basic question about make pattern rules: I want to use
I want to make 3d games for the iphone and with all this doubt
I have read a lot about this! But I can't make a clear idea!
I'm about to make a web app which will have a pretty heavy client

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.