We're running into a very strange problem on one of our reporting servers (running Crystal Reports for .Net 4 in IIS on a Windows 2008 server). When trying to run a report, we get an error saying "Load Report Failed", with an InnerException of "Invalid file name". This just started a few months ago, and had been working fine for years previously.
I have checked online and all the suggestions that I can find have been tried to no avail. A few notes about this issue:
Everything I can find on the Internet indicates this is a problem generating the temp report file. We have changed the registry setting TemDir to point to a different location than the standard temp directory.
We can see that the temporary .rpt files are being created in the desired directory, even when we get the error. I pulled one down locally and it opens in Crystal Reports designer with the data I would have expected.
We are not trying to export the reports to any file format, we are just using the standard report renderer.
This is only happening in one environment. When we copied the code that works in our higher environment Crystal server, we still get the same error.
Our server management team assures us no server changes have happened just prior to the issue (though I'm not sure we can prove that definitively).
Some fixes I have tried (not necessarily in this order):
Giving the account that the Website uses read/write access to the root of C:
Adding the account that the Website uses to the Administrators local group
Removing, then re-adding read/write/execute permissions to the temporary report directory. (Same results as above - temp files are created but we get the error still.)
Giving the account that the Website uses access to C:\Windows\Temp (no reason why that should matter since we are specifying the temp directory but thought I would give it a whirl anyway)
Stopped/started IIS, the application pool, rebooted the server.
Does anyone have any other suggestions we can look at for this problem? My gut tells me that there's still some lingering permissions issue but I can't find it.
As requested, here is some code where the error occurs:
Private Sub OpenReportFile()
Dim reportPath As String = System.Configuration.ConfigurationManager.AppSettings("ReportFileLocation")
If _reportDefinition Is Nothing Then Exit Sub
_theReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
_theReport.Load(reportPath & _reportDefinition.ReportFilePath, OpenReportMethod.OpenReportByTempCopy)
End Sub
The error is thrown on _theReport.Load.
AppSettings("ReportFileLocation") contains the base folder (a local path on the D drive) where the .rpt files reside.
_reportDefinition is a local domain object that contains the specific report path.
When the two are combined, the value of reportPath would be a local path like "D:\Inet\docroot\WebCrystal\Reports\MyReportFile.rpt"
This issue happens for every report.
Related
I'm coming across this error when I run my web app. The error is given only when the code is run on my web server. I can run the exact same code on my local machine and it works just fine. The the only way that I see the error when running the app on my webserver is if I press f12 when I try to run a given page. The page is trying to SFTP a file to another server, but like I said, I can run the exact same code on my local machine with no errors so I know that the code will work. There are no message or error boxes that popup. I've gone over the code over and over as well as looking at the difference of the configuration and programs that are installed on my local machine as opposed to what is on my web server. There is nothing that I see that is different. Here is the whole error message I see:
Sys.WebForms.PageRequestManagerServerErrorException: The source was
not found, but some or all event logs could not be searched. To
create the source, you need permission to read all event logs to make
sure that the new source name is unique. Inaccessible logs: Security.
I've found quite a few questions about this error, most of them talk about giving access to all users in this registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security
or adding a user called Network Service to the above key and giving it full access or granting read permissions for the Network Service user to the whole EventLog branch. Another path I've explored is to change the identity of the app pool in IIS and then change it back. I've tried just about everything listed on SO and other places. Like I said, most of them involve writing new keys and changing permissions on keys in the registry. Another one I've tried is creating a registry key named HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application\#MY APP# and then creating a string value inside it called EventMessageFile with the value of C:\Windows\Microsoft.NET\Framework\v4.0.30319\EventLogMessages.dll in it. Another suggestion is to open the the app as an Administrator. That didn't work either. I could go on and on and on but for the sake of not turning this into a novel I won't, but I hope I've shown enough examples to let everyone know that I've done due diligence in trying other solutions first before asking my question. Will someone please help me out with this very frustrating error?
I've created an online asp.net app using VS2010 with VB. It has been online and working for over a year. It's on our company's public web server but it's only for employee use. For as long as the site has been active and in use, I have had to made periodic changes to improve performance or to fix bugs; no problem until now. Suddenly, though, VS is throwing an error during the publishing process:
Unable to add 'app_offline.htm' to the Web site. The file 'app_offline.htm' already exists in this Web site.
The IDE is set up to create the site files in a local directory on my workstation machine, and then I copy the files to the server.
The local directory does not contain the app_offline.htm file, so I don't get why the error is saying that it already exists.
It appears that even with this error, all of the files are being properly created, and the site works fine after I copy them to the server, so this is apparently not a fatal error. But it's still unnerving to me to not know why it's doing that, and why just now when it has been fine for over a year.
I would either like to find what's causing the problem and fix it or to find a way to inhibit the process of creating the app_offline.htm file. Anyone have any ideas? No search has turned up any helpful information.
Thanks!
Have you tried removing the file in question from the project, publishing again, then adding it back and publishing?
You can right click on the file(s) and choose "Exclude from project..."
I am using the following code to attempt to print a PDF file using Spire PDF.
Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
doc.LoadFromFile(monroneyFilename);
doc.PrinterName = monroneyPrinter;
lock (printLock)
{
doc.PrintDocument.Print();
}
When it gets to the LoadFromFile method, it gives me a File doesn't exist exception. The rest of the code doesn't execute.
The monroneyFilename is "p:\foldername\11111111111111111.pdf" where the ones are 17 characters representing a Vehicle Identification Number.
There are no spaces in the filename or folder name, so the other answers I've seen about this do not apply.
I'm running this from within an ASP.NET Web Service.
Anyone have any ideas?
I was able to discover the problem. The P: drive was mapped to a folder on a network PC on a VPN on the server. I was crossing domains, so the user for the AppPool of the web service was not able to access the files on the remote server. I was able to copy the PDF locally and access it that way to test and it worked fine.
It seems Spire does not give exceptions for bad credentials, it just tells you the file doesn't exist.
Currently I'm working on a piece of code that involves using the Crystal Reports Viewer to export .RPT files to PDF. My problem is that the code works on literally everything except the website I'm planning to eventually put it on.
When placed on the website it throws back the error "Failed to open the connection." which I believe is connected to the SQL Server connection that's formed in order to read data for the report itself.
The code itself is solid and works when used in a separate console application I built to test it whether said code is run on my local machine or on the server itself. It even runs when I test the website in Visual Studio's virtual host.
I've narrowed it down to being some sort of permissions issue, but I am not knowledgeable enough in the various permissions settings to figure out which ones specifically apply to this situation. It's worth mentioning that other pages on the website are directly connecting to the same database, but they are doing so directly through Linq instead of going through the Crystal Report Viewer.
So does anybody know which settings I need to modify in order to fix the connection error.
An added note: One of the other suggestions is to make sure there's an ODBC DNS in place that matches the one being used by the code. I have created such a DNS already.
Application Pool dictates how your application runs in many ways. You can probably configure the web.config to run under the credentials, or access level of your choice.
Solution for people who didn't read the comments:
Change the identity under the advanced setting's of your application pool to the desired level of access.
Glad I could help.- J
I am getting a strange issue where I seem to have read access, because I can
1. Get a list of files from a directory (Directory.GetFiles())
2. Load an XML document using XmlDocument instance's Load() method
But I can't use File.ReadAllText() to load a text file into memory. Gives me an System.UnauthorizedAccessException. I am not even trying to read from a network directory, just a local one. I've also used System.Security.Principal.WindowsIdentity.GetCurrent().Name to check the working user which is [CompanyDomain]/[MyUserName] and this user has full access to the directory I am using. I've also checked that the directory actually exists.
My environment
1. Windows Server 2003 Standard Edition
2. Visual Studio 2008
3. Just using the built in web server that launches every time i run the project.
Note: I couldn't find the IUSR_MACHINENAME user on this machine.
Any idea what steps I should take next?
Cheers,
James
One thing to assert:
the file that can be Xml Load()-ed is the very same file that cannot be ReadAlText()-ed ?
When things get odd like this, I found that turning auditing on, at the level of the directory or even of the file, often ends up pointing me towards a proper diagnostic and hence resolving the issue.
Also: In looking online reference for ReadAllText() I noted that (oddly, I think), this exception can be caused by:
path specified a file that is read-only.
Not sure why write access should be sought by this apparent read-only operation, but, maybe just try to make the file r/w-able.
http://msdn.microsoft.com/en-us/library/72wdk8cc%28VS.71%29.aspx
<identity impersonate="true" />