我是IIS的新手,所以如果这是一个基本问题,我深表歉意。
我有一个IIS配置服务于公司内部网站(php而不是asp.net)。网站的产品版本处于“默认网站”级别,我已经将网站的演示版和测试版映射为虚拟目录。演示版和测试版实质上是prod目录的副本。我注意到将web.config复制到这些VD时,仅在VD的根URL上收到错误500。IE的主要网站是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中将web.config文件移开即可解决此问题。即使文件相同,但我认为该文件不会引起冲突,因为我的理解是IIS支持多个Web配置文件。
尽管我可以通过重命名或删除文件来解决该问题,但我想知道是否有一种方法可以将文件保留在适当的位置而不会导致此错误。
感谢巴拿马杰克的评论,我得以解决我的问题。
我收到此回复,并带有详细的错误:
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获取更多信息。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句