Service Running on Hyper-V Virtual Machine


hello,

i have service application when starting creates windows station/desktop environment , runs process in it. perform following steps, done under local system. (this done in c#.)

  • log on user , load user profile want run process under.
  • set session user logon token 1.
  • create window station, switch current station new, , add interactive desktop.
  • add ace new window station , desktop allowing logged on user full access.
  • impersonate logged in user.
  • create environment block process.
  • run process using createprocessas
  • after unload user profile, revert user self , window station.

the application service starts attempts create system.threading.semaphore following code:

bool created = false;
semaphoresecurity semsec = new semaphoresecurity();
semaphoreaccessrule rule = new semaphoreaccessrule(usersid, semaphorerights.fullcontrol, accesscontroltype.allow);
semsec.addaccessrule(rule);
using (system.threading.semaphore lsemp = new system.threading.semaphore(0, 1, eventid + "_done", out created, semsec))
{

// stuff

}

i have tested code on windows 2003, windows 2008,  vista, windows 7, , windows 2012 , works fine when installed on box or using vmware virtual machine. had test on hyper-v virtual machine fails following error.

[10/28/2013 09:21:23](1776): myprocess => starting new thread process.
[10/28/2013 09:21:23](1776): myprocess => exception caught.
[10/28/2013 09:21:23](1776): myprocess => access port denied.
[10/28/2013 09:21:23](1776): myprocess =>    at system.io.ports.internalresources.winioerror(int32 errorcode, string str)
   at system.threading.semaphore..ctor(int32 initialcount, int32 maximumcount, string name, boolean& creatednew, semaphoresecurity semaphoresecurity)
   at myprocess(object parameter)

so far exception on windows 2008 64b r2, have tested , windows 2012. have tried using worldsid semaphore access rule, local admin account logged on user, , given local admin account permission act operating system. same exception. 

other items of note:

  • only happens named system objects, eventwaithandles , wcf named pipes well. (a non-named semaphore can created.)
  • i able create system objects if run application in session 0.

anyone have idea why might be?

people lurk in forum tend not c programmers - more hyper-v administrators , powershell or wmi.  yes, may still keep hands in programming, going have more luck getting questions answered in msdn forum

.:|:.:|:. tim



Windows Server  >  Hyper-V



Comments

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS