Posts

Showing posts with the label oops

Cert-ifiably IISane

Time for an annual web site certificate renewal. No problem, we've done this dozens of times before. Only one small difference this year - it's on IIS7 in a Windows Server 2008 machine instead of IIS6 on Windows Server 2003. That shouldn't matter right? Sadly, yes, it does. I opened the IIS manager, navigated to the root node for the machine and selected "Server Certificates." There, I right-clicked and selected "Renew..." No special options to choose from so how complicated could it be? Well, it turns out that there is a difference. When I opened the request file it was quite a bit larger than I was used to seeing. Not being able to read hex I decided that was probably just due to it being a 64-bit machine instead of our previous 32-bit OSes. I uploaded the request, logged on to the certificate authority, and approved my own request. That's just how we roll around here. Then, back on the server, I downloaded the new certificate and completed t...

Conversion excursion

My team's applications rely on a large array of assemblies, some C++, some VB6, and some C#. The front end is largely a web site that is a mix of ASP and ASP.NET. We also have some Windows services - mostly C++ with a few newer ones in C#. A few of the C# assemblies are COM enabled to be usable from the C++/VB code, ASP pages, and services while others are only used by the ASP.NET. We're trying to migrate away from the VB6 code so I helped compile a list of which of the assemblies are in use by which other components. Our first pass will be to perform a direct port with COM wrappers so existing code can simply point at the new object with no API or behavior change. As we do so, we'll make a note of places where we think there are existing bugs or room for performance improvements. Have you ever performed a massive migration or upgrade? How did your team go about it? What pitfalls did you encounter as you went? With the one assembly we've ported so far, we fo...

WCF and Silverlight debugging

As part of my latest updates to my current project, I made a change to the underlying WCF service that provides much of the information to our Silverlight application. In one of my DataContract classes, I started passing a child class to one of its DataMembers (i.e. the DataMember is a property on Foo, I passed in a Bar which is a subclass of Foo). Then, when Silverlight called the asynchronous version of that method, I started getting an ambiguous error: "The remote server returned an error: NotFound" I stepped through both the Silverlight side and my WCF side - no errors apparent either place. However, just after the return statement in WCF and method exit, the Silverlight's service reference would pop up the "NotFound" error. Strange, I thought... what's the problem? Other web searched seemed to direct me to update the buffer size, to delete and re-add the service reference, all to no avail. Finally, I changed the type on my datacontract's datamem...

Warning signs

Writing effect warning signs lesson #1: If the major reason to heed the warning doesn't get them to pay attention, give them a minor reason, too. Not only will this kill you, it will hurt you the whole time you are dying

IDisposable, or how to write bad sample code

I've started my new job and am working on some data access code to IBM's DB2. I came across the following two incongruous pages in the IBM Data Server Provider for .NET reference. First, there's the DB2Connection class. In the remarks, it specifically states: The DB2Connection object uses native resources. You should always explicitly close any open DB2Connection objects by calling Close or Dispose before the DB2Connection object goes out of scope However, on the DB2DataAdapter class reference page, they happily ignore their own advice. They also fail to mention that DB2DataAdapter is disposable and should be handled as such. Here's my recommendation for new sample code: public DataSet SelectDB2SrvRows(DataSet dataset,string connection,string query) { using (DB2Connection conn = new DB2Connection(connection)) { using (DB2DataAdapter adapter = new DB2DataAdapter()) { adapter.SelectCommand = new DB2Command(query, conn); ...