How To: Create Virtual Directory for your Service using Script
When you want to host your WCF Service in IIS, you should follow several steps:
1. Your service should compile to \bin directory instead of \bin\debug
2. You must change the name of the configuration file from app.config to web.config
3. Create a .svc file in a specific format.
4. Create a virtual directory in IIS that points to the physical location of you service (probably not a subdirectory of wwwroot..)
I am using 2 scripts for creating and removing virtual directories for my WCF Services. You can find them here. These scripts also create and remove an application for your service.
CreateServiceVirtualDir relativePath folderName
RemoveServiceVirtualDir relativePath folderName
Note: You should run these scripts from the directory of your solution.
relativePath is the name of physical directory under the solution folder that your service is located.
folderName is the name you want for your virtual directory.