在唯一密钥属性“value”设置为“Default.aspx”时,无法添加类型为“add”的重复集合项

时间:2023-03-08 19:07:28

环境:windows server 2012  asp.net

找到网站目录:wwwroot ,打开web.config文件,在

在<files>与</files>之间加入代码

添加如下:

<clear />

<add value="index.php" />

<add value="Default.htm" />

<add value="index.htm" />

<add value="index.html" />

<add value="iisstart.htm" />

<add value="default.aspx" />

效果是:

<?xml version="1.0" encoding="UTF-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<defaultDocument>
<files>
<clear /> <add value="index.php" /> <add value="Default.htm" /> <add value="index.htm" /> <add value="index.html" /> <add value="iisstart.htm" /> <add value="default.aspx" /> </files>
</defaultDocument>
</system.webServer>
</configuration>