Link to home
Start Free TrialLog in
Avatar of goprasad
goprasad

asked on

Microsoft .Net Framework - Unhandled exception error in my sql 2005 Ent Sp2 box

Hello experts,
When I right click on a DB SSMS and select report in any of the instance I get the following error:
"Unhandled exception has occured in a component in your application. If you click Continue, the application will ignore this error and attempt to continue.
I have attached the screenshor reference.
SQL ver. is 2005 SP2 running on W2K3 SP 2.
Installed following vesions of Microsoft .Net Framework:
.Net Framework 2.0 SP2
.Net Framework 3.0 SP2
.Net Frameowrk 3.5 SP1
Thanks

sql-error-2.JPG
Avatar of Bodestone
Bodestone
Flag of United Kingdom of Great Britain and Northern Ireland image

I've not had this specific error before but had other errors to do with SQL server and the temp directories.

My solution was to create a temp folder on the local drive (c:\temp or d:\temp for example).
Right clicking My Computer and Properties\Advanced I change the environment variables for TEMP and TMP to point at that location (local and system).

I would then ensure that the users running all MSSQL services had read\write permissions to that location.

After a restart all was peachy.
Avatar of DBAduck - Ben Miller
The first thing I would ensure on your side is that you have the Service Pack for SQL Server installed on the box with SSMS on it.  If it is not on the server that you get the error, but from your workstation, then sometimes these are because the Tools have not been updated to the right service pack, but the Server has.

So check your machine where you are running SSMS to ensure that the version is the correct one.

If you go into SSMS and choose the Help menu and then About, you will see the versions of the tools, etc.  The tools version should match the server version.  (SELECT @@VERSION)
The advice about service packs and general patching of SQL ,is sound. I would also make sure windows and other installed Microsoft applications  are updated as well.
I would also make sure that the %TEMP% variable is mapped to either the default value or the temp folder that was mentioned above
Right click My computer icon>properties>advanced>startup & recovery>Environment variables
Temp default value is  %USERPROFILE%\Local Settings\Temp
you can also try to cleanup the contents of temp folder , for some reason I found that some applications will display strange behavior when the TEMP folder has a few thousand files or is really crowded.

Close SSMS, save the below as clean_temp.bat , and run it
@echo off
del /F /S /Q %temp%\*.*
rmdir /S /Q %temp%
mkdir "%userprofile%\Local Settings\temp"
exit

Do not worry about any errors or warnings , some files could be locked.
if the problem persists after all that , especially after applying the SQL service packs, and ensuring accessibnility to  %TEMP% & cleaning  that folder, try running Process Monitor to capture the exact issue encountered by Management studio when the error is generated.
 


I suppose I should also have asked if you were logging into SSMS using windows authentication or SQL authentication (sa for example).

Basically I was cut short by realising I had to head off before but should have added more explanation for the reasoning behind changing the temp folder away from the user profile.

I have usually found the problem arise during SSIS tasks particularly during file import or export. It is more likely when logged in to SQL Server using SQL Server authentication than windows authentication but can happen with either.

What happens is that the interface creates a temp file for import or export using the current user's profile but then tries to access it via the service running SQL Server which may not have access to the file.

I have had this issue as well when using a script to create a linked server to an access database to read from but it was some time agon now and so cannot remember more details.
ASKER CERTIFIED SOLUTION
Avatar of goprasad
goprasad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of goprasad
goprasad

ASKER

There was a VB script that was scheduled to clean temp/tmp files in C:\drive during login, which was causing this issue. Rescheduled it to run during log off and restart, fixed the issue.