<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://bloggingabout.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'WCF' and 'Visual Studio'</title><link>http://bloggingabout.net/search/SearchResults.aspx?a=1&amp;o=DateDescending&amp;tag=WCF,Visual+Studio&amp;orTags=0</link><description>Search results matching tags 'WCF' and 'Visual Studio'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Deploying WCF Services using Web Deploy</title><link>http://bloggingabout.net/blogs/jpsmit/archive/2012/06/04/deploying-wcf-services-using-web-deploy.aspx</link><pubDate>Mon, 04 Jun 2012 18:31:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:577843</guid><dc:creator>Jean-Paul Smit</dc:creator><description>&lt;p&gt;More than two years ago I wrote a &lt;a target="_blank" href="http://bloggingabout.net/blogs/jpsmit/archive/2010/03/29/deploying-a-wcf-service-using-a-web-setup-project.aspx"&gt;blog post&lt;/a&gt; about deploying WCF services using a Web Setup project. Back then it wasn&amp;rsquo;t an easy task to get services deployed using it. Especially the UI customization of the installation wizard dialog gave me some headache, moreover because they were difficult to test and debug.&lt;/p&gt;
&lt;p&gt;As also mentioned in the comments of that post, we now got Web Deploy! So I decided it was about time to rewrite the blog post using the same requirements but then with Web Deploy. Let&amp;rsquo;s see how much easier it became.&lt;/p&gt;
&lt;p&gt;A small revisit of the requirements as formulated in the other blog post:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;support deployment of the WCF artifacts &lt;/li&gt;
&lt;li&gt;be able to be deployed to whatever web site is available on the server &lt;/li&gt;
&lt;li&gt;be able to set ASP.NET security to NTLM &lt;/li&gt;
&lt;li&gt;be able to gather service settings during setup &lt;/li&gt;
&lt;li&gt;be able to change custom AppSettings in the web.config according to the settings &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Web Deploy is available for Visual Studio 2005/2008, but I&amp;rsquo;ll be focusing on Visual Studio 2010. The approaches of the Web Deploy and Web Setup are different. In Web Setup the output was an MSI which could be run by a system administrator. The Web Deploy approach is focused on IIS as the host of the web application or service. This means the output is no longer an MSI but a (ZIP) package that can be imported in IIS or IIS Express or installed using the MSDeploy command line tool.&lt;/p&gt;
&lt;p&gt;What are the typical steps to take to deploy a web application or WCF service using Web Deploy from Visual Studio?&lt;/p&gt;
&lt;p&gt;First, select the &amp;lsquo;Publish&amp;rsquo; option on the project context menu.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployPublish.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;A profile page will show up in which you can specify which publish method to use. The options are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Web Deploy&lt;/li&gt;
&lt;li&gt;FTP (File Transfer Protocol)&lt;/li&gt;
&lt;li&gt;File system&lt;/li&gt;
&lt;li&gt;FPSE (FrontPage Server Extensions)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployProfile.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Also define a profile name, the server to deploy to and the name of the web application or WCF service. Next click &amp;lsquo;Publish&amp;rsquo; and the artifacts are deployed to the target IIS server and site/application. &lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployOutput.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;This covers requirement 1: support deployment of the WCF artifacts &lt;/p&gt;
&lt;p&gt;As a side step: if you want to deploy to a remote server, you might run into a few challenges. The Web Deploy is a client/server installation so you need to correctly setup your (IIS) server in order for it to receive the deployment request. If you want to know more, take a look at these posts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" href="http://weblogs.asp.net/scottgu/archive/2010/07/29/vs-2010-web-deployment.aspx"&gt;VS 2010 Web Deployment&lt;/a&gt; and &lt;a target="_blank" href="http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx"&gt;Automating Deployment with Microsoft Web Deploy&lt;/a&gt; (Scott Guthrie)&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://forums.iis.net/p/1176267/1974277.aspx"&gt;Problems with Web Deploy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://blogs.iis.net/kateroh/archive/2009/06/05/troubleshooting-common-msdeploy-issues.aspx"&gt;Troubleshooting Common MSDeploy Issues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://blogs.iis.net/msdeploy/archive/2010/09/22/common-web-deploy-connection-errors-and-recipes-for-fixing-them.aspx"&gt;Common Web Deploy connection errors&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Requirement 2 is: be able to be deployed to whatever web site is available on the server&lt;/h3&gt;
&lt;p&gt;In the previous step the target web site was defined in Visual Studio, but that should be dynamically changeable when a system administrator runs the package on for example a production environment. &lt;/p&gt;
&lt;p&gt;First the package must become portable so it can be installed on a different server, and the next step is enabling the system administrator to pick the website to deploy the service to.&lt;/p&gt;
&lt;p&gt;To create a package there are 2 options you can use:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Visual Studio&lt;/li&gt;
&lt;li&gt;IIS (use the Export Application functionality, which is a topic by itself and not covered here)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In Visual Studio take from the project context menu the option &amp;lsquo;Package/Publish Settings&amp;rsquo; to define how the package looks like and then &amp;lsquo;Build Deployment Package&amp;rsquo; to actually build the package.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployPackage.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Important settings here are the location of the package, which is a ZIP file, and the target location of the WCF service on the IIS server. Next select &amp;lsquo;Build Deployment Package&amp;rsquo; to create it.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployBuildPackage.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Now the package has been build, it is interesting to see what&amp;rsquo;s in it. Browse to the folder specified in the &amp;lsquo;Package/Publish Settings&amp;rsquo; folder to find the files below.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployPackageFolder.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The package consists of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CMD file 
&lt;ul&gt;
&lt;li&gt;This batch file can be used to deploy the package to a server without having to access IIS via the administration console. It uses the command line tool MSDeploy to deploy the package using Web Deploy. Suitable for unattended and/or bulk installations&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Readme file 
&lt;ul&gt;
&lt;li&gt;Interesting file describing all options for the CMD file. &lt;span style="text-decoration:underline;"&gt;One very interesting one is the /T option, which calls msdeploy.exe with the &amp;quot;-whatif&amp;quot; flag, which simulates deployment.&lt;/span&gt; This does not deploy the package. Instead, it creates a report of what will happen when you actually deploy the package. Very useful for testing purposes!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Parameter file 
&lt;ul&gt;
&lt;li&gt;This file contains the parameters that are defined for this service and are extracted from the project file (DeployIisAppPath element) during packaging. This file contains by default only one item, see below. Here we immediately notice that this is the value we need to cover requirement 2.&lt;/li&gt;
&lt;li&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployParameterFile.png" alt="" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Manifest file 
&lt;ul&gt;
&lt;li&gt;This file is not used during deployment, but during generating the package. It contains provider settings and like you can see below some security related entries for the &lt;a target="_blank" href="http://technet.microsoft.com/en-us/library/dd569054(v=ws.10)"&gt;IisApp&lt;/a&gt; and &lt;a target="_blank" href="http://technet.microsoft.com/en-us/library/dd569047(v=ws.10)"&gt;setAcl&lt;/a&gt; provider.&lt;/li&gt;
&lt;li&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployManifestFile.png" alt="" /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;ZIP package 
&lt;ul&gt;
&lt;li&gt;Contains the service to deploy, including configuration, binaries and other artifacts. If you open the ZIP you&amp;rsquo;ll see all kinds of configuration files that are used during import of the application&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For now let&amp;rsquo;s see how to install the package onto a different server based on the package. First open IIS and select the web site you want to import the web application or WCF service to. &lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployImportInIIS.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;It is out of scope to describe all wizard dialogs but at a certain time you&amp;rsquo;re asked to specify the application:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployIISImport2.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;In here you can define the destination application and if it doesn&amp;rsquo;t exist, it will be created for you. This is out-of-the box functionality, but nothing different from the Web Setup approach. Anyhow, this is what we need to fulfill requirement 2.&lt;/p&gt;
&lt;h3&gt;Requirement 3 is: be able to set ASP.NET security to NTLM&lt;/h3&gt;
&lt;p&gt;By default the security is set to anonymous access, so we need to change that to windows authentication. &lt;/p&gt;
&lt;p&gt;At first this didn&amp;rsquo;t seem like a big deal, because I expected it to be some parameter or manifest setting, but the more I read on the internet the more I got worried. There is a lot to find about Web Deploy and Windows Authentication, but that mostly relates to using Windows Authentication to connect to the Web Deploy server (&lt;a target="_blank" href="http://stackoverflow.com/questions/4807049/webdeploy-401-unauthorized-error/4834248#4834248"&gt;up to adding keys to the registry&lt;/a&gt;), and not about changing the authentication of a deployed WCF service or web application.&lt;/p&gt;
&lt;p&gt;So far I haven&amp;rsquo;t found an easy way to change the authentication of a deployed WCF service or web application. What I did find was a &lt;a target="_blank" href="http://forums.iis.net/p/1189491/2022032.aspx#2022032"&gt;thread&lt;/a&gt; in the IIS Forums about specifying the authentication in the web.config, but in order for that to work the applicationHost.config must be changed to &lt;a target="_blank" href="http://technet.microsoft.com/en-us/library/cc627314.aspx"&gt;allow overrides&lt;/a&gt;. That config file is maintained by the system administrator and I can understand why the system administrator should know about deployment scripts that change the authentication. On the other hand, having a WCF service with Windows Authentication is not that uncommon. &lt;/p&gt;
&lt;p&gt;Another option that was mentioned in &lt;a target="_blank" href="http://forums.iis.net/p/1164481/1932537.aspx#1932537"&gt;this thread&lt;/a&gt; refers to running a command file which can be added to the manifest file. This command file will probably contain some VBScript to change the authentication after the package has been installed. The difficult thing here is knowing in which web site the WCF Service has been deployed&amp;hellip;..&lt;/p&gt;
&lt;p&gt;I really hope I overlooked something, so if somebody knows how to do this please leave a comment! Thanks in advance!&lt;/p&gt;
&lt;h3&gt;&lt;span style="text-decoration:underline;"&gt;Requirement 4 and 5 will be discussed combined: &amp;ldquo;be able to gather service settings during setup&amp;rdquo; and &amp;ldquo;be able to change custom AppSettings in the web.config according to the settings&amp;rdquo;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;Like we&amp;rsquo;ve seen before, there is a parameters file. This file can be customized from within Visual Studio to make it possible to change the UI the system administrator will see. For this example I&amp;rsquo;ll demonstrate what it takes to change the value of a custom AppSetting in the web.config. This will be changed from within the UI of IIS. The value to change is a key named &amp;lsquo;Test&amp;rsquo; in the AppSettings section of the web.config.&lt;/p&gt;
&lt;p&gt;First, add an XML file to your project called &amp;ldquo;Parameters.xml&amp;rdquo;, this will contain the parameters the UI will show. This is a different file from the &amp;lsquo;SetParameters.xml&amp;rsquo; file we saw earlier; that one is used with the command line option and this one with the IIS import.&lt;/p&gt;
&lt;p&gt;Next add this piece of XML. By the way, &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/ff398068.aspx"&gt;this is a good resource&lt;/a&gt; to learn more about parameters in Web Deploy.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployParameters.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;This piece describes two things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It defines a parameter with a description to show up in the UI and a default value which will be filled in.&lt;/li&gt;
&lt;li&gt;It defines where the value, read from the UI, should be applied. In this case it is targeted at the web.config file and the XPath points to the AppSettings key &amp;lsquo;Test&amp;rsquo;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Building a package from this and importing it in IIS results in the following UI:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://www.didago.nl/Media/Default/blog/WCF_WebDeploy/VSWebDeployParametersInIIS.png" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;As you&amp;rsquo;ll notice the name and description are displayed nicely, together with the default value. When the value is changed, it will be changed in the web.config when the wizard is finished.&lt;/p&gt;
&lt;p&gt;You can imagine the possibilities of this approach. It is very easy to change the UI and set values for example in the web.config without having to code it.&lt;/p&gt;
&lt;p&gt;So, did it actually became easier to deploy WCF services? Yes and no. Obviously it is much easier to customize the UI and perform all kinds of actions while deploying, but on the other hand it seems very difficult to perform some common task like changing the authentication of a web site. Like mentioned before, I hope someone will leave a comment with a clarification on the authentication issue.&lt;/p&gt;
&lt;p&gt;Anyhow, there is much more you can do with Web Deploy then is covered in this blog post. Please find below useful spending of your spare time.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a target="_blank" href="http://learn.iis.net/page.aspx/1075/installing-and-configuring-web-deploy/"&gt;Installing and Configuring Web Deploy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://learn.iis.net/page.aspx/1082/web-deploy-parameterization/"&gt;Web Deploy Parameterization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://www.asp.net/web-forms/tutorials/deployment/web-deployment-in-the-enterprise/configuring-parameters-for-web-package-deployment"&gt;Configuring Parameters for Web Package Deployment&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/ff398068.aspx"&gt;How to: Use Parameters to Configure Deployment Settings When a Package is Installed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/dd465318.aspx"&gt;How to: Transform Web.config When Deploying a Web Application Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://vishaljoshi.blogspot.nl/2010/05/applying-xdt-magic-to-appconfig.html"&gt;Applying XDT magic to App.Config&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a target="_blank" href="http://www.didago.nl/"&gt;Didago IT Consultancy&lt;/a&gt;&lt;/p&gt;</description></item><item><title>The Visual Studio 2010 Test Client for WCF services</title><link>http://bloggingabout.net/blogs/rick/archive/2011/06/01/the-visual-studio-2010-test-client-for-wcf-services.aspx</link><pubDate>Wed, 01 Jun 2011 05:21:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:486803</guid><dc:creator>Rick van den Bosch</dc:creator><description>&lt;p&gt;When writing WCF services, most of us find ourselves writing quick test applications. To give you more time to do what a developer should be doing (adding business value to the project) the Visual Studio team added a WCF test client that can help you reach goals faster.&lt;/p&gt;
&lt;p&gt;This is not a very difficult application, but it does the trick and is more than sufficient for simple testing. The WCF Test Client can be found at this location (without the &amp;lsquo; (x86)&amp;rsquo; for x86 machines): &lt;em&gt;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Taken from the help:&lt;/em&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Windows Communication Foundation (WCF) Test Client (WcfTestClient.exe) is a GUI tool that allows users to input test parameters, submit that input to the service, and view the response that the service sends back. It provides a seamless service testing experience when combined with WCF Service Host.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;em&gt;WCF Test Client screenshots: &lt;br /&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rick.metablogapi/7144.image_5F00_07736124.png"&gt;&lt;img height="203" width="240" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rick.metablogapi/6888.image_5F00_thumb_5F00_7934E833.png" alt="image" border="0" title="image" style="background-image:none;border-bottom:0px;border-left:0px;margin:5px 5px 5px 0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rick.metablogapi/6825.image_5F00_07072E2F.png"&gt;&lt;img height="203" width="240" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rick.metablogapi/7776.image_5F00_thumb_5F00_14D9742A.png" alt="image" border="0" title="image" style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" /&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:xx-small;"&gt;&lt;strong&gt;Updated&lt;/strong&gt;: Thanks to Marco for pointing out my typo...!&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Deploying a WCF Service using a Web Setup Project</title><link>http://bloggingabout.net/blogs/jpsmit/archive/2010/03/29/deploying-a-wcf-service-using-a-web-setup-project.aspx</link><pubDate>Mon, 29 Mar 2010 20:58:51 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:483037</guid><dc:creator>Jean-Paul Smit</dc:creator><description>&lt;p&gt;With this blog post I hope I can save others some time and besides that it is also nicely stored for me in case I need it again.&lt;/p&gt;  &lt;p&gt;For my current project I’m building some WCF services. One of the requirements is to have a MSI to hand-over to the system engineers for deployment. &lt;/p&gt;  &lt;p&gt;The setup should:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;support deployment of the WCF artifacts &lt;/li&gt;    &lt;li&gt;be able to be deployed to whatever website is available on the server &lt;/li&gt;    &lt;li&gt;be able to set ASP.NET security to NTLM &lt;/li&gt;    &lt;li&gt;be able to gather service settings during setup &lt;/li&gt;    &lt;li&gt;be able to change custom AppSettings in the web.config according to the settings &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;While I’m familiar with Visual Studio Setup projects, I came across some interesting challenges.&lt;/p&gt;  &lt;p&gt;Requirement 1 and 2 are easy. The regular Web Setup project is capable of doing that out of the box. If you add a Web Setup project to your solution and specify the “File System on Target Machine”. Put the svc and web.config in the “Web Application Folder” and the output of the WCF project to the “bin” folder. This will deploy your WCF service to the website you specify in the setup wizard.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/2063.filesystem1_5F00_396C5B77.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="filesystem[1]" border="0" alt="filesystem[1]" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/7801.filesystem1_5F00_thumb_5F00_7F7D188A.png" width="374" height="212" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;One caveat however is to set the value of the Virtual Directory as it is shown by default when you run the setup. This is by default the name of your WebSetup project. In my case this was &amp;lt;company&amp;gt;.&amp;lt;division&amp;gt;.&amp;lt;Project&amp;gt;.&amp;lt;Subproject&amp;gt;.&amp;lt;Setup&amp;gt;&lt;/p&gt;  &lt;p&gt;This is definitely not the virtual directory name you want to see in IIS. This cannot be changed in Visual Studio because it is not shown as a property, you need a text editor like Notepad. So open the project file of the WebSetup project: the ‘vdproj’ file. Search for “VirtualDirectory” and change the value to something suitable.&lt;/p&gt;  &lt;p&gt;The 3rd requirement is a bit more difficult. By default the web services are installed with anonymous authentication so to change that, a step in the setup should be appended. After some searching I found out I had to add a so called custom installer. That is a class that inherits the System.Configuration.Install.Installer class. You can override the ‘Install’ and/or ‘Uninstall’ methods to add custom code to the installer.&lt;/p&gt;  &lt;p&gt;So I added a CustomInstaller Class Library project to host the CustomInstaller class. Next step was how to modify the authentication of the just installed web service? This can be done using WMI or ADSI and I decided to go for WMI. I already did some things with WMI but now I needed to do more. Unfortunately the documentation is not very ‘user friendly’ and after some trying I decided to look for a ‘WMI query analyzer’ or something like that to get at least an overview of the possible queries. I was very happy to find the &lt;a href="http://www.hostmonitor.biz/download/wmiexplorer.zip" target="_blank"&gt;WMI Explorer by KS-Soft&lt;/a&gt;. It is a free download that exactly does what I needed: give an overview of what is out there regarding classes, instances and properties. A very valuable tool.&lt;/p&gt;  &lt;p&gt;I needed a query to access the properties of the WCF service. Therefore I needed to query the “IIsWebVirtualDirSetting” class, based on the virtual directory of my WCF service. But how to get the virtual directory name? The system engineer can change that value so we need to ask the runtime to get it.&lt;/p&gt;  &lt;p&gt;By default the runtime keeps some variables that you can retrieve in your code. For WebSetup projects that are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;TARGETVDIR - virtual directory to be created &lt;/li&gt;    &lt;li&gt;TARGETSITE - website where the virtual directory is to be created (site must exist), example: &amp;quot;/LM/W3SVC/1 &lt;/li&gt;    &lt;li&gt;TARGETAPPPOOL - application pool to use (must exist, it won&amp;#39;t be created) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you supply the parameters (to which I will come back later), you can access the runtime context to get the variables using Context.Parameters. The code below does that and more.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/7853.wmicode1_5F00_180CB5DB.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="wmicode[1]" border="0" alt="wmicode[1]" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/3034.wmicode1_5F00_thumb_5F00_096209F6.png" width="820" height="211" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I create a ManagementScope for “&lt;a&gt;\\localhost\root\MicrosoftIISv2&lt;/a&gt;” to connect to the local IIS instance. Next I query for the IISWebVirtualDirSettings of my WCF service to get access to the properties. This query is based on the website name and the virtual directory. If there are multiple websites in IIS, we have to get the correct one.&lt;/p&gt;  &lt;p&gt;With the following code we can iterate over the result (which should only contain one record) and set the property.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/3581.wmicode21_5F00_2DA9EC72.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wmicode2[1]" border="0" alt="wmicode2[1]" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/5826.wmicode21_5F00_thumb_5F00_066FA33D.png" width="424" height="97" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;So now the code is in place to set the authentication, but how do these parameters get into the Context object? You have to specify a custom action to your project and the custom installer is the action you need to add.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/6283.setupcustomaction1_5F00_26F3E4F5.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="setupcustomaction[1]" border="0" alt="setupcustomaction[1]" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/5811.setupcustomaction1_5F00_thumb_5F00_1FD4A87D.png" width="375" height="137" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Then you can specify properties on the custom installer and they will end up in the Context object.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/7774.setupcustomaction21_5F00_3459F7FB.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="setupcustomaction2[1]" border="0" alt="setupcustomaction2[1]" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/7853.setupcustomaction21_5F00_thumb_5F00_33EDC506.png" width="662" height="166" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;As you can see the parameter starts with ‘/’ and the value is in double quotes and square brackets if it is a variable which is gathered during the setup process in the wizard. You can also add plain text like I did with ‘localhost’ in this case. Warning: do think about the double quotes, if forgotten nothing works and there are no messages to tell you why!&lt;/p&gt;  &lt;p&gt;Requirement 4 is simply extending the user interface. &lt;a href="http://raquila.com/software/configure-app-config-application-settings-during-msi-install/" target="_blank"&gt;You can find a very good blog post here so I won’t cover that in detail&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Finally the 5th requirement: set some AppSettings values in the web.config&lt;/p&gt;  &lt;p&gt;The blog post I just mentioned also describes how to modify web.config settings from a setup project. There is one difference to my situation and that is that I have to change the configuration file for a process I haven’t loaded the host of. So I cannot use the OpenExeConfiguration method of the ConfigurationManager class. Also the web.config specific method OpenWebConfiguration of the WebConfigurationManager class cannot be used.&lt;/p&gt;  &lt;p&gt;Via WMI I was able to find the physical path of the web.config and I was almost thinking about using some XmlDocument class to read and process the settings when I found this &lt;a href="http://forums.asp.net/t/1098485.aspx" target="_blank"&gt;forum topic&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;It describes exactly what I need. I have to use the OpenMappedWebConfiguration method of the WebconfigurationManager class. Then I can still use the capabilities of this class to modify the settings without having to foul around with XML tags myself. With this in place it’s a piece of cake to change the settings.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/2804.modifywebconfig1_5F00_6579329B.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="modifywebconfig[1]" border="0" alt="modifywebconfig[1]" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/jpsmit.metablogapi/8156.modifywebconfig1_5F00_thumb_5F00_727312AC.png" width="663" height="226" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Looking back everything is very easy, as always, but I had a hard time finding the right information. Also I have my doubts about WMI over ADSI. It seems like the ADSI queries are more intuitively but I’m not sure about that.&lt;/p&gt;  &lt;p&gt;If you have a better, easier, quicker or fancier solution, please let me know!&lt;/p&gt;</description></item><item><title>[WCF] Great tools in SDK</title><link>http://bloggingabout.net/blogs/jpsmit/archive/2007/01/24/wcf-great-tools-in-sdk.aspx</link><pubDate>Wed, 24 Jan 2007 12:58:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:101458</guid><dc:creator>Jean-Paul Smit</dc:creator><description>&lt;P&gt;While browsing&amp;nbsp;the WCF SDK I found two great tools:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Microsoft Service Configuration Editor&lt;/LI&gt;
&lt;LI&gt;Microsoft Service Trace Viewer&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The configuration editor helps you with the confguration files that&amp;nbsp;you need with WCF. It simplyfies editing those files significantly. By using a tool you also avoid typing errors and it is very easy for example to switch diagnostic information on or off.&lt;/P&gt;
&lt;P&gt;With the tracing switched on, you can use the trace viewer to browse the actual log files produced. This tool shows all messages flowing and additional information about the messages like what the body of the message was and the duration of the message. With this tool it is easier to find out what is going wrong if you run into an error or unexpected behavoir.&lt;/P&gt;
&lt;P&gt;Both tools can be found in the following SDK folder &lt;STRONG&gt;C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin&lt;/STRONG&gt; or you can download it &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F54F5537-CC86-4BF5-AE44-F5A1E805680D&amp;amp;displaylang=en" target=_blank&gt;here&lt;/A&gt;.&lt;/P&gt;</description></item></channel></rss>