Last post Oct 04, 2009 04:45 PM by suthish nair
Oct 03, 2009 10:46 AM|erturkerdagi|LINK
I'm developing a ASP.NET 2.0 Project using C#. In my project I create a powerpoint file which has been initialize dynamically. In my code behind creates and imports powerpoint files using
In project reference
- I added Microsoft Office 12.0 Object Library from COM tab. (In my solution it seems Microsoft.Office.Core)
- and Microsoft.Office.Interop.PowerPoint from NET tab.
But there is an inconsequence status in here. When I run this module I can download a presentation. But after a while when I 'm importing an powerpoint file I get this error :
And all of my powerpoint modules starts givinig this error.
This is very importand for me.
Thanks for your advice.
Oct 03, 2009 11:44 AM|whighfield|LINK
Make sure that the COM components are installed/registered on any machine you are using this from (Yes office has to be installed on the server as well).
Also the accounts (NETWORK SERVICE & ASP.NET) need the proper permissions to use the COM objects. You will need to use the DCOM config tool to do this. A quick search on Google will give you the info on how to do this.
If the problem is intermittent you are pretty much on your own as Microsoft does not support nor even suggest you use Office Automation in server based applications (for this and other reasons).
Oct 04, 2009 06:32 AM|erturkerdagi|LINK
Thanks for your suggestions.
But I gived permissions to ASPNET and NETWORK SERVICE. And the errors still continue then I gived permissions to EveryOne. This point didn't solve problem. If I don't use import module my download module works successfully. But when I'm using import module,
all of my powerpoint modules start giving the errors.
Is there a suggestion ?
Oct 04, 2009 02:21 PM|whighfield|LINK
After you use your import module check out your system processes in Task Manager and make sure that the process powerpnt.exe is not listed. Realistically once your code is done it should kill this process. I know that Excel is the worst for this and have
seen dozens of EXCEL.EXE processes sitting idle on servers because the code calling them does not actually shut them down properly.
Other than that try adding the ASPNET and NETWORK SERVICE accounts to the Administrators Group and run your code.
However do not leave it like this as it's a huge security issue, you just want to try this just to make sure that it is not a permission issue.
Oct 04, 2009 03:28 PM|erturkerdagi|LINK
In my code there is a code block for killing this.
But if this occurs how can I handle this error to kill.
Oct 04, 2009 03:58 PM|whighfield|LINK
This code will have to be called even if there is an error so you probably should have a try ... catch ... finally block. The finally block should first check to see if the objects are null (Nothing in VB) before trying to call the close and quit.
Also you might want to make a call to the ReleaseComObject() method on each object and then do a Garbage collect so
Oct 04, 2009 04:08 PM|erturkerdagi|LINK
My code is in a try-catch-finally block. But now I'm adding the code about garbace.
Thanks for your suggesttions.
Oct 04, 2009 04:45 PM|suthish nair|LINK