Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900