Mar*_*obr 7 .net binding web-config assemblybinding assembly-binding-redirect
我正在尝试将程序集重定向从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>
Run Code Online (Sandbox Code Playgroud)
我想保留web.runtime.config与Web应用程序其余部分相同的文件夹.是否可以在linkedConfiguration元素中指定相对路径?
更多信息:我在VS 2015中使用IIS Express和ASP MVC应用程序对其进行了测试.使用SysInternals Process Monitor监视文件访问时,相对路径似乎解析为\\web.runtime.config(无效的网络路径),而在使用绝对路径时没有\\添加前导.
小智 5
我找到了一种指定相对路径的方法。
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<linkedConfiguration href="file:./RuntimeConfiguration.xml"/>
</assemblyBinding>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
784 次 |
| 最近记录: |