Hi Luke.
I wrote a VERY simple application to test Word. First, I wrote it as a C#
form application, and when that worked, I wrote it as a web service. The
"good" news is that I get exactly the same error as in the other one. The
code follows:
/******* CODE *******/
public Word.Application wordApp;
[WebMethod]
public string isWordThere()
{
// impersonate - unneccessary for form
if (impersonateValidUser("Administrator", "localhost", "password"))
{
try
{
// get the active object
wordApp = Marshal.GetActiveObject("Word.Application.11") as
Word.Application;
// stop impersonation
undoImpersonation();
// AOK - return a string to say so
return "AOK: word is running !!!! ";
}
catch (System.Exception ex)
{
undoImpersonation();
// exception - return it to see it
return "exception: "+ex.ToString();
}
}
else
{
// I dont think I need to undo a failed impersonation....
undoImpersonation();
// tell the user that the impersonation failed
return "impersonation failed";
}
}
/******* END CODE *******/
The thing is, I can use word if I dont use Marshal.GetActiveObject(), but
use appWord = new Word.Application() in stead. I haven't tried that in my
application, and the reason for that is that the supplier of the software
expects me to use the Marshal method.
The impersonation code is from one of microsofts articles mentioned before
in this thread - therefore not copied into this reply.
As before, I get the following error:
/***** ERROR *****/
System.Runtime.InteropServices.COMException (0x800401E3): Operation
unavailable
at System.Runtime.InteropServices.Marshal.GetActiveOb ject(Guid& rclsid,
UInt32 reserved, Object& ppunk)
at System.Runtime.InteropServices.Marshal.GetActiveOb ject(String progID)
at OfiiceWebService.OfficeService.isWordThere()
in c:\inetpub\wwwroot\ofiicewebservice\officeservice1 .asmx.cs:line 101
/***** END ERROR *****/
I am going to experiment with a Marshal-less version of my software, but to
indulge the external software provider (and my boss

), I want to have a
Marshal version working at some point.
I have been experimenting with the dcomcnfg utility to grant permissions for
my application and word, but with no luck.
I am getting more sure that the error has a trivial solution - which I
cannot see.
regards
Gunnar
"[MSFT]" wrote:
> Hi Gunnar,
>
> Based on my experience, some component may work in a winform but not in a
> web service (ASP.NET) application. This is caused by security and many
> other issues, for example, we cannot perform any UI related operation in a
> web service. What is the result you test with Word?
>
> Luke
>
>