Win 2k3 IIS Word XP Not enough storage is available to complete this operation

Hi all,

We've been searching the web and trying all sorts of things but to no avail. Can anyone help?

Let me fill you in...
Windows 2003 Server, IIS running an ASP.NET application on a virtual server (using VMWare)
Word 2003 is being automated from inside a webservice using: CreateObject("Word.Application")

Word loads a template, does some merging based on some SQL data and saves the resulting file. The called webmethod then returns the filename to the client which they open .......

This code has been installed on over 20 sites so far. We've had various problems with read-only documents coming through etc but all have been solved. This is the latest installment:
Completely randomly the word application fails to quit (the last line of code before returning to the client).
The error given is: "not enough storage is available to complete this operation"

A reboot sorts the problem for the first couple or three attempts, then the error starts again. Clearing down temporary files through IE works again for a couple of times but then it happens again.

The server is beefy, with plenty of hard drive space and ram (a few GB of each).
We found out about the virtual server part late so to make sure that our instance was getting enough memory we manually set the page file size to between 1536MB and 3072Mb (doubling the size previously allocated) but again no help.

We've written a VB.NET app which literally loads word, reads the version then quits and this runs fine. Now true we're not doing any merging here so thats probably the next stage but I'm seriously starting to run out of ideas!

If anybody has any help or suggestions, please reply

Many thanks
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Maybe a garbage collection issue?  Microsoft strongly advises against serving word through IIS due to problems with deadlocks etc, you might be finding this problem.

How are you quitting word?  with             oWordApp.Quit() ?

sarahclementsAuthor Commented:
I know we shouldnt be using word in automation, BUT, how are we supposed to generate word documents automatically?  I cant beleive we are the only ppl in the world who want todo this!

But yes.  The command the routine is failing on is l_objWord.Quit.  AND the word does quit (ie it disappears out of the task list!)

You aren't the only people, I have done exactly the same with no problems.  I am going to be changing the system as soon as is humanly possible though.  We run crystal reports and that has an export to pdf function that can be accessed programmatically.  Anyway, I digress...

I did have to add a MAPI filter on mine in IIS to handle the .docs, more from a security standpoint though.

Heres how I instantiate the object ....

        Dim missing As Object = System.Reflection.Missing.Value
        Dim fileName As Object = "C:\\test.doc"
        ' template file name
        Dim newTemplate As Object = False
        Dim docType As Object = 0
        Dim isVisible As Object = True
        Dim oWordApp As Word.ApplicationClass = New Word.ApplicationClass

            Dim oWordDoc As Word.Document = oWordApp.Documents.Open( _
                fileName:=fileName, _
                ConfirmConversions:=False, _
                ReadOnly:=False, _
                AddToRecentFiles:=False, _
                PasswordDocument:="", _
                PasswordTemplate:="", _
                Revert:=False, _
                WritePasswordDocument:="", _
                WritePasswordTemplate:="", _

Heres how I close it ...

            oWordDoc.SaveAs("C:\\Inetpub\\wwwroot\\SharedDir" & docName) 'SearchForMe.doc")

            Return docName
        Catch ex As Exception

Not sure if this will work in place of your create object statement.  Don't forget to add the object model to references.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sarahclementsAuthor Commented:
It would appear that it is something todo with the instance of our VM machine. After reinstalling it, all works fine.... Great!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Storage Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.