WCF Service Application
This project type is a more proper ASP.NET web application project compared to WCF Service. More proper because first, it has a project file (.csproj). Second, it generates .dll files. Which means we will not include the source code when deploying the service.
Below is the structure of a brand new WCF Service Application project:
│ IService1.cs │ Service1.svc │ Service1.svc.cs │ WcfServiceApplication1.csproj │ WcfServiceApplication1.csproj.user │ Web.config │ Web.Debug.config │ Web.Release.config │ ├───App_Data ├───bin ├───obj │ └───Debug │ │ .NETFramework,Version=v4.7.2.AssemblyAttributes.cs │ │ DesignTimeResolveAssemblyReferencesInput.cache │ │ WcfServiceApplication1.csproj.AssemblyReference.cache │ │ │ └───TempPE └───Properties AssemblyInfo.cs
To deploy the service, we first build the project, then publish it.
After we click Publish, Visual Studio will prompt us the publishing wizard. The wizard will first asks for the publish destination.
For flexibility, let’s choose publish to a folder. Enter the folder, then click Finish to complete the wizard.
Click the Publish button to publish the project:
Here’s how the publish output folder structure:
└───app.publish │ Service1.svc │ Web.config │ └───bin WcfServiceApplication1.dll WcfServiceApplication1.pdb
Now let’s host this WCF Service Application in IIS. We can do so by creating a new Application (right-click on the Default Website, click “Add Application”)
Enter the alias, then point the physical path to the publish folder:
That’s it. The service is now accessible.
What about the Temporary ASP.NET Files? It’s slightly different compared to WCF Service website.
└───wcfapp └───0675c2d5 └───d171ecc4 │ preStartInitList.web │ service1.svc.cdcab7d2.compiled │ ├───assembly │ ├───dl3 │ │ └───3238ffdf │ │ └───aca18044_49c2d701 │ │ WcfServiceApplication1.DLL │ │ __AssemblyInfo__.ini │ │ │ ├───temp │ └───tmp └───hash hash.web
Hopefully this will help us understand the difference and similarity between WCF Service and WCF Service Application project in Visual Studio. The similarity is both must served in IIS. The difference is WCF Service deploys the source code, the latter is deploying compiled binary.
Next post I will explore the most versatile among these three, WCF Service Library. Stay tuned! Cheers.
loading...
About Hardono
Incoming Search
.net, c#, iis, wcf