Multiple BtsHttpReceive.dll ports and URLs

Topics: IIS and Web Services, Server Deployment
May 18, 2015 at 11:53 PM
In the past BTDF successfully deployed multiple virtual directories with the same app pool and physical path. Since I upgraded to BTDF 6 all but the first CopyVirtualDirectoryFiles task fails since it is hard coded to not overwrite.

(BizTalkDeploymentFramework.Tasks, Version=6.0.110.0)
error MSB4018: The "CopyVirtualDirectoryFiles" task failed unexpectedly. 
error MSB4018: System.IO.IOException: The file '...\BTSHTTPReceive.dll' already exists. 
btdfproj snippet:
<ItemGroup>
<IISApp Include="as2">
  <AppPoolName>BtsHttpReceive</AppPoolName>
  <PhysicalPath>..\BtsHttpReceive</PhysicalPath>
  <VirtualPath>/as2</VirtualPath>
  <IsapiFileName>BtsHttpReceive.dll</IsapiFileName>
</IISApp>
<IISApp Include="as2edi">
  <AppPoolName>BtsHttpReceive</AppPoolName>
  <PhysicalPath>..\BtsHttpReceive</PhysicalPath>
  <VirtualPath>/as2edi</VirtualPath>
  <IsapiFileName>BtsHttpReceive.dll</IsapiFileName>
</IISApp>
 <!-- +2 more for two-way (synchronous) equivalents of the above -->
</ItemGroup>

Several workarounds come to mind, but what do you recommend given multiple existing partners require different port types (one/two-way) and/or receive pipelines (As2/As2Edi)?
Coordinator
May 19, 2015 at 5:48 AM
I understand that it feels a little "icky" to have four directories with four copies of the same DLL, but that would be my recommendation. Maintain a 1:1 mapping of vdir to physical path -- it's the simplest workaround and could be a lot worse!

As for the app pools, I wonder what you're saving by using the same one. One of the benefits of app pools is process isolation, with the minor tradeoff of another process and a bit more overhead. It seems like a good thing to have all four partner endpoints on their own app pools. I'd suggest four app pools, but maybe you have a strong reason to keep them together.

I'll copy this to a work item to consider adding overwrite to the copy step.

Thanks,
Tom
Coordinator
May 19, 2015 at 5:49 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 3, 2015 at 4:06 PM
Edited Jun 3, 2015 at 4:10 PM
Hi Tom,

I have a similar requirement. I am trying to deploy three virtual directories with three different App Pools. But, we are creating those app pools manually as want to then to run under specific account.

<ItemGroup>
<IISApp Include="WCFService1">
  <PhysicalPath>..\VirtualDirectories\WCFService1</PhysicalPath>
  <VirtualPath>/WCFService1</VirtualPath>
  <AppPoolName>WCFService1AppPool</AppPoolName>
</IISApp>
<IISApp Include="WCFService2">
  <PhysicalPath>..\VirtualDirectories\WCFService2</PhysicalPath>
  <VirtualPath>/WCFService2</VirtualPath>
  <AppPoolName>WCFService2AppPool</AppPoolName>
  </IISApp>
<IISApp Include="WCFService3">
  <PhysicalPath>..\VirtualDirectories\WCFService3</PhysicalPath>
  <VirtualPath>/WCFService3</VirtualPath>
  <AppPoolName>WCFService3AppPool</AppPoolName>
</IISApp>
</ItemGroup>

When I run the deployment, I am getting an error in DeployNTFSPermissionsOnVDirPaths.


Granting NTFS permissions on 'C:\Program Files (x86)\BTSApp\1.1\VirtualDirectories\WCFService1' to 'btsuser'...
       C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018: The "ConfigureVirtualDirectoryNtfsPermissions" task failed unexpectedly.\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018: System.InvalidOperationException: Method failed with unexpected error code 3.\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at System.Security.AccessControl.NativeObjectSecurity.CreateInternal(ResourceType resourceType, Boolean isContainer, String name, SafeHandle handle, AccessControlSections includeSections, Boolean createByName, ExceptionFromErrorCode exceptionFromErrorCode, Object exceptionContext)\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at System.Security.AccessControl.FileSystemSecurity..ctor(Boolean isContainer, String name, AccessControlSections includeSections, Boolean isDirectory)\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at System.Security.AccessControl.DirectorySecurity..ctor(String name, AccessControlSections includeSections)\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at DeploymentFramework.BuildTasks.ConfigureVirtualDirectoryNtfsPermissions.SetDirectorySecurity(String path, String userName, FileSystemRights rights, AccessControlType controlType)\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at DeploymentFramework.BuildTasks.ConfigureVirtualDirectoryNtfsPermissions.Deploy(ServerManager mgr, ITaskItem ti)\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at DeploymentFramework.BuildTasks.ConfigureVirtualDirectoryNtfsPermissions.Configure(ServerManager mgr, ITaskItem ti, ModeType mode, ActionType action)\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at DeploymentFramework.BuildTasks.ConfigureIISTask.Execute()\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r
        C:\Program Files (x86)\Policy Data Service\1.1\Deployment\Framework\BizTalkDeploymentFramework.targets(1684,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
I tried to override DeployVDirs task in order to skip DeployNTFSPermissionsOnVDirPaths, but I am still getting the same error.
<Target Name="DeployVDirs" DependsOnTargets="VDirListItemGroupGuard;DeployIISAppPools; DeployIISApplications;DeployIISExtensions;" Condition="'$(IncludeVirtualDirectories)' == 'true'" />
Can you please advise.

Thanks!
Coordinator
Jun 8, 2015 at 2:33 AM
Are you aware that you can have the BTDF create the AppPools with unique identities? For example, from the Advanced sample application:
   <IISAppPool Include="BTDFAdvancedSample">
      <IdentityType>SpecificUser</IdentityType>
      <UserName>$(AppPoolUserName)</UserName>
      <Password>$(AppPoolPassword)</Password>
    </IISAppPool>
Error code 3 on file system operations usually indicates Path Not Found.

I see that the user is listed above in the error as 'btsuser'. If it's a domain user, you'll need to provide a domain-qualified username. Otherwise, are you sure that each of the three directories listed in the IISApp items exist at the expected locations?

If you really want to disable the NTFS permissions changes, just add <ModifyNTFSPermissionsOnVDirPaths>true</ModifyNTFSPermissionsOnVDirPaths> to a PropertyGroup in your .btdfproj.

Thanks,
Tom