Wednesday, 4 June 2008

Value does not fall within the expected range.

This is another very annoying, useless MOSS error message. See below for a possible solution.

Server Error in '/' Application.

Value does not fall within the expected range.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Value does not fall within the expected range.

[ArgumentException: Value does not fall within the expected range.] Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, Byte& pVerGhostedSetupPath, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocId, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder) +0 Microsoft.SharePoint.Library.SPRequest.GetFileAndMetaInfo(String bstrUrl, Byte bPageView, Byte bPageMode, Byte bGetBuildDependencySet, String bstrCurrentFolderUrl, Boolean& pbCanCustomizePages, Boolean& pbCanPersonalizeWebParts, Boolean& pbCanAddDeleteWebParts, Boolean& pbGhostedDocument, Boolean& pbDefaultToPersonal, String& pbstrSiteRoot, Guid& pgSiteId, UInt32& pdwVersion, String& pbstrTimeLastModified, String& pbstrContent, Byte& pVerGhostedSetupPath, UInt32& pdwPartCount, Object& pvarMetaData, Object& pvarMultipleMeetingDoclibRootFolders, String& pbstrRedirectUrl, Boolean& pbObjectIsList, Guid& pgListId, UInt32& pdwItemId, Int64& pllListFlags, Boolean& pbAccessDenied, Guid& pgDocId, Byte& piLevel, UInt64& ppermMask, Object& pvarBuildDependencySet, UInt32& pdwNumBuildDependencies, Object& pvarBuildDependencies, String& pbstrFolderUrl, String& pbstrContentTypeOrder) +215 Microsoft.SharePoint.SPWeb.GetWebPartPageContent(Uri pageUrl, PageView requestedView, HttpContext context, Boolean forRender, Boolean includeHidden, Boolean mainFileRequest, Boolean fetchDependencyInformation, Boolean& ghostedPage, Byte& verGhostedPage, String& siteRoot, Guid& siteId, Int64& bytes, Guid& docId, UInt32& docVersion, String& timeLastModified, Byte& level, Object& buildDependencySetData, UInt32& dependencyCount, Object& buildDependencies, SPWebPartCollectionInitialState& initialState, Object& oMultipleMeetingDoclibRootFolders, String& redirectUrl, Boolean& ObjectIsList, Guid& listId) +1553 Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.FetchWebPartPageInformationForInit(HttpContext context, SPWeb spweb, Boolean mainFileRequest, String path, Boolean impersonate, Boolean& fGhostedPage, Byte& verGhostedPage, Guid& docId, UInt32& docVersion, String& timeLastModified, SPFileLevel& spLevel, String& masterPageUrl, String& customMasterPageUrl, String& webUrl, String& siteUrl, Guid& siteId, Object& buildDependencySetData, SPWebPartCollectionInitialState& initialState, String& siteRoot, String& redirectUrl, Object& oMultipleMeetingDoclibRootFolders, Boolean& objectIsList, Guid& listId, Int64& bytes) +692 Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.FetchWebPartPageInformation(HttpContext context, String path, Boolean impersonate, Boolean& fGhostedPage, Byte& verGhostedPage, Guid& docId, UInt32& docVersion, String& timeLastModified, SPFileLevel& level, String& masterpageUrl, String& customMasterPageUrl, String& webUrl, String& siteUrl, Guid& siteId, Object& buildDependencySetData) +132 Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.GetWebPartPageData(HttpContext context, String path, Boolean throwIfFileNotFound) +773 Microsoft.SharePoint.ApplicationRuntime.SPVirtualFile.GetFile(String virtualPath, Boolean fetchContent) +78 Microsoft.SharePoint.ApplicationRuntime.SPVirtualFile.GetFile(String virtualPath) +30 Microsoft.SharePoint.ApplicationRuntime.SPVirtualPathProvider.GetFile(String virtualPath) +172 System.Web.Hosting.VirtualPathProvider.GetFile(String virtualPath) +18 System.Web.Hosting.VirtualPathProvider.GetFileWithCheck(String virtualPath) +11 System.Web.FormatterWithFileInfo.GetSourceFileLines(String fileName, Encoding encoding, String sourceCode, Int32 lineNumber) +229 System.Web.DynamicCompileErrorFormatter.get_MiscSectionContent() +926 System.Web.ErrorFormatter.GetHtmlErrorMessage(Boolean dontShowSensitiveInfo) +818 System.Web.HttpResponse.WriteErrorMessage(Exception e, Boolean dontShowSensitiveErrors) +645 System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean canThrow, Boolean localExecute) +271 System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext context, Exception e) +338

While the browser output is next to useless and almost misleading, the Application event log may contain additional information of use (i.e. the real source of the exception).

Dirty Words (Michael Hanes) - blog.mediawhole.com mailto:info@mediawole.com 

Direct Dependencies Limit with User Controls

The westernaustralia.com web site uses a large number of user controls hard coded across twenty-odd page layouts--a big no-no. While we've matured as a dev team since this site launched and now fully appreciate the value of web parts and a small set of key page layouts, unfortunately the site is live as-is.

From a production support perspective we're still working on the site and adding new user controls here and there. This shouldn't be problematic but MOSS, in it's infinite wisdom, limits the number of user controls on a page and fails when that limit is reached.

Server Error in '/' Application.
Parser Error


Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The page '/_catalogs/masterpage/Home.master' allows a limit of 11 direct dependencies, and that limit has been exceeded.

Luckily, this is easy to work around via config. Each MOSS web application uses its own web.config file (a special, MOSS-extended version). In it you'll find the safeMode element which has a DirectFileDependencies attribute. This is set to 10 by default so adding more than ten user controls to a page layout will trigger the above exception. Simply increase the value to whatever you need and away you go. In my dev environment I've set it as high as 25 or 30 with no apparent issues although in production we set it where it needs to be (just over).

Tuesday, 6 May 2008

Make 'Exires' Go Away

Yesterday I posted about the useless 'Exires' [sic] header moss emits with content served from the content database under the default configuration. "Shame on you MOSS!" was shouted with just cause.

Nevertheless, I've found a fairly easy way to make 'Exires' go away and configure MOSS to emit better cache headers. It's pretty simple and while it will cost you a bit of disk space it should also save on roundtrips to the database server... all you need to do is enable the MOSS BLOB cache (aka Disk Cache).

The BLOB cache is turned off by default (for some reason) but when enabled it'll grab a copy of content database resources on the first request and cache them on disk for faster access down the road. Not only that, but, despite the name, the BLOB cache makes MOSS smart enough to emit good Cache-Control headers with your content.

The BLOB cache is configured through the web.config at the web application level, which leads me to believe you won't be able to set different max-age values for different types of content or different content groupings (let's say you want your .css and .js files cached with a different max-age value--or none at all--from the served with your images). If you're used to doing this with the content expiration mechanism in IIS at the folder or item level you may be out of luck here.

Enabling the BLOB Cache is ridiculously easy. Dig into your site's web config and find the BlobCache element (you'll need to do this on all related sites--i.e. anonymous and authenticated if you're running both on the same server). Set the enabled attribute to "true" and you're set. You may additionally want to modify the location where MOSS stores the BLOB data (i.e. a non-system disk), add extra file types to those already configured, and add a max-age="3600" attribute. The max-age attribute will be included with the Cache-Control header and is defined in seconds. Be careful with this one because if you set it to too large a value, your content will cached for the entire duration unless users clear their browser caches. Finally, the maxSize attribute defines the maximum size of the BLOB cache in gigabytes.


<BlobCache location="D:\MOSS\Cache\Consumer" path="\.(gifjpgpngswfcssjs)$" maxSize="1" max-age="3600" enabled="true" />

MOSS instruments the BLOB cache using performance counters you can access in Performance Monitor to determine cache health, turnover, etc.

If you get the BLOB cache working you should also consider reviewing the MOSS Output Cache. I'll save the details for another post but this cache extends ASP.NET output caching and deals solely with page content.

Monday, 5 May 2008

MOSS 'Exires' Header

Dear Microsoft,

What is an "Exires" header? I know what an "ExPires" header is but I have a feeling none of us (not even IE) know what to do with Exires.

Sometimes you've really got to wonder whether MOSS went through any form of QA whatsoever (and our system administrator often asks that exact question). Below is a set of typical HTTP response headers for a file requested from MOSS.

HTTP/1.1 200 OKConnection: Keep-Alive
Content-Length: 453
Date: Mon, 05 May 2008 04:44:34 GMT
Content-Type: image/gif
ETag: "{E4BBF3CA-94E3-44CB-A5CF-DD38E3330E11},3"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 12.0.0.6219
Last-Modified: Wed, 19 Dec 2007 05:52:22 GMT
ResourceTag: rt:E4BBF3CA-94E3-44CB-A5CF-DD38E3330E11@00000000003
Exires: Sun, 20 Apr 2008 04:44:34 GMT
Cache-Control: private,max-age=0
Public-Extension: http://schemas.microsoft.com/repl-2

Note the useless Exires header. Without the extra 'p' this header is going to float right through any caches and will be ignored by the user agent. Not only that, but Exires is pumped out with most MOSS-based resource--that is any resource delivered from the MOSS content database (images, CSS, etc) excluding pages. Due to their size, images are great candidates for caching; likewise for the number of smaller files, like CSS and JavaScript, that otherwise clog up your page load times.

Friday, 11 April 2008

yslow for Performance Measurement

We're doing a fairly thorough performance/load time analysis of westernaustralia.com at the moment and I was recently introduced to YSlow in the process. YSlow originated at Yahoo! and works as a Firebug-dependent Firefox add-on.

In addition to using a combination of packet sniffing and DOM sniffing techniques to give you an accurate idea of how long the current web page takes to load, it also reports page weight, gives you information about page load weight from a primed and unprimed browser cache, tells you all about what's got an Expires header, what's got an etag, what's being gzipped, allows you inspect page components directly or at the header level, and grades the page overall. The grading system is backed up by a thorough set of recommendation for increasing the grade.

Apparently YSlow even fixes a bug with the Firebug net pane!

Definitely enough for me to add this to my toolkit--thanks Yahoo!

Global Submarine Cable Map

This is a very decent, high-resolution, free map of the submarine (undersea) telecommunication cables around the world. The date marked when I downloaded it this morning was April 2006.

Note: the file is about 22MB and there's also a .tiff file available.

http://www.pccwglobal.com/network-technology/pdf/1-Cable-Map-TM.pdf

Saturday, 22 March 2008

Windows 2008 Hyper-V

As I'm currently working for Diversus, a Microsoft partner, I was invited to attend the Heroes Happen {2008} event last Wednesday night. The invite promised a free copy of Windows 2008 (as well as Vista Ultimate with SP1--which ended up coming with a stinkin' 365-day license and a silly trial of Team Suite which I won't even waste my finger tips on--get real, Microsoft, and give us real stuff!) and knowing there would most likely be food and alcohol, I went along.

Despite Heroes supposedly being the simultaneous launch of Windows Server 2008, Visual Studio 2008 (which RTM'd late last year), and SQL Server 2008 (which isn't due to launch until Q3), the emphasis was squarely on Windows Server 2008 and Hyper-V. I've been using Microsoft's Virtual PC and Virtual Server tools for a few years now and after taking a close look at ESX Server lately, I was interested to see how Hyper-V would compete. I'm not a system admin or anything close but I reckon MS is headed in the right direction.

I wasn't sure the Heroes-supplied W2k8 disk would include Hyper-V; apparently Server will be sold with and without at a price difference of about $50. Why MS would do that is beyond me but I was pleased to see the Hyper-V check box listed in the Add Roles Wizard (Hyper-V is still in beta but the beta has been included with the Windows Server 2008 RTM build). The final Hyper-V release is supposed to be available on Windows Update around the same time SQL Server 2008 launches.

As a natural geek, I've got a handful of old PIII and PIV boxes lying around the place serving various roles within my home network. There's one box for AD/DNS/DHCP, another working as a dedicated file server, and others configured as web and database servers. By contrast, SharePoint being SharePoint, everything I do in relation to said software has been within a virtualised environment and it's been that way for a while now; I can provision new VPCs and backup existing VPCs as required. Having had success with Virtual PC and Virtual Server, I figure it's time to virtualise as many boxes as possible. I'm a Green at heart and running running multiple boxes in my small home office makes a hot Aussie day even hotter ;-)

The Heroes media included 32 and 64-bit editions of Server 2008 so I figured I'd go 64-bit just for fun. Apart from a few extra folders and Control Panel items referring to 32-bit, I haven't noticed a differece. The host box is only used as a server so I don't have weird hardware running and everything was detected automatically by the installer. Speaking of the installer, it's wonderful! Select your location and go. Not long after, the OS fires up and you do all the stuff you used to be promted for within the installer. I installed Hyper-V post-installation and everything went, um, fine... see below.

Apparently Hyper-V is supposed to be a "bare metal" (Type 1) hypervisor coming in at 650KB in size; I'm not entirely clear whether Hyper-V can be installed on a Windows Server Core base but at this point I'm still looking at Window and it's sitting right there between the metal and the virtualisation components. Apart from that, it seems like a pared-back version of Virtual Server: the admin screens are very simple and it just works.

I did have one issue after firing up the Hyper-V console for the first time: the Virtual Machine Management service wouldn't start and I had no idea why. Apart from a less-than-helpful UI error on attempting to start the service, the following event entry was logged:

The Virtual Machine Management service terminated with the following error:
The parameter is incorrect.


Luckily Ben Armstrong and Joe Hemmerlein from Microsoft were kind enough to weigh in on the discussion of this issue and pointed me in the right direction. As a I reside in Australia, I naturally selected English (Australia) as my location when I installed Windows but apparently that's not good enough for Hyper-V and it only likes the US. The link above goes through the configuration of your regional settings and language options to get the VMM service running without a Windows reinstall. I changed all my settings back to Oz after things started working but that's no good either: starting up the box today the VMM service failed again. This time I managed to get the service started without having to remove the role: I simply went through the necessary regional/language option config steps, applied to all accounts, and rebooted. I've since changed my account and the default account back to Aussie, leaving the System Accounts as they are. Long story short: this is really annonying and I hope Microsoft fixes this before launch.

After that rigamarole, I installed Windows Server 2008 in a VM, giving it 1GB of RAM (I've successfully installed 2003 on 128MB but Vista has made me wary). Performance at the UI hasn't been too zippy but this is a VM after all.

In the virtual world, I installed the AD role and it was a painless affair. I also turned off IPv6 because I don't know enough about it and those 128-bit hex addresses aren't going to give me much on a home network. DHCP was next and it too was uneventful. As mentioned previously, I'm not a system admin or a network engineer or a network anything--I was suprised when I managed to install AD on Windows 2003 so easily a few years ago and I've noticed the process is that much easier in 2008.

And so the network build continues. I'll soon be whacking MOSS onto a 2008 box for the fun of it and I'll let you know how that goes!

Great Subnetting Tutorial

The link below provides superb, in-depth information about IP addresses and subnetting. All the basics are covered: the breakdown of IP address ranges by class, converting decimal IP addresses to binary, and so on but lesson 6 explains subnetting more clearly than I've ever seen it explained. The author also covers routing and communications and the diagrams make it all as clear as possible.

You have to register to view the article but even if you think you understand subnetting, it's worth it.

http://searchnetworking.techtarget.com/tip/0,289483,sid7_gci1016859,00.html

Friday, 21 March 2008

Say Goodbye, Google AdSense

By the number of ads on this page you may have noticed I'm a Google AdWords user. I realised today it's been nearly a year since I signed up--mainly to track basic statistics and hopefully make a buck or two from page views.

On the stats side I've been very happy. I've watched my "readership" (or number of click-in/click-out visitors, at least--I've got no idea how many of you actually read what I write let alone who subsribes to this blog) grow steadily over the past year and it's been exciting to consider the off chance that some of you actually find my posts helpful or interesting or both.

On the financial side, however, I'm quite disappointed. As I expected, visitors don't click the AdSense links and as a result I've made a grand total of $0.63USD this year. Wow--luckily I'm not in it for the money! A New York Times article suggests only one in every six blogs receives 500 or more page views per day and at that rate you're looking at $45 a month. It's conceivable I've misconfigured something along the way but I've never found it that hard to use any of Google's numerous applications and it really shouldn't be that hard anyway.

Moreover, for all the extra clutter AdWords contributes to my blog and the internet in general, I've decided it no longer cuts the mustard. I've decided to remove the sprinkling of AdWords panels from the right column and leave a single ad in the footer of each page to continue tracking visitors. Harsh, but considering I can grab a free page tracker from anywhere, I perceive no value filling Google's coffers for minimal return.

Sunday, 2 March 2008

Content editor web part dislikes neutral cultures

With the CurrentUICulture property of the current thread set to a neutral culture like 'de', attempting edit the content in a MOSS Content Editor Web Part results in the following exception:

Server Error in '/' Application.

Culture 'de' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: Culture 'de' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thr...

Very boring. On a hunch, I think you can probably get around this by using a specific culture but that may not be possible in very case. This was only an issue while in edit mode, for us, so I got around it by simply setting the CurrenUICulture as en-US whenever a page is in edit mode. Kind of a cheat but our content editors are all English so it doesn't matter.