Changing a dynamic web link from web./app.config

I have a problem with changing a dynamic web link in a configuration file. Changing the URL in the configuration file has no effect. I have to change the url in .settings and compile to change it.

I added a web link using the wizard. Set the behavior of the URL dynamic by adding the appropriate XML tags to the configuration file.

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

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

Note that this is <Runner.Properties.Settings> , not <WebAPI.Properties.Settings> .

My solution is configured as follows:

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

Are there any restrictions that I don’t know about or something is wrong?

+4
source share
1 answer

Did you try to restart the application after making changes? For example, restart a Windows service or website in IIS?

Another option is to load this parameter into memory, and each time so often read this setting in memory again for the life of the application.

0
source

Source: https://habr.com/ru/post/1434447/


All Articles