locked
Problem trying to open Excel 2007 from a web service RRS feed

  • Question

  • I have a website running that uploads excel files.  In order to make sure the excel files are in the correct format, I call a web service, which uses the Microsoft.Interop.Excel assembly dll.  This process was set up on a production server for Excel 2003 and it worked fine.  However, we needed to upgrade its capability for Excel 2007.  I therefore set the web service up on my laptop, installed the Office 2007 PI Assemblies, and got it working fine locally.  I tried to set the same exact thing up on a test server before pushing it to production, but cannot get it to work.

     

    What happens is the web service is running under a local user account on the server, which is a local admin on the server.  The web service tries to open Excel, and inspect the document.  On my local machine, if I run task manager, Excel opens when I run the code, has activity for a couple seconds, closes, and the file uploads perfectly.  When I go do it on the server, Excel opens, has a little activity, but then just stays open in task manager and the website times out.  On my local machine, Excel opens as the ASPNET user, and on the server, it opens as the local user mentioned earlier.

     

    Here's the kicker.  When I log in to the server as the web service user, it works fine when I go to the website on my local machine.  I watch task manager on the server, Excel opens, has activity, closes, and the file uploads.  When I'm logged in to the server as another user, or not logged into the server at all, Excel hangs and doesn't ever close.  It DOES work with Excel 2003 files though when not logged in!  If it helps, the part of the code where I can debug to is the Application.Workbooks.Open function, and then when it calls this function, that's when it hangs.

     

    I'm confused, I've tried so many things and cannot figure out what it is.  Please help, it would be very greatly appreciated!  Thanks a lot!


    -Paul

    Monday, May 19, 2008 2:36 PM

Answers

  • Hey, thanks anyway guys, but I finally got it!!  After messing with the test environment for a long time with permissions and different settings, I ran all windows server 2003 updates, and activated the trial version of Excel 2007.  Excel had been on the trial period where it lets you use it for 30 times and then requires a key.  I had activated it and it still hadn't worked, so I think the solution was one of the updates for office 2007.  Of the updates, I think it was either Office suite Service Pack 1 for office 2007 or the Excel 2007 update.

    Also, in conjunction with that, I changed the application pool to run as the NETWORK SERVICE account instead of the custom user that had been set up before.

    So now, with all updates installed for the activated Excel 2007, my web site can upload an excel spreadsheet, and call the web service, which logs in as the NETWORK SERVICE account.  The web service writes the spreadsheet out to a temporary directory, opens it, checks it to make sure it is correct, closes it, deletes the temporary spreadsheet, and saves it to the database.  And it WORKS!

    Hopefully this helps if anyone else ever has this issue.

    -Paul
    • Marked as answer by David DoBell Friday, June 27, 2008 4:24 AM
    Friday, May 23, 2008 3:40 PM

All replies

  • Thank you for your posting.  After reviewing your question, we have duplicated this thread to the ASP.net Configuration and Deployment forum for visibility.

    Wednesday, May 21, 2008 4:18 AM
  •  

    Thanks Warren,

     

    The link took me to an outlook web access page though, and didn't know if you had intended on that. 

     

    Thanks again,

    Paul

    Wednesday, May 21, 2008 4:55 PM
  • Thanks Paul.  I have corrected the link above.

    Thursday, May 22, 2008 9:22 PM
  • I'm sorry, I still can't seem to find the thread on the ASPnet forum.  I've searched for it but cannot find it.  I was hoping someone had replied to it on there.  I'm still having troubles getting it to work, but I could give a bit of an update.  It seems like that's the more appropriate place to post though, is that correct?  Thanks again,
    -Paul
    Thursday, May 22, 2008 9:32 PM
  • Hey, thanks anyway guys, but I finally got it!!  After messing with the test environment for a long time with permissions and different settings, I ran all windows server 2003 updates, and activated the trial version of Excel 2007.  Excel had been on the trial period where it lets you use it for 30 times and then requires a key.  I had activated it and it still hadn't worked, so I think the solution was one of the updates for office 2007.  Of the updates, I think it was either Office suite Service Pack 1 for office 2007 or the Excel 2007 update.

    Also, in conjunction with that, I changed the application pool to run as the NETWORK SERVICE account instead of the custom user that had been set up before.

    So now, with all updates installed for the activated Excel 2007, my web site can upload an excel spreadsheet, and call the web service, which logs in as the NETWORK SERVICE account.  The web service writes the spreadsheet out to a temporary directory, opens it, checks it to make sure it is correct, closes it, deletes the temporary spreadsheet, and saves it to the database.  And it WORKS!

    Hopefully this helps if anyone else ever has this issue.

    -Paul
    • Marked as answer by David DoBell Friday, June 27, 2008 4:24 AM
    Friday, May 23, 2008 3:40 PM