我正在尝试将程序集重定向从web.config
外部文件移动。其原因是我想将绑定重定向保留在一个地方并在调试和生产配置中使用它。
它有点工作,但我正在努力指定相对路径。
<configuration>
<!-- this works, but forces me to use the same path on dev and production machines -->
<linkedConfiguration href="file://c:\data\web.runtime.config"/>
<!-- none of those works -->
<linkedConfiguration href="file://web.runtime.config"/>
<linkedConfiguration href="file://..\web.runtime.config"/>
<linkedConfiguration href="file://~/web.runtime.config"/>
</configuration>
我想将它保存web.runtime.config
在与 Web 应用程序的其余部分相同的文件夹中。是否可以在linkedConfiguration
元素中指定相对路径?
更多信息:我已经在 VS 2015 中使用 IIS Express 和 ASP MVC 应用程序对其进行了测试。当使用 SysInternals Process Monitor 监视文件访问时,相对路径似乎解析为\\web.runtime.config
(无效的网络路径),而使用绝对路径时没有\\
添加前导.