ASP.net C # - WINWORD.exe

I am playing with a Microsoft text document from ASP.NET/C#.

My programs open internal documents. using

app = new Word.Application();
app.Documents.Open

it creates an instance of the winword.exe process, I see it in the task manager.

even if I close the doc with close()and app.quit(). he must kill the process. but this process is not killed.

any idea how to kill this process programmatically.

+3
source share
7 answers

To begin with, I agree with Arthur and Ivo: do not use Word automation on the server ... it is not supported and it is painful.

  • , / Word DOCX ( XML-, , .NET Framework pre-Office 2007 )
  • , , (ala Ivo answer)

Word:

Winword.exe , , .

: , . , . , AppPool ( ). :

  • , ,
  • "dcomcnfg"
  • → → → COM +
  • " Microsoft Word" ( "{000209FF-0000-0000-C000-000000000046}" ) →
  • "" → " " → ""
  • "" AppPool
  • 5-6, " "

, winword.exe AppPool , , .

+5

Office "" . excel.

50 Excel

+2

System.Diagnostics.Process.GetProcessesByName System.Diagnostics.Process.Kill

-

string processName = "ProcessName";
Process[] processes = Process.GetProcessesByName(processName);

foreach(Process process in processes)
{
    process.Kill();
}
+2

:

foreach(Process p in System.Diagnostics.Process.GetProcessesByName("winword"))
 {
   p.kill();
   p.WaitForExit();
 }

, null?

+1

(Microsoft) Office , Word ( Office), , . , asp. , , asp . .

. , , .

+1

, . - , COM-, . - .

0

, : Office . WebApplication.

- , Office . .

Office ( WordML, Office XML), .

0

Source: https://habr.com/ru/post/1724426/


All Articles