locked
AppDomain for Excel Process RRS feed

  • Question

  • User-220424742 posted

    I am very new to the AppDomain concept. AppDomain makes perfect sense to me but I am struggling a little with the exact nuts and bolts of the code. I have a Web Service that will perform various manipulations and of Excel files. The path for those files will be passed to the Web Serice by the user. Currently I am doing this without the use of AppDomain, it all works fine except the Excel app hangs. I now know why and believe that AppDomain will correct this problem. My question is this, how do I put the "Microsoft.Office.Interop.Excel, Version=11.0.0.0" into my domain and then how do I call methods and properties for the necessary manipulations? Also where does that dll need to reside once I deploy this webservice. It's my understanding that it can't be just a reference.

    Any help you could give me would great. Thanks!

    spartacus

    Wednesday, September 12, 2007 8:53 AM

Answers

  • User-2017008401 posted

     

    it all works fine except the Excel app hangs

    Hi spartacus,

    Based on my understanding, you are using office automation in ASP.NET application. For this scenario, we cannot prevent the application from being hanged. Because it is by design that Office may exhibit unstable behavior and/or deadlock when run in server-side environment. For more information about this issue, please refer to the following link:

    Considerations for server-side Automation of Office
    http://support.microsoft.com/kb/257757/en-us
    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when run in this environment.

    To solve this issue, I recommend you to use ADO.NET for getting the data from excel file. For the demo code, please refer to the following link. I hope it is helpful to you.

    How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET
    http://support.microsoft.com/kb/316934/en-us

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 17, 2007 4:38 AM

All replies

  • User-2017008401 posted

     

    it all works fine except the Excel app hangs

    Hi spartacus,

    Based on my understanding, you are using office automation in ASP.NET application. For this scenario, we cannot prevent the application from being hanged. Because it is by design that Office may exhibit unstable behavior and/or deadlock when run in server-side environment. For more information about this issue, please refer to the following link:

    Considerations for server-side Automation of Office
    http://support.microsoft.com/kb/257757/en-us
    Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when run in this environment.

    To solve this issue, I recommend you to use ADO.NET for getting the data from excel file. For the demo code, please refer to the following link. I hope it is helpful to you.

    How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET
    http://support.microsoft.com/kb/316934/en-us

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 17, 2007 4:38 AM
  • User1998032045 posted

    please visit below link, may be will help you, which is a sample code to run your assembly within appDomain

    http://roshworldoftechnologies.blogspot.in/2013/08/working-with-multiple-appdomain.html

     

    Thursday, September 12, 2013 10:12 AM