Remote debug WCF services running under a custom IIS account - wcf

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.

Related

How to disable WCF Test Client while hosting services in a managed application?

I am hosting WCF services in a console application and i am trying to use the same endpoint address configured in the service config file in my host application. But when ever i am trying to run the application i am getting AddressAlreadyInUse exception because of WCF Test Client is consuming those ports. So i wanted to disable automatice hosting in the WCF test client while debugging self hosting.
I tried disabling WCFTestClient.exe startup through project property section but still it's not working.
Have a look of the snapshot:

got EndpointNotFoundException when consuming WCFService in A webrole from B webrole

I have a webrole for hosting a web application, and another webrole for hosting a WCF service. Now I have got my WCF service webrole published on windows Azure, but the webrole with web application is not since I am still developing it. Then when I try to consuming the WCF service which has published on cloud in the web application, it gives the error:EndpointNotFoundException, the inner exception is remote server is not found.
But actually, I can comsuming the WCF service in a web application which is not a Azure project. so is it because web application in one webrole can't consume WCF service in another webrole?
It should be able to as long as they both aren't in Azure. At that point you will need an InternalEndpoint instead for them to communicate through. Did you add it as a web reference in Visual Studio and that worked correctly? Can you browse to the WCF service from the browser and see it? My guess would be that it has the wrong port, maybe you just manually updated the reference after publishing it to Azure.

Questions about adding a WCF service to a Windows service assembly

I have found some basic information about hosting a WCF service in a Windows service, but not much. All of my experience thus far with WCF has been in Web projects. I have a few simple questions.
I have a project which creates a windows service application. I have done a right click -> add WCF Service. This creates Service1.cs and IService1.cs.
I'm wondering why no SVC file is created in this scenario? When I add services to Web projects i get an SVC file which I can navigate to and use to consume the service.
Adding the service adds some configurations to the app.config under the services element. I'm seeing a default base address of
http://localhost:8732/Design_Time_Addresses/WindowsServiceName.services/WCFServiceName/
What does this mean? It's sort of an odd looking address. Am I supposed to change it to whatever I want?
Navigating to this address in a browser results in an unable to connect message. Does the windows service itself have to be running to talk to the WCF service?
How do I go about consuming this service from another application without an svc file?
I'm taking a guess on this first one, but I'm thinking the .svc file when hosting in IIS is to tell IIS, "Hey I have a WCF service here, please handle accordingly".
The base address is as it should be and yes you can change it if I'm not mistaken.
You can't hit the WCF service unless the Windows service is running, which is one of the dangers of hosting in a Windows service, because if the service dies somehow your WCF service is offline until you get the Windows service running again.
You consume the service the same way you do any other WCF service, just using that base address to get at it.

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.

How would you communicate a wcf service with a windows service?

Two weeks ago I needed a way to communicate a wcf service with a windows service running on the same computer. The windows service had to get data from a external source and share it with the wcf service (hosted in IIS) who had to give it when a client made a request. I chose to do that with ipc.
I done it and now the windows service is the ipc server and the wcf service is the ipc client. This goes well but I think I made a mistake doing this because to make it run right the windows service must to be executed with the ASPNET account, for this the ASPNET password account must be assigned and when I do that the IIS does not work correctly.
I am thinking on different alternatives, but in all of them the problem persists. Some ideas?
Edit:
What I needed was a system that made public, in a web service hosted in IIS, data gotten through telnet from another old system, what is a little unstable. How the response of this second system was slow I chose to put a process (the windows service) between the web service and the old system. The windows service had to save the data collected from the old system and when the wcf service asked it give it all at once through ipc.
Why does the windows service need to run as the ASPNET user? Is that because you're using an IPC connection that requires authentication from the caller?
Another alternative (if you have control over the windows-service code) would be to make that a WCF service as well (using a ServiceHost in the windows service). The IIS service could connect to the windows service using a NetTcp or NetNamedPipe binding if you need the IPC-like performance.
Why not just create another account with the same permission set of the ASPNET user which both the WCF service and your other service run under? That way, you have control over the password.
Ideally, the windows service should run as a WCF service, that way its easy for the client to communicate with it.
The next question is weather the 'client' needs to be a WCF service. If this client needs to serve other applications then it is appropriate, otherwise it may not be nessesary. I don't know enough about your system, so its up to you to decide what's best!