IIS启动条件不适用于Windows 7(64位计算机) [英] IIS Launch Condition doesn't work with windows 7 (64 Bit Machine)
问题描述
你好,
我有一个网络安装项目.安装之前,我需要检查是否在目标计算机上配置了IIS.我使用了以下URL, IIS启动条件 [ ^ ],但这不起作用如果目标计算机是Windows 7.谁能帮我解决这个问题?
更新:此问题仅与64位操作系统有关.
现在,我可以通过阅读注册表项来检查IIS的存在.这是该代码.
Hello,
I have a web setup project. I need to check whether IIS is configured on target machine before installation. I have used the following URL, IIS Launch Condition[^] , But this is not working if the target machine is Windows 7 . Can anyone help me to solve this?
Update : This issue is with 64 bit OS only.
Now I can check the presence of IIS by reading registry key. Here is the code for that.
private bool showError = false;
public bool ShowError
{
get { return showError; }
set { showError = value; }
}
private string subKey = @"SOFTWARE\Wow6432Node\Microsoft\Inetmgr\Parameters";
public string SubKey
{
get { return subKey; }
set { subKey = value; }
}
private RegistryKey baseRegistryKey = Registry.LocalMachine;
public RegistryKey BaseRegistryKey
{
get { return baseRegistryKey; }
set { baseRegistryKey = value; }
}
private void ShowErrorMessage(Exception e, string Title)
{
if (showError == true)
MessageBox.Show(e.Message,Title,MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public string Read(string KeyName)
{
RegistryKey rk = baseRegistryKey;
// Open a subKey as read only
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistrySubKey doesn't exist -> (null)
if (sk1 == null)
{
return null;
}
else
{
try
{
// If the RegistryKey exists I get its value or null is returned.
return (string)sk1.GetValue(KeyName.ToUpper()).ToString();
}
catch (Exception e)
{
ShowErrorMessage(e, "Reading registry " + KeyName.ToUpper());
return null;
}
}
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(Read(@"MajorVersion"));
}
但是在我的Web安装项目中,启动条件不起作用.
我已经尝试过如下....
But in my web setup project, the Launch condition is not working.
I have tried it as follows....
Name = Search for IIS
Propery = IISVERSION
regKey = HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Inetmgr\Parameters
Root = vsdrrHKLM
Value = MajorVersion
我给出的条件如下....
I have given the condition as follows....
IISVERSION >= "#4"
但是这种情况似乎不起作用.当我在配置了IIS的64位Windows 7计算机上尝试该安装程序时,安装程序因IIS启动条件而失败.
任何帮助,将不胜感激.
问候
Sebastian
But this condition is not seems to be working. When I tried it in a 64 bit Windows 7 machine with IIS configured, the installer failed with IIS launch condition.
Any help on this would be appreciated.
Regards
Sebastian
推荐答案
这无济于事:Right-click web setup project -> View -> Launch Condition -> IIS Condition to set for IIS check.
更新:
有可以使用的替代方法.我们在这里被告知需要为IIS检查哪个注册表项: http://learn. iis.net/page.aspx/135/discover-installed-components/ [ ^ ].
您的启动条件可以读取该特定的注册表项(HKLM \ SOFTWARE \ Microsoft \ InetStp \ Components \ Metabase),并检查该值是否等于字符串"1".
这篇文章 [ ^ ]听起来用户已成功使用Win7.
值得一试!
Does this not help:Right-click web setup project -> View -> Launch Condition -> IIS Condition to set for IIS check.
UPDATE:
There is an alternative that can be used. We are told that which registry key needs to be checked for IIS here: http://learn.iis.net/page.aspx/135/discover-installed-components/[^].
Your launch condition can read that specific registry key (HKLM\SOFTWARE\Microsoft\InetStp\Components\Metabase) and check if the value equals the string "1".
This post[^] sounds user was successful in it with Win7.
Worth a try!
这篇关于IIS启动条件不适用于Windows 7(64位计算机)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!