Solved

Reportingservices 401 and 404

Posted on 2013-01-15
10
475 Views
Last Modified: 2013-03-04
Please help before my hair turns grey!
Environment server2008R2 IIS 7.5 SQLexpress2005
Application runs in classic mode

Services run under the network service account.

Reports run as the should in browser, but when running rs.exe from command line all I'm getting is HTTP401 and 404
0
Comment
Question by:Everlas
  • 5
  • 4
10 Comments
 
LVL 37

Expert Comment

by:ValentinoV
Comment Utility
How are you running rs.exe?  Does the account with which you're logged in have admin rights on the report server?  Also, did you open the command prompt "as administrator"?
0
 

Author Comment

by:Everlas
Comment Utility
I'm starting the command prompt as administrator - the same user as logged in at the server.
I think the administrator has almost any rights.

My command looks like this:

C:\Users\Administrator>

rs -i C:\Rapport\CreatePDF.rss -s http://Localhost/ReportServer$SQLExpress -e Exec2005 -v FileName=""C:\Rapport\test.pdf"" -v reportPath=""/test""
0
 
LVL 37

Expert Comment

by:ValentinoV
Comment Utility
Using that same user, are you able to do it manually? (through Report Manager)

With run "as administrator" I didn't only mean to log with an admin account but also to open the command prompt with elevated permissions.  That's done by right-clicking the shortcut and selecting "Run as administrator".  On some OSes, such as Windows Server 2008 R2, this is needed even with an admin account.

Also, are you sure that the endpoint (Exec2005) is the right one to use here? (without seeing the CreatePDF.rss file I can't really judge this)
It just seems more logical to use one of the management endpoints in this context.
0
 

Author Comment

by:Everlas
Comment Utility
What do you mean by report manager?

Yes, elevated permissions.

The rrs file looks like this with very little information as the parameter are given in the command.

    'Dim format as string = "Excel"
    Dim format As String = "PDF"

    Public Sub Main()

        ' Prepare Render arguments
        Dim historyID As String = Nothing
        Dim deviceInfo As String = Nothing
        Dim showHide As String = Nothing
        Dim results() As Byte
        Dim encoding As String = Nothing
        'Dim mimeType as string = "ms-excel"
        'Dim extension as string = "xls"
        Dim mimeType As String = "application/pdf"
        Dim extension As String = "pdf"
        Dim warnings() As Warning = Nothing
        Dim reportHistoryParameters() As ParameterValue = Nothing
        Dim streamIDs() As String = Nothing
        Dim rs As New ReportExecutionService
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials

        Dim parameters(0) As ParameterValue
        parameters(0) = New ParameterValue()
         'parameters(0).Name = "Area"
         'parameters(0).Value = AreaPara
        'parameters(1) = New ParameterValue()
        'parameters(1).Name = "StopDate"
        'parameters(1).Value = StopDatePara
        'parameters(2) = New ParameterValue()
        'parameters(2).Name = "ReportName"
        'parameters(2).Value = FileNamePara
        Dim execHeader As New ExecutionHeader()
        Dim rpt As New ExecutionInfo
        rpt = rs.LoadReport(reportPath, Nothing)
        rs.SetExecutionParameters(parameters, "da-dk")
        rs.ExecutionHeaderValue = execHeader
        rs.ExecutionHeaderValue.ExecutionID = rpt.ExecutionID
        results = rs.Render(format, deviceInfo, extension, mimeType, encoding, warnings, streamIDs)

        ' Open a file stream and write out the report
        Dim stream As FileStream = File.OpenWrite(fileName)
        stream.Write(results, 0, results.Length)
        stream.Close()

    End Sub
0
 
LVL 37

Expert Comment

by:ValentinoV
Comment Utility
Ow okay, you're rendering to PDF!  In that case it's indeed the right endpoint to use.  (I was under the impression you were uploading a PDF to the server.)

Report Manager is the management interface (website) that ships with reporting services.  In your case you can probably access it through the following URL: http://localhost/reports_SQLExpress

BTW: is the URL to your report server working fine? (the one you've mentioned in your first comment: http://Localhost/ReportServer$SQLExpress)
You can test that by using Internet Explorer to open it.  With sufficient privileges you should be able to render the existing reports.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:Everlas
Comment Utility
It works perfectly in the browser.
0
 
LVL 10

Expert Comment

by:Monica P
Comment Utility
Check once the URL assigned in your code in webservice URL

 ' Assign the URL of the Web service and not ReportManager URL
        rs.Url = "https://www.tttt.com/reports/ReportService.asmx"
0
 

Accepted Solution

by:
Everlas earned 0 total points
Comment Utility
The following line in the rss file had to be removed:
Dim rs As New ReportExecutionService
0
 
LVL 37

Assisted Solution

by:ValentinoV
ValentinoV earned 500 total points
Comment Utility
Wow yeah, I surely missed that line!  As you've discovered, it's not a good idea to re-instantiate the RS object.  It gets created automatically by the RS Utility.

The script environment automatically connects to the report server, creates the Web proxy class, and generates a reference variable (rs) to the Web service proxy object.
(ref. Format a Reporting Services Script File)
0
 

Author Closing Comment

by:Everlas
Comment Utility
Plain answer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now