I've written a web app (in VS 2010 Pro) that serves up reports. As usual, the web app works fine locally, but when I publish it to the web server (ours, not an ISP), I get the following error when clicking on a link the should bring up a report:
Server Error in '/' Application.
The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
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 handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x80070006): The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))]
CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.get_ProductLocaleID() +0
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.get_ProductLocaleID() +62
CrystalDecisions.ReportSource.CachedObjectReportSource.GetReport(RequestContext context, Boolean bAddToCacheWhenCreated) +757
CrystalDecisions.Web.CrystalReportSource.get_ReportDocument() +327
XXXXXXXXXXXXXX.Report_View.Report_View_Init(Object sender, EventArgs e) in C:\Users\XXXXXXXXXXXXXXXX\Documents\Visual Studio 2010\Projects\XXXXXXXXXXXXXX\XXXXXXXXXXXXXX\Report_View.aspx.vb:14
System.Web.UI.Page.OnInit(EventArgs e) +105
System.Web.UI.Control.InitRecursive(Control namingContainer) +133
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1970
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Here is the code behind on the "Report_View.aspx" page that's called (and produces the error:
Imports CrystalDecisions.Shared
Public Class Report_View
Inherits System.Web.UI.Page
Private Sub Report_View_Init(sender As Object, e As System.EventArgs) Handles Me.Init
Dim sReportNum As String = Request.QueryString("Report")
configureCRYSTALREPORT()
Select Case sReportNum
Case "1"
CrystalReportSource1.Report.FileName = "reports/XXX111.rpt"
CrystalReportViewer1.ID = "XXX111"
CrystalReportSource1.ReportDocument.Refresh()
'CrystalReportSource1.ReportDocument.SetParameterValue("Region", "Mid-Atlantic")
CrystalReportSource1.ReportDocument.SetParameterValue("Last7", "False")
CrystalReportViewer1.EnableParameterPrompt = True
Case "2"
CrystalReportSource1.Report.FileName = "reports/XXX222.rpt"
CrystalReportViewer1.ID = "XXX222"
CrystalReportSource1.ReportDocument.Refresh()
'CrystalReportSource1.ReportDocument.SetParameterValue("Region", "Mid-Atlantic")
CrystalReportSource1.ReportDocument.SetParameterValue("Last7", "False")
CrystalReportViewer1.EnableParameterPrompt = True
Case ("3")
CrystalReportSource1.Report.FileName = "reports/XXX333.rpt"
CrystalReportViewer1.ID = "XXX333"
CrystalReportSource1.ReportDocument.Refresh()
'CrystalReportSource1.ReportDocument.SetParameterValue("Carrier", "ABC")
CrystalReportSource1.ReportDocument.SetParameterValue("Last7", "False")
CrystalReportViewer1.EnableParameterPrompt = True
Case "4"
CrystalReportSource1.Report.FileName = "reports/XXX444.rpt"
CrystalReportViewer1.ID = "XXX333"
CrystalReportSource1.ReportDocument.Refresh()
CrystalReportSource1.ReportDocument.SetParameterValue("Last7", "False")
CrystalReportViewer1.EnableParameterPrompt = False
Case "5"
CrystalReportSource1.Report.FileName = "reports/XXX555.rpt"
CrystalReportViewer1.ID = "XXX555"
CrystalReportSource1.ReportDocument.Refresh()
'CrystalReportSource1.ReportDocument.SetParameterValue("Carrier", "ABC")
CrystalReportSource1.ReportDocument.SetParameterValue("Last7", "False")
CrystalReportViewer1.EnableParameterPrompt = True
Case "6"
'Not yet
'CrystalReportSource1.Report.FileName = "reports/XXX666.rpt"
End Select
Dim exportFormats As Integer = CInt(CrystalDecisions.[Shared].ViewerExportFormats.ExcelFormat _
Or CrystalDecisions.[Shared].ViewerExportFormats.ExcelRecordFormat _
Or CrystalDecisions.[Shared].ViewerExportFormats.PdfFormat)
CrystalReportViewer1.AllowedExportFormats = exportFormats
'configureCRYSTALREPORT() '<-- Was here, moved to top of procedure
End Sub
Private Sub Report_View_Unload(sender As Object, e As System.EventArgs) Handles Me.Unload
If Not IsNothing(CrystalReportViewer1) Then
CrystalReportSource1.Dispose()
CrystalReportViewer1.Dispose()
End If
End Sub
Private Sub configureCRYSTALREPORT()
Dim myConnectionInfo As New ConnectionInfo()
myConnectionInfo.ServerName = "000.000.000.000"
myConnectionInfo.DatabaseName = "MyDatabase"
myConnectionInfo.UserID = "ABCDEF"
myConnectionInfo.Password = "GHIJKL"
setDBLOGONforREPORT(myConnectionInfo)
End Sub
Private Sub setDBLOGONforREPORT(ByVal myconnectioninfo As ConnectionInfo)
Dim mytableloginfos As New TableLogOnInfos()
mytableloginfos = CrystalReportViewer1.LogOnInfo
For Each myTableLogOnInfo As TableLogOnInfo In mytableloginfos
myTableLogOnInfo.ConnectionInfo = myconnectioninfo
Next
End Sub
End Class
TIA
Hi Clifton,
Moved your post to the .NET SDK forum.
What patch level are you on for Crystal Reports for Visual Studio 2010?
Are you running the app in 32 or 64 bit mode?
Does your app Pool also match the platform also, x86 or x64?
Which Redist package did you use to deploy the runtime on the web server?
Don
What's the easiest way to find out which patch is installed (on the web server)? I have access to the web server machine, but did not install Crystal Reports for Visual Studio 2010.
The web server is a 64-bit machine. I presume it's running the 64 bit version of CR4VS2010.
I'm not sure about the App Pool (we're getting beyond my pay grade). This is the list under Application Pools on the web server:
Where do I find the Redist package that I (presumably) used?
I'm sorry for all the questions I'm sure I should have known before I posted.
I will admit that publishing a web app is not as simple as building a deployment package for a desktop application. I'm not really a web developer (can you tell?), I'm more of a desktop application developer that went to his boss with "a neat idea". Now I'm stuck trying to get it to work on a machine other than my own development machine.
Hi Clifton,
Check the 'C:\windows\assembly' location.
Right click the 'CrystalDecisions.CrystalReports.Engine' assembly go to proerties, version tab. theres your full version.
Add remove programs (programs and features) wii tell you if its 32 or 64 bit redistributables.
If it is, then two things to check.
1) If the applications target platform on the DEV machine is X64
2) App pool advance settings property "Enable 32 bit applications" should be false.
- Bhushan.
Ok, curiously I have two "CrystalDecisions.CrystalReports.Engine" on both the local machine and the web server machine.
The two have these version numbers:
13.0.2000.0
11.5.3700.0
On my local machine, I have the following entries under "Uninstall or change a program":
SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)
SAP Crystal Reports, version for Visual Studio 2010
(Both the above show a version of 13.0.3.612)
On the web server machine, I have listed:
SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)
The version shown for this one is: 13.0.1.220
Since both my local (development) machine and the web server machine is 64-bit, I'm trying to target that if possible.
Just for grins and giggles I tried changing the default pool setting "Enable 32-bit applications" to true (it was set to false) and I got this error:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified
So I set the property back to false.
Hmm.. looks like a configuration issue.
Try this:
- Uninstall all the CR version 13 component from your Server machine.
- Install CR for VS 2010 SP4 64 bit runtimes (msi)
- Check the .NET framework targetted on the DEV machine and verify the same is targeted by the app pool on the server.
- Try changing the 'Pipeline mode'.
- If this does not work, you may want to redeploy the application.
Thanks,
- Bhushan.
On uninstalling/re-installing CR4VS2010SP4:
No joy. ![]()
Target Framework on Dev machine and framework referenced in app pool (4) is the same.
Not sure what "Pipeline mode" is nor how to change it.
I've redeployed (re-published) after almost every change to the dev machine and web server (it's quick, so it's no big deal).
Hi Clifton,
You said:
On my local machine, I have the following entries under "Uninstall or change a program":
SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)
SAP Crystal Reports, version for Visual Studio 2010
(Both the above show a version of 13.0.3.612)
On the web server machine, I have listed:
SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit)
The version shown for this one is: 13.0.1.220
So use Service Pack 3 redist package on the WEB server, not SP 4.
Can you check the properties of the assemblies in your project? They too should be version 13.0.3.612, I'm thinking possibly it's using both.
For the App properties also make sure it's targetting 4.0 framework in the App's properties, and share the folder of course.
Try using Fiddler, it should indicate where the permission issue are.
And because you have both 13 and 11.5 on the WEB server create a new App Pool for the 13 application, it may be the app pool already has 11.5 loaded and therefore your new app will not run.
Don
I think I'm collecting so many different versions are the redist package, I'm not sure what I have any more. I have a file named "CRforVS_13_0_3.exe", would that be what you want me to install?
On my development, the crystal references are all version 13.0.2000.0
Everything is (or should be) targeting framework 4.0. I'll verify, but I'm fairly certain it is the case.
I am downloading Fiddler and will run it as soon as it finishes.
I do not know how to create an app pool (wasn't this automatic with the publishing?).
I looked at the results of Fiddler and see that the thing seems to have a problem with crv.js.
Here is the request/response (IP addresses changed to protect the innocent):
REQUEST:
GET /aspnet_client/system_web/4_0_30319/crystalreportviewers13/js/crviewer/crv.js HTTP/1.1
Accept: application/javascript, */*;q=0.8
Referer: http://000.000.000.000/Report_View.aspx?Report=1
Accept-Language: en-US
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Accept-Encoding: gzip, deflate
Host: 000.000.000.000
Connection: Keep-Alive
Cookie: ASP.NET_SessionId=qzbqydakz0pc223uqrdamcx3
Response
HTTP/1.1 404 Not Found
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Mon, 13 Aug 2012 20:43:29 GMT
Content-Length: 5314
I looked and have, indeed, found crv.js where (I think) it's supposed to be, that is:
C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13\js\crviewer
Permissions on this file seem to be correct.
Hi Clifton,
"I have a file named "CRforVS_13_0_3.exe", would that be what you want me to install?
On my development, the crystal references are all version 13.0.2000.0"
13_0_3 is service pack 3. 13.0.2000.0 is the framework version, all of CR's assemblies are versioned in this format so you don't have to recompile each time a patch is release, although recommended. It's the file version of our dll's located in \windows\assemblies where you'll find/confirm the version installed.
CR for VS 2010 requires an uninstall is performed before a runtime update can be done.
As for the error and other access permission issue do you have a WEB Server Administrator? That person should be able to verify how all of the shares are configured in the WEB Server and App pool, and how to create a new one. Check Microsofts Forums for more info also, they can be very helpful in configuring IIS.
Thanks again
Don