In my app I'm reading data to database and then I want to start Integration Serivces to import the data into the cube. This is the command, which I use to start it from SSMS:
execute master..xp_cmdshell 'dtexec /DTS "\MSDB\B_Costs" /SERVER . /CHECKPOINTING OFF /REPORTING V'
But how use it from my app? I've got this error at the begining:
The EXECUTE permission was denied on the object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys'.
And after use such command:
GRANT EXECUTE ON xp_cmdshell TO [IIS APPPOOL\DefaultAppPool]
I've got another error:
The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.
And as I checked I have no credentials in Database Engine -> Security -> Credentials.
I wanted use such command as:
EXEC sp_xp_cmdshell_proxy_account 'IIS APPPOOL\DefaultAppPool', 'password'
But I don't know what should I write in 'password'. Any suggestions?
This is my 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");
}