BTDF for application to be hosted as IIS

Topics: Bindings File, Settings Management and SSO, ESB Toolkit Integration, General Questions, Getting Started/Beginner, IIS and Web Services, Server Deployment, Tips and Tricks, Visual Studio Integration
Feb 18, 2013 at 8:06 AM
Hi
I am completely unaware of packaging an application that is to be hosted as WCF.

My application is a simple one that has an orchestration that takes 2 numbers as input and gives the sum of the numbers.
I tried that independently on my local machine and it worked fine.( with WCF publish wizard)..
Now could you please help me to deploy using BTDF ?

I got stuck in the middle and unknowing what to do.
I have my biztalk project..
I added Deployment project to my solution..
Until this point it is done..
Now i dont know what to do with the btdfproj file..( I did deployement successfully for normal biztalk applications).
I mean I dont know what code to be included and how to make use of Biztalk publishing wizard..
If I use BT WCF wizard, then the directory is gtting created in c:/inetpub/wwwroot/ folder..
So I request you all to give me step by step procedure for deploying biztalk application that is to be hosted as WCF Service...
Coordinator
Feb 18, 2013 at 6:20 PM
Hi,

Use the WCF Publishing Wizard, then move the entire WCF service folder from c:\inetpub\wwwroot to your BizTalk solution folder next to your other BizTalk project folders. Then just follow the instructions here. The Physdir setting will refer to the service folder that you moved into the solution folder.

Thanks,
Tom
Feb 19, 2013 at 5:48 AM
Hi TOM,,

I have an error while installing the MSI..

"C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj"
(Deploy target) (1) ->
(DeployVDirs target) ->
C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj(
90,5): error MSB4018: The "CreateVirtualDirectory" task failed unexpectedly.\r
C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj(90
,5): error MSB4018: System.Runtime.InteropServices.COMException (0x80005000): U
nknown error (0x80005000)\r
C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj(90
,5): error MSB4018: at System.DirectoryServices.DirectoryEntry.Bind(Boolean
throwIfFail)\r
C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj(90
,5): error MSB4018: at System.DirectoryServices.DirectoryEntry.Bind()\r
C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj(90
,5): error MSB4018: at System.DirectoryServices.DirectoryEntry.get_SchemaCla
ssName()\r
C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj(90
,5): error MSB4018: at DeploymentFramework.BuildTasks.CreateVirtualDirectory
.Execute()\r
C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj(90
,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.B
uild.BackEnd.ITaskExecutionHost.Execute()\r
C:\Program Files\BizSampleSol for BizTalk\1.0\Deployment\Deployment.btdfproj(90
,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiat
edTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingCont
ext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask,
Boolean& taskResult)

And Here goes my target code ...

<Target Name="DeployVDirs" DependsOnTargets="SetWinVer;GetSoftwarePaths" Condition="'$(IncludeVirtualDirectories)' == 'true'">
 Deploy virtual directories and handle service account assignment. 

<CreateVirtualDirectory MetabasePath="$(IISMetabasePath)" Name="%(VDirList.Vdir)" Path="%(VDirList.Physdir)" />

 <!--Make sure aspnet account can read physical directory & its contents.  
     For workstation deployments, you would need to supply the account value through an MSBuild property.--> 
<Message Text="Modifying NTFS permissions on virtual directory folders..." Condition="'$(ModifyNTFSPermissionsOnVDirPaths)' == 'true'" />

 <!--Take the username value from install wizard if doing a formal install--> 
<Exec Command="cacls &quot;%(VDirList.Physdir)&quot; /E /G $(VDIR_UserName):R"
    Condition="'$(ModifyNTFSPermissionsOnVDirPaths)' == 'true' and ('$(IisMajorVersion)' == '6' or '$(IisMajorVersion)' == '7') and '$(Configuration)' == 'Server'" />
<Exec Command="cacls &quot;%(VDirList.Physdir)\*.*&quot; /E /G $(VDIR_UserName):R"
    Condition="'$(ModifyNTFSPermissionsOnVDirPaths)' == 'true' and ('$(IisMajorVersion)' == '6' or '$(IisMajorVersion)' == '7') and '$(Configuration)' == 'Server'" />

<Exec Command="cacls &quot;%(VDirList.Physdir)&quot; /E /G $(AppPoolAccount):R"
    Condition="'$(ModifyNTFSPermissionsOnVDirPaths)' == 'true' and ('$(IisMajorVersion)' == '6' or '$(IisMajorVersion)' == '7') and '$(Configuration)' != 'Server'" />
<Exec Command="cacls &quot;%(VDirList.Physdir)\*.*&quot; /E /G $(AppPoolAccount):R"
    Condition="'$(ModifyNTFSPermissionsOnVDirPaths)' == 'true' and ('$(IisMajorVersion)' == '6' or '$(IisMajorVersion)' == '7') and '$(Configuration)' != 'Server'" />
<Message Text="Done modifying NTFS permissions on virtual directory folders." Condition="'$(ModifyNTFSPermissionsOnVDirPaths)' == 'true'" />

 <!--Create app pool and place vdir in app pool for win2003--> 
<AssignVirtualDirectoryToAppPool
  MetabasePath="$(IISMetabasePath)" VDirName="%(VDirList.Vdir)" AppPoolName="%(VDirList.AppPool)"
  Condition="('$(IisMajorVersion)' == '6' or '$(IisMajorVersion)' == '7')" />
<ConfigureAppPool
  MetabasePath="$(IISMetabasePath)" AppPoolName="%(VDirList.AppPool)" UserName="my username " Password="my passwd"
  Condition="('$(IisMajorVersion)' == '6' or '$(IisMajorVersion)' == '7') and '$(Configuration)' == 'Server'" />

 <!--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;%(VDirList.AppPool)&quot; /managedRuntimeVersion:%(VDirList.AppPoolNetVersion)"
    Condition="'$(IisMajorVersion)' == '7' and '$(Configuration)' == 'Server' and '%(VDirList.AppPoolNetVersion)' != ''" />
</Target>

And my ItemGroup code is as follows :

<ItemGroup>
<VDirList Include="*">
  <Vdir>BizSampleAdditionWCF</Vdir>
  <AppPool>BiztalkAppPool</AppPool>
  <AppPoolNetVersion>4.0</AppPoolNetVersion>
  <Physdir>..\BizSampleAddWCF</Physdir>
  </VDirList>
</ItemGroup>

I already have an application pool called "BiztalkAppPool".

My WCF wizard created me virtual directory... I moved (copied + deleted) the folder to my solution folder..
Now I dont know why this error is getting generated..
I kindly request you to explain this in a clean manner..
Coordinator
Feb 26, 2013 at 6:28 AM
Hi, are you on Windows Server 2008? If so, do you have the IIS 6 Compatibility features installed for IIS? Are you using the Default Web Site?

The Deployment Framework uses WMI to access IIS://localhost/w3svc/1/Root by default. In your case, it appears that immediately after creating a DirectoryEntry object on that WMI path, this line of code throws the exception "string className = site.SchemaClassName".

Did you copy that whole DeployVDirs target into your .btdfproj, or are you just duplicating what is in the Framework's .targets file?

Thanks,
Tom
Nov 5, 2013 at 7:05 PM
Hi Tom. It has been a long time. I hope all is well.

I have set this up before but it has been a while. I am trying to remember, will BTDF create the AppPool, the virtual directories and install the results of the WCF Publishing Wizard that was copied to the Deployment project? Or do I have to have the AppPool in place first?

Regards,
Keith
Coordinator
Nov 5, 2013 at 7:52 PM
Hello again Keith,

During a Visual Studio deployment the AppPool is not created, but during server/MSI deployment it is created. That just avoids having to collect a password to set up the AppPool identity during VS deployments.

The vdir is always created and pointed to the directory that contains the web service files, which must be moved from c:\inetpub\wwwroot to your BizTalk solution folder hierarchy.

Hope that helps,
Tom
Nov 5, 2013 at 8:10 PM
Thanks Tom and yes it does help, but I still need to clarify one thing. I was reading the documentation online and it only talks about the need to add the <ItemGroup> entry for the <VDirList>. Do we also have to add a section like listed above with all the <Target> settings (which I think is where the vdir is created)? And if so, is there a good clean example of that?

Regards,
Keith
Coordinator
Nov 5, 2013 at 8:45 PM
Aside from the VDirList ItemGroup, you only need the property <IncludeVirtualDirectories>true</IncludeVirtualDirectories>. I don't know why the earlier writer copied that MSBuild target into his message, but you don't need it. The Advanced sample application in the Deployment Framework includes virtual directory deployment, so you can always have a look at that.

Thanks,
Tom