Crystal Reports for Visual Studio 2010 Error - c#

I am trying to run a crystal report from my web application which was built using ASP.NET 4.0 and Visual Studio 2010. I have installed the following from the SAP site (http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp)
1) SAP Crystal Reports, version for Visual Studio 2010 - Standard EXE installation package which installs the software into the Visual Studio IDE.
2) SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)
I have a page called Reports.aspx in which I have a crystal report viewer control
<CR:CrystalReportViewer ID="rptViewer" runat="server" AutoDataBind="true" />
In the Reports.aspx.cs file I have the following code:
protected override void OnPreRender(EventArgs e)
{
ReportDocument report = new ReportDocument();
var path = Server.MapPath("Reports/Sample.rpt");
report.Load(path);
report.SetDatabaseLogon("username", "password", "servername", "databasename");
rptViewer.ReportSource = report;
}
On the report.Load(path) line I get the following error:
Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.
How can I fix this?

I also got into the same problem my problem was report path was not valid, May be you have same problem , check Server.MapPath("Reports/Sample.rpt") returning valid path ?

make sure the report is in app_code folder
initialize a new instance of it instead of initializing a reportdocument and loading the report in it.
Sample report = new Sample();
this worked for me

You will need to modify two properties in the .rpt files:
Build Action is set to "Embedded Resource" by default. Change it to "Content".
Copy to Output is set to "Do not copy" by default. Change it to "Copy always".
Rebuild, Build deployment package and Publish. Done!

NOTE: Below, the term "WebSite" refers to actual web site nodes in IIS, NOT a virtual directory within a web site.
Problem Root Cause: There is no "aspnet_client" folder accessible by the application.
This can happen for several reasons:
Since the SAP CR installer appears to install the aspnet_client folder in the ...\inetpub\wwwroot\ folder, if your Web Site physical path is NOT ...\inetpub\wwwroot, your application will not have access to the aspnet_client folder.
If the aspnet_client folder was moved or deleted from to the top level of your web site's physical path, your IIS application will not have access to the folder.
Problem Solution (For Windows Server 2008 R2)
Go to the IIS manager on your server
Expand the tree view node for the WebSite running your application
Look at the level immediately under the web site node and ensure you see a "aspnet_client" folder.
If you do see the folder, then perhaps this root cause is not the cause of your problem.
If you do NOT see the folder, search the server's hard drive for it and COPY it to the Web Site's Physical path.
Right mouse button click on the Web Site node and click Refresh from the popup Menu
You should now see the aspnet_client folder at the level directly under your web site node and the reports in the application should work.

I ran into this when I converted a web site to a web application. The report would run fine on my dev machine, but not on the server. Then I realized the rpt file was missing on the server!
By default the report files were considered embedded resources and were not copied when the web application was published. I just changed them individually, republished the site, and all was well again.

I have also had a report load failure if I have mistakenly left the report file open in crystal reports designer.

This error is a real treat, and seems to have many possible antecedents. Fortunately I only wasted a day on my particular variation:
ReportDocument.Load() also makes a local temp copy. (This may only be in the case of a load from a network drive location, I didn't test this in the case of a local load.)
If the user context under which the load occurs does not have authority to create the temp file locally, Load will fail with the same very unhelpful error.
Also, I ended up diagnosing this with Process Monitor. It may be helpful for you as well.

Please make sure your report rpt files are in their original folder. I got the same error first, after I "published" my MVC web site to IIS. I didn't realize that "Publish" didn't put rpt files in the package.

Re-install the "Crystal report engine" to the server
Build Action set to "Content".
It perfectly worked for me..!

Related

rdlc could not be found in published project by oneClick

I have programed an application in visual studio and ithas reports of report Viewer(rdlc)it workes fine on development machine, but when I deploy it on server (IIS 6) ,the program won't run and fails, what it says : downloading report.rdlc did not succeed .The remote server returned an error: (404) Not Found.. the file exist in the "application files" folder in published application.
what I have done is that:
1-in the report file the build action is "Content" and it always copy
2-in the server I add a Mapping for the rdls extention to aspnet.isapi.dll location
3- in the application files of publishing it is set to "Include(Auto)"
what else can I do to run the application with rdlc?
These are what I have done to solve the problem:
in Publish page of project properties, in the prerequisites , I checked the Microsoft Visual studio 2010 Report Viewer
in the Application Files page of project properties, I changed the publish Status to "Include" of the following files
a) Microsoft.ReportViewer.Common.dll
b) Microsoft.ReportViewer.DataVisualization.dll
c) Microsoft.ReportViewer.ProcessingObjectModel.dll
d) Microsoft.ReportViewer.WinForm.dll
I checked the value of "Use .deploy file extenstion" in following Path
Properties of Project => Publish => Options => Deployment
These changes solved my Problem.

HTTP error 500.19 - Cannot read configuration file

In one of my ASP.NET apps, all of a sudden I am unable to run it in Visual Studio 2013 due to the error displayed below. It appears that it is trying to open the web.config from a path that doesn't even exist. All of my project code, including web.config, are located under C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web. I've found a number of posts here from users experiencing a similar error, but the solutions seem to vary and none I've found so far seem applicable to my situation. I looked in that TraceLogFiles directory and the most recent log file there is five days old so it obviously hasn't been logging anything since I've been having this issue. Any suggestions are appreciated.
In my case I deleted all folders in D:\My Documents\My Web Sites\ before
Then I caught the error
There is a file .vs\config\applicationhost.config in my solution folder
It contains reference to the deleted folder. So, I deleted applicationhost.config and then pressed 'Create Virtual Directory' button in my project property Web page. It was recreated the file and the folder
I've been able to resolve this issue even though I can't say I fully understand all of the details. I'll attempt to describe the situation the best I understand it and hopefully others with greater insight can add further clarification.
After having been doing all of my development on my workstation, it was suggested that I begin doing this work in a new VM environment that had been set up for me. So I installed VS 2013 there and copied my source code from various projects over there. However, rather than follow my previous local path convention of C:\Projects\SourceCode[ProjectName]... this time I decided to use the directories that are set up during the VS install, c:\users[MyUser]\My Documents\Visual Studio 2013\Projects[ProjectName]. Sometime shortly thereafter, our infrastructure team made a change so that my home directory, c:\users\rmayer, was now being pointed to a common network drive, \totalsafety\TSUsers\rmayer. Everything continued to work without any issues.
However, due to various difficulties I had working in this VM environment, I decided to return to doing my development work on my workstation using the original local paths for my source code. This is when I began encountering the errors described above whenever I would try to run my code through VS. What I've begun to learn is that there is an applicationhost.config file that IIS Express uses located here: \totalsafety\TSUsers\rmayer\My Documents\IISExpress\config. It contains entries for each of my web projects; the one relevant to this issue had a section which looked like this:
<site name="AFEManager.Web-Site" id="8">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\rmayer\Documents\My Web Sites\AFEManager.Web-Site" />
</application>
<application path="/AFEManager" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:19257:localhost" />
</bindings>
</site>
The physical path attribute listed under applicationPool="Clr4IntegratedAppPool" at that time was set based on the local path I had been using at the time I was working in the VM environment. Now that this one file is being shared regardless of whether I'm working locally or within the VM due to the move of the users' home directories, this path is invalid when I'm working from my workstation. By updating this path to C:\Projects\SourceCode\AFEManager\Trunk\AFEManager.Web, it now works correctly from my workstation.
Again, I have a limited understanding of how this is supposed to work, but what it's telling me is that I will be unable to do development work from multiple environments (not that I want to any longer) unless the local paths are consistent between all of them. If I'm correct about this, this seems like a less than ideal design.
I had this issue when I moved the project folder to the new machine. The problem is that the VS has the site registered in its config file (applicationhost.config) inside .vs/ folder but did not create folder inside %USERPROFILE%\My Documents\My Web Sites\. If you just click Create Virtual Directory inside the project properties (Web tab) it will not be enough.
First close your VS and remove .vs/ folder inside your solution directory
Reopen VS and click Create Virtual Directory inside the project properties (Web tab) - VS will register the site again and create corresponding folder inside %USERPROFILE%\My Documents\My Web Sites\
I changed the virtual directory path in vs\config\applicationhost.config inside the solution folder.
In my case, the project was located on network not my local disk. After copying the project to local, the issue was resolved. Hope it can save someones time who has the same issue.
You can change the path for the web.config to its real path in applicationhost.config file. This file is located in /.vs/config folder.
After changing the path in this file, save it and restart the project, it solved my issue.
This is happening because I have different work stations, but the project is saving in different folders.
Delete .VS folders that Visual studio created.
It might be hidden in your project structure.
Unhide the folders and look for .vs folder and delete that folder and rebuild the application.
Most simplest way to solve this issue.
Approximate reason to arise this error is copy project from another pc.
Solution:
Step 01: From Visual Studio Solution Explorer, Right click on your project and choose Open Folder in File Explorer.
Step 02: Open .vs folder (Hidden Folder) and
you will get 2 folder named config and another one is named as
your_project_name/config.
Step 03: Both config folder will contain a
file named applicationhost.
Step 04: Open both applicationhost file using notepad and find the directory showing in error screen (Config
File \?\C:\User\hp\Documents\My Web
Sites\YourProjectName\web.config)
Step 05: Just replace this
directory according to your pc directory. Example, in my pc I have
changed as below:
C:\Users\Sydur Rahman\Documents\My Web Sites\MyProjectName-Site
to
C:\Users\hp\Documents\My Web Sites\MyProjectName-Site
Note: Please make sure you have changed in both applicationhost file.
That's all. Now your project will run as expected!
Thank you PongGod!! I am not able to comment on your answer but I wanted to post anyway since I had the exact same issue while running an instance of Orchard. In my case, everything had been running great until I found a bunch of old project files located in:
%USERPROFILE%\My Documents\My Web Sites\
And started deleting them for no apparent reason. I then tried to start up Orchard from Visual Studio in debug mode and received the error message above. After applying the same fix to my applicationhost.config file, everything is working fine now.
In my case, I am assuming that the directories got mixed up because I had initially ran the default Orchard files from Visual Studio and from Web Matrix. Then later on, I downloaded the full source files and began running the files from a completely different directory. Thanks again.
Here is a solution i have found.
https://gyorgybalassy.wordpress.com/2015/03/06/i-asked-for-a-vs-folder-and-the-vs-team-gave-it-to-me/
(1)Find the applicationhost.config file in |YourSolution|\.vs\config
(2)Modify the VirtualDirectory PhysicalPath To your project.
(3)Restart solution. Start project.
(4)If it's still not working, try to check setting in your IISExpress config. If there is not site setting, copy And paste the setting to |UserOnYourComputer|\Documents\IISExpress\config\applicationhost.config
(5)Change the id to other id which not be used in IISExpress applicationhost.config.
(6)Start your project.
I experienced the same issue and I resolve it quite simply. My issue was arose after when I perform a merge operation in git repository, after merge operation Visual Studio some how changed my default project URL to the default URL of my partner's computer from where he pushed the last time in to my repository.
So here is how I resolved this error:
Simply go to the properties of the project.
From the left vertically aligned menu, select Web.
After you will Project url and a text box containing the default port number, now just aside that textbox there is a button "Create Virtual Directory".
Press that button and there you go.
It will again point the default url the current working folder of your project.
Hope it works for you all :)
After all this answers I find my solution. Delete te WebSite in the IIS and recriate. Why? Because I had create de website before installed the framework 4.5 and URL Rewrite.
Go to the project dir:
..\\{ProjectDir}\\.vs\\{ProjectName}\\config
Then delete the applicationhost.config file and recompile your solution.
That's all.
This steps helped me to get over this error
1.In Windows Explorer, locate the web.config file that is associated with the Web site.
2.Right-click the web.config file
3.Click Properties.
4.Click the Security tab, and then click Edit.
5.Click Add.
6.In the Enter the object names to select box, type computername\IIS_IUSRS, click Check Names, and then click OK.
Note* Computername is a placeholder for the computer name.
7.Click to select the Read check box, and then click OK.
8.In the Web.config Properties dialog box, click OK.

Crystal reports display a blank page in C#, asp.net

I have a website in vs2008. I have created a crystal report which works fine in the DEVELOPMENT environment. But when I publish my website to IIS, the report is never displayed. It just displays a blank page. Can anyone tell me how to resolve this issue?
Thanks
If you installed your application in a website different from Default WebSite, try this:
Solution
Copy aspnet_client folder from c:\inetpub\wwwroot folder to the new website root folder.
or in IIS:
Create a virtual directory called aspnet_client that points to c:\inetpub\wwwroot inside the new website.
Cause of the problem
Using client tools (debug window of your browser) or server tool (IIS log) you will find that some required Crystal files like crv.js and style.css are not served. That's because these files are placed by CR installer in wwwroot\aspnet_client folder, but they cannot be reached from other websites installed on the same machine.
I can see that you use different versions of software and different configurations, but I think you have the same problem.
Make sure Folder "2_0_50727" exists at C:\inetpub\wwwroot\aspnet_client\system_web
or your SiteRootFolder\aspnet_client\system_web
if not exists copy the folder "4_0_30319" as "2_0_50727".
If you are using Submit button for viewing the report, make sure you effect a full postback on submit button click. You will find that all pages in the report will work perfectly fine.
Note: Use Trigger with Update Panel to Effect the Full Post Back (The Control ID of the trigger should be the ID of the button).
Perfect! The solution is to work on IIS this way:
Copy aspnet_client folder from c:\inetpub\wwwroot folder to the new website root folder.
OR
Create a virtual directory called aspnet_client that points to c:\inetpub\wwwroot inside the new website
Thank you so much
You need to install the merge modules on the web server. You can download them from Here
Check the Crystal Report Run-time version, for example if you install version 13.0.1 and your Visual Studio uses 13.0.2 the report will display but not data will be displayed.

Build (and Debug) ASP.NET Web Application in a non-default folder location

I have a Visual Studio 2008 solution with an ASP.NET Web Application project. I want to change the default output folder, of said project, to $(SolutionDir)\WebApps\$(ProjectName)\bin. This I can do and when I build I get the expected assembly files in this folder. It doesn't copy the content files (aspx, etc.) to the parent folder but I have managed to fix this by hacking the project.csproj file with a custom build target.
The problem is I want to be able to debug this application using the ASP.NET Development Server, by pressing F5 in VS2008. Unfortunately the ASP.NET Dev server starts, has a "Physical Path", in the project directory rather than the parent of the output directory.
Is there any way to build my web application to a different output folder but still run the asp.net dev server to debug my site?
Thanks.
Short answer is yes, but it isn't pretty. The process I used is given below.
Unloaded the project in VS.
Manually edited the .csproj file to include a post build action that basically copies the content files (aspx, etc.) to the parent of the output folder.
For the debug options I set the project to launch an external executable. The Asp.Net Development server. Also manually set the url to launch.
What I learnt? I wouldn't do this, I'd just stick with the default and create an install/web deployment project instead.

Remote-Debugging in Running Web Application

We are trying to add a new page to a running web application. such that a new dll and aspx file are being added. I've setup break points in the code file and Built the application transfering the dll to the remote machine bin file and the aspx page to a folder within the web application. Note this folder is not in the same folder hierarchy as it built in. I'm not sure if thats the problem. Basically we are appending new functionality to a web application.
I've completed the following
I've copied the correct Remote Debug Monitor to the server and have it running.
I'm able to attach to the process which in this case is w3wp.exe (I've Identified that it is the correct process for my application.
I deployed the *.dll to the the bin folder with the *.pdb file along with it.
I've deployed the *.aspx file to the location we want.
With the file open in visual studio with breakpoints setup, we attach to the process and debug. I get 'No symbols loaded' and the breakpoint go empty.
I'm missing something it seems. I've searched the net but have only found complete publish\ deployment scenario.
Any thoughts
Tools -> Options -> Symbols -> Add the path to your deployed web application dlls and pdbs.
You might also need to uncheck "Enable Just My Code" under general debugging.
Here's a more detailed answer that got it working for me in the past: Remote Debugging is not breaking on errors

Categories