답변됨 Unable to run the process in a wcf service hosted in IIS

  • Monday, March 05, 2012 3:44 PM
     
     

    Hello ppl,

    I have developed a WCF Service in which i am using Process.Start(), the process will do the printing stuff.

    When i am running this WCF service from visual studio, it is working fine.

    But when i hosted in IIS, it is not working.

    Could anyone please help me in this regard.

    Thanks,

    Murthy.

All Replies

  • Tuesday, March 06, 2012 6:07 AM
    Moderator
     
     Answered

    Hi,


    What error message did you get while you are running your WCF service hosted in IIS? you need to make sure that you can access to the application file and also have permission to access it. Here are some similar posts to which you can refer.

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

     

    Regards,
    Peter


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

  • Wednesday, March 07, 2012 3:52 AM
    Moderator
     
     Answered

    Hello Murthy,

    Generally, it is not quite a good idea to use "Process.Start" to launch some application(which might have GUI interation code logic) in service application(such as ASP.NET webform, webservice or WCF service) hosted in IIS. Because such service application are configured to run under a machine/service account and the service process's execution context do not have GUI(like interactive logon user account session). This will cause problem whenever the certain GUI related process run into a status that demand user interaction(for example, an error or information dialog displayed), since no user to handle it, the process just blocked there.

    For troubleshooting, you can use debugger to debugging the certain process(be launched by your WCF service) to see whether it is blocked at a certain point.

    From design point of view, I would recommend you consider build a GUI app(winform or WPF or even CONSOLE) which do the printing related tasks and let the WCF service app send some notification to the GUI app so as to ask it to do the printing(or other GUI related) works. For the communiation between the to apps, you can use a netTcp or namedpipe based wcf service(hosted in the GUI app).


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.