Categories
.NET ASP.NET IIS Tips

.NET Framework 4 and Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’ Error …

 

So, day before yesterday I was working on some app. And I deployed it on my IIS (v7.5) server. The deployment process went very well without any sort of troubles. But when I tried to run that application from my web browser I got loads of error. And I found that the main error was something like this,

Could Not Load Type ‘System.ServiceModel.Activation.HttpModule’

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

Description: An unhandled exception occurred during the execution of the current Web request. Review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

 

With little googling, I found that I was not the first victim of this error !!! And after few clicks I finally found the reason and solution for this error.

The Reason: If you have installed IIS AFTER installing .NET Framework 4 (in my case) then it won’t get register with IIS and so when you run the app that is built on .NET v.4  by deploying it won’t work and will give you above mentioned error. And the solution is next.

Categories
SQL Server Tips

IDENTITY key is not itself set to be Primary Key or Unique Key ??

If you have done any sort of development in database you might be familiar with IDENTITY column. It basically gives you a column which increments it self to a given value (aka Seed and Increment). General syntax for IDENTITY is,

IDENTITY [ ( seed , increment ) ]

It is basically a “Plan B” for tables where you can’t find any candidate key. By declaring a column having IDENTITY Key, you can get your self out of dilemma of what to do and how to do when your client want you to have flexibility to add any type of redundant data with still ability to distinguish between different entries !! Or simply to evade many to many (m:n) relations between tables. But as we know, it is not a good practice to simply assign an IDENTITY key and jerry rig the problem, but something we don’t have a choice (do we ever have any ?? smile_wink) …

Anyways, today’s post is about what the title says. Some people (like one of my friend) think that when we declare an Identity column, it itself becomes Unique key (because the IDENTITY key always generates UNIQUE Numbers) .. and hence it can be used as a FK even though we have not made it Primary Key or even not include UNIQUE keyword in its definition !! I have prepared a little experiment to demonstrate this …

Categories
Database How To Tips Wordpress

WordPress and Database Connection Error …

This week, I changed my WP Blog password and DB Password for that blog as well. And I did it using control panel provided by my hosting service provider. It went all well without any sort of error or so. But just today when I was trying to access my blog for some past reference, with my surprise my blog was displaying “HTTP Error 500” aka Internal Server Error for my IE9 which made no sense to me … but then I fired up my Chrome/Firefox and browse my blog it was stating “Database Connection Error” … Which was kind of self explaining … I had messed up with the database connection setup.

And it is all because I assumed that when I change password for my DB of WP in control panel of Host, it automatically configures WP to make it use the newer settings … but I WAS WRONG … it actually doesn’t … changing password for DB at Host only gives access to WP to use that password to connect DB to use, but how will WP know that it has to use new password instead of new password ?? Because if you have setup the self hosting WP blog then you know that.. we store DB connection strings (passwords,DB name, DB Username, DB Server Name) manually !! So, we hard code the password for database as well. And naturally, the password update thing in host doesn’t update password in my configuration file of WP lightbulb

Categories
How To Tips

64 bit System and Debugging in SSIS

It has been always confusion between whether we should use 32bit OS or 64bit system… and in present time it has been quite common to have 64 bit system specially in an enterprise environment or even servers. I think the main reason for that is memories are getting cheaper and processing power of processors increasing exponentially (and if Moore’s Law prove to be true then may be after few years PC will have computing power equivalent to today’s supercomputers). Oki, keeping science fiction on side back to my topic.

As we know that there are couple of features in SQL Server Integration Services (SSIS, an ETL component of SQL Server) are not yet supported for 64bit OS. So if you try to run that component in 64bit system you will be present with error stating that selected operation can’t be performed because it is not meant for 64bit system. So you may be wondering what should we do to perform an operation that is only supported by 32bit system but you have only 64bit system ?? …

The solution lies in “Property” setting of SSIS package. It has an option called “Run64bitRuntime” which is by default set to “True” when you have 64bit system. Once you make it false, you can run your package which uses 32bit operation without any error.

Following are the screenshot of such a operation, (Excel Connection Manager) in which my package was trying to connect to an excel file at debug but it was failing because that operation is not supported in 64bit system.

Categories
.NET ASP.NET Software Tips Visual Studio Windows

ASP.NET and Page Not Found Error while debugging !

Being sunny weekend today, with full of energy I began to work on making some prototype application which I have to present to my client sometimes during next week. It been a while since I worked on ASP.NET on my application (@ 2 weeks) since I installed Sharepoint Server 2010 demo in my machine. So, with having no idea of a monster under the bed, I made a simple web app and fired it up to debug … and with my little surprise, I got really weird “Page Not Found” error !!! To be honest, I have not seen this error before until today. And I had no idea that what went wrong with it. But I thought that may be it is because something is blocking up my access of application to web server. I checked with my new firewall software (Online Armor) which I had installed few weeks ago for testing purposes (yah, I love testing everything … smile_wink) …

Categories
Access Migration SQL Server Tips

Access to SQL Server migration … and Compatibility Issues !!

Recently I was involved in a migration project. Client was/is using ancient application built on Access 2.0 (yup … its 2.0) … I think it was started as a small app for just couple of users and with time it grew larger and soon it became mission critical application which still is built on old technology. Now here I am not gonna discuss about advantages of SQL Server over Access … because fact is both have their place in Data Processing Systems. In my native language we have a nice saying which loosely means that “sometimes we can’t do something by knife, that has to be done by needle” … having little bit interest in element of life and Zen … I consider myself self-proclaimed philosopher smile_wink, ( if you have problem with that then … I really don’t care ) … oki back to discussion … what I meant to say is, in a situation where you need very small application that will be used by 1-2 or very few people, with very little data to process (v2.0,95,97 everyone had 1GB physical size limit), have very little or no budget, easy to maintain,deploy and design solution then I guess access is pretty good fit. But if there are high number of concurrent users (user > 5-10), high data storage capacity, requirement of better ( wayyy better ) security then SQL Server is ideal solution.

With that said, let me explain the situation that let me to write this blog post. I had already installed, patched and configured SQL Server properly on our database server, I had also prepared the workstation too, which was able to connect to database server. Now, I thought to try for test run of a sample migration. It was an access 97 file (which was originally access 2.0, converted to access 97 to be compatible with SQL Server import.) with just 2 database and had no other stuffs (or say views). I first opened that access file in my workstation to be sure that it is working (I mean not corrupted), after that I fired up SQL Server Migration Assistance (SSMA, is a great free utility by Microsoft which allows users to migrate access database to SQL Server, which can also be done by making package in SSIS).

And I was greeted with this message in SSMA console …

Starting conversion...

Analyzing metadata...

Access Object Collector error: Database

     Retrieving the COM class factory for component with CLSID {CD77B9-4FD-42C5-AE42-8D281F0419} failed due to the following error: 80040154. This error may be a result of running SSMA as 64-bit application while having only 32-bit connectivity components installed or vice versa. Please run SSMA in 32-bit (or 64-bit) mode or consider updating your connectivity components from http://go.microsoft.com/fwlink/?LinkId=197502.
     An error occurred while loading database information.

Conversion finished with 0 errors, 0 warnings, and 0 informational messages.

There is nothing to process.
Categories
How To SQL Server Tips

SQL Server Installation Rules and “System Reboot Required” Error

When we do installation or removing SQL Server, it always executes installation rules. And what really weird is, installer even checks for these rules when we want to Un-install the SQL Server (kind of reminds me, my experience with Office ‘97 which had quite similar craving for installation media while uninstalling).

Today, when we were trying to install SQL server on one of our test machine which was built freshly from scratch was acting really weird. When I ran the installation, it executed installation rules as usual to check if there is something missing. But I got this common error saying “RebootRequiredCheck: Failed”, which basically says that System Reboot is Required, so we thought it might be because of some update (Windows does have really bad habit of asking to reboot every now and then after updates ). So we did as required by SQL Server and rebooted the system. Then we again fired the installation process and guess what ?? we had again same error !! We tried couple of other stuffs like cleaning temp files and stopping services which might be causing this problem but it didn’t worked even after 3-4 reboots. So, finally wise guy (me :D) thought to Google this problem, and I found that this error has nothing to do with SQL Server itself !!

Error

Actually it is because of Windows … apparently, when there is some updates are done or some critical software is installed, windows sets a parameter in registry which makes that windows gets rebooted once that process is completed. But somehow, that registry value doesn’t get reset even after reboot and that can cause trouble for SQL Server !! So, we have to manually remove that value from registry.