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

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.

Related

Remote debug WCF services running under a custom IIS account

I want to remote debug an WCF service. The application pool that hosts the WCF service runs under an custom account. The custom account is a domain account.
In the 'Attach to Process' window in Visual Studio 2012 I have checked 'Show all processes from all users' but it only shows WCF services that are hosted under a built-in IIS account (like NETWORK SERVICE, etc.).
How can I remotely debug this service?
Assuming you've gone through this https://msdn.microsoft.com/en-us/library/y7f5zaaa.aspx, you may need to go through this https://msdn.microsoft.com/en-us/library/9y5b4b4f.aspx
HTH!
You are not seeing because it is not hosted in your application. You have to host the Remote WCF Service first. Add Service reference to add WCF to your app. Then right click WCFService.svc file to view WCF Service in browser to start the service. It will now be available to you and you can Attach the process.

WCF on cloud is not working

I just created a WCF service and deployed in one of the machine's IIS and checked it works fine.
When I deploy the same service on Cloud VM's IIS I am not able to consume that service.
I am getting the error saying that "There is no listener with the endpoint".
Can i deploy normal WCF on cloud or do i need to create WCF cloud service?
Environment(IIS 8.5)
It could be several Things, most probably:
ASP.net not activated on IIS
Also check:
The url you are using
firewall problems
site not started

Calling a net.tcp wcf service from Silverlight - in an external facing web site?

I have an external (public) website developed in Silverlight. The Silverlight app currently calls http based wcf services hosted in IIS.
I am now having to call a wcf service with net.tcp binding hosted in a different app server. I have the net.tcp wcf service hosted in a windows service on port range 4502-4530 and with an interface to expose clientaccesspolicy.xml file as part of the service. I am able to invoke this service from my Silverlight app in the web server. I want the SL app to make direct call to net.tcp, rather than routing the call to it from another http based service.
Question is will this work without any issues when exposed over internet.
Client browser --> IIS webserver with Silverlight website --> App Server with wcf service on net.tcp.
I am assuming in this case, from XAP SL would try to make direct call to the app server service using net.tcp ?
The communication between the web server and app server could be opened up for ports 4502-4535. But I am wondering what about the client. Does this setup require the ports to be available even in the clients machine (with browser)?
Any insight is much helpful.
Thanks.
Take a look at http://support.microsoft.com/kb/2425652; there is sample code included as well! If you setup clientaccesspolicy.xml correctly; it should work as long as clients can access your TCP server.
If your clients are behind some firewall which is blocking your server's ports; they may face connectivity issues!

WCF http activation without IIS

Is it possible to enable HTTP components for WCF without installing IIS. When i try to enable the HTTP components on windows server 2008 it forces me to enable the web server components.
Is there a workaround by not installing webserver.
(any solution other than self hosting or windows service)
thanks
Ben
WCF services can be hosted in any managed .NET application, not only IIS. You can either host it inside a windows service, or create a standard .NET executable to host the service (self-hosting). You can configure your end point to http eventhough the WCF is hosted outside IIS.
Check this article for more insight:
Hosting and Consuming WCF Services

WCF REST on windows service

I have hosted WCF REST service on windows service on my machine. I can access the service from my system but not able to do the same from some other system in network. I tried hosting it on internet and got the same problem. Any possible cause of the problem ?