Re: Problem marshalling SAFEARRAY from webservice



Have you considered that it may be a Code Access Security problem? Calling COM or standard libraries require a higher than normal assembly trust level.

--
Bryan Phillips
MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Web Site: http://www.composablesystems.net



"atlasgp" <atlasgp@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:3DEDFA63-CA6C-4C71-A3FE-2B50535083A0@xxxxxxxxxxxxx:

In a VC6 ATL Com server application I have the following IDL declaration:
[id(2), helpstring("method Symbols")] HRESULT test([in]SAFEARRAY(BSTR) test);

and I have the following C# code both in a .net webservice and a regular
.net application -

MyLib.MyTestClass mytest= new MyLib.MyTestClass();
String[] test= new test[3];
test[0] = "123";
test[1] = "456";
test[2] = "789";
System.Array param = (System.Array)test;
mytest.test(param);

When the call is made from the regular .net application I get a populate
SAFEARRAY ( of BSTR's ) in the COM server application. However, if the call
is made from the webservice the SAFEARRAY* comes in NULL, i.e., the
marshalling fails with calling the COM server from the webservice.

In DCOM config I have set the ASP.NET user to have launch and access
permissions to the COM object, as well as set the identity to impersonate the
interactive user, thus I don't believe that the .net user should have a
problem accessing the object. Also, other calls not passing a safearray
succeed ( for example, if I simply pass a string or an int ). Can someone
point in the right direction on resolving this issue?

.


Loading