[RESOLVED]using RDLC in MVC projects

We have a MVC 4.0 project and for reporting we used RDLC. We need to have the reportviewer control available in client page, because we want our web application to be very similar with a desktop application.

To work with RDLC we have to use aspx pages inside our project which are loaded inside iframe based on src=… path.

We store these files in Reports folder inside our project.

Everything was working in our development process. We use Visual Studio 2013 with IIS Express.

When we have done the deployment to the production server, we observe that our reports are not working. We receive the 404 error. We have received the same 404 error from Windows Server 2008 SBS and from Windows Server 2012 Standard where we have made the
deployment

Please help us with this issues.

Thank you very much

You may look into using the Reports as "Local Reports" and simply using MVC to render them via their path (instead of navigating to them directly, which would require routing changes). I recently implemented a similar structure to support accessing
data via Entity Framework to populate to populate a few RDLC Reports that I had created. Although this may not be exactly the approach that I took, I would recommend

taking a look at this blog post on the topic
.

If you don’t want to take that approach and would prefer to render an actual Report Viewer directly within an MVC View (or navigate to an ASPX page that contained your report), you might be better off using an approach
like this one.

Hi horia,

First, please refer to Rion’s reply.

Secondly, please use
Server.MapPath
to generate the path dynamically.

On the other hand, there are some articles about report that can help you:

# ASP.NET MVC Html Helpers for ReportViewer Control.

https://github.com/ilich/MvcReportViewer

# Prototype MVC4 Razor ReportViewer? RDLC

http://www.codeproject.com/Articles/609580/Prototype-MVC-Razor-ReportViewer-RDLC

Best Regards

Starain Chen

if you have internet explorer greater than I.E 8. There is something called developer tools (press F12). on network tab you can start monitoring.

Find the url which is giving 404. Hit the url separately from new tab in the browser, check if you are getting the same 404.

Find the url which is working in you dev environment, get the url from there. Find the difference between working and non working url. It could be because of cross posting, domain bieng different, url bieng wrong, insufficient file permission for files in
reports folder. If there are physical file, you might also want to set it up as static file at IIS level or in web.config

In the first approach I can not see report toolbar at client. I want that client to be able to navigate from page to page, choose option to export in XLS, PDF.Doc, to be able to print and to choose the printer like in desktop application.

second approach I have to test in the next days and I will let you know.

But I have one very logical question. Why it is working in developing with IIS Express and is not working in production server with IIS. For me this is unbelievable.

Thanks for reply

Of course I have tried with network monitoring and the same path in the IIS express is working fine, but In production environment IIS give 404 error.

IIS Express example:

<iframe width="99.5%" height="99%" id="myReport" src="….ReportsRaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&amp;idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&amp;Format=FACT&amp;lcnrZecimaleCantitate=3&amp;lcnrZecimalePret=2&amp;lcnrZecimaleValuta=2"
frameborder="1"></iframe>

URL Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache read‎‎ Gap‎‎
/Reports/RaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&Format=FACT&lcnrZecimaleCantitate=3&lcnrZecimalePret=2&lcnrZecimaleValuta=2 GET 200 text/html 58.79 KB 0.67 s frame
navigate 2465 0 655 16 0 1014

is working well

 

IIS production server example:

<iframe width="99.5%" height="99%" id="myReport" src="….ReportsRaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&amp;idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&amp;Format=FACT&amp;lcnrZecimaleCantitate=3&amp;lcnrZecimalePret=2&amp;lcnrZecimaleValuta=2"
frameborder="1"></iframe>

URL Method Result Type Received Taken Initiator Wait‎‎ Start‎‎ Request‎‎ Response‎‎ Cache read‎‎ Gap‎‎
/Reports/RaportDocumentIesire.aspx?idSucurs=219bc74c-1ab6-11d4-b1e8-00a0d21052ef&idDocument=fcc247d8-ae2a-49f1-ae74-1ac063606932&Format=FACT&lcnrZecimaleCantitate=3&lcnrZecimalePret=2&lcnrZecimaleValuta=2 GET 404 text/html 1.70 KB 125 ms frame
navigate 63 0 125 0 0 13634

 

If we are looking to the calling path in  both cases are the same. The entire structure of the folders were copied from development server to the production. No good results.

Any idea?

Thank you.

 

Tkank you for your reply. I will begin to study again this approach and compare with article which you recommended.

Thank you

Leave a Reply