Marshal.GetActiveObject throws an exception in a C# webservice but

O

OfurGørn

Hi Luke.
I have tried both

Object MyObject;
MyObject = Server.CreateObject("Acme.Component.3");

and

Test.Application ta= new Test.Application();

Neither works. The error I get for Server.CreateObject, is that the
compiler is not happy with the 'Server.' part, so I changed it to
'httpServerUtility.', but then it doesn't compile, compiling about static and
so on. (An object reference is required for the nonstatic field, method, or
property 'System.Web.HttpServerUtility.CreateObject(string)' ) - probably my
c# inexperience showing here.
In the other case, I get an exception 'COMException (0x800401F9): Error in
the DLL'. I will research further........

Best Regards,
Gunnar
 
M

[MSFT]

Hi Gunnar

I am not sure why Server.CreateObject cannot be compiled on your side.
Normally it should work in an ASP.NET application . Did you test the code
in an ASP.NET (Web service) project or others?

Luke
 
O

OfurGørn

it is a C# web service. The line giving me problems is the following

m_tstApp = (tstApplication)Server.CreateObject("tstApplication");

I tried to change the Server.CreateObject to HttpServerUtility.CreateObject,
but got then the static error I posted earlier.

regards,
Gunnar
 
M

[MSFT]

Hi Gunnar,

Have you add a COM reference for "tstApplication", the compiler may not be
able to recognize the "(tstApplication)" whitout the reference.

Luke
 
O

OfurGørn

Yes Luke.
The program is almost identical to my C# form application, which compiles
and works perfectly.

regards
Gunnar
 
M

[MSFT]

Hi Gunnar,

This is really weird. Could you please create a new ASP.NET project and
test the code? If it still didn't work, please send me the project for
further research. To get my actual email, please remove the string
"online".

Regards,

Luke
 
M

[MSFT]

Hi Gunnar,

I have perform following test on my side:

1. create a new web service project;
2. Copy the file "interop.zenOn.dll" in the package you sent me to its bin
folder.
3. Add a reference to "interop.zenOn.dll"
4. Add following code:

[WebMethod]
public string HelloWorld()
{

try
{
zenOn.ApplicationClass testApp= new ApplicationClass();

}
catch (Exception Ex)
{
return Ex.Message;
}
return "Hello World";
}

Above code can be compiled. Anyway, it failed finally because I don't have
the COM component "zenOn" installed on my computer.

If you repeat this steps, what will be the result?

Luke
 
M

[MSFT]

Hi Gunnar,

Did the application run under a local administrator account? And the
anonymous access has been disabled? For all the test, we had better run it
with local administrator group since a win form application work well.

Luke
________________________________________
From: Gunnar Gudmundsson [mailto:[email protected]]
Sent: 2005Äê2ÔÂ16ÈÕ 18:03
To: Luke Zhang
Subject: RE: C# .Net Web Service exceptions

Hello Luke

I have replied to your post in the community. The exception is the
following:

"System.Runtime.InteropServices.COMException (0x800401F9): Error in the DLL
at newZenOnWebService.newZenOnService.TestZenOn() in
c:\inetpub\wwwroot\newzenonwebservice\newzenonservice.asmx.cs:line 92"

I don't think the 3rd party app likes this method, i.e. it is a runtime
server I need data from, which I don't think I get access to with a new
instance of it.

/gunnar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top