none
Excel 2007 Office Automation in Windows 2008 64 bit server and IIS7 RRS feed

  • 問題

  • Hi, please help to solve the problem,

    I have a asp + asp.net system. This system need to use Excel object (Office automation) and power point to create the report and upload data.

    It run normal on the Vista + IIS7 + Office 2003, Vista+IIS7 + Office 2007 and Windows 2008 (32 bit) + IIS7 + Office 2007.

    However, as the client production platform use Windows 2008 (64 bit) + Office 2007. The Excel and PPT cannot open file and save file on the ASP and ASP.Net Program.  I also enable the 32 bit application on the IIS setting.

    Please help to solve!!!!!!

    thanks  a lot.

     

    2008年11月13日 上午 07:10

解答

所有回覆

  • kychiu, did you solve the problem?
    I am having a very similar issue with automating Word on IIS7/Vista 64-Bit. It works fine on all 32-bit systems (xp, 2003, vista) but not on 64-bit vista.

     

    Please if you have found a solution to your issue please post it here. Thanks

    2008年12月10日 下午 08:08
  • Hi GoodSmith,

    We cannot solve the problem. Finally, we can only use Windows 2008 64-bit. But it is work fine on Windows 2003 64-bit ( I never try 64-bit Vista before).

    Hope some one can find the solution and post it

    Thanks

    2008年12月15日 上午 02:00
  • Hi, GoodSmith,

     

    Have you tried to rebuild you ASP.net solution using 64-bit machine?  I am not sure that is way but please try as there are 32-bit and 64-bit .net framework.

     

    Hope it can help.

     

    2009年1月7日 下午 12:35
  • > It run normal on the Vista + IIS7 + Office 2003, Vista+IIS7 + Office 2007 and Windows 2008 (32 bit) + IIS7 + Office 2007.
    >
    I am having a very similar issue with automating Word on IIS7/Vista 64-Bit. It works fine on all 32-bit systems (xp, 2003, vista) but not on 64-bit vista.

    Why don't you try running it on windows 2003/2008 (
    32-bit) using hyper-v on windows 2008 (64-bit)?


    2009年1月11日 下午 04:00
  • For Windows 2003 64bit, we have to run a command in order to let it run 32bit web application.

     

    Configuring IIS to Run 32-bit Applications on 64-bit Windows

    http://technet.microsoft.com/en-us/library/cc784046.aspx

     

    There is also a thread in asp.net asking the same happen, running 32 bits application in 64 bits OS. Have a look.

    http://forums.asp.net/p/1156811/1901796.aspx#1901796

    2009年1月19日 上午 06:14
  • Hi,
    I'm using Interop.Word for saving doc file as pdf file. When I'm using my solution locally everything works fine. But when I try to run it on IIS variable doc is always null.

    This is my code:

                Word.Application word = new Word.ApplicationClass();
    
                Word.Document doc;
    
                string fullPath = Document;
    
                string fullDocPath = newDocument;
    
                object o = (object)fullPath;
    
                object missing = Type.Missing;
    
                object newObj = (object)fullDocPath;
    
                object format = (object)Word.WdSaveFormat.wdFormatPDF;
    
    
    
                doc = word.Documents.Open(ref o, ref missing, ref missing, ref missing,
    
                    ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
    
                    ref missing, ref missing, ref missing, ref missing);
    
    
    
                try
    
                {
    
                    doc.SaveAs(ref newObj, ref format, ref missing, ref missing, ref missing,
    
                        ref missing, ref missing, ref missing, ref missing, ref missing, ref missing
    
                        , ref missing, ref missing, ref missing, ref missing, ref missing);
    
                    doc.Close(ref missing, ref missing, ref missing);
    
                }
    
                catch { }
    
                
    
                word.Quit(ref missing, ref missing, ref missing);
    
                word = null;
    
    
    

    I'll go through it in sections, so I can explain what's the problem.

     
    Word.Application word = new Word.ApplicationClass();
    
    Word.Document doc;
    
    string fullPath = Document;
    
    string fullDocPath = newDocument;
    
    object o = (object)fullPath;
    
    object missing = Type.Missing;
    
    object newObj = (object)fullDocPath;
    
    object format = (object)Word.WdSaveFormat.wdFormatPDF;
    
    
    
    
    

    This part is pretty straight-forward. I create instance of word application class, and set object that will be used for opening document.

    This is where problems start:

     
    doc = word.Documents.Open(ref o, ref missing, ref missing, ref missing,
    
    ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
    
    ref missing, ref missing, ref missing, ref missing);
    
    
    
    try
    
    {
    
    doc.SaveAs(ref newObj, ref format, ref missing, ref missing, ref missing,
    
    ref missing, ref missing, ref missing, ref missing, ref missing, ref missing
    
    , ref missing, ref missing, ref missing, ref missing, ref missing);
    
    doc.Close(ref missing, ref missing, ref missing);
    
    }
    
    catch { }
    
    
    
    
    


    If I run this on wcf service, that's hosted on IIS 7.0, variable doc is always null, so nothing is done in try block. This works perfectly in local mode.

    It's not security issue, since service is run under mu account, and I'm the administrator. I have also tried adding Everyone to starting\executing section in Component Services (that's accessible through DCOMCNFG). Nothing happened.
    I don't even get an exception when I try to load file, so I don't really know the reason why it's not loading.


    Also:
    word.Quit(ref missing, ref missing, ref missing);
    
    word = null;
    
    
    
    


    This part, combined with doc.Close() (from previous segment), closes the runing instance of WINWORD.exe, that has been started, by
    Word.Application word = new
    
    Word.ApplicationClass();


    BUT!
    it only closes word executable when it's run locally. In my "server-side scenario" document isn't open, so call to doc.Close() cannot be made, and call to word.Quit() by itself doesn't stop WINWORD.exe. So it keeps running in background.

    Any ideas?
    A had similar problem with server side execution of InfoPath, but I found a way around it, but it's not working with word
    2009年6月19日 下午 02:18