Visual studio 2010 Word 2010与Visual Studio 2010的集成

Visual studio 2010 Word 2010与Visual Studio 2010的集成,visual-studio-2010,ms-word,office-2010,Visual Studio 2010,Ms Word,Office 2010,我使用的代码在Visual Studio 2010集成Web服务器中运行良好,但在IIS上部署时,**行出现错误: Word.Application oWord = new Word.Application(); Word.Document oWordDoc; //= new Word.Document(); object breakPage = Word.WdBreakType.wdPageBreak; oWord.Visibl

我使用的代码在Visual Studio 2010集成Web服务器中运行良好,但在IIS上部署时,**行出现错误:

        Word.Application oWord = new Word.Application();
        Word.Document oWordDoc; //= new Word.Document();
        object breakPage = Word.WdBreakType.wdPageBreak;

        oWord.Visible = false;
        oWord.Options.set_DefaultFilePath(Microsoft.Office.Interop.Word.WdDefaultFilePath.wdUserTemplatesPath, Server.MapPath(TemplatesFolder)); //@"D:\Presentationalism\Presentationalism\Presentations\Templates");

        Object oTemplatePath = Server.MapPath(TemplatesFolder + templates[ddTemplates.SelectedIndex]);
        **oWordDoc = oWord.Documents.Add(ref oTemplatePath, ref oMissing, ref oMissing, ref oMissing);**

        oWordDoc.Activate(); 
错误如下:

Word was unable to read this document.  It may be corrupt.
Try one or more of the following:
* Open and Repair the file.
* Open the file with the Text Recovery converter.

如何修复它?

您的IIS是否在同一台机器上?word 2010是否在IIS服务器上?您确信IIS服务器上的文档路径是正确的吗?我不确定您要做什么,但我建议,如果您想立即操纵Word文档并且使用IIS,您应该考虑使用。openXml@AndrewIIS在同一台计算机上,它似乎可以与VisualStudio2010的集成Web服务器配合使用,但不能与IIS配合使用。它有什么问题?