Today we will create a Windows service, which will serve as the WCF service. An example will be based on the use of the library FastReport.Service.dll (WCF Service Library), which can be found in the package of FastReport .NET.
Open Visual Studio and create a project WindowsService.
Open the designer of Service1.cs
Change the name of the service on your own.
Click by right mouse button on window and select “Add Installer”.
Edit the properties of the component serviceInstaller1 - set up a DisplayName.
In the component properties serviceProcessInstaller1 set up the type of account for the service LocalSystem.
Add references in project on System.ServiceModel and FastReport.Service.dll
Create application configuration file.
Copy the following text into the new app.config
Go to the editor of Service1.cs and add the line:
Then you need to modify the class of service, so that it looks like:
Compile the project and make sure that there are no errors.
You can install the service using the command line utility InstallUtil.exe, which comes with .NET Framework, such as:
And you can start service by command:
Open web browser and check an address http://localhost:8732/FastReportService/, which set in app.config in baseAddress. You can change folder and port on your own.
Commands for stop and uninstall of the service:
You can see this example in latest builds of FastReport .NET in folder "\Demos\C#\WCFWindowsService".
Thank you for attention!