cancel
Showing results for 
Search instead for 
Did you mean: 

Database logon Error Through IIS

Former Member
0 Kudos

I'm using the push method to create an xml and load it in the reportdocument object.

l_objReportDocument.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, strAppPDFFileName)

l_objReportDocument.Load(l_strReportFileName)

So to simulate load, i'm batching a certain scenario through my app, with multiple instances running simulataneously.

When i run multiple instances of the app in "desktop mode" (not through IIS), there are no issues.

However, when the same is done through IIS, i get a database logon error randomly throughout the run.

Are there any known issues with IIS and crystal with regards to multiple instances and high loab

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Paul

there is no known issues, but I don't know what version of VS and CR you are using...

Also, when doing batch processing you have to be very, very careful that you do not exceed the limits of the report engine. The engine is limited to processing three Concurrent Processor Licenses. So, you can send 10 requests or a 100, but only three of those will be processed, the others will be queued up. Depending on the the length of the ques, hardware, etc., this will eventually lead to all kinds of issues, particularly for web apps as you have the IIS variable to contend with also. So, make sure you close and dispose the report object as you get done with it.

Then there is also a concept called Print Job. This is set by default at 70. A print Job is pretty well anything the report does. From paging to zooming to printing. Additionally, if you have a report with one subreport in the detail section and the report returns 70 records, thus running 70 subreports, you're over the 70 limit (10 dubreports, + 1 main report).

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Former Member
0 Kudos

The runtime is version 13.04 and i've tried the latest as well. Visual studio is 2010.

Answers (7)

Answers (7)

Former Member
0 Kudos

Any comments? This last bit of info would help a lot.

0 Kudos

Are you using Sessions and Postback methods? If not then try it, it will work.

Also, search for "threading" You actually get better performance if you don't use threading with CR SDK.

Don

Former Member
0 Kudos

The way the application and system is structured makes it so that isn't feasible or in my control.

And i did encounter in my extensive reading the study where multiple threads does not improve the performance of the Crystal SDK.

I'm wondering if it is just not intended to have multiple crystal objects going at once in the same process. Like Crystal dot net SDK is meant to be used as a singleton across one's entire site/application. It seems as though you're implying this is the case, that i can't have multiple instances of crystal in a single process.

0 Kudos

If you have no control over using sessions and post backs then nothing we can do, it's a requirement to keep each report in a separate memory block.

Good luck

Former Member
0 Kudos

The root cause seems very similar to this:

Note 1892901:Unexpected error when multiple threads access the same Crystal Report with ExportToStr...

I do realize it is for an older version of crystal and a different error message. But the way it is created is the same. And my reports have different names.

Former Member
0 Kudos

Any comment to the new information i provided?

0 Kudos

Sounds like you are not keeping the reports in session. Try adding Session handling and PostBack methods to your application.

Don

Former Member
0 Kudos

Could you elaborate a little bit with some background knowledge? Kindly?

0 Kudos

Search the WEB on how to use Sessions and PostBack methods. Lots of info in this forum also.

On the Overview tab there is a link to our samples also.

When using BOE and keeping report objects in session here's how we do it:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.Enterprise;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.Enterprise.Viewing;
using CrystalDecisions.ReportAppServer.Controllers;

public partial class _Default : System.Web.UI.Page
{
    EnterpriseSession boEnterpriseSession;
    InfoObject boInfoObject;
    ReportClientDocument boReportClientDocument;

    protected void Page_Init(object sender, EventArgs e)
    {
        SessionMgr boSessionMgr;
        InfoStore boInfoStore;
        EnterpriseService boEnterpriseService;
        InfoObjects boInfoObjects;
        string boReportName;
        string boQuery;
        ReportAppFactory boReportAppFactory;

        if (Session["boEnterpriseSession"] != null)
        {
            boEnterpriseSession = (EnterpriseSession)Session["boEnterpriseSession"];
        }
        else
        {
            //Log on to the Enterprise CMS
            boSessionMgr = new CrystalDecisions.Enterprise.SessionMgr();
            boEnterpriseSession = boSessionMgr.Logon("Administrator", "Password", "localhost", "secEnterprise");//(Request.QueryString["username"], Request.QueryString["password"], Request.QueryString["cms"], Request.QueryString["authtype"]);
            Session.Add("boEnterpriseSession", boEnterpriseSession);
        }
        if (Session["boReportClientDocument"] != null)
        {
            boReportClientDocument = (ReportClientDocument)Session["boReportClientDocument"];
        }
        else
        {
            boEnterpriseService = boEnterpriseSession.GetService("", "InfoStore");
            boInfoStore = new CrystalDecisions.Enterprise.InfoStore(boEnterpriseService);

            boReportName = "World Sales Report";

            //Retrieve the report object from the InfoStore, only need the SI_ID for RAS
            boQuery = "Select * From CI_INFOOBJECTS Where SI_NAME = '" + boReportName + "'";
            boInfoObjects = boInfoStore.Query(boQuery);
            boInfoObject = boInfoObjects[1];

            boEnterpriseService = null;

            //Retrieve the RASReportFactory
            boEnterpriseService = boEnterpriseSession.GetService("RASReportFactory");
            boReportAppFactory = (CrystalDecisions.ReportAppServer.ClientDoc.ReportAppFactory)boEnterpriseService.Interface;
            //Open the report from Enterprise
            boReportClientDocument = boReportAppFactory.OpenDocument(boInfoObject.ID, 0);

            //Add the reportClientDocument to session
            Session.Add("boReportClientDocument", boReportClientDocument);
        }
            //check the viewer session has not already be set other set the defaults.
        if (Session["boReportClientDocument"] != null)
        {
            //Set the ReportSource of the viewer to the report in Session and export options
            int myFOpts = (int)(CrystalDecisions.Shared.ViewerExportFormats.AllFormats);
            CrystalReportViewer1.AllowedExportFormats = myFOpts;
            CrystalReportViewer1.EnableToolTips = true;
            CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
        }
        else
            CrystalReportViewer1.ReportSource = Session["boReportClientDocument"];

    }
    protected void CrystalReportViewer1_Init(object sender, EventArgs e)
    {

    }
}

Bottom line is if you don't keep them in session then IIS will simply use what object happens to in focus or completely crash because it doesn't know what you are asking it to do...

Former Member
0 Kudos

So you cannot have multiple crystal report document objects in the same w3wp.exe process even though they are separate threads/requests and the object is created and destroyed with each request? Why?

(note i am not using the viewer, i'm exporting to PDF, and i'm not using BO)

Former Member
0 Kudos

Is the Crystal runtime re-entrant and threadsafe?

Even if i increase the number or worker processes, that will only probably mask the problem. If i have 10 processes and 15 requests i'll likely see the problem again.

Former Member
0 Kudos

I have noticed, if i set IIS to recycle after every request. This problem disappears. But that isn't really practical. It basically handles each request one at a time, which obviously work.

However, when i increase the number of worker process to 10, the problem seems to go away.

Former Member
0 Kudos

Yes the Print Job Limit has no effect. Here is a more detailed error message from my logs.

07/08/2015 16:47:27    CossCrystalReports.CreateCrystalReport() - Database logon failed. -at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)

   at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

   at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)

   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)

   at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)

07/08/2015 16:47:27    There are 1 inner exceptions:

07/08/2015 16:47:27    Inner Exception #1 - Database logon failed. -    at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)

   at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

0 Kudos

Hi Paul,

I see you are still on SP 4. Can you download SP 14 and test again?

http://scn.sap.com/docs/DOC-7824

Don

Former Member
0 Kudos

Upgrading the version doesn't have any effect either.

0 Kudos

Hi Paul,

Can you attach that report to this post? Use advanced and add a .txt to the rpt file.

I'll run it through my test app and see if I can find the cause. It could be unused formula or typically a field may be referenced that does not exist.

Don

Former Member
0 Kudos

Hi Don,

You seem to misunderstand. The .rpt has nothing to do with it. It is the same .rpt everytime, and i'm running the same case through it repeatedly, and therefore sending the same data to it.

It's just that when i run two different "user versions" of my app side by side through our api with IIS, i start to see the error i posted above randomly through my logs.

Can you run your test app simultaneously by hitting it through IIS repeatedly as I describe above and see if you get this result?

0 Kudos

Hi Paul,

SDK Assumes ALL parts of the report are valid, if there are error in any formula or DB connection info that may or may not be used can cause problems. So validate everything in the RPT file and try again.

Also enable DB logging and see what is happening, recent updates to DB servers are now using Connection Pooling and not releasing the connections. Could be you are maxing out the connection pool on the DB server.

Need to do more debugging to find the root cause.

Don

Former Member
0 Kudos

It seems highly unlikely the rpt is at fault. There are no errors in the rpt. It is the same case over and over as i have said. I'm just running requests to two different apps simultaneously, and batching this same case over and over again.

But could you forward me how to turn on DB Logging.

And this only happens through IIS. As I said, if i run my app as two separate desktop apps, I don't get this problem. Probably because two separate processes are started. When through IIS, there is only one worker process, which causes the problems. See my posts below as well.

I did manage to create this log. I get this repeatedly.

<Log>

  <Message></Message>

  <File>.\crreportsource.cpp</File>

  <Line>308</Line>

  <Time>2015/07/15 13:35:01.966</Time>

  <ThreadID>08412</ThreadID>

  <DetailMessage><![CDATA[Analysis Server: 0x8004100F

Database logon failed.

..\reporthandler.cpp (10367)

Analysis Server: 0x8004100F

]]></DetailMessage>

</Log>

Former Member
0 Kudos

Also, i don't think it is the print job or any of those limits. I believe each process starts it's own instance of the crystal runtime. And I'm disposing of Crystal correctly.

Also, the error message i get isn't what you would expect from these errors. I'm getting the Database Logon error.

It's almost like IIS is running out of memory even though it doesn't seem possible.

former_member183750
Active Contributor
0 Kudos

the error message i get isn't what you would expect from these errors.

That is precisely the point. In these instances you do not get errors that you'd typically want. Please follow my suggestions and see if they help...

- Ludek

Former Member
0 Kudos

Yes Sir.

I set this key to -1. I also attempted to change other relevant keys. I see no difference, sadly.

HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Report Application Server\InprocServer\PrintJobLimit

And this is only through IIS. And i'm pretty sure every time my app starts, there is a new crystal process.

former_member183750
Active Contributor
0 Kudos

Hi Paul

the -1 option only works for the OEM RAS SDK. See if setting it to something like 500 has a better result. I'm still not sure if you are using .close and .dispose on the report objects?

- Ludek

Former Member
0 Kudos

Yes Sir. I set it to 500, and I am using .close and .dispose. No difference, sadly.

Remember, i'm running multiple instances of my app concurrnetly. So there are multiple requests going through IIS, and each starts an independent run of my app. And this is only observed through IIS. Using version 6 of IIS.

I'm editing this post Ludek, it is so random that it is hard to say if there are less errors when increasing this value, but it does appear upon a closer look that there may be slightly less. What is the upper bound of this setting?

Second Edit: It really appears the setting has no effect.

former_member183750
Active Contributor
0 Kudos

HI Paul

There is no real limit as such. But increasing the jobs puts more of a strain on the hadrware, IIS and OS.

Can you tell me a bit more about "When i run multiple instances of the app"? E.g.; how, why, etc.

- Ludek

Former Member
0 Kudos

HI Ludek.

So there are calls being made through an API that hits IIS and calls our dotnet program that produces the crystal report PDF. (I should add that from what i read, these errors are unique to exporting to PDF).

Different users get directed via the api to load up a separate dotnet program with a different crystal report on the backend.

Other than some per-user custom logic inside the report and app, the actual crystal implementations between the different "apps" are the same.

I have cases duplicated for two of these user apps. And i am batching simultaneous calls to these apps through our IIS Webservice API with a small script i wrote. Then seeing how many times i get this database logon error. In my script, i keep running the same use case over and over again so i know it isn't the use case causing the error message, because it is still random with the same use case through the apps.

Do you understand a little?