【问题标题】:Setting multiple IIS Custom HTTP error messages on InstallShield 2009在 InstallShield 2009 上设置多个 IIS 自定义 HTTP 错误消息
【发布时间】:2012-06-29 02:28:13
【问题描述】:

如何在 InstallShield 2009 安装的网站上设置 HTTP 自定义错误消息?

它看起来确实很简单。有一个 Internet 信息服务视图,我们可以在其中创建网站或虚拟目录对象,这些对象的选项卡之一看起来可以让我们设置自定义 HTTP 错误消息。

它甚至可以重置 1 或 2 个错误消息,但是当我尝试重置所有 HTTP 错误消息时,它确实失败了。

具体来说,这是我的 InstallShield 项目中的 ISIISCommon 表(XML 文件格式):

<table name="ISIISCommon">
    <col key="yes" def="s72">ISIISCommon</col>
    <col def="S72">ISIISCommon_Parent</col>
    <col def="L255">DisplayName</col>
    <col def="s50">RootDir</col>
    <col def="i4">Attributes</col>
    <col def="L255">DefDoc</col>
    <col def="I4">SessionTimeout</col>
    <col def="I4">ScriptTimeout</col>
    <col def="S255">AnonyUserName</col>
    <col def="S255">AnonyPasswrd</col>
    <col def="S0">CustomErrors</col>
    <col def="L255">AppName</col>
    <col def="S72">SSLCert</col>
    <col def="L72">AppPool_</col>
    <col def="S255">Aspversion</col>
    <col def="S255">SslPassword</col>
    <col def="S255">HostHeaderName</col>
    <row><td>ISIISCommonVRoot</td><td>ISIISCommonWebsite1</td><td>##ID_STRING121##</td><td>WEB</td><td>25873</td><td>Index.html</td><td>20</td><td>90</td><td/><td/><td>400,*,URL,CustomError.html;401,1,URL,CustomError.html;401,2,URL,CustomError.html;401,3,URL,CustomError.html;401,4,URL,CustomError.html;401,5,URL,CustomError.html;403,1,URL,CustomError.html;403,10,URL,CustomError.html;403,11,URL,CustomError.html;403,12,URL,CustomError.html;403,13,URL,CustomError.html;403,14,URL,CustomError.html;403,15,URL,CustomError.html;403,16,URL,CustomError.html;403,17,URL,CustomError.html;403,2,URL,CustomError.html;403,3,URL,CustomError.html;403,4,URL,CustomError.html;403,5,URL,CustomError.html;403,6,URL,CustomError.html;403,7,URL,CustomError.html;403,8,URL,CustomError.html;403,9,URL,CustomError.html;404,*,URL,CustomError.html;405,*,URL,CustomError.html;406,*,URL,CustomError.html;407,*,URL,CustomError.html;412,*,URL,CustomError.html;414,*,URL,CustomError.html;500,*,URL,CustomError.html;500,100,URL,CustomError.html;500,12,URL,CustomError.html;500,13,URL,CustomError.html;500,15,URL,CustomError.html;501,*,URL,CustomError.html;502,*,URL,CustomError.html</td><td>##ID_STRING127##</td><td/><td>##ID_STRING31##</td><td/><td/><td/></row>
</table>

您可能注意到,我尝试将虚拟目录上的所有 HTTP 错误设置为重定向到 CustomError.html 页面。另请注意,我认为将此信息存储在 TD 元素中而不是其自己的 TABLE 中是错误的,尤其是在 InstallShield/Windows Installer 世界中。

这在各个层面上都行不通。

首先,这里是安装日志,

    MSI (s) (60:14) [12:28:49:025]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI72A0.tmp, Entrypoint: CreateIISVRoots
    InstallShield 12:28:49: User legacy object preference is the following: 1 . This is based on the value of the following property: IISPREFERLEGACYOBJECTS
    InstallShield 12:28:49: InitIISObject
    InstallShield 12:28:49: CreateAppPoolFunction
    InstallShield 12:28:49: OpenKeyLog, pszMDPath =/LM
    InstallShield 12:28:49: AddKey, pszMDPath = /W3SVC/AppPools/MyAppPool
    InstallShield 12:28:49: OpenKeyLog, pszMDPath =/LM/W3SVC/AppPools/MyAppPool
    InstallShield 12:28:49: getvaluelog
    InstallShield 12:28:49: SetVRtStrProperty for property '1002' with value 'IIsApplicationPool' and strSubPath '/'.
[zip]
    InstallShield 12:28:49: SetVRtStrProperty for property '6006' with value 'Index.html' and strSubPath '/'.
    InstallShield 12:28:49: SetData, pszMDPath = /
    InstallShield 12:28:49: SetVRtDelimMultiszProperty for property '6008' with value '400,*,URL,CustomError.html;401,1,URL,CustomError.html;401,2,URL,CustomError.html;401,3,URL,CustomError.html;401,4,URL,CustomError.html;401,5,URL,CustomError.html;403,1,URL,CustomError.html;403,10,URL,CustomError.html;403,11,URL,CustomError.html;403,12,URL,Cus'.
    **InstallShield 12:28:49: SetVRtMultiszProperty for property '6008' and value '400,*,URL,CustomError.html' with length '522'**.

从外观上看,它不喜欢使用 522 个字符来描述自定义错误。在 IIS 中,仅使用了前 259 个字符,因此只有少数自定义错误设置正确,最后一个错误设置严重错误(生成的 403.12 自定义错误 URL 为“cus”)。

有没有办法解决这个限制?

【问题讨论】:

    标签: iis-6 windows-installer iis-7.5 http-error installshield-2009


    【解决方案1】:

    我将 CustomError 页面从 CustomError.html 重命名为 ce.htm。这节省了一些空间,但还不够。一个更大的字符缓冲区保护程序是旧的 *.而不是

    401,1,URL,CustomError.html;401,2,URL,CustomError.html;...;401,13,CustomError.html;401,2,URL,CustomError.html

    我最终使用:

    401,*,文件,ce.htm;

    这就是虚拟目录行现在在 ISIISCommon 表中的样子:

        <row><td>ISIISCommonVRoot</td><td>ISIISCommonWebsite1</td><td>##ID_STRING121##</td><td>WEB</td><td>25873</td><td>Index.html</td><td>20</td><td>90</td><td/><td/><td>400,*,FILE,ce.htm;401,*,FILE,ce.htm;403,*,FILE,ce.htm;404,*,FILE,ce.htm;405,*,FILE,ce.htm;406,*,FILE,ce.htm;407,*,FILE,ce.htm;412,*,FILE,ce.htm;414,*,FILE,ce.htm;500,*,FILE,ce.htm;501,*,FILE,ce.htm;502,*,FILE,ce.htm</td><td>##ID_STRING127##</td><td/><td>##ID_STRING31##</td><td/><td/><td/></row>
    

    这可能并不适合所有场景(如果有人希望 401.1 和 401.2 有不同的客户错误怎么办?)。

    另外,我必须直接在 InstallShield XML 项目文件上进行此更改,因为 GUI 无法理解(而且仍然可以,即使加载项目并正确构建它,自定义错误选项卡是一团糟,我只是忽略了 DEFAULT 或 suberror 专门条目,它们不在生成的 MSI 文件中,或者这就是 Orca 所说的)。

    我也从 URL 转移到 FILE,因为后者似乎更正交于身份验证。

    阅读更好的解决方案会很棒,但我仍然想知道为什么在这样一个表格世界中,有人认为存储这样的表格是个好主意。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 2011-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多