How to make Asp.net access Crystal Report from IIS website?


J

JB

Hello Community


I developed a web site using ASP.Net, C# and Sql Server.
I used Windows Installer to deploy the application.
Under virtual directory tab in IIS it states:
C:\inetpub\wwwroot\NetAppl\

The applications runs but the reports don’t work now that the application is
running on IIS.

Below is how I call the reports:
ReportDocument apReport = new ReportDocument();

string reportPath = Server.MapPath("~/appStart / rptFolder
/rptOne.rpt");

apReport.Load(reportPath);

apRptJob.ObjRptJob(apReport);

apReport.SetDataSource(apJob);

CrystalReportViewer1.ReportSource = apReport;

CrystalReportViewer1.Visible = true;

Now when I run the reports below is the error message that it creates:
Server Error in '/ NetAppl ' Application.
The system cannot find the file specified.
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 system
cannot find the file specified.

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 (0x80004005): The system cannot find the file specified.
]

CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object&
DocumentPath, Int32 Options) +95

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +271

[CrystalReportsException: Load report failed.]

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +334
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename, OpenReportMethod openMethod, Int16 parentJob) +894
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename) +84
appHead.appStart.rptFolder.rptReporter.Page_Load(Object sender, EventArgs
e) +1441
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

________________________________________
Version Information: Microsoft .NET Framework Version:2.0.50727.3053;
ASP.NET Version:2.0.50727.3053

This error came after a lot of work because at first the error was stating
that it could not find the file. In fact I am having difficulty with the
syntax to point to the rpt files on the virtual directory.

What can I do to make my Crystal Reports run?

Thanks
Jeff
 
Ad

Advertisements

G

gerry

did you verify that reportPath contains the proper value and that the file
exists and that permissions are correct ?
It may just be the way it posted but it looks like there are a number of
spaces in there : "~/appStart^/^rptFolder/rptOne.rpt"


JB said:
Hello Community


I developed a web site using ASP.Net, C# and Sql Server.
I used Windows Installer to deploy the application.
Under virtual directory tab in IIS it states:
C:\inetpub\wwwroot\NetAppl\

The applications runs but the reports don't work now that the application
is
running on IIS.

Below is how I call the reports:
ReportDocument apReport = new ReportDocument();

string reportPath = Server.MapPath("~/appStart / rptFolder
/rptOne.rpt");

apReport.Load(reportPath);

apRptJob.ObjRptJob(apReport);

apReport.SetDataSource(apJob);

CrystalReportViewer1.ReportSource = apReport;

CrystalReportViewer1.Visible = true;

Now when I run the reports below is the error message that it creates:
Server Error in '/ NetAppl ' Application.
The system cannot find the file specified.
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 system
cannot find the file specified.

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 (0x80004005): The system cannot find the file specified.
]

CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object&
DocumentPath, Int32 Options) +0

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object&
DocumentPath, Int32 Options) +95

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
+271

[CrystalReportsException: Load report failed.]

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
+334
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename, OpenReportMethod openMethod, Int16 parentJob) +894
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename) +84
appHead.appStart.rptFolder.rptReporter.Page_Load(Object sender,
EventArgs
e) +1441
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

________________________________________
Version Information: Microsoft .NET Framework Version:2.0.50727.3053;
ASP.NET Version:2.0.50727.3053

This error came after a lot of work because at first the error was stating
that it could not find the file. In fact I am having difficulty with the
syntax to point to the rpt files on the virtual directory.

What can I do to make my Crystal Reports run?

Thanks
Jeff
 
J

JB

--
JB


gerry said:
did you verify that reportPath contains the proper value and that the file
exists and that permissions are correct ?
It may just be the way it posted but it looks like there are a number of
spaces in there : "~/appStart^/^rptFolder/rptOne.rpt"


JB said:
Hello Community


I developed a web site using ASP.Net, C# and Sql Server.
I used Windows Installer to deploy the application.
Under virtual directory tab in IIS it states:
C:\inetpub\wwwroot\NetAppl\

The applications runs but the reports don't work now that the application
is
running on IIS.

Below is how I call the reports:
ReportDocument apReport = new ReportDocument();

string reportPath = Server.MapPath("~/appStart / rptFolder
/rptOne.rpt");

apReport.Load(reportPath);

apRptJob.ObjRptJob(apReport);

apReport.SetDataSource(apJob);

CrystalReportViewer1.ReportSource = apReport;

CrystalReportViewer1.Visible = true;

Now when I run the reports below is the error message that it creates:
Server Error in '/ NetAppl ' Application.
The system cannot find the file specified.
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 system
cannot find the file specified.

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 (0x80004005): The system cannot find the file specified.
]

CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object&
DocumentPath, Int32 Options) +0

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object&
DocumentPath, Int32 Options) +95

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
+271

[CrystalReportsException: Load report failed.]

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
+334
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename, OpenReportMethod openMethod, Int16 parentJob) +894
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename) +84
appHead.appStart.rptFolder.rptReporter.Page_Load(Object sender,
EventArgs
e) +1441
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

________________________________________
Version Information: Microsoft .NET Framework Version:2.0.50727.3053;
ASP.NET Version:2.0.50727.3053

This error came after a lot of work because at first the error was stating
that it could not find the file. In fact I am having difficulty with the
syntax to point to the rpt files on the virtual directory.

What can I do to make my Crystal Reports run?

Thanks
Jeff


.
Hello Jerry

Thanks for your response. I would like to clarify the question:

Lets say the location of the Crystal Report file on the file system
c:\DotNetAppl\NetAppl\rptFolder\Report1.rpt

However the virtual direcory is \Inetpub\wwwroot\NetAppl\rptFolder\

How can I point reportPath to
c:\DotNetAppl\NetAppl\rptFolder\Report1.rpt ?

Thnaks
Jeff
 
J

JB

--
JB


gerry said:
did you verify that reportPath contains the proper value and that the file
exists and that permissions are correct ?
It may just be the way it posted but it looks like there are a number of
spaces in there : "~/appStart^/^rptFolder/rptOne.rpt"


JB said:
Hello Community


I developed a web site using ASP.Net, C# and Sql Server.
I used Windows Installer to deploy the application.
Under virtual directory tab in IIS it states:
C:\inetpub\wwwroot\NetAppl\

The applications runs but the reports don't work now that the application
is
running on IIS.

Below is how I call the reports:
ReportDocument apReport = new ReportDocument();

string reportPath = Server.MapPath("~/appStart / rptFolder
/rptOne.rpt");

apReport.Load(reportPath);

apRptJob.ObjRptJob(apReport);

apReport.SetDataSource(apJob);

CrystalReportViewer1.ReportSource = apReport;

CrystalReportViewer1.Visible = true;

Now when I run the reports below is the error message that it creates:
Server Error in '/ NetAppl ' Application.
The system cannot find the file specified.
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 system
cannot find the file specified.

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 (0x80004005): The system cannot find the file specified.
]

CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object&
DocumentPath, Int32 Options) +0

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object&
DocumentPath, Int32 Options) +95

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
+271

[CrystalReportsException: Load report failed.]

CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
+334
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename, OpenReportMethod openMethod, Int16 parentJob) +894
CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String
filename) +84
appHead.appStart.rptFolder.rptReporter.Page_Load(Object sender,
EventArgs
e) +1441
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

________________________________________
Version Information: Microsoft .NET Framework Version:2.0.50727.3053;
ASP.NET Version:2.0.50727.3053

This error came after a lot of work because at first the error was stating
that it could not find the file. In fact I am having difficulty with the
syntax to point to the rpt files on the virtual directory.

What can I do to make my Crystal Reports run?

Thanks
Jeff


.
Hello Jerry

Thanks for your response. I would like to clarify the question:

Lets say the location of the Crystal Report file on the file system
c:\DotNetAppl\NetAppl\rptFolder\Report1.rpt

However the virtual direcory is \Inetpub\wwwroot\NetAppl\rptFolder\

How can I point reportPath to
c:\DotNetAppl\NetAppl\rptFolder\Report1.rpt ?

Thnaks
Jeff
 
G

gerry

since ths is outside of your web app you either hard code it just like
that - "c:\DotNetAppl\NetAppl\rptFolder\Report1.rpt"
or stick the folder path in your web.config and pull it from there

personally I would put these reports within your web app so that your
current code works as-is.
that way your site is self contained and can run on any server without any
special permissions or 3rd party intervention - there is not much ( zero ? )
chance you will be able to do this through a hoster.
 
J

JB

--
JB


gerry said:
since ths is outside of your web app you either hard code it just like
that - "c:\DotNetAppl\NetAppl\rptFolder\Report1.rpt"
or stick the folder path in your web.config and pull it from there

personally I would put these reports within your web app so that your
current code works as-is.
that way your site is self contained and can run on any server without any
special permissions or 3rd party intervention - there is not much ( zero ? )
chance you will be able to do this through a hoster.








.
Hello Gerry

Thanks for the tip. I did just that because when the error message said
file
not found. But out of curiousity if I did use web.config what section would
I put
that file system path in?

Jeff
 
Ad

Advertisements

G

gerry

web.config :

<appSettings>
<add key="ReportFolder" value="c:\DotNetAppl\NetAppl\rptFolder\" />
</appSettings>


in your project : reference System.Configuration
in your code :
using System.Configuration;
. . .
string ReportFolder = ConfigurationManager.AppSettings ["ReportFolder"];
. . .
reportPath = ReportFolder + "Report1.rpt ";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top