WCF service not working after program update

Posted by Boesj on Stack Overflow See other posts from Stack Overflow or by Boesj
Published on 2009-08-26T15:11:23Z Indexed on 2010/05/01 7:07 UTC
Read the original article Hit count: 209

Filed under:
|
|
|

I have recently added a WCF service reference to my program. When I perform a clean install of this program, everything seems to work as expected. But, when I install the program on a client which already has a previous version (without the new service reference) installed, I get a exception telling me the default endpoint for this particular service could not be found.

It seems that the appname.exe.config is not being updated with the new endpoint settings. Is there any reason for this and how can I force the installer to overwrite the config file? I'm using the default Visual Studio 2008 installer project with RemovePreviousVersions set to True.

Update: My program encrypts the settings section after the first run with the following code

Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
        ConfigurationSection section = config.GetSection(sectionKey);
        if (section != null)
        {
            if (!section.SectionInformation.IsProtected)
            {
                if (!section.ElementInformation.IsLocked)
                {
                    section.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
                    section.SectionInformation.ForceSave = true;
                    config.Save(ConfigurationSaveMode.Full);
                }
            }
        }

When I do not run the program before installing the new version the app.config gets updated.

© Stack Overflow or respective owner

Related posts about endpoints

Related posts about wcf