Neokernel Articles
Neokernel Demos
Sales and Licensing
Support
Company

Running a WCF Service under the Neokernel Web Server

The WCF Projects generated by Visual Studio require configuration changes to host under the Neokernel Web Server.

The WCF Agent Template is available at http://www.neokernel.com/wcf_template.zip and it provides a template that can be used when configuring your WCF project for hosting under the Neokernel Web Server. There is also a demonstration project included with the download that shows how to run a WCF service using the Neokernel Web Server - this is provided in demos.zip file, in the sub directory \demos\C# Projects\WCF Agent .

To configure your WCF project for hosting with the Neokernel Web Server, follow these steps:

  • Download and unzip the Neokernel WCF Template, then open the Neokernel WCF Template project in Visual Studio.
  • Open your WCF project in another instance of Visual Studio.
  • Copy the source code for your WCF service's interface (by default, this is found in the file IService1.cs in your visual studio WCF project) and replace the service interface code in the WCF Agent project with your source code (paste your code into the file IService1.cs in the WCF Agent project.) with the service interface code from your WCF project.
  • Copy the source code for your service implementation from your WCF project (found in the file Service1.cs )and paste it into the WCF Agent project file containing the service implementation code (this file is called Service1.cs in the WCF Agent project).

Note: If your project type is a C#\Web\WCF Service Application, it has a .svc file associated with it and you can right click on the .svc file in the project explorer and select view source to see the source for Service1.cs.

  • Copy configuration settings from your WCF Project into the WCF Agent Project. Copy the contents of the file web.config from your WCF project into the neokernel.config file in the WCF Agent Project.
  • Rebuild your project. If you didn't change the names of any files or classenames then your WCF Service will be started as a self-hosted service by the WCF agent, and will be available at the url http://localhost:8080/services/Service1. You can run your webservice by double clicking the neokernel.exe file found in the folder \WCF Agent\bin\debug. The build process will also copy the modified Neokernel.config file and the new DLLs with your service code to this folder.

Notes: If the class that implements your WCF service is NOT called Service1, you must edit the source code for the WCF Agent so that it loads your class. The WCF Agent hosts your WCF service as a self-hosted WCF service instead of hosting the WCF service on the same port as the web server. By default, the WCFAgent project hosts the web service on port 8080, so you can run a web server (with HTTP on port 80 and SSL on port 441) as well as the WCF service. The web server cannot run on the same port as a WCF service being hosted by the WCF Agent.

Updated: 6/8/10 1:51 PM