Galin Iliev's blog

Software Architecture & Development

IIS7 Administration and Customization talk

My talk yesterday went well and I think people found it interesting so I've decided to post slides and demo as well as some useful links

From presentation:

  • Slides - PowerPoint 2007 - (2.4 MB)
  • Demo - VS 2008 project (961 KB)

Some resources:

IIS7 talk @ SofiaDev UG

I am giving a talk this Thursday in front of SofiaDev .NET User group at local Microsoft office at 18:30 local time.

In the presentation I will show:

  1. New tools in IIS7 as well as new administration options
  2. New tracing and diagnostics options
  3. New integration pipeline
  4. Deep example that:
    • use custom IIS module written in C#
    • extend IIS configuration schema
    • extend IIS Manager by adding UI component

If this sounds interesting to you and you want to attend write to branimir _ at _ sofiadev dot org

See you there!

SQL 2005 Database mirroring

I had interesting case last week - I had to setup SQL 2005 database mirror. First it sounded as piece of cake - I had to follow steps and recommendations as described in SQL Server Books Online (and here). My goal was to setup DB mirror of type High safety with automatic failover (synchronous).

I had to prepare SQL Instances as:

  1. Create a user (called SqlService in my case) with same password on all machines that will participate in the mirror. Give it enough rights to it. (I put it in Administrators group and denied local login. Later I set more granular security to it)
  2. Setup instances to run in this user context
    image
  3. Set trace flag 1400 as startup parameter to SQL instance
    image

 

Then I followed How to: Prepare a Mirror Database for Mirroring (Transact-SQL) and when it came to setup DB Mirror it was created... But although I had witness server I was unable to test automatic failover. More precisely I set a connection string of type (

"Data Source=myServerAddress;Failover Partner=myMirrorServer;Initial Catalog=myDataBase;Integrated Security=True;"

) to a simple web application but when I stopped the instance that hold Principal database the mirror database didn't became principal as expected.

Note: This test was done on SQL 2005 Standard Edition with SP2 on Windows 2003 Standard with the latest updates.

I decided to test this on SQL 2005 Standard (with no SP2) in Win2003. And it worked. I applied SP2 then and I as able to setup DB mirroring again and everything worked as expected - even automatic failover.

Bottom line: Somehow SQL 2005 SP2 break DB mirroring if installed right after SQL Server installation. This was my experience and I if someone has another experience with this I would be grateful if we can discuss here

Useful links:

Hope this helps!

Debugging .NET Applications in production

The title might seems strange as in 99.99% of cases we cannot afford Visual Studio in production environment. Even hardly mention this possibility could drive sysadmin crazy ;). Last moth Vladi Tchalkov gave a nice presentation on the subject on SofiaDev monthly meeting.

There is another resource on the subject - there is whole guide made by Patterns&Practice team in Microsoft -

Production Debugging for .NET Framework Applications

It could give some nice ideas how to troubleshoot issues in application in production environment.

VS 2008 and .NET Feature Specifications

Feature specifications are posted on MSDN so everyone who is interested how to write specifications or how looks like specifications inside Microsoft can take a look at Feature Specifications for Visual Studio 2008 and .NET Framework 3.5 in MSDN. All documents are in XPS format.

Technology Area

Feature Specification

Developer Tools Plaform

Command Bar Improvements

MSO File Dialog Removal

File Tab Channel Improvements

IDE Navigator

MSBuild Multi-Targeting

Object Browser Support for New Language Features

Segoe UI Font Support

Tool Window Docking Targets

Tool Window Frames and Tabs

VS Color Service and VS Gradient Service: Vista Palette Addition

Windows Framework Support in Object Browser and Find Symbol

Menu Improvements

Splash Screen Improvements

Pseudo Multi-targetting

Updated Branding

Visual Studio Proxy Service

Visual Studio Settings Migration

Visual Studio for Devices

eVC: VS2005 Migration

Visual C++

Friend Templates

STLCLR

.NET Framework Multitargeting in Visual C++

Versioning of Visual C++ Libraries

Asmmeta.exe

Dialog Templates

File Dialogs

Marshaling Library

MFC Support for Common Controls

Scope Reduction in VC Libraries

UAC for VC

Vista Common Controls

Network Class Libraries

Internationalized Resource Identifier Functional Specification

VSTO & VSTA

VSTO & VSTA Project Upgrade

VSTA

Dynamic Programming Model

Office Workflow Tools

Setup

Uninstall Wizard UI

UI Frameworks

ListView

Partial Page Rendering

Visual C#

Mapping Format

XLinq

.NET Compact Framework

Microsoft.WindowsCE.Forms.SystemSettings Extensions

Team Architect

Support for Web Application Projects

Architectural Roles

Enterprise Developer

ASP.NET AJAX: Debugging Breakpoint Mapping

ASP.NET AJAX: Script Explorer in Solution Explorer

VS 2008 and .NET 3.5 are RELEASED !!!

I've just read ScottGu's blog post  (from an hour ago) where he announces that Visual Studio 2008 and .NET 3.5 Released  as well as many many links for info about new IDE version.

You can download (90-days free trial edition) of:

I guess MS bandwidth will be filled in next days ;)

Adding client script to ASP.NET page

I had interesting experience today: A custom ASP.NET control (written by me  :( ) that wraps Google maps functionality produces very nice results for a while but placed in new design  started to render like this in IE...

GoogleMaps

I have to say it behaves well in all test pages up to now... well what happened?!

Unfortunately this happened on very complicated page with master page, themes, pieces loaded into page from DB and so on... briefly said difficult to isolate the issue. But still.. we are talking for HTML&JS so this is where the search should start ad more precisely - around map code (you can find more how to setup such map on Google Maps API Documentation).

After digging around I found that the control was placed in a HTML table, but I tested mainly in DIV tags. And markup looks like this:

   1:  <table border="0" cellpadding="0" cellspacing="0"  >
   2:   <tr>
   3:     <td>
   4:         <companyName:googlemaps id="GoogleMaps1" runat="server" height="400px" width="400px" />
   5:     </td>
   6:   </tr>
   7:  </table>

 

A quick test was setup and bingo.. this is it! It is broken on very simple page :) But why!? A (not so) quick search gave this forum post saying:

Your page structure contains this (very much simplified here)

   1:  <table> 
   2:  <tr><td><div id="map"></td></tr> 
   3:  <script>....</script> 
   4:  </table> 

That means that when the script is run, it's acting on a map within a table which hasn't been finalised because the browser hasn't reached </table>. In IE, everything within that table is treated as though it has zero size until the browser reaches </table> and sorts it all out.

But why my control produces such resulting structure? Aaah this hurry... I haven't used  ClientScriptManager.RegisterStartupScript Method but I placed a code with this simple Response.Write... It seemed right at that time and especially all tests worked fine...

So bottom line is: Always be careful if you break the page logic! And those methods are there for reason. And last but not least: An hour or two reading can save you days of boring ghost hunting ;)

Hope this helps

Using LINQ to Objects in .NET 2.0 projects

If you've played with C# 3.0 and LINQ you might feel bored with good old .NET 2.0 projects. But wait! There is a way to use LINQ to Objects in .NET 2.0 projects. LINQBridge makes this possible. But how?

First, it's important to understand that C# 3.0 and Framework 3.5 are designed to work with CLR 2.0-the same CLR version that Framework 2.0 uses. This means that the C# 3.0 compiler emits IL code that runs on the same virtual machine as before.

This makes Framework 3.5 additive-just as Framework 3.0 was additive-comprising additional assemblies that enhance the existing 2.0 Framework and CLR. So there's nothing to stop us from writing our own assemblies that do the work of Framework 3.5 (at least, the critical bits required for local LINQ queries).

Can I use LINQBridge with C# 2.0 and Studio 2005?

You can-but the query operators will be awkward to use without lambda expressions, extension methods, query syntax, etc.

More info you can find at LINQBridge official page as well as source code. Thanks to Joe Albahari!