Create Application Pool for Virtual Directory

Topics: IIS and Web Services
Aug 9, 2013 at 7:25 PM
Hi Team

I have started using BTDF for my biztalk deployment and i found it quite powerful.

1) I want to use BTDF to deploy virtual Directories along with BizTalk artifacts.Also i want to create application Pool if it is not present.

However, i couldn't find anything which can point me in right direction?

2) I want to have App Pool name dynamic using Settingfile. I tried that, but while deploying the solution, BTDF takes AppPool as String instead of replacing it with value from setting file.

I used following:
<VDirList Include="*">
  <Vdir>My.Vdir</Vdir>
  <Physdir>..\Configuration\VirtualDirectory\My.Vdir</Physdir>
  <AppPool>${MyAppPool}</AppPool>
  <AppPoolNetVersion>4.0</AppPoolNetVersion>
</VDirList>
</ItemGroup>
<ItemGroup>
<PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;MyAppPool" />
</ItemGroup>

However IIS show "${MyAppPool} as Application Pool for my Virtual Directory.


Please help.

Thanks
Deepak Sanghi
Aug 13, 2013 at 9:31 AM
Hi,
If you use a variable name from settings file in VDIRList , it is not replaced by the value while creating Virtual directory. I fixed it in this way. Here I use website id and application pool from settings file:

<Target Name="DeployVirtualDirectory">
<CreateVirtualDirectory MetabasePath="IIS://localhost/w3svc/$(IISWebSiteID)/Root" Name="%(VDirList.Vdir)" Path="$(MSBuildProjectDirectory)\%(VDirList.Physdir)" />
</Target>
<Target Name="DeployVDirsIIS6Plus" Condition="'$(IisMajorVersion)' != '5'">
<!-- Create app pool and place vdir in app pool for win2003+ -->
<AssignVirtualDirectoryToAppPool
  MetabasePath="IIS://localhost/w3svc/$(IISWebSiteID)/Root" VDirName="%(VDirList.Vdir)" AppPoolName="$(MyAppPool)" />
<ConfigureAppPool
  MetabasePath="IIS://localhost/w3svc/$(IISWebSiteID)/Root" AppPoolName="$(MyAppPool)" UserName="$(VDIR_UserName)" Password="$(VDIR_UserPass)"
  Condition="'$(VDIR_UserPass)' != ''" />
<Message Text="SKIPPING APP POOL IDENTITY CONFIGURATION because the property VDIR_UserPass is empty." Condition="'$(VDIR_UserPass)' == ''" />

<!-- Set the .NET runtime version on the AppPool if AppPoolNetVersion was specified; IIS 7.0+ only -->
<Exec Command="&quot;$(AppCmd)&quot; set apppool /apppool.name:&quot;$(MyAppPool)&quot; /managedRuntimeVersion:&quot;%(VDirList.AppPoolNetVersion)&quot; /managedPipelineMode:Integrated"
      Condition="'$(IisMajorVersion)' != '6' and '$(Configuration)' == 'Server' and '%(VDirList.AppPoolNetVersion)' != ''" />
</Target>

You also need to add ,
<PropsFromEnvSettings Include="SsoAppUserGroup;SsoAppAdminGroup;IISWebSiteID;MyAppPool" />