Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET2.0
Hi Guys,

Can anyone please help me in get rid of this error. I have an application which will generate offer letter in word format. When there are many winword process opened in the server i am getting error message "the message filter indicated that the application is busy rpc_e_servercall_retrylater".

Is there any way to prevent this error message occuring.

I am using c# language to develop the code.


Here is my code for opening & closing word document.

public WordTemplate()
{
objWApp = new Word.ApplicationClass();
}

public void OpenWord()
{
try
{
object objMissingValue = System.Reflection.Missing.Value;
objDoc = objWApp.Documents.Add(ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue);
objDoc.Activate();
}
catch (Exception ex)
{
throw ex;
}
}

public void OpenWord(string strFileName)
{
try
{
object objMissingValue = System.Reflection.Missing.Value;
object objFileName = strFileName;
object objIsReadOnly = false;
object objIsVisible = true;
objDoc = objWApp.Documents.Open(ref objFileName, ref objMissingValue, ref objIsReadOnly, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objIsVisible, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue);
//objDoc = objWApp.Documents.Open(ref objFileName, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue, ref objMissingValue);
objDoc.Activate();
}
catch (Exception ex)
{
throw ex;
}
}
public void Close()
{
try
{
object objMissingValue = System.Reflection.Missing.Value;
objWApp.Quit(ref objMissingValue, ref objMissingValue, ref objMissingValue);

}
catch (Exception ex)
{
throw ex;
}
finally
{
objDoc = null;
objWApp = null;
GC.Collect();
GC.WaitForPendingFinalizers();
}
}


Thanks,
Prashant
Posted 21-Feb-13 17:04pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 199
1 Sergey Alexandrovich Kryukov 154
2 Sascha Lefévre 120
3 Abhinav S 104
4 Rana Waqas 78
0 Sergey Alexandrovich Kryukov 6,628
1 OriginalGriff 6,298
2 Peter Leow 2,534
3 Maciej Los 2,437
4 Abhinav S 2,378


Advertise | Privacy | Mobile
Web04 | 2.8.150414.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100