【问题标题】:IIS 7 Redirecting Default Website to custom pageIIS 7 将默认网站重定向到自定义页面
【发布时间】:2012-07-05 16:46:25
【问题描述】:

我们有一个在 IIS 7 上设置的网站,并正在尝试用新网站替换它。

旧站点使用自定义文件作为主页,称为 WN-main.asp

新站点不再使用 ASP,我们希望使用常规 index.html 作为主文件。但是,当我们访问该网站时,它会不断尝试将我们的 .com 重定向到 .com/WN-main.asp

在 IIS“默认文档”设置中,我们在顶部有 index.html,而 WN-main.asp 在列表中无处可寻(它从未存在过)。这个重定向到底在 IIS 中的什么位置? :)

我们还从根目录中删除了 web.config 文件,并将整个旧网站放在一个子目录中。以及重新启动IIS。这个重定向的位置有什么想法吗?

谢谢!

【问题讨论】:

  • 要查看实际错误,您可以立即前往worzalla.com,不过很快我们将不得不恢复旧的 ASP 站点。
  • 嘿,我现在收到此链接的 404 错误。解决了吗?
  • @Kim L 当我访问 worzalla.com 时,我看到了一个非常不错的网页。我真的很羡慕你的造型和外观。我没有重定向。当我访问 worzalla.com/wn-main.asp 时,我收到 404 错误。是否只是服务器上一些模糊的缓存最终被清除了?
  • 谢谢!我们不确定最终是什么问题 - 不知何故,旧主页可能缓存在服务器上,并且页面本身重定向到 /WN-main.asp 页面......即使服务器不应该一直在缓存任何东西。在玩了很多东西之后,它突然开始工作了!微软。
  • (虽然我们也禁用并重新启用了 asp 和 .net - 这可能有所帮助)

标签: iis iis-7 webserver windows-server-2008


【解决方案1】:

在 IIS 中,您可以将设置配置到网站以外的其他级别,例如一个 machine.config 文件,它定义了服务器所有站点的设置。您站点的最终配置不仅会使用您的 web.config,还会使用这些其他父级配置。

检查这些文件,看看是否有定义错误的<defaultDocument>

Server-level configuration is stored in the following configuration files:    
- Machine.config. This file is located in %windir%\Microsoft.NET\Framework\framework_version\CONFIG.    
- Root Web.config for the .NET Framework. This file is located in %windir%\Microsoft.NET\Framework\framework_version\CONFIG.    
- ApplicationHost.config. This file is located in %windir%\system32\inetsrv\config.

Site, application, and virtual and physical directory configuration can be stored in one of the following locations:    
- A server-level configuration file. When configuration for a site, application, directory, or URL is stored in a server-level configuration file, you must use a location tag to specify the site, application, directory, or URL to which the configuration applies.    
- A parent-level Web.config file. When configuration for an application, directory, or URL is stored in a parent-level configuration file, you must use a location tag to specify the child at which the configuration applies.     
- The Web.config file for the site, the application, or the directory. When you configure settings for an application, directory, or URL, the configuration is stored in the same directory as the site, application, or directory. You do not need to use location tags.

摘自:Working with configuration files in IIS7

【讨论】:

    【解决方案2】:

    我们不确定最终是什么问题 - 在某个地方,不知何故,旧主页可能缓存在服务器上,并且页面本身重定向到 /WN-main.asp 页面......即使服务器不应该缓存任何东西,我们最初已经检查了多次。在玩了很多设置之后,它突然开始工作了!微软。我们禁用和启用 asp 和 .net 的事实可能有所帮助,但我不确定……至少它现在可以工作了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-17
      • 1970-01-01
      • 1970-01-01
      • 2017-08-31
      • 1970-01-01
      • 2017-07-18
      • 1970-01-01
      相关资源
      最近更新 更多