dbTalk Databases Forums  

ADOMD and MDX in C# - Security Exception

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss ADOMD and MDX in C# - Security Exception in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ch
 
Posts: n/a

Default ADOMD and MDX in C# - Security Exception - 12-08-2006 , 12:05 PM






Hi,
I hope I am in the right group to post a question about the issue I am
having.

I have a web page (ASP.NET web page .aspx) that uses a NT Account (It
has read privilege on the cube) to hit a OLAP cube on a different
server and display the results from the Cube on the web page. I am
using an adomd component and build mdx queries (ALL the MDX Queries are
SELECT statements).

When I move this code to the server I get the following error after
15-16 hits to the page. Then I had to reset the IIS to make this report
work. The problem shows up again after 15-16 hits to the web page.

System.Data.OleDb.OleDbException: Initial command(s) for cube 'HR
Scorecard' failed, command = ''. The operation requested failed due to
security problems - the underlying data structures are not valid An
unexpected internal error has occurred. Initial command(s) for cube 'HR
Scorecard' failed, command = 'GRANT CELL WRITE ON CURRENTCUBE FOR ALL'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32
hr) at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orMultpleResults(tagDB
PARAMS dbParams, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior
behavior, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) at
System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior)
at
System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(Comm
andBehavior behavior) at
System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) at
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) at
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at CITReporting.MyPage.GetDataSource(String mdxQry)

Here's the method I use:

private DataSet GetDataSource(string
mdxQry)
{
DataSet dsCube = new DataSet();
OleDbConnection oleDbConn = new OleDbConnection();
try
{
oleDbConn.ConnectionString =
ConfigurationSettings.AppSettings["MyCube"].ToString();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = oleDbConn;
cmd.CommandText = mdxQry;
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd.CommandText,
oleDbConn);
adapter.Fill(dsCube, "CubeData");
}
catch(Exception ex)
{
DisplayMessage(ex.Message, ex.ToString());
}
finally
{
oleDbConn.Close();
}
return dsCube;
}

Any help with this issue is greatly appreciated.

Thanks
CH


Reply With Quote
  #2  
Old   
Jéjé
 
Posts: n/a

Default Re: ADOMD and MDX in C# - Security Exception - 12-08-2006 , 01:35 PM






if you want to use the integrated security of IIS to delegate the current
user, you have to setup the Kerberos correctly
(type "IIS Kerberos" in the serach bar on the MS web site and you'll found a
good KB about this)

Also, search on google for IIS kerberos you'll found a lot of posts about
this in this newsgroup.

good luck.


"ch" <m4frea (AT) yahoo (DOT) com> wrote

Quote:
Hi,
I hope I am in the right group to post a question about the issue I am
having.

I have a web page (ASP.NET web page .aspx) that uses a NT Account (It
has read privilege on the cube) to hit a OLAP cube on a different
server and display the results from the Cube on the web page. I am
using an adomd component and build mdx queries (ALL the MDX Queries are
SELECT statements).

When I move this code to the server I get the following error after
15-16 hits to the page. Then I had to reset the IIS to make this report
work. The problem shows up again after 15-16 hits to the web page.

System.Data.OleDb.OleDbException: Initial command(s) for cube 'HR
Scorecard' failed, command = ''. The operation requested failed due to
security problems - the underlying data structures are not valid An
unexpected internal error has occurred. Initial command(s) for cube 'HR
Scorecard' failed, command = 'GRANT CELL WRITE ON CURRENTCUBE FOR ALL'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32
hr) at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orMultpleResults(tagDB
PARAMS dbParams, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior
behavior, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) at
System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior)
at
System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(Comm
andBehavior behavior) at
System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) at
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) at
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at CITReporting.MyPage.GetDataSource(String mdxQry)

Here's the method I use:

private DataSet GetDataSource(string
mdxQry)
{
DataSet dsCube = new DataSet();
OleDbConnection oleDbConn = new OleDbConnection();
try
{
oleDbConn.ConnectionString =
ConfigurationSettings.AppSettings["MyCube"].ToString();
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = oleDbConn;
cmd.CommandText = mdxQry;
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd.CommandText,
oleDbConn);
adapter.Fill(dsCube, "CubeData");
}
catch(Exception ex)
{
DisplayMessage(ex.Message, ex.ToString());
}
finally
{
oleDbConn.Close();
}
return dsCube;
}

Any help with this issue is greatly appreciated.

Thanks
CH


Reply With Quote
  #3  
Old   
ch
 
Posts: n/a

Default Re: ADOMD and MDX in C# - Security Exception - 12-08-2006 , 02:01 PM



Hi Jéjé,
Thanks so much for your response. The NT account I am using is actually
impersonated on the server in the registry. I know that this ID is
being used for hitting the cube(the report works for 15-16 requests
before crashing), if that's something you are suggesting to look at.
My web.config file has this key:
<add key="MyCube" value="provider=msolap;Data Source=xyz;initial
catalog=abc;Integrated Security=SSPI"/>

Am I doing wrong somewhere?

Thanks,
CH


Reply With Quote
  #4  
Old   
Jéjé
 
Posts: n/a

Default Re: ADOMD and MDX in C# - Security Exception - 12-08-2006 , 02:51 PM



what is the content of the <identity> section of your web.config?

do you want to delegate the user which access the page?
or do you want to use a fixed account to access the cube?



"ch" <m4frea (AT) yahoo (DOT) com> wrote

Hi Jéjé,
Thanks so much for your response. The NT account I am using is actually
impersonated on the server in the registry. I know that this ID is
being used for hitting the cube(the report works for 15-16 requests
before crashing), if that's something you are suggesting to look at.
My web.config file has this key:
<add key="MyCube" value="provider=msolap;Data Source=xyz;initial
catalog=abc;Integrated Security=SSPI"/>

Am I doing wrong somewhere?

Thanks,
CH


Reply With Quote
  #5  
Old   
ch
 
Posts: n/a

Default Re: ADOMD and MDX in C# - Security Exception - 12-08-2006 , 04:39 PM



This is what I have:

<location path = "abc/xyz/Myreport.aspx">
<system.web>
<identity impersonate="true"
userName="registry:HKLM\SOFTWARE\YourApp\identity\ ASPNET_SETREG,userName"

password="registry:HKLM\SOFTWARE\YourApp\identity\ ASPNET_SETREG,password"
/>
</system.web>
</location>

Doing Impersonation for just this report.

Thanks
CH


Reply With Quote
  #6  
Old   
ch
 
Posts: n/a

Default Re: ADOMD and MDX in C# - Security Exception - 12-19-2006 , 09:11 AM



Any ideas? Pls help.

Thanks,
CH


Reply With Quote
  #7  
Old   
Jéjé
 
Posts: n/a

Default Re: ADOMD and MDX in C# - Security Exception - 12-19-2006 , 05:18 PM



Sorry, I don't know

I have no more ideas.
Try to track your OLAP access using the profiler

what's appends if in the code you close and reopen a new connection when the
error occurs?


"ch" <m4frea (AT) yahoo (DOT) com> wrote

Quote:
Any ideas? Pls help.

Thanks,
CH


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.