none
Executing a process inside wcf service and hosting this wcf service in iis or windows service. RRS feed

  • Question

  • Hello,

    First of all the most important thing that I am new to WCF.

    I have created a wcf service. This wcf service has a service contract which accepts some input and launch a process(another program with GUI which takes the input as arguments) to calculate something and returns back the output. I have used a call back contract to notify the client about the process when finished and also to send the output back to client.

    Everything works fine with self hosting the service. BUT when I try to host same service in windows service or iis, the same service contract is not working. Somehow it does not start the process and just come out of the method immediately.

    I checked to implement another simple service contract to return "Hello" string and it works fine for me. So I dont see any problems with the implementation or configurations file.

    Can you please help me to identify the real problem? Could it be because of the launch of GUI with the process or something else ?

    Best regards,

    Siddharth


    Siddharth.Shinde


    Thursday, January 7, 2016 3:35 PM

Answers

  • Hi Siddharth,

    According to your description, you can host your WCF service to console application,

    that means your WCF service is correctly. So, in my opinion you can check the IIS log

    file when you host it on IIS to find the root issue. Also, you can set the trace file with WCF Service.

    For more information, please refer to the following articles:

    1. Configuring Tracing

    2.Troubleshooting Failed Requests Using Tracing in IIS 7

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    Wednesday, January 13, 2016 8:33 AM
    Moderator

All replies

  • Which wcf binding are you using? May be following link may help in implementing it.

    http://www.nichesoftware.co.nz/2011/01/13/wcf-callbacks-and-iis.html


    Gaurav Khanna | Microsoft .NET MVP | Microsoft Community Contributor

    Thursday, January 7, 2016 4:21 PM
  • Hi Siddharth.Shinde,

    According to this case, could you post some code about this issue, that will help us to reproduce

    this issue.

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Friday, January 8, 2016 5:10 AM
    Moderator
  • Hello Wanjun & Gaurav,

    Its difficult for me to share the complete code.

    But I can try to explain the scenario.

    We have a simulation software on the server and we have many clients to connect with this simulation software. For this purpose we thought of developing a wcf service which is to be installed on server.

    Clients can contact this wcf service. 

    1. This wcf service has a service contract which accepts input (could be a stringbuilder) from client and stores it in as a text file on server computer.

    2. Further it starts a process, which actually starts the simulation software which is installed on the server in a batch mode. This process takes the input file from location, process simulation(simulation can last for longer time also for eg 3-4 hours) and generates the output file.

    3. Meanwhile in the wcf service, the process waits for exit.

    4. As soon as the process exits (the output file is also generated and stored in same location), I call a call back contract which picks the output file from location and sends it back to client.

    When I am hosting my service application in console app or windows forms app. It works fine. But when I host the same application with same configuration in IIS or windows service. Its not working for me.

    I hope this helps to understand the case.

    Best regards,

    Siddharth


    Siddharth.Shinde

    Friday, January 8, 2016 8:55 AM
  • I found this thread today and it shows a similar problem that I am facing. I hope this helps.

    http://stackoverflow.com/questions/7209505/how-to-start-a-process-from-an-iis-hosted-wcf-service


    Siddharth.Shinde

    Friday, January 8, 2016 3:50 PM
  • Hi Siddharth,

    According to your description, you can host your WCF service to console application,

    that means your WCF service is correctly. So, in my opinion you can check the IIS log

    file when you host it on IIS to find the root issue. Also, you can set the trace file with WCF Service.

    For more information, please refer to the following articles:

    1. Configuring Tracing

    2.Troubleshooting Failed Requests Using Tracing in IIS 7

    Best Regards,

    Wanjun Dong


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    Wednesday, January 13, 2016 8:33 AM
    Moderator