wcf service start - wcf

I have a wcf service inside a windows service. Inside the wcf service I have a http listener which needs to be started automatically when the windows service is started. Any ideas?

Thanks for the answers but I found the solution
In order to have your constructor called, you need this:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]

can you not use IIS to host the WCF service, it has the WAS (Windows Activation Service ) to start the WCF Service?

Related

.NET Remoting and WCF

I have an old ASP.NET app connecting to a .NET Remoting service. I'd replaced the .NET Remoting service to a WCF service. I have the original WSDL and I've generated a WCF service by the help of svcutil. I don't know whether the client will able to connect and call the WCF service without changing its code.
Is it possible to solve this problem, please?
A service can be both a remoting service and a WCF service at the same time.
Just configure it with RemotingServices as usual for remoting.
Then decorate with OperationContract / ServiceContract and construct with ServiceHost and you can create clients for both techniques, just that remoting is TCP only.
WCF and Remoting are different paradigms. So if you changed your Remoting server to .NET WCF service, you will have to change the client code to use the wsdl generated client
look at https://learn.microsoft.com/en-us/dotnet/framework/wcf/migrating-from-net-remoting-to-wcf#Client_Comp. it should not be difficult

How to convert self-hosted WCF service to IIS 7

I currently have a self-hosted WCF service running in a Windows service. I have been asked to host the WCF service in IIS 7. It seems that all of the MSDN suggestion require me to implement a wrapper class for the service instead of loading the service dll directly via a configuration file. I have already read the links Why/how to migrate self-hosted WCF service to IIS7? and WCF Service. Can't host in IIS7. Has anybody done this before? If so, can you point me in the right direction?

How to build Wcf service that runs/processes request after client that published task is closed?

I am trying to build a WCF based web service hosted on IIS 7.0. WCF Service is hosted on IIS and is designed to accept requests from multiple WCF clients(console applications). Each WCF client will give/publish a task to service hosted on WCF. After publishing task client terminates or shuts down.
After a while Client will query WCF Service for status of the task it published, service will return the status either completed or terminated etc... for the query request.
I'm new to the paradigm of WCF and webservices. Can someone help me with WCF concepts that can help me achieve this. samples are appreciated.
Thanks,
--Prasad
If I understand you correctly, then you're looking for a WCF Service that keeps running after the client closes the connection and then make a new connection to that same service at a later time.
From the service's point of view, that new connection is a new, different client - so you're sharing the same service with multiple clients.
You can achieve this with the InstanceContextMode.Single service behavior:
[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
public class EvalService : IEvalService { ...
See The lifetime of an instance of a WCF service?.

How to start/stop windows service from a remote machine through WCF service?

I have created a WCF service which is deployed on my local machine. This service exposes one method which start/stop a windows service on my local machine.
On the remote machine I have created a client that consumes the WCF service. When I try to invoke the method which start/stop service exposed from a WCF service , I get InvalidOperationException . I found that this is the Security issue.
Also when I do the same operation (start/stop windows service) on the local machine it works!!
The WCF service is hosted on IIS 7.0 which is using basichttpBinding. Also Anonnymous access is checked. I have also added <identity Impersonate = true > under the web section in the web config file but still no success.
Please help!!
You set impersonation for ASP.NET. Impersonation in WCF uses its own infrastructure. Moreover in WCF client has to allow service to impersonate his identity. Check this simple example.

Consume WCF Service Hosted in a Windows Service

I wrote the WCF Service and hosted in windows service. I need to know how to consume this windows service in my client application.
Note:
I wrote Net pipe binding service.
Edit:
How can I write the client application for net pipe binding?
You need to do a few easy steps:
start your Windows service hosting your WCF service
from within Visual Studio (2008 or higher), right-click on a project node in the solution explorer and choose "Add service reference"
enter the URL where your service can be reached
That's about all there is, really. Visual Studio will go to your running service, get all the metadata it needs (assuming you've enabled a MEX endpoint for metadata exchange), and will create a client proxy class for you to use to connect your client to your service.
Marc
you need to use ChannelFactory to create a proxy, and then you can use the proxy to perform wcf tasks.
ChannelFactory<IWCFService> pipeFactory = new ChannelFactory<IWCFService>(
new NetNamedPipeBinding(),
new EndpointAddress("net.pipe://localhost/PipeWCFService"));
IWCFService pipeProxy = pipeFactory.CreateChannel();
pipeProxy.RunWCFServiceMethod();}
http://www.switchonthecode.com/tutorials/wcf-tutorial-basic-interprocess-communication
You can consume it like any other WCF service. The method used for hosting the WCF service is not relevant to the client side.
If you need details on how to actually build the client, let me know and i'll update the post.
Edit : Start here to learn how to build a WCF client.