I recently had some downtime and wanted to build on my knowledge of WCF. I had previous experience with WCF on using proxy generation but knew that the ChannelFactory existed and I wanted to gain experience using that, so I decided to create a sample WCF Service hosted in IIS on Vista.
So what to do first.....

(I had already installed the windows component for IIS (in vista, click start Help and Support and search on Turn Windows features on or off). I selected everything under the IIS Web Mangement Tools section and the IIS World Wide Web Services. I also aready ran the ServiceModelReg.exe -i for the 404.3 error (Read http://msdn.microsoft.com/en-us/library/ms732012.aspx for more explanation).
The next thing I had to do was to make sure that I had an application in IIS set up for the services. During the build, the sample code made a directory under IIS and copied the dlls to it. I knew I either needed to make that an application myself, run the setupvroot found in the WCF_WF_CardSpace_Samples\WCF\Setup\CS, or create an application pointing to the bin directory where my services bin lived. I chose to make an application pointing to the C:\inetpub\wwwroot\ServiceModelSamples folder.
Next, I tried to run the project and it worked but as I'm looked through the code, I wondered how to get the endpoint address to be configurable. I wanted something like
ChannelFactory factory = new ChannelFactory("wsHttpBinding_CalculatorService");
where wsHttpBinding_CalculatorService was defined in my client's app.config.
I had to make the app config look something like

I ran again and it worked. Great! The next thing I wanted to do is try to create my own. I wanted to try extracting out my data contracts and service interfaces so they could be shared between client and server. One of the things I ran into was that the output directory for my services project was pointed to \bin\debug. I had to change that to \bin. I also had issues because I had a virtual directory in iis for the service folder instead of making it an application. I kept getting an error saying
"The service[ServiceName] cannot be activated due to an exception during compilation. The exception message is: The type [ServiceName], provided as the Service attribute value in the ServiceHost directive could not be found. "
Once I made it an application instead of a virtual directory, my sample app worked. Yeah!!!!
So what to do first.....
I knew I wanted to see how to use the ChannelFactory so I went out looking for samples online and found Windows Communication Foundation (WCF) and Windows CardSpace Samples at http://www.microsoft.com/downloadS/details.aspx?familyid=0043041F-95D6-4EB7-966A-C21A737E193A&displaylang=en. I installed this and opened the ChannelFactory solution.

(I had already installed the windows component for IIS (in vista, click start Help and Support and search on Turn Windows features on or off). I selected everything under the IIS Web Mangement Tools section and the IIS World Wide Web Services. I also aready ran the ServiceModelReg.exe -i for the 404.3 error (Read http://msdn.microsoft.com/en-us/library/ms732012.aspx for more explanation).
The next thing I had to do was to make sure that I had an application in IIS set up for the services. During the build, the sample code made a directory under IIS and copied the dlls to it. I knew I either needed to make that an application myself, run the setupvroot found in the WCF_WF_CardSpace_Samples\WCF\Setup\CS, or create an application pointing to the bin directory where my services bin lived. I chose to make an application pointing to the C:\inetpub\wwwroot\ServiceModelSamples folder.
Next, I tried to run the project and it worked but as I'm looked through the code, I wondered how to get the endpoint address to be configurable. I wanted something like
ChannelFactory
where wsHttpBinding_CalculatorService was defined in my client's app.config.
I had to make the app config look something like

I ran again and it worked. Great! The next thing I wanted to do is try to create my own. I wanted to try extracting out my data contracts and service interfaces so they could be shared between client and server. One of the things I ran into was that the output directory for my services project was pointed to \bin\debug. I had to change that to \bin. I also had issues because I had a virtual directory in iis for the service folder instead of making it an application. I kept getting an error saying
"The service[ServiceName] cannot be activated due to an exception during compilation. The exception message is: The type [ServiceName], provided as the Service attribute value in the ServiceHost directive could not be found. "
Once I made it an application instead of a virtual directory, my sample app worked. Yeah!!!!