Code Project

Link Unit

Friday, January 29, 2010

Exception Details: System.Runtime.InteropServices.COMException: Access is Denied

"Access Denied" : Error was creeping when we are tring to load the crystal report file by using Load("~/Reports/MyReport.rpt"); The error looks silly as it is not pointing where the access should be given. After doing bit of googling and applying/reverting the changes found the solution.
Reason & Solution
When a CR[Crystal Report] is being created in ASP.NET, the .NET will create a report file in a temp folder, e.g. C:\Documents and Settings\MachineName\ASPNET\Local Settings\Temp.
#1 You can try to give ASPNET permission for this folder.
#2 You can also update web.config to impersonate.

<authentication mode="Windows">
<identity impersonate="true"
userName="mydomainname\myusername"
password="mypassword" />

I preferred the #1 solution ,as it is easier to give permissions once on the folder; You may like to try option #2 but keep a note that whenever Domain[very rare],user or password changes at that point web.config needs to be updated.

Hope it helps

Monday, January 25, 2010

TNS-3505 Failed to resolve name

On the primary database the current tnsnames.ora config for the db in
question looks like this :

LIVE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = A.B.C.D)(PORT = 1521))
)
(CONNECT_DATA =
(SID = live)
)
)

This works ok - tnsping etc ...

now when I try to add an entry for <dbname>_PRIMARY or
<dbname>_STANDBY,

LIVE2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = X.Y.C.D)(PORT = 1521))
)
(CONNECT_DATA =
(SID = live)
)
)

I get a TNS-3505 Failed to resolve name.
I tried various combinations but none worked.

Solution:
After doing lot of comparsion with existing files TNSNAME.ORA , it appeared that nothing is wrong.
Giving the new entry a closer look revealed that minor difference ,a leading whitespace[space on left] exist . Removed that extra space , all worked fine.

Hope it helps