C#,vb.net,MVC,Jquery,javascript,jscript,vbscript,html,vb,sharepoint,COM,WPF,WCF,Wwf,Asp,Asp.net,questions & answers,

Latest in Sports

Tuesday, October 14, 2014

Hosting WCF Services in IIS using MSI

SOLUTION 1:
Out the box MSI installers are discontinued from VSTS2012, so you won’t be able to use those, however you have option to revert back to VSTS 2010 just for deployment project.
For VSTS2012, I recommend using WIX, you could google out WIX, there is plenty of resources available. For quickstart below is some important WIX steps –
 
   <Directory Id="Example" Name=" Example ">
                 //copy all the Assemblies
            <Component Id='Copy Assemblies' Guid='{Enter your GUID}'>
              <File Id="Sample.dll" Source ="$(TargetDir)Sample.dll"/>
            </Component>
            </Directory>-->
           </Directory>
                 //copy all the Service specific files
          <Component Id='Copy Service File' Guid='{Enter your GUID}'>
            <File Id="Service1.svc" Source ="Service1.svc"/>
            <File Id="Web.Config" Source ="Web.config"/>
          </Component>
                 //Create IIS component like Application pool,website nd virtual directory
          <Component Id="IISComponent" Guid="{Enter your GUID}" KeyPath="yes">
            <iis:WebAppPool Id="WebAppPool" Name="ServicePool" ManagedRuntimeVersion="v4.0" IdleTimeout="0" RecycleMinutes="0" ManagedPipelineMode="integrated">
            </iis:WebAppPool>
            <iis:WebSite Id ='Service'  Directory ='INSTALLATION FOLDER' Description'Website Description'>
                <iis:WebAddress Id="AllUnassigned" Port="8019" />
            </iis:WebSite>
            <iis:WebVirtualDir Id="Virtual" Alias="VD" Directory="INSTALLATION FOLDER"  WebSite="Service">               
              <iis:WebApplication Id="MyWebAppApplication" WebAppPool="WebAppPool" Name="WebSiteVirtual" />
              <iis:WebDirProperties Id="MyWebSite_Properties" AnonymousAccess="yes" WindowsAuthentication="no" />
            </iis:WebVirtualDir>      
          </Component>
        </Directory>
 
 

SOLUTION 2:
n order to achieve this you can write your service as an Installer Class custom action and install it using a ".NET Installer Class Action" predefined custom action. Also, you can take a look on "How to: Host a WCF Service in a Managed Windows Service" article which should be useful for you.

No comments:

Post a Comment