none
i can't open word office on iis7 RRS feed

  • Question

  • I am opening a word document in asp.net form, that works fine when i check it using 'View in browser' in my visual studio, but when i publish that on local iis and open directly from browser using web server address, it cant open file, and server just running and running, no responce, I am using visual studio 2010, and Microsoft Office 2007, Here is the code I am using :

    Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();

    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "New" + ".docx");

    object fileName = path;

    object readOnly = false;

    object startIndex = 0;

    object isVisible = true;

    object missing = System.Reflection.Missing.Value;

    WordApp.Visible = true;

    Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();

    please help me it's urgent thanks

    Tuesday, November 8, 2011 12:38 PM

Answers

All replies

  • hi

    i use in my project in word office and i published that on iis7, i can't open the office

    please help me how to it do

    thanks

    Sunday, November 6, 2011 2:05 PM
  • hi

    i in my project use of word office

    when i published on iis7 , i can't open word office

    please help me, it's urgent

    thanks

    Sunday, November 6, 2011 2:23 PM
  • Hi vahidbakhtiary,

     

    Thanks for posting in the MSDN Forum.

     

    Would you please clarify whether you project is a Word document-level project, and you published the project via copy Word document to the iis7 server machine?

     

    In my opinion, the publish mean create a click once deployment and update to the webserver. Do you have any trouble to publish click once deployment for your project.

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, November 8, 2011 2:48 AM
    Moderator
  • Hi Vahidbakhtiary,

    Thank you for posting.

    I found that you want to do server side automation of Office, as far as I know, Microsoft does not recommend or support server side automation, for more details, please refer to this article:

    http://support.microsoft.com/kb/257757

    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, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    So, you may need to take consideration of the alternative technologies which are describled in the article. Hope this can give you some hint.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, November 8, 2011 8:35 AM
  • thanks for your answer

    i in my project use of this code in button :

      Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application(); 

    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "New" + ".docx");

                object fileName = path;
                object readOnly = false;
                object startIndex = 0;
                object isVisible = true;
                object missing = System.Reflection.Missing.Value;

                WordApp.Visible = true;

                Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();

    i in visual studio when click on button,to be open word office but when i published on iis7 ,when i click on button ,don't open word office

    please help me

    Tuesday, November 8, 2011 8:48 AM
  • Hi vahidbakhtiary

    In this case, you aren't using the VSTO technology, so your question needs to be in the Word for Developers forum, or on a forum that supports IIS.

    FWIW, the Office applications were not designed to run in a Server environment. See ( http://support.microsoft.com/kb/257757/en-us). And, while it is possible (as outlined in the article), it's not supported and you can run into permissions problems. That's why asking on a forum that supports IIS and similar technologies might be the better place to ask - those people are aware of what you need to do in order to automate Office from that kind of environment.

    From the look of your code, it appears the reason you want to automate Word is in order to generate Word documents? Have you considered using the Office Open XML file format? That lets you create and manipulate Word documents without the Word application. You can do it with the standard XML and Packaging namespaces in the .NET Framework. Microsoft has even released a set of tools - the Open XML SDK - for Visual Studio. You can find more information about this at OpenXMLDeveloper.org.


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bruce Song Wednesday, November 16, 2011 7:43 AM
    Tuesday, November 8, 2011 9:51 AM
    Moderator
  • thanks

    namely i can't open office from iis

    if possible more help me

    it's urgent

     

    Tuesday, November 8, 2011 12:02 PM
  • I am opening a word document in asp.net form, that works fine when i check it using 'View in browser' in my visual studio, but when i publish that on local iis and open directly from browser using web server address, it cant open file, and server just running and running, no responce, I am using visual studio 2010, and Microsoft Office 2007, Here is the code I am using :

    Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();

    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "New" + ".docx");

    object fileName = path;

    object readOnly = false;

    object startIndex = 0;

    object isVisible = true;

    object missing = System.Reflection.Missing.Value;

    WordApp.Visible = true;

    Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();

    please help me it's urgent thanks

    Tuesday, November 8, 2011 2:11 PM
  • I am opening a word document in asp.net form, that works fine when i check it using 'View in browser' in my visual studio, but when i publish that on local iis and open directly from browser using web server address, it cant open file, and server just running and running, no responce, I am using visual studio 2010, and Microsoft Office 2007, Here is the code I am using :

    Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();

    var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "New" + ".docx");

    object fileName = path;

    object readOnly = false;

    object startIndex = 0;

    object isVisible = true;

    object missing = System.Reflection.Missing.Value;

    WordApp.Visible = true;

    Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();

    please help me it's urgent thanks

    Tuesday, November 8, 2011 2:12 PM
  •  

    i in my project use of this code

    in visual studio when i click on button i can open office but published it on iis ,when i click on button i can't open office

    Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();

    Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();

    WordApp.Visible = true;

    please help me

    Tuesday, November 8, 2011 2:41 PM
  • i in my project use of this code in button :

      Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application(); 


                object missing = System.Reflection.Missing.Value;

                WordApp.Visible = true;

                Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();

    i in visual studio when click on button,to be open word office but when i published on iis7 ,when i click on button ,don't open word office

    please help me it's urgent

    Tuesday, November 8, 2011 2:44 PM
  • i try this code

     Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
            Response.Write("1");
            Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();
            Response.Write("2");
            WordApp.Visible = true;
            Response.Write("3");

     

    and when i run it wite 1 ,2 ,3

    but just can't open office

    Tuesday, November 8, 2011 2:51 PM
  • i try this code

     Microsoft.Office.Interop.Word.Application WordApp = new Microsoft.Office.Interop.Word.Application();
            Response.Write("1");
            Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Add();
            Response.Write("2");
            WordApp.Visible = true;
            Response.Write("3");

     

    and when i run it wite 1 ,2 ,3

    but just can't open office

    Tuesday, November 8, 2011 2:51 PM
  • i think don't know iis Microsoft.Office.Interop.Word

     

    Tuesday, November 8, 2011 5:02 PM
  • i think don't know iis Microsoft.Office.Interop.Word

     

    Tuesday, November 8, 2011 5:02 PM
  • HI vahidbakhtiary,

     

    I’m afraid your snippet on IIS server side. Please notice the KB http://support.microsoft.com/kb/257757. If you want to create a Word document on IIS side I would recommend you use OpenXml SDK. You will find support at this forum http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/threads. As you mentioned “Open” Word document on IIS side, I suppose you want to open Word document at the web browser. Is it right?

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, November 9, 2011 7:48 AM
    Moderator
  • thanks for your answer

    i don't open word document at the web browser

    i want open word office in every client

    please help me

    Wednesday, November 9, 2011 8:27 AM
  • Vahidbakhtiary, though the problem is server side automation and is not in the support scope, I have an article for you to reference:

    http://www.codeproject.com/KB/aspnet/word_automation.aspx

    Hope this can give some hint and address the problem. If not, I suggest you use Open XML technology or sharepoint related. Good luck.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Bruce Song Monday, November 21, 2011 12:44 PM
    • Marked as answer by Bruce Song Friday, November 25, 2011 11:10 AM
    Friday, November 11, 2011 7:20 AM