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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:39:36+00:00 2026-05-15T01:39:36+00:00

Every time my program runs vs adds the default configuration to my app.config file.

  • 0

Every time my program runs vs adds the default configuration to my app.config file. At that run it works fine, but at the next run it actually tries to read the config.

The problem is that the default configuration has errors, it adds the attribute “Address”, but attritbutes are not allowed to have capitals so it throws an exception.

This means I have to remove the bad section every run!

I’ve tried to configure the .config but it gives errors.

Here is the code that I use to host the server:

private static System.Threading.AutoResetEvent stopFlag = new System.Threading.AutoResetEvent(false);
ServiceHost host = new ServiceHost(typeof(Service), new Uri("http://localhost:8000"));
host.AddServiceEndpoint(typeof(IService), new BasicHttpBinding(), "ChessServer");
host.Open();
stopFlag.WaitOne();
host.Close();

Here is the client code that calls the server:

ChannelFactory<IChessServer> scf;
scf = new ChannelFactory<IService>
              (new BasicHttpBinding(), "http://localhost:8000");
IService service = scf.CreateChannel();

Thanks for any help.

Edit: Sorry it took me so long, I’ve been trying to use DualWSHttpBinding instead (since I actually need the server to call client methods to anyway) but still generates the config file. Here’s the entire auto-generated config file:

<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup><system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service name="Chess.ChessService">
                <endpoint Address="" binding="wsHttpBinding" contract="Chess.IChessServer">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint Address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <Add baseAddress="http://localhost:8732/Design_Time_Addresses/Chess/ChessService/" />
                    </baseAddresses>
                </host>
            </service>
            <service name="Chess.ChessClient">
                <endpoint Address="" binding="wsHttpBinding" contract="Chess.IChessClient">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint Address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <Add baseAddress="http://localhost:8732/Design_Time_Addresses/Chess/ChessClient/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
</configuration>
  • 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-15T01:39:37+00:00Added an answer on May 15, 2026 at 1:39 am

    Visual Studio does not re-create the WCF configuration on every run. It will re-create the WCF configuration every time you do an Update Service Reference on your service reference in the project – but it definitely doesn’t automatically do that before every run – there must be something else causing you grief here.

    Furthermore, you’re not connecting to the correct address – your server defines it here:

    ServiceHost host = new ServiceHost(..., new Uri("http://localhost:8000"));
    host.AddServiceEndpoint(..., .., "ChessServer");
    

    and this results in your endpoint address on the server being

    http://localhost:8000/ChessServer
    

    However, you’re client appears to attempt to connect to

    http://localhost:8000/
    

    and there’s no service there.

    A last point: if you set up all your things like endpoints, bindings etc. in code, any changes to the config shouldn’t even bother you at all – there must be something else causing your problems.

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

Sidebar

Related Questions

I need to start a program every time the user logs in, but I
Every time the program terminates when it runs the third time through this loop:
I have a large text file. Each time my program runs, it needs to
Every time I write a program of the form below using LINQ to SQL,
I wish to retrieve a unique number every time I start my program (from
Everytime I run the program, this mysterious error pops up saying that I have
My program compiles fine, but crashes everytime throw (not inside of a try...catch block)
I setup a FSEvent that runs well but it keeps reporting the same event
I have a program that runs a large number of regular expressions (10+) on
I have a java program that runs another (Python) program as a process. Process

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.