我在更改配置文件中的动态 Web 引用时遇到问题。更改配置文件中的 url 没有任何效果。我必须更改 .settings 中的 url 并编译它才能更改。
我使用向导添加了网络参考。将 URL 行为设置为动态,这会在配置文件中添加相关的 XML 标记。
在我的解决方案中,我在一个单独的项目(类库)中有 Web API(Web 参考),所以我引用了该项目并复制了<applicationSettings>
过去。
<applicationSettings>
<Runner.Properties.Settings>
<setting name="WebReference" serializeAs="String">
<value>http://someurl/somefile.asmx</value>
</setting>
</Runner.Properties.Settings>
</applicationSettings>
请注意,它是<Runner.Properties.Settings>
而不是<WebAPI.Properties.Settings>
。
我的解决方案设置如下:
Solution:
- WebAPI (class lib, has the web reference)
- Runner (console app, references WebAPI)
是否有一些我不知道的限制或者我做错了什么?