首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“访问被拒绝”LOGON32_LOGON_SERVICE

“访问被拒绝”LOGON32_LOGON_SERVICE
EN

Stack Overflow用户
提问于 2013-01-04 21:21:31
回答 2查看 4.3K关注 0票数 3

我试图使用advapi32模拟网络服务。

代码语言:javascript
复制
LogonUser("NETWORK SERVICE", "NT AUTHORITY", null, LOGON32_LOGON_SERVICE, LOGON32_PROVIDER_DEFAULT, ref token)

但是继续在Windows 8机器上获取Access is denied错误。有什么想法吗?(我搜索了很多,但找不到答案)。

代码语言:javascript
复制
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">        
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
      <applicationRequestMinimum>
        <defaultAssemblyRequest permissionSetReference="Custom" />
        <PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
      </applicationRequestMinimum>
    </security>
  </trustInfo>
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application />      
  </compatibility>  
</asmv1:assembly>

编辑:

因此,经过几次尝试,模拟似乎是有效的,但我永远无法作为主机的网络服务进行身份验证。应用程序池如何在网络服务下运行?

使用

代码语言:javascript
复制
LOGON32_LOGON_SERVICE

在以下方面的成果:

代码语言:javascript
复制
Unhandled Exception: System.ComponentModel.Win32Exception: Access is denied
   at Tools.Network.Impersonator.Impersonate(String userName, String domainName,
 String password, LogonType logonType, LogonProvider logonProvider)
   at Tools.Network.Impersonator..ctor(String userName, String domainName, Strin
g password, LogonType logonType, LogonProvider logonProvider)
   at Impersonation.Program.Main(String[] args)

使用

代码语言:javascript
复制
LOGON32_LOGON_NEW_CREDENTIALS

在以下方面的成果:

代码语言:javascript
复制
System.IO.IOException: Logon failure: unknown user name or bad password.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Bo
olean overwrite)
   at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean ov
erwrite)
   at Impersonation.Program.Main(String[] args)

迷惑了。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-01-10 18:26:11

终于来了!我找到了一个答案:

我如何作为‘网络服务’运行?

http://geek.hubkey.com/2008/02/impersonating-built-in-service-account.html

在Windows 8..。“微软已经改变了Windows8/ Windows 2012中的默认行为。要允许交互式服务,您需要找到注册表项HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows,并将NoInteractiveServices从1更改为0。”

票数 3
EN

Stack Overflow用户

发布于 2013-01-04 23:55:57

这是一个非常好的链接,它有代码和所有东西,我认为这是您可能正在寻找的东西。请告诉我这个链接是否有用。

WINNT50作为登录提供程序类型。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14165173

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档