Posts

Showing posts from December, 2009

S3 Organizer Dialog?

Image
I am copying some of the functionality from this dialog in the S3 Organizer.  I don’t think I will copy these instructions:     {6230289B-5BEE-409e-932A-2F01FA407A92}

WCF with no app.config

I did a Service Reference in my .NET C# assembly and got the infrastructure for a fully enabled WCF proxy.  I also got a app.config file added to my project that I didn’t want.  I need to run configuration free since I am running in both COM+ and managed mode (i.e. some public classes are COMVisible and some are Managed), plus my COMVisible classes are hosted in COM+.  So I need to get ride of the app.config which looks like this:   <? xml version="1.0" encoding="utf-8" ?> < configuration > < system.serviceModel > < bindings > < basicHttpBinding > < binding name = "AmazonS3SoapBinding" closeTimeout = "00:01:00" openTimeout = "00:01:00" receiveTimeout = "00:10:00" sendTimeout = "00:01:00" allowCookies = "false" bypassProxyOnLocal = "false" hostNameComparisonMode = "StrongWildcard" ma

Debugging 0x80070002

0x80070002 is the error code returned when a FileNotFoundException (HRESULT COR_E_FILENOTFOUND) is thrown in managed code.  Basically, there is a missing file that your managed code expects.   In my case I was getting this when I tried to install a component in COM+ (Component Services) where the COM object was written in C#.  However, I didn’t have a method defined as with a [ComRegisterFunctionAttribute], so how could my code throw a file not found exception?  The issue was that my assembly relied on other assemblies that where not present.  Which lead to a binding problem when install the component in COM+, so it was the CLR that was throwing the exception not my code.   To make matter’s worse, I was trying to install the component during an MSI installation.  The .log file from msi just showed an 0x80070002 error.  To find the issue I used the Assembly Bind Log Viewer (FUSLOGVW.exe) found in the Windows SDK.  While the MSI installer ran, The Assembly Bind Viewer was trackin

What is 0x80131501?

When managed code with a COM interface throws a SecurityException the return value (HRESULT) is 0x80131501.  This can happen on a regsvr32.exe (or regasm.exe) or on any method call to the COM interface.   {6230289B-5BEE-409e-932A-2F01FA407A92}

Linking Leaf Nodes In Google Search

Image
I run a travel and tourist site for San Juan Island Kulshan.com .  A long time ago we wrote up reviews for all the islands, the major towns, and the high tourism attractions.  The site is structured this way:       We also create a Google Site map giving the home page has the highest priority, the islands the next highest, the cities a lower priority and the individual write-ups the lowest priority.  All pretty standard.  However, when we started to look at the reports from Google Webmaster Tools we saw something very disturbing:     We were telling Google about 220 pages, however only 93 had been indexed.  Why was this?  We presumed it was because there where no external links to the leaf pages (the individual reviews of restaurants, parks, beaches, and trails).  Google crawler was doing exactly what we asked, traverse the high priority pages in the site map and leave the low priority pages.  The leaf pages (the reviews) that were linked externally where being indexed

Amazon EC2 for Windows The Basics – Part VI

The size of Elastic Block Storage (EBS) on Amazon EC2 is charge by the size of the formatted drive, not the size of data on the drive.  In the case of the Windows-Server2008-i386-Base-v101 this is a 30 Gigabytes (the primary hard drive).  Which you pay for regardless if you are using all of it or not.    This is different the the dynamically expanding .vhds that are used in Windows Virtual Server.    EBS storage is allocated all at once to avoid disk fragmentation and poor storage.   {6230289B-5BEE-409e-932A-2F01FA407A92}

Amazon EC2 for Windows The Basics – Part V

What is Elastic Block Storage (EBS)? When the Amazon web site describes EBS there is a lot of references about mounting and raw block storage -- Linux terms. However, with the new boot from EBS for Windows this is a confusing. So from a Windows perspective I am going to try to explain EBS and touch on why boot from EBS is the only way to go for Windows. Windows doesn't really have a concept of mounting hard drives, and the operating system likes all physical drives to be in place before it boots. Which means that when Amazon EC2 boots your Windows instance it needs to know what storage (drives) are attached.  Keep this in mind as you read on. In Microsoft Virtual server we think about this as a .vhd drive. All the virtual hard drives are attached when the Virtual instance is started. Back to Amazon EC2, there are two types of storage (drives) available. ESB drives and Amazon Machine Images (AMI). Amazon Machine Images are stored on the Amazon S3 cloud, and mo

Shortcut of a Shortcut

There is no such thing as a shortcut to a shortcut in the Windows File System.  If you create a shortcut from a shortcut then you just get a shortcut to the original target.  You can programmatically create a shortcut to a shortcut using CLSID_ShellLink, however Windows will not render the icon correctly, or navigate the end target correctly.   {6230289B-5BEE-409e-932A-2F01FA407A92}

CLSID_ShellLink

  You can not call IShellLink method SetPath with a full parsable path to a namespace extension in Windows 7.  Instead you have to call IShellLink SetIDList.  Once you have set the id list and save the .lnk file via IPersistFile Save method the shortcut will find your namespace extension (on open).  However, CLSID_ShellLink is unable to render the Image via IExtraceImage for the link if the link is to an image (or other file type that supports IExtractImage).  Instead it renders the default icon for your perceived type.  It asks your namespace extension for the perceived type via IShellFolder2::GetDetailsOf.   {6230289B-5BEE-409e-932A-2F01FA407A92}

Creating a Windows Build Server On Amazon EC2

Image
My definition of a build server is a standalone box that has been configured so that it can build a release of your software with one command.  The server typically has compilers, install packing software, and is dedicated to the task of building a release.  Questions from the Joel Test that a build server needs to answer in the affirmative: Build in one step? Daily builds?    My build scripts, that run on the build server, perform these tasks: Clean the Build Directories Checkout all the source files from source control. Compile all the source. Package the binaries and assemblies into installations (setup.exe) Deploy the installations to the download location on the web sever. Update a database (web content server) with version information, download location etc… Over the years, I built different types of build servers, and written many build scripts.  Ten years ago, I had dedicated build servers.  Lately, I use virtual machines hosted on top

Amazon EC2 for Windows The Basics – Part IV

There is a lot of documentation about running Amazon EC2 and if you are having trouble Amazon will quickly direct you to the forums for questions, however there isn’t really a resource from a Windows centric developer to other Windows gurus.  As I 20 year Window veteran, I am going to try to fill that gap with a few blog posts entitled “Amazon EC2 for Windows The Basics”   The second thing I do when install a new windows server is to run Windows Update.    “The second thing that you need to do on your EC2 instance is install the Windows updates.”   The Windows 2003 R2 instances from ESB are recent to the R2 of Windows 2003, however there are a lot of security hot fixes released since R2.  I like to have them all applied.  It is fairly painless since Amazon amazing download times.   Remember this is Windows 2003, so you need to go back to Windows Update every time it makes you reboot until there are no more updates to install.   {6230289B-5BEE-409e-932A-2F01FA407

Amazon EC2 for Windows The Basics – Part III

Image
There is a lot of documentation about running Amazon EC2 and if you are having trouble Amazon will quickly direct you to the forums for questions, however there isn’t really a resource from a Windows centric developer to other Windows gurus.  As I 20 year Window veteran, I am going to try to fill that gap with a few blog posts entitled “Amazon EC2 for Windows The Basics”   Once you have your instance boot, you have retrieved the administrator login from the AWS management console, successfully connected to the server via RDC.   “The first thing to do when you get logged in is change the administrator password”   Amazon provides a good secure password for the administrator account – it is obvious there is a lot of thought put into security.  However, it is a pain in the butt to get the password the first time and to log in.  So changing the password saves you a lot of time on the next boot of the instance.   If you are using Windows you probably already know that you

Amazon EC2 For Windows The Basics – Part II

Image
There is a lot of documentation about running Amazon EC2 and if you are having trouble Amazon will quickly direct you to the forums for questions, however there isn’t really a resource from a Windows centric developer to other Windows gurus.  As I 20 year Window veteran, I am going to try to fill that gap with a few blog posts entitled “Amazon EC2 for Windows The Basics”   I know it is suppose to work, and I know this will get fixed.  However, as of December 2009:   “Sometimes windows instances do not start.”   I don’t want to be negative or point out a bug, however it is really frustrating when you don’t know this might be the case and it happens to you.  It is less frustrating it you know this might happen and what do about it.   The first thing is to figure out if the instance started or not.  The way to do this is look at the system log from the AWS management console.  It should look like something like this:     It should say: “Windows is Ready to use

Amazon EC2 for Windows The Basics – Part I

There is a lot of documentation about running Amazon EC2 and if you are having trouble Amazon will quickly direct you to the forums for questions, however there isn’t really a resource from a Windows centric developer to other Windows gurus.  As I 20 year Window veteran, I am going to try to fill that gap with a few blog posts entitled “Amazon EC2 for Windows The Basics”   For me EC2 is all about replacing servers with cloud computing and when I get rid of my old servers it is my Linux friends that take them.  As Windows IT we always buy the latest and greatest servers and they seem super fast when we buy them.  I get good mileage out of my servers, usually 5 to 10 years.  However, when I go to sell them it seems that they only fetch $50.  However, there is always some Linux geek ready to snatch it up and replace a Pentium 3 server he has in his basement.  Doing so he brags: “I can run 500 web sites on this server” and off he goes into his cave.   The point of this rabble: Windows

Every Exception Has A Unique GUID

Image
If you know me you will know that I love GUIDs and use them for everything.  One of the things I use them for is to create a unique identifier to error messages in my code.  I have override the Exception class adding my own method that looks like this:   public ProviderException(System.Guid error, string message, Exception innerException)     : base(String.Format(CultureInfo.CurrentCulture, "{{{0}}}: {1}", error.ToString(), message, innerException)) { }   Basically, anytime that I want to throw an exception in my code, I do so with a unique GUID.  The calling code looks like this:   catch(SoapException soapException) {     throw (new ProviderException(new Guid("{513EEF48-8C02-4135-9344-2A401EAF2112}"), soapException.Message, soapException)); }   I have the option of creating my own message, and I always pass the exception I am trapping as the inner exception.  Notice that I have a hard coded GUID in my code.  It is not Guid.NewGuid() –

Batch File Bug

This is the code I have:   cd %PROJECTROOTLOCAL%\Installation\AmazonS3\AmazonS3\ del  /s /f /q *.*   What I want to do is delete all files in the Installation\AmazonS3\AmazonS3 directory.  However what if the directory doesn’t exist?  Well I get this error on the first line: The system cannot find the path specified.   And the current directory isn’t changed.  Which leaves me at the root of the my project.  Which means that the second command deletes all the files in my project.  Not good.  The fix is this:   mkdir %PROJECTROOTLOCAL%\Installation\AmazonS3\AmazonS3\ cd %PROJECTROOTLOCAL%\Installation\AmazonS3\AmazonS3\ del  /s /f /q *.*   Or is there something better?   {6230289B-5BEE-409e-932A-2F01FA407A92}

ShortCut Syntax For Command Line

Here is the shortcut syntax I use to get a command line at a particular directory: %windir%\system32\cmd.exe /K "cd \My Projects\BigDrive\trunk\Version 1.0\" This is helpful for having a shortcut pinned to the start menu that opens a command line directly to directory where I run my build commands for my projects. {6230289B-5BEE-409e-932A-2F01FA407A92}