Tuesday, September 2, 2014

Could not load library when hosting the app in IIS

When an application is deployed in the server and if it throws the could not load library exception, we can enable the x86 support in application pool. In case any assembly was built targeting the x86 platform, this would be the right fix to make the site available.

However, it is strongly advised not to target specific platform unless a firm reason be found.

Saturday, August 2, 2014

How to debug OWIN related stuff using Symbol Source

I ran into a situation today wherein I was required to debug the Google Authentication middleware built on top of OWIN.

I already had the code checked out from Katana project in CodePlex. However, when I tried to use, it was the latest bits [dev channel]. My app was using the version 2.1 and the dev version was in 3.0.

Tired of searching the tag for the version 2.1, I came to know that the symbols for the various open source projects are made available from SymbolSource.org

Given this piece of information, I read the steps on how to configure the symbol server in Visual studio and then upon successful source registration, I was able to step through the middlewares and do the debugging stuff.

Things that I did were,

  1. Grab the public [authentication less uri access] from Symbol Source [http://srv.symbolsource.org/pdb/Public]
  2. Go to Tools -> Options -> Debugger -> General.
  3. Uncheck “Enable Just My Code (Managed only)”.
  4. Uncheck “Enable .NET Framework source stepping”. Yes, it is misleading, but if you don't, then Visual Studio will ignore your custom server order (see further on) and only use it's own servers.
  5. Check “Enable source server support”.
  6. Uncheck “Require source files to exactly match the original version”
  7. Go to Tools -> Options -> Debugger -> Symbols.
  8. Select a folder for the local symbol/source cache. You may experience silent failures in getting symbols if it doesn't exist or is read-only for some reason.
  9. Add symbol servers under “Symbol file (.pdb) locations”. Pay attention to the correct order, because some servers may contain symbols for the same binaries: with or without sources. We recommend the following setup:
    1. http://referencesource.microsoft.com/symbols
    2. http://srv.symbolsource.org/pdb/Public or the authenticated variant (see above)
    3. http://srv.symbolsource.org/pdb/MyGet or the authenticated variant (see above)
    4. http://msdl.microsoft.com/download/symbols
  10. These steps are highlighted in the Uri [http://www.symbolsource.org/Public/Wiki/Using]
This saved me a lot of time than hunting for the specified tagged version and to build them and then use it.

Hope this helps

Monday, May 26, 2014

Push code from local machine to github in windows

To Create a new Repository in Github from the gitbash command line interface, follow the steps below,
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/saravanandorai/GitURL.git
git push -u origin master
To push existing code to a Repository in Github from the gitbash command line interface, follow the steps below
git remote add origin https://github.com/saravanandorai/GitURL.git
git push -u origin master

Additional Reference:
See here

Monday, May 19, 2014

Difference between the pfx and cer / cert

May be this post is kind of well known to many. I have encountered this couple of days back, while working with a custom authorization server. Hence posted here.

There are two types of digital certificate,
1. .pfx, an archive kind of certificate which contains a public key, private key and other public keys like the CA(certifying authority) public keys.
2. .cer, which contains only the public keys.

Pfx certificates are meant to be only on the server, whereas the car or cert files are meant to be shared with the client's that will talk to the server.

In authorization server, the server uses pfx files and the clients use the .cer or the .cert files.

Monday, April 28, 2014

Debugging application running in IIS Express

In order to debug the application that is run in IIS Express in visual studio, following are the steps

1. Run the application /s in IIS express configured in visual studio
2. In the system tray or task bar near by the system clock, IIS express icon will be shown. Click on it and click on "show all application"
3. All the application hosted in IIS express will be shown along with the corresponding process ids.
4. In visual studio, go to Tools > Attach to process > in the processes, order by the process I'd and choose the correct process I'd to debug the application.
5. If the process is not listed there, pick on the "show process from all user account" check box in the bottom left corner of the window.
6. Leave a break point in the source and that's it.

Hope this helps.