在我的应用程序中,我正在将数据读取到数据库,然后我想启动集成服务以将数据导入多维数据集。这是我用来从 SSMS 启动它的命令:
execute master..xp_cmdshell 'dtexec /DTS "\MSDB\B_Costs" /SERVER . /CHECKPOINTING OFF /REPORTING V'
但是如何从我的应用程序中使用它?我一开始就有这个错误:
对象'xp_cmdshell',数据库'mssqlsystemresource',模式'sys'的EXECUTE权限被拒绝。
在使用这样的命令之后:
GRANT EXECUTE ON xp_cmdshell TO [IIS APPPOOL\DefaultAppPool]
我还有一个错误:
xp_cmdshell 代理帐户信息无法检索或无效。验证“##xp_cmdshell_proxy_account##”凭据是否存在并包含有效信息。
当我检查时,我在Database Engine -> Security -> Credentials中没有凭据。
我想使用这样的命令:
EXEC sp_xp_cmdshell_proxy_account 'IIS APPPOOL\DefaultAppPool', 'password'
但我不知道我应该在“密码”中写什么。有什么建议么?
这是我的 CubeController:
public ActionResult Index()
{
string sql = "execute master..xp_cmdshell 'dtexec /DTS \"\\MSDB\\B_Costs\" /SERVER . /CHECKPOINTING OFF /REPORTING V'";
try
{
MyEntity.Database.ExecuteSqlCommand(sql);
}
catch (Exception e)
{
string error = "There was an error: <br />" + e.Message;
TempData["Message"] = error;
}
return RedirectToAction("Index","Home");
}