开发者

Activator.CreateInstance Works in Web Service ONLY if User is Logged in Locally

开发者 https://www.devze.com 2023-04-06 17:31 出处:网络
I have a WCF Service that impersonates a user and calls Activator.CreateInstance to create a COM Object:

I have a WCF Service that impersonates a user and calls Activator.CreateInstance to create a COM Object:

if(impersonateValidUser(impersonatedUser,impersonatedUserDomain,impersonatedUserPassword))
    {
    try
    {
        obj = Activator.CreateInstance(Type.GetTypeFromProgID("Client.Application"));
    }
    catch { }
    undoImpersonation();
}

When I am logged on to the server locally as impersonatedUser, all works as expected. Client.exe exists as a process, as does Viewer.exe. Both are created when I activate the COM Object.

However, if I am NOT logged on locally as impersonatedUser, only Client.exe is created as a process, and I get the error:

The instruction at “<address>” referenced memory at "0x00000000". The memory could not be “read.”

My only guess is that the system doesn't allocate enoug开发者_StackOverflow中文版h memory if the user is not otherwise logged on? I have no other idea what the issue could possibly be. Any suggestions?

Thank you for any and all help!


Is it possible that Viewer.exe is created after and somehow not allotted enough memory by your code? Could you activate that?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号