How to disable auto-generated WCF configuration
- by user351025
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.