Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Tuesday, 20 March 2012

Connect to Analysis Services with specific username

Hello,

We are trying to develop an ASP .Net web application that connects to an SQL Server 2005 analysis services and executes MDX statements. We want the connection to be made using a specific user name that we specify in the code rather than having the web application inherit the logged on domain user account.

We tried to specifiy the user name in the connection string as follows, but it is still taking the logged in user account rather than the one specified.

Microsoft.AnalysisServices.Server s = new Microsoft.AnalysisServices.Server();

s.Connect("Provider=MSOLAP.3;Password=123;Persist Security Info=True;User ID=domain\username;Data Source=<server ip>;Initial Catalog=<analysis DB>");

Is this possible?

Note that if we are using the OLEDB 9.0 provider for Analysis Services to connect an excel sheet to the analysis database we can easily specify the user name and password, so is there a similar way to do the same from a .Net application?

Any feedback is appreciated, thanks,

Grace

If you want to use a Windows Indentity, then you can′t. For other connection options refer to the connection properties which are shown e.g. here:

http://www.ssas-info.com/ssas_articles/ssas_articles/analysis_services_2000_and_2005_connection_string_properties.html


Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

Thanks Jens,

The link helped a lot. We were able to connect using specific Roles and that is what we were looking for exactly but didn't know it exists.

Grace

Connect to Analysis Manager via VB2005

Does anybody know how to use VB2005 or VB.NET to connect to analysis manager to extract the CUBE information?

Can I have a sample program? I'm very stuck.

Thanks in advance :)

Check out AMO for the cubes metadata
or ADOMD.net to query the cube

There are some examples on those pages, and there are more in the sql server samples.

C

Connect to a server from client

I'm receiving ths following error message when I try to connect to my server:
Cannot generate SSPI context. (.Net SqlClient Data Provider)
An idea?
Check this article:
http://blogs.msdn.com/sql_protocols/archive/2005/10/19/482782.aspx
Ayad Shammout
"Joseph" <Joseph@.discussions.microsoft.com> wrote in message
news:C22E4CA3-2289-47B0-B009-C7D63E590B78@.microsoft.com...
> I'm receiving ths following error message when I try to connect to my
> server:
> Cannot generate SSPI context. (.Net SqlClient Data Provider)
> An idea?

Thursday, 8 March 2012

Conn Obj

Hi All -

Prior to ASP .Net I use to create a connection object for SQL Server in my global.asa file and I would reference the obj whenever needed. how can I do the same in asp .net.

Here is my old asp sample:

Global.asa file:

Sub Session_OnStart

set session("conn") = createobject("adodb.connection")
session("conn").Open "PROVIDER=MSDASQL;DRIVER={SQL Server};SERVER=xxx.xxx.xxx.xxx;DATABASE=xxxxx_db;UID=xx;PWD=xxxxxxxx;"

End Sub


Call from Other Pages:

sqlstr = "select * from members WHERE memberid = '" & session("mbr_memberno") & "'"
set objRS = session("conn").Execute(sqlstr)

... How can I do this in .net?

rich

You can do a similar thing in ASP.NET using the global.asax file.Though, I would caution against it: check out this article for somereasons why you want to avoid this:
http://www.codeproject.com/asp/dbobjects.asp
Jason

|||

So is it better to just set session variables for servername, uid and pass so if it changes its in one file rather than shifting through tons of code replacing sql server names. Also if I do create a session var of these items can I call them in the vb.net portion of the code?

rich

|||web.config is the place to do it...there's an article on my blog on how to do it..check it out.|||The proper way to do it is to store the connection string itself in theweb.config (as the previous post suggests -- though others say thatstoring usernames and passwords in an unecrypted format is a bad idea-- trusted connections are better they say) and instantiate theconnection object and close the connection object on each page.
Jason
|||

You can encrypt the connection string and put it in the web config. There's a good example of doing so here:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT08.asp

Wednesday, 7 March 2012

Confusion about dialog security steps.

Hi There

I have done the following.

2 Servers across the net work Server A and Server B.

I have created private keys at each and copied to public keys across.

I create an endpoint at each with validation by the certificates. I then create appropriate users and logins at each and import the public certificates with authorization to the users who have send permission on the endpoints.

That is transport security sorted and it works.

Now from what i have learnt from examples, to setup dialog security i do the following.

create a private key in each DB :

create certificate Store001DialogPri

with subject = 'Store001DialogPri',

start_date = '07/20/2006'

active for begin_dialog = on;

go

I then copy the public key to each server, create a user only in each DB and import the public keys with authorization on the user. And grant send to the appropriate servcies to the user.

I then create appropriate remote service bindings with this user.

Now this works for me. Everythign seems A OK.

However i am going thorugh the Service Broker "bible", and there are a ton of steps i am not doing but my setup works ?

Steps i am not doing for example is when i create the private keys in the DB i should authorize them to a user i create who is then gratnted CONTROL permission on the SERVICES.

Now i do not do this but everything seems to be working. I thought i finally understood dialogs security but now i am totally confused ?

Is what i am doing correct ? If so why are these all these additinal steps mentioned ? WHat am i missing ?

Thanx

The AUTHORIZATION and CONTROL steps in the samples are needed if you are performing these steps for somebody else. You test probably ended up with all the services being owned by [dbo], (you are sysadmin on the test machine, aren't you?), and the certificates with private keys also being owned by [dbo], so it just worked. But in real life, you might have to do this setup steps for a service owned by a different database user, so in that case is important to associate the private key with the service owner.

HTH,
~ Remus

|||

Hi Remus

Yes everything should be owned by dbo, however i do not see any otehr users coming into the SB application, so therefore i shouldnot have to do these steps?

Thanx for the feedback

Friday, 24 February 2012

Conflicting docs on how to render

I am trying to use the render method to render to a byte array in an ASP.Net application and I am having a problem in that there is a lot of conflicting information in the books and the docs on how to do this. The latest docs I read led to the following code...

ReportingService2005 _rs = new ReportingService2005();

//have to use custom credentials because ASPNET does not have sufficient authority...
NetworkCredential myCred = new NetworkCredential("myuserid", "mypassword", "mydomain");
CredentialCache myCash = new CredentialCache();
myCash.Add(new Uri("http://localhost/myWebSiteName"), "NTLM", myCred);
_rs.Credentials = myCash;
_rs.Url = "http://localhost/ReportServer/ReportService2005.asmx";

//we just have one parameter...
ParameterValue[] Parameters = new ParameterValue[1];
Parameters[0].Name = "myReportID";
Parameters[0].Value = argmyReportID;

//Render the report to a byte array...
byte[] data;
data = _rs. oops there is no Render method!!

The first docs I read (WROX BOOK on SSRS2005) said to use the ReportingService class but there is no such class. I then found docs saying to use ReportingService2005 class as I did above. But that class has no Render method. Today I found other docs that say to use ReportExecutionService class.

Why are there so many conflicting docs. What class am I supposed to use to do a render?

Thanks,
Gary

This one here worked for me:

ReportServices.ReportingService rs = new ReportServices.ReportingService();

rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

byte[] ResultStream; // bytearray for result stream

string[] StreamIdentifiers; // string array for stream idenfiers

string OptionalParam = null; // string out param for optional parameters

ReportServices.ParameterValue[] optionalParams = null; // parametervalue array for optional parameters

ReportServices.Warning[] optionalWarnings = null; // warning array for optional warnings

ResultStream = rs.Render("/ReportProject1/Report1", "HTML4.0", null,

"<DeviceInfo><StreamRoot>/RSWebServiceXS/</StreamRoot></DeviceInfo>", null, null,

null, out OptionalParam, out OptionalParam, out optionalParams,

out optionalWarnings, out StreamIdentifiers);

After creating a webServices proxy class on ReportService.asmx.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

I get an error on

ResultStream = rs.Render(My.Settings.ReportPath, "PDF", Nothing, "<DeviceInfo><StreamRoot>/RSWebServiceXS/</StreamRoot></DeviceInfo>", Nothing, Nothing, _

Nothing, OptionalParam, OptionalParam, optionalParams, _

optionalWarnings, StreamIdentifiers)

it says that "render" is not a member of reportService. any ideas?

|||Which WebService (*.asmx) did you reference ?

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

I am using both the reportExecution and ReportService. After struggling with it for a while I went and looked at the renderand save sample that someone had pointed out earlier. This time the code actually worked with some minor modifications. I am posting the whole code routine below in case someone has the same issue in the future.

Public Sub ExportToDisk()

Dim strFileName As String = System.Windows.Forms.Application.StartupPath

Dim strAppPath As String = System.Windows.Forms.Application.StartupPath

Try

Dim rs As New ReportExecutionService()

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

rs.Url = My.Settings.EmailInvoices_ReportExecution_ReportExecutionService

Dim result As Byte() = Nothing

Dim reportPath As String = My.Settings.ReportPath

Dim format As String = "PDF"

Dim historyID As String = Nothing

Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

' Prepare report parameter.

Dim parameters(0) As ReportExecution.ParameterValue

parameters(0) = New ReportExecution.ParameterValue()

parameters(0).Name = "InvoiceNumber"

parameters(0).Value = Me.Invoice

Dim credentials As ReportExecution.DataSourceCredentials() = Nothing

Dim showHideToggle As String = Nothing

Dim encoding As String = ""

Dim mimeType As String = ""

Dim warnings As ReportExecution.Warning() = Nothing

Dim reportHistoryParameters As ReportExecution.ParameterValue() = Nothing

Dim streamIDs As String() = Nothing

Dim execInfo As New ExecutionInfo

Dim execHeader As New ExecutionHeader()

Dim SessionId As String

Dim extension As String = ""

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportPath, historyID)

rs.SetExecutionParameters(parameters, "en-us")

SessionId = rs.ExecutionHeaderValue.ExecutionID

Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID)

Try

result = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)

execInfo = rs.GetExecutionInfo()

Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)

Catch e As System.Exception

Console.WriteLine(e.ToString)

End Try

' Try

Using stream As FileStream = File.OpenWrite(strFileName & "\EmailFiles\" & Me.Invoice & ".PDF")

stream.Write(result, 0, result.Length)

stream.Close()

stream.Dispose()

End Using

Catch e As Exception

Console.WriteLine(e.Message)

End Try

Catch e As System.Exception

MessageBox.Show(e.Message)

End Try

End Sub

|||

I am using both the reportExecution and ReportService. After struggling with it for a while I went and looked at the renderand save sample that someone had pointed out earlier. This time the code actually worked with some minor modifications. I am posting the whole code routine below in case someone has the same issue in the future.

Public Sub ExportToDisk()

Dim strFileName As String = System.Windows.Forms.Application.StartupPath

Dim strAppPath As String = System.Windows.Forms.Application.StartupPath

Try

Dim rs As New ReportExecutionService()

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

rs.Url = My.Settings.EmailInvoices_ReportExecution_ReportExecutionService

Dim result As Byte() = Nothing

Dim reportPath As String = My.Settings.ReportPath

Dim format As String = "PDF"

Dim historyID As String = Nothing

Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

' Prepare report parameter.

Dim parameters(0) As ReportExecution.ParameterValue

parameters(0) = New ReportExecution.ParameterValue()

parameters(0).Name = "InvoiceNumber"

parameters(0).Value = Me.Invoice

Dim credentials As ReportExecution.DataSourceCredentials() = Nothing

Dim showHideToggle As String = Nothing

Dim encoding As String = ""

Dim mimeType As String = ""

Dim warnings As ReportExecution.Warning() = Nothing

Dim reportHistoryParameters As ReportExecution.ParameterValue() = Nothing

Dim streamIDs As String() = Nothing

Dim execInfo As New ExecutionInfo

Dim execHeader As New ExecutionHeader()

Dim SessionId As String

Dim extension As String = ""

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportPath, historyID)

rs.SetExecutionParameters(parameters, "en-us")

SessionId = rs.ExecutionHeaderValue.ExecutionID

Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID)

Try

result = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)

execInfo = rs.GetExecutionInfo()

Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)

Catch e As System.Exception

Console.WriteLine(e.ToString)

End Try

' Try

Using stream As FileStream = File.OpenWrite(strFileName & "\EmailFiles\" & Me.Invoice & ".PDF")

stream.Write(result, 0, result.Length)

stream.Close()

stream.Dispose()

End Using

Catch e As Exception

Console.WriteLine(e.Message)

End Try

Catch e As System.Exception

MessageBox.Show(e.Message)

End Try

End Sub

|||

I am using both the reportExecution and ReportService. After struggling with it for a while I went and looked at the renderand save sample that someone had pointed out earlier. This time the code actually worked with some minor modifications. I am posting the whole code routine below in case someone has the same issue in the future.

Public Sub ExportToDisk()

Dim strFileName As String = System.Windows.Forms.Application.StartupPath

Dim strAppPath As String = System.Windows.Forms.Application.StartupPath

Try

Dim rs As New ReportExecutionService()

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

rs.Url = My.Settings.EmailInvoices_ReportExecution_ReportExecutionService

Dim result As Byte() = Nothing

Dim reportPath As String = My.Settings.ReportPath

Dim format As String = "PDF"

Dim historyID As String = Nothing

Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

' Prepare report parameter.

Dim parameters(0) As ReportExecution.ParameterValue

parameters(0) = New ReportExecution.ParameterValue()

parameters(0).Name = "InvoiceNumber"

parameters(0).Value = Me.Invoice

Dim credentials As ReportExecution.DataSourceCredentials() = Nothing

Dim showHideToggle As String = Nothing

Dim encoding As String = ""

Dim mimeType As String = ""

Dim warnings As ReportExecution.Warning() = Nothing

Dim reportHistoryParameters As ReportExecution.ParameterValue() = Nothing

Dim streamIDs As String() = Nothing

Dim execInfo As New ExecutionInfo

Dim execHeader As New ExecutionHeader()

Dim SessionId As String

Dim extension As String = ""

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportPath, historyID)

rs.SetExecutionParameters(parameters, "en-us")

SessionId = rs.ExecutionHeaderValue.ExecutionID

Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID)

Try

result = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)

execInfo = rs.GetExecutionInfo()

Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)

Catch e As System.Exception

Console.WriteLine(e.ToString)

End Try

' Try

Using stream As FileStream = File.OpenWrite(strFileName & "\EmailFiles\" & Me.Invoice & ".PDF")

stream.Write(result, 0, result.Length)

stream.Close()

stream.Dispose()

End Using

Catch e As Exception

Console.WriteLine(e.Message)

End Try

Catch e As System.Exception

MessageBox.Show(e.Message)

End Try

End Sub

Conflicting docs on how to render

I am trying to use the render method to render to a byte array in an ASP.Net application and I am having a problem in that there is a lot of conflicting information in the books and the docs on how to do this. The latest docs I read led to the following code...

ReportingService2005 _rs = new ReportingService2005();

//have to use custom credentials because ASPNET does not have sufficient authority...
NetworkCredential myCred = new NetworkCredential("myuserid", "mypassword", "mydomain");
CredentialCache myCash = new CredentialCache();
myCash.Add(new Uri("http://localhost/myWebSiteName"), "NTLM", myCred);
_rs.Credentials = myCash;
_rs.Url = "http://localhost/ReportServer/ReportService2005.asmx";

//we just have one parameter...
ParameterValue[] Parameters = new ParameterValue[1];
Parameters[0].Name = "myReportID";
Parameters[0].Value = argmyReportID;

//Render the report to a byte array...
byte[] data;
data = _rs. oops there is no Render method!!

The first docs I read (WROX BOOK on SSRS2005) said to use the ReportingService class but there is no such class. I then found docs saying to use ReportingService2005 class as I did above. But that class has no Render method. Today I found other docs that say to use ReportExecutionService class.

Why are there so many conflicting docs. What class am I supposed to use to do a render?

Thanks,
Gary

This one here worked for me:

ReportServices.ReportingService rs = new ReportServices.ReportingService();

rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

byte[] ResultStream; // bytearray for result stream

string[] StreamIdentifiers; // string array for stream idenfiers

string OptionalParam = null; // string out param for optional parameters

ReportServices.ParameterValue[] optionalParams = null; // parametervalue array for optional parameters

ReportServices.Warning[] optionalWarnings = null; // warning array for optional warnings

ResultStream = rs.Render("/ReportProject1/Report1", "HTML4.0", null,

"<DeviceInfo><StreamRoot>/RSWebServiceXS/</StreamRoot></DeviceInfo>", null, null,

null, out OptionalParam, out OptionalParam, out optionalParams,

out optionalWarnings, out StreamIdentifiers);

After creating a webServices proxy class on ReportService.asmx.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

I get an error on

ResultStream = rs.Render(My.Settings.ReportPath, "PDF", Nothing, "<DeviceInfo><StreamRoot>/RSWebServiceXS/</StreamRoot></DeviceInfo>", Nothing, Nothing, _

Nothing, OptionalParam, OptionalParam, optionalParams, _

optionalWarnings, StreamIdentifiers)

it says that "render" is not a member of reportService. any ideas?

|||Which WebService (*.asmx) did you reference ?

HTH, Jens K. Suessmeyer.


http://www.sqlserver2005.de

|||

I am using both the reportExecution and ReportService. After struggling with it for a while I went and looked at the renderand save sample that someone had pointed out earlier. This time the code actually worked with some minor modifications. I am posting the whole code routine below in case someone has the same issue in the future.

Public Sub ExportToDisk()

Dim strFileName As String = System.Windows.Forms.Application.StartupPath

Dim strAppPath As String = System.Windows.Forms.Application.StartupPath

Try

Dim rs As New ReportExecutionService()

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

rs.Url = My.Settings.EmailInvoices_ReportExecution_ReportExecutionService

Dim result As Byte() = Nothing

Dim reportPath As String = My.Settings.ReportPath

Dim format As String = "PDF"

Dim historyID As String = Nothing

Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

' Prepare report parameter.

Dim parameters(0) As ReportExecution.ParameterValue

parameters(0) = New ReportExecution.ParameterValue()

parameters(0).Name = "InvoiceNumber"

parameters(0).Value = Me.Invoice

Dim credentials As ReportExecution.DataSourceCredentials() = Nothing

Dim showHideToggle As String = Nothing

Dim encoding As String = ""

Dim mimeType As String = ""

Dim warnings As ReportExecution.Warning() = Nothing

Dim reportHistoryParameters As ReportExecution.ParameterValue() = Nothing

Dim streamIDs As String() = Nothing

Dim execInfo As New ExecutionInfo

Dim execHeader As New ExecutionHeader()

Dim SessionId As String

Dim extension As String = ""

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportPath, historyID)

rs.SetExecutionParameters(parameters, "en-us")

SessionId = rs.ExecutionHeaderValue.ExecutionID

Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID)

Try

result = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)

execInfo = rs.GetExecutionInfo()

Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)

Catch e As System.Exception

Console.WriteLine(e.ToString)

End Try

' Try

Using stream As FileStream = File.OpenWrite(strFileName & "\EmailFiles\" & Me.Invoice & ".PDF")

stream.Write(result, 0, result.Length)

stream.Close()

stream.Dispose()

End Using

Catch e As Exception

Console.WriteLine(e.Message)

End Try

Catch e As System.Exception

MessageBox.Show(e.Message)

End Try

End Sub

|||

I am using both the reportExecution and ReportService. After struggling with it for a while I went and looked at the renderand save sample that someone had pointed out earlier. This time the code actually worked with some minor modifications. I am posting the whole code routine below in case someone has the same issue in the future.

Public Sub ExportToDisk()

Dim strFileName As String = System.Windows.Forms.Application.StartupPath

Dim strAppPath As String = System.Windows.Forms.Application.StartupPath

Try

Dim rs As New ReportExecutionService()

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

rs.Url = My.Settings.EmailInvoices_ReportExecution_ReportExecutionService

Dim result As Byte() = Nothing

Dim reportPath As String = My.Settings.ReportPath

Dim format As String = "PDF"

Dim historyID As String = Nothing

Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

' Prepare report parameter.

Dim parameters(0) As ReportExecution.ParameterValue

parameters(0) = New ReportExecution.ParameterValue()

parameters(0).Name = "InvoiceNumber"

parameters(0).Value = Me.Invoice

Dim credentials As ReportExecution.DataSourceCredentials() = Nothing

Dim showHideToggle As String = Nothing

Dim encoding As String = ""

Dim mimeType As String = ""

Dim warnings As ReportExecution.Warning() = Nothing

Dim reportHistoryParameters As ReportExecution.ParameterValue() = Nothing

Dim streamIDs As String() = Nothing

Dim execInfo As New ExecutionInfo

Dim execHeader As New ExecutionHeader()

Dim SessionId As String

Dim extension As String = ""

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportPath, historyID)

rs.SetExecutionParameters(parameters, "en-us")

SessionId = rs.ExecutionHeaderValue.ExecutionID

Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID)

Try

result = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)

execInfo = rs.GetExecutionInfo()

Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)

Catch e As System.Exception

Console.WriteLine(e.ToString)

End Try

' Try

Using stream As FileStream = File.OpenWrite(strFileName & "\EmailFiles\" & Me.Invoice & ".PDF")

stream.Write(result, 0, result.Length)

stream.Close()

stream.Dispose()

End Using

Catch e As Exception

Console.WriteLine(e.Message)

End Try

Catch e As System.Exception

MessageBox.Show(e.Message)

End Try

End Sub

|||

I am using both the reportExecution and ReportService. After struggling with it for a while I went and looked at the renderand save sample that someone had pointed out earlier. This time the code actually worked with some minor modifications. I am posting the whole code routine below in case someone has the same issue in the future.

Public Sub ExportToDisk()

Dim strFileName As String = System.Windows.Forms.Application.StartupPath

Dim strAppPath As String = System.Windows.Forms.Application.StartupPath

Try

Dim rs As New ReportExecutionService()

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

rs.Url = My.Settings.EmailInvoices_ReportExecution_ReportExecutionService

Dim result As Byte() = Nothing

Dim reportPath As String = My.Settings.ReportPath

Dim format As String = "PDF"

Dim historyID As String = Nothing

Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"

' Prepare report parameter.

Dim parameters(0) As ReportExecution.ParameterValue

parameters(0) = New ReportExecution.ParameterValue()

parameters(0).Name = "InvoiceNumber"

parameters(0).Value = Me.Invoice

Dim credentials As ReportExecution.DataSourceCredentials() = Nothing

Dim showHideToggle As String = Nothing

Dim encoding As String = ""

Dim mimeType As String = ""

Dim warnings As ReportExecution.Warning() = Nothing

Dim reportHistoryParameters As ReportExecution.ParameterValue() = Nothing

Dim streamIDs As String() = Nothing

Dim execInfo As New ExecutionInfo

Dim execHeader As New ExecutionHeader()

Dim SessionId As String

Dim extension As String = ""

rs.ExecutionHeaderValue = execHeader

execInfo = rs.LoadReport(reportPath, historyID)

rs.SetExecutionParameters(parameters, "en-us")

SessionId = rs.ExecutionHeaderValue.ExecutionID

Console.WriteLine("SessionID: {0}", rs.ExecutionHeaderValue.ExecutionID)

Try

result = rs.Render(format, devInfo, extension, encoding, mimeType, warnings, streamIDs)

execInfo = rs.GetExecutionInfo()

Console.WriteLine("Execution date and time: {0}", execInfo.ExecutionDateTime)

Catch e As System.Exception

Console.WriteLine(e.ToString)

End Try

' Try

Using stream As FileStream = File.OpenWrite(strFileName & "\EmailFiles\" & Me.Invoice & ".PDF")

stream.Write(result, 0, result.Length)

stream.Close()

stream.Dispose()

End Using

Catch e As Exception

Console.WriteLine(e.Message)

End Try

Catch e As System.Exception

MessageBox.Show(e.Message)

End Try

End Sub

Friday, 10 February 2012

Configure SQL Server 2005 to allow remote connections!

Hello there,

I just deployed a new ASP.NET 2.0 website on a remote serverhttp://www.alrazem.com/. and when i want to log on, or when any connection to the database happens!! the following error ocurs.

Server Error in '/' Application.

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Anyways, I searched the new. and i found this link:http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277... I followed the instructions and changed theSurface Area Configuration for Services and Connectionsto Local and remote connections.and Applied both protocols. Then redeployed the application. but the error still ocurs.

I didn't restart my machine after changing the SQL to remote. but i did the website from scratch again. and created a new connectionstring and database!!!

Any help? Thanks!

Hi singlenipple,

It seems that the after enabling the remote connection, you still cannot connect to it.

In this case I suggest you try the following steps.

1. Restart the computer and make sure that your SQL Server service is started.
2. Check if there is any firewall app running on this machine that prevents your service from being accessed.
3. Create a .txt file on a remote client machine, rename it to .udl, and double click on it. You will see a connection property dialog then. You can use this wizard to test the connection.

Configure Reporting Services

Specs
Server 2000, IIS5, .Net 2, .Net 1.1, SQL Server 2005 Developers Edition
Unable to set Web Service Identity
Web Service Identity is blank, have set
rsreportserver.config to include
<WebServiceAccount>ASPNET</WebServiceAccount>
Also tried
<WebServiceAccount>./ASPNET</WebServiceAccount>
but none seem to work?
The service is inistialized, but I cannont go to /reports or /reportmanager
when I apply on the blank entry in theReporting Services configration, I
receive this error:
ReportServicesConfigUI.WMIProvider.WMIProviderException: An unknown error
has occurred in the WMI Provider. Error Code 80070005
at
ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.SetWebServiceIdentity(String applicationPool)
please helpFacing the same problem. I've the same configuration and got same error. any
luck?
"GregCrossan" wrote:
> Specs
> Server 2000, IIS5, .Net 2, .Net 1.1, SQL Server 2005 Developers Edition
> Unable to set Web Service Identity
> Web Service Identity is blank, have set
> rsreportserver.config to include
> <WebServiceAccount>ASPNET</WebServiceAccount>
> Also tried
> <WebServiceAccount>./ASPNET</WebServiceAccount>
> but none seem to work?
> The service is inistialized, but I cannont go to /reports or /reportmanager
> when I apply on the blank entry in theReporting Services configration, I
> receive this error:
> ReportServicesConfigUI.WMIProvider.WMIProviderException: An unknown error
> has occurred in the WMI Provider. Error Code 80070005
> at
> ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.SetWebServiceIdentity(String applicationPool)
>
> please help|||Make that three of us.
I've tried:
uninstalling & reinstalling IIS,
reconfiguring Reporting Services,
re-registering asp.net
(C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i)
Any suggestions?
--
Clayton
"samjay" wrote:
> Facing the same problem. I've the same configuration and got same error. any
> luck?
> "GregCrossan" wrote:
> > Specs
> > Server 2000, IIS5, .Net 2, .Net 1.1, SQL Server 2005 Developers Edition
> >
> > Unable to set Web Service Identity
> >
> > Web Service Identity is blank, have set
> > rsreportserver.config to include
> > <WebServiceAccount>ASPNET</WebServiceAccount>
> > Also tried
> > <WebServiceAccount>./ASPNET</WebServiceAccount>
> >
> > but none seem to work?
> >
> > The service is inistialized, but I cannont go to /reports or /reportmanager
> >
> > when I apply on the blank entry in theReporting Services configration, I
> > receive this error:
> > ReportServicesConfigUI.WMIProvider.WMIProviderException: An unknown error
> > has occurred in the WMI Provider. Error Code 80070005
> > at
> > ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.SetWebServiceIdentity(String applicationPool)
> >
> >
> >
> > please help|||Hey all, just curious if any of you got this figured out. We all seem
to have the same problem.
Chris

Configure Report Server - Web Service Identity

Windows 2000 Server / IIS 5 / SQL Server 2005 Developers Edition / .Net 2.0 and .Net 1.1

When I attempt to configure the Report Server, I cannot configure the Web Service Identity, the ASP.NET service account shows blank. I have attempted to edit the rsreportserver.config file, as follows:

<WebServiceAccount>.\ASPNET</WebServiceAccount>

This (stop / start of course). But this only causes the Report Server to not start. If I leave that sectopn blank, the service starts, but I cannot access /Reports...

If I attempt to apply with that sectikon left blank I receive this error:

ReportServicesConfigUI.WMIProvider.WMIProviderException: An unknown error has occurred in the WMI Provider. Error Code 80070005


at ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.SetWebServiceIdentity(String applicationPool)

Please help

On Win2K, the actual ASP.NET account is read from machine.config file at /configuration/system.web/processModel/username. Do you have it set? If not run "aspnet_regiis -i -enable".|||

the machine config section is as follows for our setup....

<system.web>
<processModel autoConfig="true"/>

<httpHandlers />
Thanks for your help.. feels like i am getting closer