我是IIS的新手,如果这是一个基本问题,请道歉。
我有一个IIS配置服务于公司内部网站(php而不是asp.net)。该网站的产品版本处于“默认网站”级别,我已将该网站的演示版和测试版映射为虚拟目录。演示和测试版本基本上是prod目录的副本。我注意到将web.config复制到这些VD,我只在VD的根URL上收到错误500。 I.E.主网站为https://mainwebsite.com并且工作正常但https://mainwebsite.com/demo/无效,而https://mainwebsite.com/demo/index.php工作正常。
web.config文件非常基本:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
</handlers>
<defaultDocument>
<files>
<add value="index.php" />
</files>
</defaultDocument>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:03:00" />
</staticContent>
</system.webServer>
</configuration>
将VD.config文件移出VD可以解决问题。即使文件相同,我也不认为该文件会引起冲突,因为我的理解是IIS支持多个Web配置文件。
虽然我通过重命名或删除文件有一个解决方法,但我想知道是否有办法将文件保留到位而不会导致此错误。
答案 0 :(得分:0)
感谢巴拿马杰克的评论,我能够解决我的问题。
我收到了详细错误的回复:
Error Summary
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
进一步向下:
Config Error
Cannot add duplicate collection entry of type 'add' with unique key attribute 'value' set to 'index.php'
要解决这个问题,我只是在web.config XML中注释掉这一行:
<add value="index.php" />
我确定有更好的方法可以解决这个问题但是现在,这会让我得到答案以及如何在日志无用时从IIS获取更多信息。
答案 1 :(得分:0)
如果创建到另一个Web根的虚拟目录 web.config会导致这种情况(我个人认为该文件的位置完全疯狂。.与htm和图像等混合在一起) 将该目录复制到其他没有web.config文件/不包含该目录的位置。然后将虚拟目录指向该目录。并设置一个任务来复制较新的文件。