Friday, June 20, 2008

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005

seeing exceptions like this make me moan in desperation... spent several hours searching the web...and although i found few good articles on this error here and here, I didn't exactly followed them because in our web app we have impersonating user, so when i opened Component Services->Computers->My Computer->DCOM Config and opened properties on Microsoft Excel Application and would give Launch permissions to this impersonated user.
It didn't work the first time, not the second, so I added this user to the local admins group.
This didn't work much either.
So in the end in some post a line containing 'Event Log' caught my attention and I swiftly opened the event viewer where, under System, found several relevant error messages, one of which

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID...
gave me the info I needed - turns out I really had to put the ASPNET user account under which asp.net is running.

This solved the problem

I still have doubts as to why the ASPNET account should be held responsible and not the impersonated one, but....whatever!

Thursday, June 19, 2008

MS SQL Server Management Studio - Create new table/Add new column

For some (long) time now I've been irritated by SQL Server Management Studio everytime I add new column to a table that has to be var char with length other than 50, which is the default.
It was like whenever I put value different than 50, Management Studio would revert the value back to 50, and I'd have to change the value again and this time it would work.

Now today I noticed something - this would happen everytime I put a value of varchar(10), but not for other values!
So for varchar(10) it is reverted to varchar(50),
but for varchar(20) the value is preserved when I change the focus....funny, no?

Tuesday, June 17, 2008

Assembly.GetEntryAssembly()

I have to use a library designed for use with Winforms.
I have to use it in Asp.net though, so at one point I got to a method using unguarded Assembly.GetEntryAssembly() call that failed.

After a little research and found this in the MSDN:



The GetEntryAssembly method can return null reference (Nothing in Visual Basic) when a managed assembly has been loaded from an unmanaged application



and became evident that the reason for the problem was that the library was call from the unmanaged IIS process.

I searched for a generic solution, but finally only managed to find a hint here:http://www.developersdex.com/asp/message.asp?p=2912&r=5817390

so now I'll add this code to solve the problem

if (null != Assembly.GetEntryAssembly())

{

// proceed with Assembly.GetEntryAssembly()

}

Else

{

// read a setting from the config file and set the entry assembly to this value if not empty

System.Configuration.ConfigurationManager.AppSettings["EntryAssembly"]

}


and thats all for now ...