ASP.NET 项目安装程序注册表项?

发布于 2024-08-15 12:21:26 字数 240 浏览 6 评论 0原文

我有一个asp.net项目,并编写了一个网络安装程序。 安装 exe/msi 将该项目复制到安装用户选择的目录中,并为其创建一个应用程序。

如何获取 ASP.NET 应用程序的安装路径(在安装程序中)? 我想将 ASP.net 应用程序的物理路径写入注册表,因为 Windows 服务需要监视此 Web 项目的目录,但它无法做到这一点,除非它知道 Web 项目安装到哪里。

Webinstaller 项目是否会自动将此值写入注册表?

I have a asp.net project, and wrote a web installer.
The setup exe/msi copies that project in directory chosen by the installing user, and creates an application for it.

How can I get the path my asp.net application got installed to (in the installer)?
I want to write the physical path of my ASP.net application into the registry, because a windows service needs to watch a directory of this web project, and it can't do that, unless it knows where the web project was installed to.

Does the Webinstaller project by any chance write this value into the registry automatically ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

别理我 2024-08-22 12:21:26

有可能:

右键单击安装项目,然后从上下文菜单中选择“查看”->“注册表”。
右键单击 HKEY_Local_Machine,添加一个新键,将其命名为 Software。
右键单击“软件”,添加一个新密钥,将其命名为“MyCompanyName”。
右键单击 MyCompanyName,从上下文菜单中选择 new->String
称之为安装文件夹。
左键单击installationFolder键,并将属性值设置为[TARGETDIR]
添加一个附加字符串键,将其命名为 version 并为其指定值 [ProductVersion]

包括[]

在 x64 上,您可以在 regedit 的
下找到您的注册表项
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\YourCompany]

但通过编程方式,您可以从正常项目和 Web 项目中正常读取它:
My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\YourCompanyName", "安装文件夹", 无)

It is possible:

Right-click on the setup project, and choose View->Registry from the context menu.
Right-click on HKEY_Local_Machine, add a new key, call it Software.
Right click on Software, add a new key, call it "MyCompanyName".
Right click on MyCompanyName, from the context-menu, choose new->String
call it installation folder.
Left click on the installationFolder key, and set property value to [TARGETDIR]
Add an additional string key, call it version and give it the value [ProductVersion]

including the []

On x64, you'll find your registry key in regedit under
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\YourCompany]

But programmatically, you can read it normally, from normal projects and web projects, with:
My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\YourCompanyName", "Installation Folder", Nothing)

不幸的是没有; IIS 使用注册表以外的方式来存储其配置。

对于 IIS4、IIS5 和 IIS6,您需要查看 IIS 元数据库。这是 Windows 文件夹中 system32\inetsrv\Metabase.xml 下的 XML 文件;它是 XML,因此您应该能够直接读取它以查找所需的信息。

IIS7不再使用元数据库;相反,请参阅此处了解托管的详细信息IIS 配置的 API。

因此,您可能会发现最好重新设计您的应用程序,以在这些位置中查找您需要的目录信息。

Unfortunately no; IIS uses means other than the registry to store its configuration.

For IIS4, IIS5 and IIS6, you'll need to take a look through the IIS Metabase. This is an XML file in your Windows folder under system32\inetsrv\Metabase.xml; it's XML, so you should be able to read it directly to find the information you need.

IIS7 doesn't use the Metabase any more; instead, see here for details of the managed API to the IIS configuration.

So you may find it best to rework your application to look in either of these places for the directory information that you need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文