Sunday, April 5, 2009

HttpHandler create and debug

Recently was working on creating a HttpHandler for PDF to handle differently the way PDF are rendered on our site, I got frustrated by the fact that the breakpoint in the Handler was hitting if path = "*" and not if I change it to path = "*.pdf". After googling around frustrated I found the answer and answer made me realize how dumbly I was hitting F5 again and again and expecting for breakpoint to hit, while the control was not even with aspnet_isapi. PDF are not by default handled by aspnet_iaspi then of course breakpoint wont be hit.

Finally after finding out that one should add a PDF custom handler in the Inetmgr under the Mappings, I found that IIS5.1 wont let me add, OK button was disabled no matter what.

Here are the two articles that helped me through this frustration.

1. How to Build a HttpHandler : http://blogs.msdn.com/nikhiln/archive/2008/05/22/httphandler-to-authorize-file-downloads-c-code-sample.aspx

In the above article Nikhil mentioned to add just PDF without dot, but that did not work for me, the OK button got enabled only after I placed a Dot (Apparently there are lot of bugs around this window in Inetmgr)

2. How to add Mappings in Inetmgr. http://forums.devarticles.com/web-server-configuration-51/iis-problem-unable-to-add-application-extension-mapping-2527.html

 

--Kiran Bheemarti

Friday, March 20, 2009

Got my IPhone finally....Playing with it currently

 

If I search my blog, I blogged about IPhone 3G, June last year, I could not get it back then, for my contract was not over, finally got it now, playing with Add-on's in Apple Store, found few very interesting add-on's, especially Google Pack which is free.

Kiran Bheemarti

Reflector Add-in

 

Have two dll's same name version yet acting differently? Want to open them in Reflector and do a code diff, Reflector Diff is really awesome in this. Recent we had a similar problem with two dll's same name version sitting in ASPNET Temporary Files and we wanted to do a diff, my friend found this and it works awesome.

http://dotnet.org.za/codingsanity/archive/2005/07/27/40364.aspx

Regards

Kiran Bheemarti

Sunday, March 15, 2009

Import Google bookmarks into Chrome.....

 

One thing I miss the most using Google Chrome is Google toolbar, its a different discussion why Google has not yet thrown out there, Google toolbar for Chrome.

I use Google bookmarks pretty heavily for I can bookmark once access from all my computers, but lately I started using Chrome more and more, and I am finding myself switching between Firefox, IE and Chrome, for Chrome misses Google toolbar and thus misses all my Google bookmarks.

So I decided to import those bookmarks and here are steps. (FYI. Chrome does not have a import from Google directly so we do it indirectly)

1. Go to Google Bookmarks, Manage Bookmarks (Hit Bookmarks in toolbar and hit Manage Bookmarks), In Manage Bookmarks you have towards the end, Export option, Hit Export Bookmarks and Save your bookmarks as Html Page.

2. Go to Firefox Bookmarks, hit Manage Bookmarks, in the Manage Bookmarks window, you will have Import and Backup option, Hit it and import the Html Page you just saved in Step 1 with your Google bookmarks. Now you have all your Google bookmarks in your firefox bookmarks.

3. Now Go to Tools->Import Bookmarks & settings in Chrome and select Firefox in the browsers and import firefox bookmarks.

This is not a great solution, as its not realtime automatic sync between Google and chrome, but it works for me for now, I will wait with this until Google throws Toolbar for Chrome or I find a better Sync technique.

Kiran Bheemarti

Friday, December 12, 2008

Gmail adds tasks list manager finally....

 

One thing I always missed in Google gadgets was a task manager, and I am happy that finally Google added the task manager to the gmail labs.

To get this feature, Go to your account settings, then go to labs section and enable Tasks, once you enable it you will see a label "Tasks" right below "Contacts" label. When you click on this label you will see the Tasks manager appearing on the right bottom of the screen.

image image

There are many sleek features in this tasks manager like, indenting (Sub tasks), fully Ajax'd, fully keyboard manageable, you can indent un-indent rearrange the tasks, with keyboard or mouse.

One most important feature is the addition of "Add to tasks" action under the More actions, choose any mail in your inbox and go to More actions, select "Add to tasks", a task is created and a link to the mail selected is placed in the newly created tasks as a reference.

image

Previously I used many applications for Tasks management, lately was hooked to http://www.rememberthemilk.com/ it is a neat site too, I enjoyed it a lot, but I always have one window open with Gmail and if my tasks lists sits right in that window its a added advantage.

Yet another tasks management tool...Hopefully I will be to manage myself to the extent I would like to :)

Regards

Kiran Bheemarti

Thursday, November 20, 2008

How To do a clean uninstall of .NET Framework 3.0 CTP and install .NET Framework 3.0, 3.5

 

Last year I made a mistake of installing CTP on my DEV box and learnt the lesson ("Never install CTP versions on the machine, always use Virtual machine") hard way.

I installed .NET framework 3.0 CTP and WCF, WPF, WF extensions for Visual Studio 2005, I worked on a SOA project where we used WCF as web service provider, we hosted WCF service in Windows Service and all worked great, project deployed, I moved on.

Recently I tried to write a WCF service for one of my current project, and this time I wanted to host it in IIS, it did not work, my initial reaction was I forgot the concepts of WCF and my code has a mistake, so I read few WCF tutorials, redid the service, it failed again. Then I followed MSDN introduction to WCF link step by step, luckily one of the example I followed hosted the service in Web Development Server (previously Cassinni server) and the sample worked, I moved the same sample to IIS and it failed. So my initial trouble shooting was over, I knew my framework 3.0 is corrupt and need to be repaired, I searched online found many articles hinting at re-registering *.svc as an extension etc., nothing worked. So I came to conclusion of uninstalling 3.0 and reinstall it. And my troubles started here.

I uninstalled Framework 3.0, Framework 3.5 from my box, and tried to re-install both. Uninstall went fine, but re-install failed, I tried several times, digged into the logs to learn more about the failure but nothing was helpful. I googled, found nothing specific, so I started removing .NET altogether from my box, removed 2.0, remove 1.1, remove 1.0 and re-installed all, each time I got stuck at Installing Framework 3.0. In the Framework 3.0 installation log, I found some strange error DepCheck: WCF is not found blah blah, but I am installing Framework 3.0 for same WCF, how can it find WCF there.

After hours of agonizing install re-install uninstall google sequences, I stumbled on few blogs which mentioned about few Registry keys WCF CTP sets up which don't get deleted while uninstall, and have to remove them manually, I found another interesting blog post about a Tool to Clean up .NET Framework

http://blogs.msdn.com/astebner/archive/2005/04/08/406671.aspx 

I downloaded the tool and ran it, it did cleaned up the registry keys, but still no luck with the installation.

I was back reading the installation logs, and this time I found out that the Framework 3.0 exe actually extracts itself to C:\Documents and Settings\$User$\Local Settings\Temp\dotnetfx304506.30\1033\ (infact all framework exe's does this) and run the msi's from there, actuall Framework 3.0 exe seems to have only 3 files, in 3 folders, wcf/wcf.msi, wpf/wpf.msi, wf/wf.msi, now I got the idea, since the DepCheck: from above is complaining about WCF not found, I thought I will install WCF from this extracted folder first separately, then try 3.0 installation.

Hurray!!!! I found the actual problem this time, when I ran wcf.msi, it complained and this time the complaint was much more understandable. WCF msi was complaining about write permissions to one of the registry keys (Check Below)

MY Computer\HKLM\System\CurrentControlSet\Services\EventLog\Security\ServiceModel 3.0.0.0

I gave permissions, and re-ran Framework 3.0 exe and Yes, this time it worked :), this left me thinking, if wcf.msi is actually part of the parent Framework 3.0 exe why did not the parent exe gave me the exact similar message, was the child not propagating its problems to the parent.

During this whole Ordeal I found the reason for my initial actual problem, "Not able to host WCF Service in IIS", I found my reason in Microsoft .NET Framework 3.0 release notes, and the reason is CTP had this problem.

http://msdn.microsoft.com/en-us/windowsvista/bb188202.aspx 

Reason from above link :

2.7.4 May not be able to web host WCF services if a pre-RC1 version of WCF was previously installed

If you installed a previous version of the .NET Framework 3.0 while IIS was installed, when you upgrade to the RTM version of the .NET Framework 3.0 you may have difficulty accessing WCF services that are IIS hosted using .svc files. On computers running Windows Server 2003, accessing an .svc extension from the browser may return a "404: Page Not Found" error. On computers running Windows XP, the .svc content may be displayed as plain text.
This is due to an issue with WCF script map registrations in a previous release.  

To resolve this issue

There are three ways to work around this issue:

  1. Download the unsupported tool, CleanIISScriptMaps.exe from http://wcf.netfx3.com/files/folders/product_team/entry5648.aspx. Run the tool from a command console without any arguments.
  2. Uninstall and reinstall IIS or re-create your Web sites:
    1. Uninstall IIS and reinstall it so that the IIS Metabase is refreshed. Then run the WCF install tool manually to re-register the WCF scriptmaps:
      "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" /r /y
    2. If you are running Windows 2003 Server, you may be able to resolve the problem by deleting the "Default Web Site" and re-creating it.
  3. Install .svc manually as a temporary workaround:
    You can run the following command to install .svc mapping manually. However, this refreshes the IIS Metabase for existing sites. "%windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" /s:W3SVC

This solution I found may not work exactly for the problems you are facing with your installation, but!!!! HEY, if did, I will be happy with the effort I put into writing this post :)

--Kiran Bheemarti

Tuesday, November 18, 2008

Worst service pack upgrade experience ever.....My Ordeal with Commerce Server 2002 Service Pack 4 upgrade.

This is the post about the problems I faced in upgrading Commerce Server 2002 Sp3 to Sp4, if you don't want read all the story, you can skip to the last paragraph and get your solution, I will be glad either way :-)

I am currently supporting a e-commerce site built on ASP.NET 2.0 and Commerce Server 2002. Recently we discovered that Microsoft has stopped support of Commerce Server 2002 Sp3 and supports only Commerce Server 2002 Sp4. So we decided to upgrades to Sp4. Sounds simple right, something we do quite regularly in our professional life with many products. But nothing is simple with Commerce Server, not at least with Commerce Server 2002. I discovered that many times and I was for a bigger shock this time.

I downloaded SP4 from Microsoft site, extracted it, ran the executable...........BOOOOOOOOOM!!!!!!!!!! everything came down, it brought down the site, Checked the event log and found this error.....

image

Me and my friend Joey google'd around for 3 days read tons of articles, forums, blogs, found nothing about it, then Joey posted the problem in Microsoft's Commerce Server Forum

http://social.msdn.microsoft.com/Forums/en-US/commserver2002/thread/c9842cbe-6a5e-453f-8f4b-ad2ec7a8bf6f

No one ever replied to this post, either no one is using Commerce Server 2002 anymore or if using then not upgrading it any more, but it was not uncommon to find nothing on Commerce Server 2002, its kind of old now and not much activity going around it.

We waited for few days for someone to reply to the above forum post, as we got no reply, I started tackling the issue back. Got a new server started setting the server up from scratch, installed Commerce Server 2002, installed Sp3, set up everything to the point of working, then installed SP4........BANG!!!!! the same error was back, mistake I did was to take image of server to the point of working (Pre SP4).... :((, so was basically at same point back, Got another server started from scratch, installed everything to the SP3 point, got database back ups, server image, installed SP4...this time was not surprised with the same error, Kind of got used to by now :). Did a database compare, Pre and Post Sp4, found nothing new added to database by SP4 that was suspicious enough, then I did a registry Compare, this time found bunch of Commerce Server Keys pointing to C-Drive.....Oh by the way, I forgot to say, we always installed Commerce Server to D-Drive, it always worked and had no issue until now. So after find these Keys, I tried to changed them manually and we all know that a Evil thing, it brought the server down again :(.

So got a new server and back to Square 1 :), installed everything blah blah....... BOOM it worked this time......reason it worked was I installed Commerce Server to C-drive on this new server and SP4 upgrade worked great by doing it...........DAMN IT!!!!! How can they (Microsoft) do that, that cant be true, I love Microsoft, I live on its technologies, they can't screw up so bad.....So I searched around the issue, found people logging similar problems with Site Server, Yep the father of Commerce Server, looks like Microsoft reinvented the problem after all these years.

Any ways, bringing the post to the end, my success was not complete as our production server has Commerce Server running on D-drive, so I cannot suggest to make another server with C-drive installation. Yeah you guessed it right, Back to Square 1, I was given another server and asked to make it work on D-drive this time. After few more days of setting a new server digging through the registry, I found that its only one registry key that I have to mess with, not bad after all.

So, if you are already bored with my long story or may be skipped through :), here is the solution, install the SP4 upgrade then change the following key to point to Your installation drive.

My Computer\HKEY_CLASSES_ROOT\CLSID\{CFA49C05-212F-4718-A514-29B6B8721988}\InprocServer32\DefaultKey

image

Even though every problem is frustrating some problems teach you a lot of things, this one was one such problem, and I am glad I tackled and got it to work. Uhhhh!!!!

--Kiran Bheemarti