首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在WiX安装程序中安装期间模拟不同的用户

在WiX安装程序中安装期间模拟不同的用户
EN

Stack Overflow用户
提问于 2013-04-22 17:36:58
回答 1查看 595关注 0票数 1

我刚刚创建了一个WebV3.5安装程序来将我的WiX应用程序安装到IIS7上。我有自定义操作,允许用户选择他们想要的网站和应用程序池,并通过对话框命名虚拟目录。

但是现在我已经到了身份验证阶段,我被难住了。我正在尝试启用模拟,并允许用户输入他们的模拟登录和密码。我在我的Visual Studion2010安装项目中工作得很好,所以现在我需要在WiX中复制相同的内容。

显然,这可以通过appcmd来完成,就像下面这个问题:Is setting "ASP.NET Impersonation" possible using WiX 3.x with IISExtension?,但我似乎不能让它工作。我是否可以将其添加到我的product.wxs中,并将其包装在自定义操作中?有没有人有主意?如有任何帮助,我将不胜感激。

代码语言:javascript
复制
appcmd set config /commit:WEBROOT/section:identity /impersonate:true
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-23 21:41:36

您好,我设法让这个工作,所以如果其他任何人都有同样的问题,我通过修改我的web.config在我的安装过程中解决了这个问题:

为此,我将以下代码添加到我的product.wsx中以编辑我的web.config,使用我在新对话框中分配给文本框的属性,以允许用户在安装时输入模拟用户名和密码:

代码语言:javascript
复制
<Component Id="Web.config" Guid="2ED81B77-F153-4003-9006-4770D789D4B6">
        <File Id="Web.config" Name="Web.config" Source="$(var.SolutionDir)MyWebApp\Web.config" DiskId="1" KeyPath="yes" />
        <util:XmlFile Id="system.webidentity" File="[INSTALLLOCATION]Web.config" Action="createElement" ElementPath="/configuration/system.web" Name="identity" Sequence="1" />
        <util:XmlFile Id="system.webIdentityAttribute" Action="setValue" File="[INSTALLLOCATION]Web.config" ElementPath="/configuration/system.web/identity" Name="impersonate" Value="true" Sequence="2" />
        <util:XmlFile Id="system.webIdentityAttribute2" Action="setValue" File="[INSTALLLOCATION]Web.config" ElementPath="/configuration/system.web/identity" Name="password" Value="[IMPERSONATIONUSERPASSWORD]" Sequence="3" />
        <util:XmlFile Id="system.webIdentityAttribute3" Action="setValue" File="[INSTALLLOCATION]Web.config" ElementPath="/configuration/system.web/identity" Name="userName" Value="[IMPERSONATIONUSER]" Sequence="4" />

注意:如果你使用msbuild和heat自动将你的文件添加到你的Wix项目中,你必须确保你没有在这里复制你的web.config,或者如果你复制了你的目标,删除我的web.config你的目标设置。否则你会得到重复的错误。

代码语言:javascript
复制
<Target Name="BeforeBuild">
<MSBuild Projects="%(ProjectReference.FullPath)" Targets="Package" Properties="Configuration=$(Configuration);Platform=AnyCPU" Condition="'%(ProjectReference.PackageThisProject)'=='True'" />
<Delete Files="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\web.config">
</Delete>
<PropertyGroup>
  <LinkerBaseInputPaths>%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\</LinkerBaseInputPaths>
</PropertyGroup>
<HeatDirectory OutputFile="%(ProjectReference.Filename).wxs" Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\" DirectoryRefId="INSTALLLOCATION" ComponentGroupName="%(ProjectReference.Filename)_Project" SuppressCom="true" SuppressFragments="true" SuppressRegistry="true" SuppressRootDirectory="true" AutoGenerateGuids="false" GenerateGuidsNow="true" ToolPath="$(WixToolPath)" Condition="'%(ProjectReference.PackageThisProject)'=='True'" />   </Target>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16143831

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档