NLog not working from Windows Service hosted WCF Service - c#

I have a WCF service with NLog logging in C#. This service references 3 class libraries. Every projects uses NLog logging.
In Debug mode everything works fine, every projects logs to the specified log file successfully. I use async file target.
In production mode I have a Windows Service that hosts the above WCF Service. This Windows Service contains the NLog package too.
After I install my Windows service I see only log messages from Windows Service and not from the WCF Service and the other class libraries.
How can I receive log messages to file from WCF Service after it's hosted by a Windows Service?
Thank you!

Related

How to expose restful interface from windows service ?

I wrote a wcf service that expose restful interface.
Now i using the iis as the wcf service host.
There are some action that i need to make on my application beside the exposing of the restful - and for this need i must run my application as a windows service.
But the using the iis as a host will not make my wcf server run as a service.
How to make it possible to using a windows service with expose wcf restful interface service ?
You can self-host WCF services, please refer to ServiceHost.
To be able to run the app in 2 different host models, you have to separate hosting stuff from you main code. The key point of it: you can use controllers created in the other library project.
I did this before:
Create a library project and move all you controllers and other classes there.
Create empty WFC service, add reference to the lib above and make it working.
Create an empty console app, reference to the lib, add self hosting stuff and make it working.
Add topshelf package to console app to be able to install it as windows service.
So you will get:
building and deploying WCF project you can host it in IIS;
building a console app you can run it as console app;
using topshelf install param you can install a console app as windows service.

Minimum Configuration for a WCF service to host

I have a class library project which has an interface and an implemented service class with Service and Data Contracts.
I have built those to dlls and now I have created an empty web application and referenced those assemblies. I want this web application to host the service.
What minimum Web configurations do I need to make the service up and running.

Host developed wcf service on azure

I have ready project in silverlight, which is using wcf services.
I have one project for silverlight app and another for wcf services.
Can I move this wcf services from project to azure simple?
Or I have to rebuild all project.
There are 2 options.
Host your project as an IIS project on a Windows Server Virtual machine in Azure. No coding would be necessary, but you'd have to move your project to IIS.
Recode your Project as an Azure Cloud Service. It's not that difficult. I show an example of how to do that with an ASMX service in the below video, but moving a WCF service should be much easier than even this was.
Video is at:
http://www.youtube.com/watch?v=oQbMnoG56lk

Use WCF class library in application

I am new to WCF and I don't really understand the puropose of a WCF class library. (it does not look like a library to me it launches a program when I run my application) I have created a WPF application with a reference to my WCF service library. Everything works great under development. When I launch my application from visual studio the service get's hosted automatically by visual studio.
Now let's say I am ready to deploy. If I launch the application from outside visual studio then the service will not run. How do I start the service?
WCF service class cannot exist in a void. You need to host and there are a couple of option for Hosting.
In Visual Studio, there was two main template for WCF, WCF Service Application and WCF Service Library. Depend on your need, choose which template will be good for your project. If you want Self Hosting, better choose WCF Service Library template. (You need to write Hosting Service/Application). If you want to Host in IIS, better choose WCF Service Application.
And check this Tutorial for self hosting.
http://wcftutorial.net/WCF-Self-Hosting.aspx

Hosting Web Service/WCF Service?

I'm new to Windows Azure and I'm trying to deploy my web application to Windows Azure.
In my app I used some web services, now I would like to know how can I build them in windows azure and include that web reference in my web app?
Some tutorials said that I have to import my current web service into a Cloud Service Project as a WebRole but in my web serivce folder, there's no csproj file.
Thanks!
I found out that I just have to create a new Window Azure Project and add a WCF Service Web Role, copy my old files in the old Web Service (maybe change a little bit if it's ASMX) then host it the same way as web application. And voila, everything is ok now :)
I think you should use a WebRole for a web service, but you can use a WorkerRole though.
Take a look on this:
http://www.devproconnections.com/article/windows-azure-platform3/Hosting-WCF-Services-on-Azure-101.aspx

Categories

Resources