Search code examples
c#azure-sql-databaseazure-cloud-servicescrystal-reports-2010

Crystal Reports throws Database Logon Failed error in Azure Cloud Service


I am struggling to see why Crystal Reports fails with a "Database Logon Failed" message when it is using the same credentials as the .NET application which connects without issue. Running the app in Azure as a Cloud Service, connecting to Azure SQL Database. Crystal runtime is installed as a startup task.

All works fine in local debug, but fails on deployment with same login error.

I have tried a few things, none of which work. Crystal Reports runtime is installed, I have a StartUp.cmd file with:

msiexec.exe /I "CR13SP29MSI64_0-10010309.msi" /qn
robocopy D:inetpubwwwroot E:sitesroot /S

I am deploying the app with CR13SP29MSI64_0-10010309.msi in the root, have a startup task defined in ServiceDefinition.cscfg which is:

<Startup>
  <Task commandLine="StartUp.cmd" executionContext="elevated" taskType="background" />
</Startup>

Note, if I RDP to the cloud service and run the MSI it asks if I want to reinstall, so it looks like the install itself is fine.

Tried running reports with

doc.SetDatabaseLogon(conn.UserID, conn.Password, conn.ServerName, conn.DatabaseName, true);

where doc is a ReportDocument and conn contains valid credentials.

Also tried reading from config and using DataSourceConnections...

var connString = ConfigurationManager.ConnectionStrings["myEFconnection"].ConnectionString;

var sCon = new SqlConnectionStringBuilder(connString);

doc.DataSourceConnections[0].SetConnection(sCon.DataSource, sCon.InitialCatalog, sCon.UserID, 
sCon.Password);

The user and password are correct, the myEFconnection is what the app uses and all works ok, plus this all works with the same config fine in Visual Studio connecting to the Azure SQL DB. So clearly not a username and password issue and can't be firewall either otherwise other application functions would fail. What else?

Any help much appreciated as the error is particularly unhelpful and I am somewhat stumped as to where else to go.


Solution

  • I could not find a solution to this. As a result I have migrated to Telerik instead. This was not pain free of course, but the time spent migrating was less than the time spent trying to trouble shoot the crystal issue.

    If anyone from Crystal is interested, the fundamental problem here is providing insufficient information in an error. The call stack is not surfaced to the end user, nor logged in the event viewer and hence cannot be viewed, any inner exceptions are swallowed and discarded and instead wrapped in a very unhelpful high level generic error "Database Logon Failed".

    I have no doubt the underlying issue would have been simple to resolve if only it had been possible to see what it truly was. I hope you fix this in future, otherwise I can only imagine you will be handing more of your business to Progress Software and the Telerik team.