经典 ASP 和 ITaskScheduler 访问被拒绝错误
Classic ASP and ITaskScheduler access denied error
>我开发了一个COM+服务器组件(dll),它使用ITaskScheduler和ITask接口为我工作的公司创建的特定.exe创建和编辑任务。该组件是从经典的ASP页(VBScript)调用的,是我们正在开发的办公包的一部分。整个系统使用Web界面。在Windows Server 2003/2008上的IIS下运行时,我在尝试调用例如ITaskScheduler->Enum时遇到0x80070005拒绝访问错误。这是完全有道理的,IUsr_...帐户不应有权访问任务计划程序。我为用户添加了字段以在网页上输入其凭据,然后调用 LogonUser,然后在 COM 对象中调用 ImanalogateLoggedOnUser。但是,我仍然收到拒绝访问的错误。随后对 IServerSecurity->QueryBlanket 的调用显示 COM 对象仍在IUsr_下运行。帐户。我的登录逻辑如下:
bool SystemUser::LogonUser(const wchar_t* userName, const wchar_t* domain, const wchar_t* password)
{
if(::LogonUser(userName, domain, password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &_token))
{
return true;
}
System::LogSystemError(__W_FILE__, __W_FUNCTION__, __LINE__, L"Unable to logon user: %s domain: %s", userName, domain);
return false;
}
bool SystemUser::Impersonate()
{
if(::ImpersonateLoggedOnUser(_token))
{
return true;
}
System::LogSystemError(__W_FILE__, __W_FUNCTION__, __LINE__, L"Unable to impersonate user");
return false;
}
SuccessCode::Enum SystemUser::Logon(const wchar_t* userName, const wchar_t* domain, const wchar_t* password)
{
if(!_token)
{
if(!LogonUser(userName, domain, password) || !Impersonate())
{
return SuccessCode::ImpersonateError;
}
else
{
Global::systemLog.Write(LogLevel::Information, L"Successfully logged on as user: '%s' domain: '%s'", userName, domain);
}
}
return SuccessCode::Success;
}
使用 LOGON32_LOGON_INTERACTIVE 作为登录类型没有区别。在 COM+ MMC 中设置特定角色也是如此。任何帮助或建议非常感谢。
此问题的解决方案是将登录和模拟逻辑移动到单独的 COM 对象。在创建任务计划对象的实例并调用其代码之前,需要在 ASP 和调用的登录代码中创建此实例。这样,模拟逻辑将应用于 ASP。现在可以看到 ASP 在模拟帐户下运行。
相关文章:
- Windows C++:文件夹移动访问被拒绝错误
- clang --版本权限被拒绝错误
- 如何修复 CopyFile() 错误 5 - 访问被拒绝错误
- QSSLSLSOCKETS无法解决和权限拒绝错误
- CreateFile 在尝试打开目录进行读取时始终返回错误 5(访问被拒绝)
- 运行简单 c++ 程序时出现权限被拒绝错误
- Apache HTTPD模块共享内存权限拒绝了错误
- 如何在两个设备之间与TCP通信时修复错误"连接被拒绝"
- 拒绝挥发性RVALUE到STD :: implotial rvalue的分配是错误的
- 访问被拒绝错误
- 获取错误 - 启用权限后,OpenProcess() 中的访问被拒绝
- 64位Windows API结构对齐导致命名管道上出现“拒绝访问”错误
- RegLoadKey给出错误代码5(拒绝访问)
- 使用终止进程终止"mstsc.exe"进程时出现错误代码(5)访问被拒绝
- 访问被拒绝错误 - 创建文件
- MySQL / C ++连接器错误:使用旧的(4.1.1之前)身份验证协议的连接被拒绝
- 油.dll调用 - 访问被拒绝错误80020009出错
- 经典 ASP 和 ITaskScheduler 访问被拒绝错误
- 具有"与无人共享"属性的文件夹的 SQL 访问被拒绝错误
- Python客户端- c++服务器连接被拒绝错误