I bet you are all drooling over the new VirtualStream support in BizTalk Server 2006. With this, you can access a forward-read only stream as if it was a fully implemented stream with backward and forward access to the data.

   

The VIrtualStream is implemented in the undocumented API's but is also exposed in the SDK as VirtualStream.cs, so I feel pretty safe in using the deployed version.

   

But, the use of the VirtualStream is not what this about, this is about the security implications of the VirtualStream. The VS supports a disk caching scheme to store large streams…

   

As such, this means that the stream size in the cache can be quite large and you _generally_ don't have to worry about it, but in fact you do because this can fail in subtle an unexpected ways.

   

Two things can go wrong in this scenario.

Understand that the stream is cached to the BizTalk Server Host Instance account's %TEMP% folder, generally under:

C:\Documents and Settings\<BTSHostInstanceName>\Local Settings\Temp

   

The first problem I see here is that the C: Drive is NOT a good place to put large files that grow unexpectedly. The IO performance is poor and in addition, you could exhaust the drive space unexpectedly. So I recommend setting the BizTalk Host Instance's TEMP folder manually to a separate drive, preferably a non-backed up high speed disk.

   

Ok, so now you have the TEMP folder set to a separate drive, the second problem that could occur is that the BizTalk Host Instance account may not have Read-Write access to that folder. When the account is logged on the first time, the OS builds the account's local folder structure and gives it the correct access, but you need to manually set this when you manually set the TEMP folder location.

   

So:

1)      Try to move the TEMP folder of the BizTalk Host Instance account to a large and non-OS used drive

2)      Make sure that BizTalk Host Instance account has full control of the folder

   

That's it, then you won't get surprising failures in your pipeline when processing large files.