This is the second example project in this series and is based off of the first example. This is a complete example of WCF using OO principles that leverage the NetDataContractSerializer. This example goes along with the content found here. The zip file contains the following projects:
This is the first example project in this series and forms the foundation of the other example projects--each of which builds off of this one in an attempt to make each example easy to understand. This is a complete example of WCF using OO principles that leverage the ServiceKnowType attribute. This example goes along with the content found here. The zip file contains the following projects:
You'll want the ability to upload files to your web site without having direct access to your server. However, where many sites on the Internet will tell you to accomplish this with IIS's FTP server, for security reasons it's not a good idea. This is because when you connect to IIS's FTP server, your user name and password will be sent in plain text...never a good idea when passing along user credentials over the Internet.
An area you'll want to take a look at when building a WCF service is service throttling. Throttling refers to the number of sessions, calls, and/or service instances that are available at any given time. Here is an example of how throttling is configured in a configuration file:
Now you need to make sure that when a request to your site comes in from the Internet, your network configuration allows the request to pass through to your web server. I'll assume you are using a router that connects to your modem, and that your web server has a connection to the router. There are two ways to allow external requests to pass through to the web server, depending on your equipment:
Ahhh...and now I've found what I was looking for. Thanks to Avner Kashtan's Blog, which pointed me to Aaron Skonnard's blog...
The next step in the process of self-hosting your own site is to set up a computer as a web server. To do this on Windows XP Professional or Windows Server 2003, you'll need IIS installed. On Windows XP Professional, you will only have the ability to create a single, stand-alone web site, while Windows Server 2003 allows you to create as many web sites as you'd like to. So, if you want to host multiple domains and you are running Windows XP Professional, you'll need to resort to a redirect script or some other "trickery" to allows users asking for http://www.somedomain.com to go to a different location on your server than those asking for http://www.someotherdomain.com. The rest of this tutorial assumes you are using Windows Server 2003, but other than the instructions for hosting multiple web sites, the details are pretty much the same.
As I've previously mentioned, you need a dynamic IP address resolution service in order to reliably host your own service. I will explain how to set this up using a particular provider of this service, DynDns.com. You'll want to visit this company's site, create an account, and then click on the "Services" link at the top of the page. On the page you are taken to you will click on "DNS Services" on the left hand side, and you'll either want to select the Dynamic DNS or Custom DNS service. The Dynamic DNS service is free, while the CustomDNS service costs 24.95 a year. Take a look at the difference in features and see what works for you. Personally, I chose the Custom DNS service because 24.95 a year is cheap and it offers a few features and better support. This tutorial assumes you are using the Custom DNS service, but I believe the user-interfaces to each system are close enough (if not the same) for you to follow along if you choose the Dynamic DNS service instead.
Right out of the gate, my biggest problem with WCF was understanding how to develop against a WCF service while still retaining the OO principles I've come to know and love. I really prefer to not have to change my development methodologies to fulfill the needs of whatever technology comes down the pike. For instance, I will never be fond of a technology that disallows me from using interfaces (as opposed to classes), and when I first started playing around with WCF this did indeed seem to be a problem.
Here are links to the Resharper User Live Templates, User File Templates, and customized Predefined File Templates we use around here.