Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > calling unmanged c-dll from webservice

Thread Tools

calling unmanged c-dll from webservice

Nicki Carstensen
Posts: n/a
hi all

I have a class that hooks up to a matlab engine dll that looks something
like this:
class MatlabConn
IntPtr engine;

static extern IntPtr engOpen(string startcmd);

engine = engOpen(null);
if(engine == IntPtr.Zero)
throw new NullReferenceException("engine creation failed");
When the code is used in a winform app it works perfectly, but when i
try to use it in a webservice, the call til engOpen returns null and
thus the exception is thrown. engOpen is supposed to start a Matlab
provcess and as far as I understand it does so via COM but the
libeng.dll is not a COM-dll itself. I've tried to switch impersonation
context like this:

void DoStuff()
IntPtr hToken;
LogonUser("Administrator", ".", "pass", 3, 0, out hToken);
WindowsIdentity id = new WindowsIdentity(hToken);
WindowsImpersonationContext wic = id.Impersonate();
MatlabConn matlab = new MatlabConn();
Then it works fine, but I'm not very fond of having to use the local
administrator account directly in code.
Is there a way to use a non-admin user instead og the admin, or is it
possible to allow the aspnet/network serivce account to launch the
matlab process?

Thanks in advance, and sorry for the novel

Nicki Carstensen
remove the car in my email
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem! calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 1 01-26-2006 12:05 PM
Problem! calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 0 01-26-2006 08:13 AM
Calling a webservice from a webservice ASP .Net Web Services 2 04-20-2005 02:02 PM
ASP.Net and Excel Process is not killed. Unmanged code problems =?Utf-8?B?UHJhdmVlbiBL?= ASP .Net 2 10-08-2004 06:15 AM
Webservice calling a webservice.....Error Peter Nordström ASP .Net Web Services 0 10-21-2003 12:02 PM