4

I have a problem changing a dynamic web reference in the config file. Changing the url in the config file doesn't have any effect. I have to change the url in .settings and compile for it to change.

I added the web reference using the wizard. Set the URL behavior to dynamic, which added the relevant XML tags in config file.

In my solution I have the web API (web reference) in a separate project (class lib), so I referenced the project and copied the <applicationSettings> over.

<applicationSettings>
    <Runner.Properties.Settings>
      <setting name="WebReference" serializeAs="String">
        <value>http://someurl/somefile.asmx</value>
      </setting>
    </Runner.Properties.Settings>
</applicationSettings>

Note that it's <Runner.Properties.Settings> and not <WebAPI.Properties.Settings>.

My solution is set up as follows:

Solution:
- WebAPI (class lib, has the web reference)
- Runner (console app, references WebAPI)

Are there some limitations I'm not aware of or am I doing something wrong?

Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
  • Is your wcf client now in a dll? And you are instantiating that wcf client from the dll in your web application? And the service reference config is in the yourdll.config? – rene Sep 16 '12 at 09:34
  • I'm not sure if understand "wcf client" correct. The project where I added the web reference is a dll and I use that dll in a console project. Both the "wcf client" (dll) and the console program has app.configs. But as far as I know only the running (startup project) app.config is used. So in my output dir I have webapi.dll, runner.exe & runner.exe.config – Snæbjørn Sep 16 '12 at 09:46
  • does the runner.exe.config contain the service reference stuff? – rene Sep 16 '12 at 10:16
  • Yes, I tried to explain that in the question. It's located under ... > – Snæbjørn Sep 16 '12 at 10:39

1 Answers1

0

Have you tried restarting your application after you make the change? For instance restart the windows service or the website in IIS?

Another option would be to load the parameter into memory and every so often go read that setting into memory again for the life span of the application.

BossRoss
  • 869
  • 2
  • 11
  • 31