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.
Related
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!
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
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
I am new to wcf. I have developped a wcf service application(not a library). Can someone tell me how to deploy it other than iis. And how to access the service as a webservice. is this possible and how?
This link has an example that shows how to deploy a WCF-service as a servicehost application.
This means it runs as a service and does not need to be deployed to an IIS-instance.
There is an automatic WCF deploy tool in Visual Studio or copy the code to the server.
The server will be access like through a website like http://localhost:2342342432342/YourWebService.Svc.
You have to get the references from the WS using a tool that generates all the classes for you and you use that service's classes to write your code.
If your intention is to deploy to to a server that does not use IIS for hosting, you could look at an alternative hosting application like Cassini.
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