Friday, March 30, 2012

ReportViewer fails when called direct from production server / works when called indirect

Hi Folks ...

Here is my setup and then I'll detail what is working, not working with the ReportViewer control:

1) Server (Everything is contained on one server right now) sits in the DMZ (Web application available to Internet)

- Win2003 Server

- IIS

Web Site A -www.site1.comWeb Site B -www.site2.comWeb Site C -www.site3.com

- SQL Server 2005

- SQL Server Reporting Services

Each web site has its own SRSS Virtual Reports and ReportServer directories setup for reporting.

2) Development Workstation - inside the firewall.

- Windows XP Professional

- Visual Studio 2005

Ok, you have the setup. Now for the problem. I've created a web application that uses form authentication with user ids and passwords stored in the database that I check to allow authorization in to the web program. I have created reports and deployed them via Visual Studio to the Report Server.

Run Verification:

Successfully runs when I run by keying the web address in to the web browser - am prompted for user id and password, I manually key in the user id and password that I have coded in to the application:http://www.site1.com/ReportServer?/ApplicationName/ReportName

Run from within Visual Studio on Development Machine - note this authenticates properly - note that when run within VS, it still calls report on server:

Successfully runs the report when I have the following code on a form - the ReportViewer control is located within the web page and is named rptMOCLog (I created the MOCReportServerCredentials authentication mechanism to support my Form based authentication based on articles in this Forum and MSDN to create the authentication mechanism that can be passed to ReportServer)

ProtectedSub rptMOCLog_Init(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles rptMOCLog.Init

Dim loParameters(3)As ReportParameter

Me.rptMOCLog.ServerReport.ReportServerCredentials =New ReportServerCredentials("ApplicationReportUser","ApplicationReportUserPassword","")

Me.rptMOCLog.ServerReport.ReportServerUrl =New Uri("http://www.site1.com/ReportServer")

Me.rptMOCLog.ServerReport.ReportPath ="/ApplicationName/ReportName"

loParameters(0) =

New Microsoft.Reporting.WebForms.ReportParameter("corpID", Session("svCorpId").ToString,False)

loParameters(1) =

New Microsoft.Reporting.WebForms.ReportParameter("plantID", Session("svPlantId").ToString,False)

loParameters(2) =

New Microsoft.Reporting.WebForms.ReportParameter("dateBegin", Format(DateAdd(DateInterval.Year, -1, Date.Now()),"d").ToString,True)

loParameters(3) =

New Microsoft.Reporting.WebForms.ReportParameter("dateEnd", Format(DateAdd(DateInterval.Day, 1,Date.Now()),"d").ToString,True) Me.rptMOCLog.ServerReport.SetParameters(loParameters)EndSub

Next I move the entire application up to the IIS Server and attempt to run from there - moved to thewww.site1.com web site on the server.

Application fails to run the report with the following message

The request failed with HTTP status 401: Unauthorized.

I have verified that the ApplicationReportUser is a part of the following groups:

SQLServer2005ReportingServicesWebServiceUser$ENTERPRISE$MSSQLSERVERSQLServer2005ReportServerUser$ENTERPRISE$MSSQLSERVER

Ok, I'm banging my head against the wall and it's starting to hurt. Anyone have any clue on how to make the report run from the production server?

I ended up having to blow away and reinstall the entire SQL Server environment to get rid of my error and have the reports display properly. Don't know what other solutions may exist, but this is the only way I could solve the problem.

Hoping this doesn't happen after I role this in to production ... fingers crossed.

David

No comments:

Post a Comment