BakedPotato.com
IIS and XML configuration files
It seems like at least once a week or so I'm forced to wade into the complexities of the XML configuration files that one must now (as of IIS 7 and later) grapple with in order to configure web sites and server behavior.

Don't get me wrong, it's much better than doing the same configuration tasks through what would be a shockingly complex UI - it's just frustrating to feel like, because of Microsoft's somewhat lacking documentation, you're always shooting in the dark trying to accomplish what seems like it should be simple. And was in this case, in fact, very simple, in IIS 6.

I inherited a legacy set of sites that I had to get to Windows 2008/IIS 7. The catch was that the two sites operated out of a single directory. And each site had its own default page, and 404 handler page. In IIS 6 it was no sweat, just edit the properties for each site and off you go.

In IIS 7, not so fast! When you edit the properties for one site, you end up editing the properties for both sites because most changes are applied in the Web.config file, which is shared between the sites.

But I finally, after much fiddling around, found a solution. Enter the inetsrv applicationHost.config file (located at c:\windows\system32\inetsrv). You can create location elements in this file, giving each the name of the site as entered in the IIS 7 manager user interface, like this:



<location path="SITE_NAME_1" allowOverride="false">
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/pathToPageNotFound1.aspx" responseMode="ExecuteURL" />
</httpErrors>
<defaultDocument enabled="true">
<files>
<add value="nameOfDefaultFile1.aspx" />
</files>
</defaultDocument>
</system.webServer>
</location>
<location path="SITE_NAME_2" allowOverride="false">
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/pathToPageNotFound1.aspx" responseMode="ExecuteURL" />
</httpErrors>
<defaultDocument enabled="true">
<files>
<add value="nameOfDefaultFile1.aspx" />
</files>
</defaultDocument>
</system.webServer>
</location>





Web services in an MVC.net site
I had an interesting problem yesterday.

I'd integrated .Net's MVC functionality into my pre-existing web site (not web application). The problem was that my web service (asmx) files that had been working great all of a sudden were returning 404 errors - sometimes. Yes, on my development machine, everything worked great, in debug and release versions. On the servers, in both the test and release sites, the same files, with the same configuration, were returning 404 errors.

I still don't know why there was a difference between the machines, but I was able to fix it with the help of this article on StackOverflow.

And for those of you stuck using VB on your project, here's the call you need to add to your Global.asax file (or more precisely, the place where you setup your routes):


routes.Ignore("{*allasmx}", New With {.allasmx = ".*\.asmx(/.*)?"})


Git can be confusing...
I was confused for a while when a repository I was using - that I only used for pulling, I never made any commits - would show "Your branch is ahead of origin/master by X commits". I couldn't figure out why that would be.

Apparently you need to do a "general" fetch or pull - not from a specific branch. Bailey has a bit more of an explanation here.


Great tool - shout out
I really have to give a shout out to a fantastic jQuery plugin I discovered recently - DataTables. If you need to deal with lots of data on your web page, I can't recommend this highly enough. It seems to be very well implemented (I really just started using it...), and performs very well, even on surprisingly large datasets.

If you try it, leave a comment here and let me know how it worked for you.


The Beginning
I'm going to be posting here to document the problems I have to solve as I develop web sites. Partially this is for me, so I can remember what I do. But it's also for other people who might end up having the same problems I do.