cancel
Showing results for 
Search instead for 
Did you mean: 

.COMException: The document has not been opened (Windows 7, IIS 7, ASP.NET)

Former Member
0 Kudos

Hi all,

I updated my PC to Windows 7 last night and just finished reinstalling all of my software including CR2008 with all of the latest service packs.

I can't seem to get any of my report documents to load in my ASP.NET applications and I can't figure out why.

All I get is:

System.Runtime.InteropServices.COMException: The document has not been opened

It fails on the very first line of the load process:

using (ReportDocument doc = new ReportDocument()) {

String path = Server.MapPath(aiSettings.siteRoot + "/reports/incident_report.rpt");

ExportFormatType f = ExportFormatType.PortableDocFormat;

doc.Load(path);

ConnectionInfo connectionInfo = new ConnectionInfo();

connectionInfo.ServerName = ConfigurationManager.AppSettings["crystal_dsn"].ToString();

Tables tables = doc.Database.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables) {

TableLogOnInfo tableLogonInfo = table.LogOnInfo;

tableLogonInfo.ConnectionInfo = connectionInfo;

table.ApplyLogOnInfo(tableLogonInfo);

}

doc.DataDefinition.RecordSelectionFormula = "{ai_vew_incident_printout.id} IN [235274];";

doc.ExportToHttpResponse(f, Response, true, "ir_expt_" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day);

}

Even if I clean out the entire function and JUST have the using statement, it still fails.. so something is happening when the report document object is created and I don't know where to turn from here.

Any thoughts?

Edited by: RussellMD on Aug 11, 2009 5:25 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, Russell;

CR 2008 has not been certified to run on Windows 7. But, let's see what we can do...

Is this a new project, or an existing one? If it is an existing one, try creating a new one.

Was .NET installed before Crystal Reports 2008? If not, you may need to reinstall CR 2008.

What is the version of .NET you are working with?

Regards,

Jonathan

Former Member
0 Kudos

Hi there,

The project is existing, but does the same thing with a new project as well.

I am running on .Net 3.5 sp1, and crystal reports was installed after IIS and .NET were installed.

Former Member
0 Kudos

BTW here are my assembly references. Are my versions right? They are the same version #'s as CR2008 SP0.. I looked in the assembly cache to see if the versions had changed but they hadn't.

<add assembly="CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.ReportSource, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.Shared, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.Web, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

Former Member
0 Kudos

The assembly versions do not change, just the file versions. I'll setting up to try it here, and will post my results when I have them.

Regards,

Jonathan

Former Member
0 Kudos

looking forward to it!

Former Member
0 Kudos

Hi, Russell;

Well, I got it tested here, and I don't believe it is a Windows 7 issue. I was able to run several different ASP.NET projects on Windows 7 with no issue at all.

If it is having a problem loading the report, can you try putting the report in a different location and seeing if that makes any difference? And, can you try a new, simple report? You can even just make a Blank report, and see if that will load.

Regards,

Jonathan

Former Member
0 Kudos

Jonathan:

this is thing.. it doesn't matter what file name or directory or report I use.. it's not the actual report that isn't loading, it's bombing right when I instantiate the reportdocument object.

IE, even if I just do this:

using (ReportDocument doc = new ReportDocument()) {

}

and literally put nothing between the braces, I get the error.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: The document has not been opened.

Source Error:

Line 204: HttpContext.Current.Response.ClearHeaders();

Line 205:

Line 206: using (ReportDocument doc = new ReportDocument()) {

[COMException (0x8004180b): The document has not been opened.]

CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.set_ProductLocaleID(CeLocale pVal) +0

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.CreateRptDoc() +60

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper..ctor() +31

CrystalDecisions.CrystalReports.Engine.ReportDocument.Initialize() +378

CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor() +195

former_member183750
Active Contributor
0 Kudos

Perhaps the place to start will be with a windows app. Just a simple CrystalReportViewer1.ReportSource = <path> (use a saved data report). I do understand that you are trying to develop a web app, but a win app does remove a number of variables.

Also, please do confirm that the version of CR you are using is 12.2.0.290

Ludek

Former Member
0 Kudos

Just an FYI guys.. I haven't abanonded this yet, just need a few days to get caught up and then I'll try the windows app.

But as an aside, I tried another one of my web apps that also uses the exact same code and it's doing the same thing.. so it's not an isolated problem to that one web app and both worked fine before windows 7.

Former Member
0 Kudos

Guys,

I'm trying to do a windows app (which I have never done) and I'm not sure how to get the crystal reports viewer added to the toolbox. It's not available under add items because I didn't install crystal reports for visual studio.

What to I "browse" to in terms of a DLL file to get it added as a COM component to the toolbox?

In other news, I made a very basic 1 page web app with a single default.aspx and blank test.rpt file, with a single button on the page called cmdGo.

protected void cmdGo_Click(Object sender, EventArgs e) {

HttpContext.Current.Response.ClearHeaders();

using (ReportDocument doc = new ReportDocument()) {

String report_name = "test.rpt";

String path = Server.MapPath(report_name);

ExportFormatType f = ExportFormatType.PortableDocFormat;

doc.Load(path);

doc.ExportToHttpResponse(f, Response, true, "report.pdf");

}

}

still fails.

former_member183750
Active Contributor
0 Kudos

The file to browse to, to get the viewer is CrystalDecisons.Windows.Forms(12.0.200)

But, the fact that you actually have to browse to the assembly would indicate that there is an issue here. The viewer should simply be available - if all is well.

Perhaps reinstalling CR 2008 may not be a bad idea(?). Also, ensure you do have Crystal reports version 12.2.0.290 (In the CR designer, go to Help | About.

Ludek

Former Member
0 Kudos

I'm fairly sure it's not Crystal reports that installs the toolbox item. It's a matter of selecting the crystal reports editor for visual studio when VS is actually installed.

I went and ahead and did that and the component appeared fine.

That being said, I don't use the viewer in my web app. If you check out the code that I posted before, I'm loading the object into memory and then exporting it to PDF.

anyhow I did try what you wanted, a basic winforms app with a viewer object and a basic report, and the report loads fine.. so I'm not where to go with it now.

and yes that's the version # that I'm using.

former_member183750
Active Contributor
0 Kudos

Since the original app fails on the very first line of the load process:

using (ReportDocument doc = new ReportDocument())

Let's see what Process Monitor tells us. ProcMon is here:

http://technet.microsoft.com/en-ca/sysinternals/bb896645.aspx

Filter it for your process. ProcMon likes to make huge files. Then look through the log of any error messages; access denied, file not found, etc.

Ludek

Former Member
0 Kudos

Here's the process entries that run the moment that I click the "go" button to export the PDF:

3:17:31.9198870 PM w3wp.exe 4408 QueryOpen C:\inetpub\wwwroot\test\Default.aspx.cs FAST IO DISALLOWED

3:17:31.9199874 PM w3wp.exe 4408 CreateFile C:\inetpub\wwwroot\test\Default.aspx.cs SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened

3:17:31.9200276 PM w3wp.exe 4408 QueryNetworkOpenInformationFile C:\inetpub\wwwroot\test\Default.aspx.cs SUCCESS CreationTime: 8/21/2009 11:30:39 AM, LastAccessTime: 8/21/2009 11:30:39 AM, LastWriteTime: 8/21/2009 11:32:46 AM, ChangeTime: 8/21/2009 11:32:46 AM, AllocationSize: 4096, EndOfFile: 892, FileAttributes: A

3:17:31.9200521 PM w3wp.exe 4408 CloseFile C:\inetpub\wwwroot\test\Default.aspx.cs SUCCESS

3:17:31.9203330 PM w3wp.exe 4408 CreateFile C:\inetpub\wwwroot\test\Default.aspx.cs SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: Read, AllocationSize: n/a, OpenResult: Opened

3:17:31.9203858 PM w3wp.exe 4408 ReadFile C:\inetpub\wwwroot\test\Default.aspx.cs SUCCESS Offset: 0, Length: 892, Priority: Normal

3:17:31.9204664 PM w3wp.exe 4408 CloseFile C:\inetpub\wwwroot\test\Default.aspx.cs SUCCESS

I did several tests of this nature, loading the page over and over and then clicking the button over and over to load the PDF, and the one thing that appears to be consistant is that first line "FAST IO DISALLOWED" only appears when I click the button, and not when the page loads.. so I wonder if that's where the issue is?

0 Kudos

Hello,

This is a harware issue. Search using google or similar on that error and you'll find all sorts of hits.

I believe installing the BIOS updates and local hardware drivers may fix the issue. Or could be a BIOS configuration problem in your harddrive legacy settings, various names for this. You need to allow your buss faster access by enabling SATA support.

You may want to consult with a Computer IT guy or search your BIOS support site for configuration and updated drivers.

Thank you

Don

Former Member
0 Kudos

Don:

That's really not the problem. I've been using the same computer for a year with Windows Vista and everything worked fine. I'm on a Quad Core Q9550 CPU w/ 8GB of memory and a Western Digital Velociraptor hard drive. I can assure you there's no performance issues going on.

The whole problem started when I went to Windows 7.

Obviously though, there's no known solution, so for now I will simply have to hope your next service pack corrects the problem.

Mitch

0 Kudos

Hi Mitch,

Which version of Windows 7 are you using? It' s not been released to the general public? Are you still using one of the beta builds? Or did you get thr RTM build?

You may want to purchase a case so we can pass sample app's back and forth. If it is a CR bug you will get a credit, if not then at least you'll get a dedicated support engineer to help you resolve the issue.

Thanks again

Don

Former Member
0 Kudos

Don:

I'm using the MSDN offical RTM copy. I have an MSDN subscription.

I'll look into getting a support case. Thanks

Answers (0)