Showing posts with label direct. Show all posts
Showing posts with label direct. Show all posts

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

Wednesday, March 28, 2012

ReportViewer Control and German-Swiss date-format

Direct select on my Server gives the following three all working:
select * from tblvehicle
where dtmyearofpurchase = '2/1/1980 3:36:07 PM'
select * from tblvehicle
where dtmyearofpurchase = '02/01/1980 15:36:07'
select * from tblvehicle
where dtmyearofpurchase = '1980-02-01 15:36:07'
the only one NOT working ist the GERMAN-SWISS date-format!!!
select * from tblvehicle
where dtmyearofpurchase = '01.02.1980 15:36:07'
Unfortunately I receive this format automatically from Report-Server!!
----
Additional Info:
----
I've embedded a ReportViewer Control in a Winforms app.
I get the parameters via ReportViewer1.ServerReport.GetParameters
and show values to be chosen from in a checked listbox from
ValidValues(i).Value (chosen the values, NOT the labels!)
I run the Winform-App one time from an external us-en-Client and
one time from the same de-ch-Swiss Server
US-client: Query DOES work
- XP SP2
- all suggested automatic updates installed incl. newest ones from today
(19.06.06)
- VS2005 V. 2.0.50727
- all english Software
Language Config:
Windows XP and all running programs are us-english
First Language in Internet Explorer: en-us
Regional Options: english-us with
time: h:mm:ss tt, e.g. 11:12:36 AM
short date: M/d/yyyy , e.g. 6/19/2006
long date: dddd, MMMM dd, yyyy, e.g. Monday, June 19, 2006
Server (and at the same time Swiss-Client): Query DOES NOT work!!!
- Enterprise Server 2003R2
- all suggested automatic updates installed incl. newest ones from today
(19.06.06)
- SQL Server 2005, SP1, cumulative post SP1 hotfixes
- all english Software
Language Config:
Windows 2003R2 and all running programs are us-english
First Language in Internet Explorer: de-ch (=german switzerland)
Regional Options: german switzerland
time: HH:mm:ss, e.g. 11:18:54
short date: dd.MM.yyyy, e.g. 19.06.2006
long date: dddd, d. MMMM yyyy, e.g. Montag, 19. Juni 2006
Via SQL Server Profiler I retrieved the following data:
either requested by the ReportViewer1.ServerReport.GetParameters
or sent by the SetParameters
1. DOES work:
from ReportServer (enumeration) to external en-us client
retrieved values via GetParameters
following values from Profiler:
<Value>2/1/1980 3:36:07 PM</Value>
<Label>02/01/1980 15:36:07</Label>
Sent Query from winforms via SetParameters
also retrieved from Profiler:
@.Parameters=N'strTableName=tblVehicle&strColumnName=dtmYearOfPurchase&Suchschlussel=2/1/1980 3:36:07 PM'
2. This DOES NOT work
to self server de-ch (german switzerland)
retrieved values via GetParameters
<Value>01.02.1980 15:36:07</Value>
<Label>02/01/1980 15:36:07</Label>
Sent Query from winforms via SetParameters
@.Parameters=N'strTableName=tblVehicle&strColumnName=dtmYearOfPurchase&Suchschlussel=01.02.1980 15:36:07'
Apparently it seems all to be right...
in 1. it works = one datarow is sent back to the winform app
in 2. it doesnt work = the report is rendered but empty.Hello Henry,
In Report Layout View you can select the Properties window. You can set the
language for the report which determines formatting according to language
preferences.You can use some expression like User!Language to make the
language selection dynamic. You may test default language/US-English of
report to see differences
The locale of the parameter section is based on the browser
Accept-Language. The formatting of dates in the report is based on the
language specified in the RDL.
Note that you need to deploy the report to server to test since there is
some issue in design time reportviewer regarding this.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Thanks Peter,
we are so involved in lots of other Reporting-Services areas, that we
couldn't resolve this issue yet, despite your valuable information.
I'll come back to this problem in the next four weeks.
Yours Henry
""privatenews"" wrote:
> Hello Henry,
> In Report Layout View you can select the Properties window. You can set the
> language for the report which determines formatting according to language
> preferences.You can use some expression like User!Language to make the
> language selection dynamic. You may test default language/US-English of
> report to see differences
> The locale of the parameter section is based on the browser
> Accept-Language. The formatting of dates in the report is based on the
> language specified in the RDL.
> Note that you need to deploy the report to server to test since there is
> some issue in design time reportviewer regarding this.
> Best Regards,
> Peter Yang
> MCSE2000/2003, MCSA, MCDBA
> Microsoft Online Partner Support
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>|||Hello Henry,
Thank you for taking time to write in about the status of the issue. I
understand that you have other priorities right now. If you need any
assistance from us, please feel free to post back.
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Dear Peter,
the problem was found to be:
(recap)
- Enduser works in localized Windows (e.g. Regional Settings Italian)
- Enduser may have different IE-Language Setting of e.g. us_english
- Enduser may like to work in our WinForm-Application (that includes a
ReportViewer-Control) in his German Language
So:
- we configure all text in our WinForm-App to be expressed in German
- we send an @.winform-language-Parameter to Reporting-Service
- we configure in the Report all the Body-Text, Dropdown-List content,
Column-Names etc. to be in German
- we do Selects to an underlying DB via Stored-Procedures that contain
Datetime-data-types in the Where-clause
- THE RESULT-SETS ARE EMPTY!!!
Problem:
- The explicit parameter for German will not work, since Dropdown Box
ValidValues are sent in the us_english-dateformat (mdy)
- the SQL-Server Server language is swiss-German (de-CH) with its inherent
dateformat of dmy
here's the solution:
- we define an internal Parameter @.language in the RDL
- we allow blank value
- NO available Values
- Default Value is a non-queried expression:
=Iif (user!Language.StartsWith("de"),"1",Iif
(user!Language.StartsWith("en"),"2",Iif
(user!Language.StartsWith("fr"),"3",Iif
(user!Language.StartsWith("it"),"4","2"))))
- we send this @.language Parameter to any Stored Procedure
- there we set the batch-level-language (means: in the SP):
if @.language = 1 set language German
if @.language = 2 set language English
if @.language = 3 set language French
if @.language = 4 set language Italian
Drawback:
- the user chose German for her WinForm-App
- she receives ALL text in German BUT us_english Dates in Dropdown Boxes
But finally the whole thing works.
Best Regards, Henry|||Hello Henry,
Thank you for taking time to write in about your detailed workaround to
solve this issue and this shall benefit the community!
Best Regards,
Peter Yang
MCSE2000/2003, MCSA, MCDBA
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.