【发布时间】:2015-07-02 14:33:11
【问题描述】:
我将我的项目升级到 ASPNET5。我在升级我的 web.config 文件时遇到了麻烦。
我尝试使用 Microsoft.Framework.ConfigurationModel.Xml 包来读取 URL 重写配置。配置如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="MainRule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" matchType="Pattern" pattern="api/(.*)" negate="true" />
<add input="{REQUEST_URI}" matchType="Pattern" pattern="signalr/(.*)" negate="true" />
</conditions>
<action type="Rewrite" url="default.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
但是,当它尝试将其转换为 aspnet5 使用的对象时,我当然会遇到重复的密钥问题。
将现有的 web.config 移植到新的 aspnet 模型的最佳方法是什么?这是我意识到的一个小案例,但在现实世界中,这些配置非常激烈。
我创建了一个example project,希望在弄清楚其中一些案例后与其他人分享。
【问题讨论】:
标签: asp.net web-config asp.net-core