Month: June 2012

Free Training–MSDN Benefit for PluralSight Training “Starter Subscription”

For a limited time, all MSDN subscribers qualify for a free one-year “starter” subscription that contains 20 of the most popular Pluralsight courses. Request your activation code now. This offer will be available for redemption through December 11, 2012. This offer is not available to DreamSpark, WebsiteSpark, BizSpark or MPN MSDN subscribers. There are some really good courses, though the starter pack is mostly beginner and intermediate level, if you’ve already shelled out the money for an MSDN subscription then a lot of these courses may be more of a review  I would recommend the following as good refresher...

Read More

SharePoint 2010 – Change Web Application to use Different Application Pool

When optimizing your farm, one of the recommendations from Microsoft is to only have 10 application pools running on the server (http://technet.microsoft.com/en-us/library/cc262787(v=office.14).aspx). Limit Maximum value Limit type Notes Application pools 10 per web server Supported The maximum number is determined by hardware capabilities. This limit is dependent largely upon: The amount of memory allocated to the web servers The workload that the farm is serving, that is, the user base and the usage characteristics (a single highly active application pool can utilize 10 GB or more) But, once you’ve created your web applications, your ability to change the application pool the web application is running under is quite limited. Not something that can be done in the Central Admin GUI in any case so it either takes very careful planning or a way to go back and change the application pools.  Luckily, it can be quite easily achieved through a simple PowerShell script. Here is a basic.ps1 file I created to easily change the Application Pool of a particular Web Application, as some point I may turn it into a real commandlet: #--------------------------------------------------------------------------------------- # Name: Set-WebApplicataionPool.ps1 # Description: Change which application pool the web application is using # Usage: SetWebApplicationPool -WebAppURL "<ApplicationURL>" -ApplicationPoolName "<ApplicationPoolName>" # By: ieDaddy.com #--------------------------------------------------------------------------------------- # Define 2 parameters for this script param( [string] $WebAppURL = "$(Read-Host 'WebApplication URL')", [string] $ApplicationPoolName = "$(Read-Host 'ApplicationPool Name')" )...

Read More

Entity Framework: Procedure or View with System.NullReferenceException

I was coding a feature that was using a view, it was working fine in development when I had some pretty strict controls over the datasets utilized, but when it got out in the wild it started acting up with the following exception: Error: System.NullReferenceException: Object reference not set to an instance of an object. at System.Data.EntityKey.AddHashValue(Int32 hashCode, Object keyValue) at System.Data.EntityKey.GetHashCode() at System.Collections.Generic.GenericEqualityComparer`1.GetHashCode(T obj) at System.Collections.Generic.Dictionary`2.FindEntry(TKey key) at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) at System.Data.Objects.ObjectStateManager.TryGetEntityEntry(EntityKey key, EntityEntry& entry) at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet) at lambda_method(Closure , Shaper ) at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper) at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext() After digging around for...

Read More

SharePoint–SQL Query to Find All Pages With WebPartTypeId

I know that Microsoft says don’t query the databases directly, and that’s still a good practice for any application level code.  But just like in http://iedaddy.com/2012/03/sharepoint-2010sql-view-to-get-user-profile-property-bag-values/ sometimes it’s a quick and dirty way of getting things done, especially when dealing with content database cleanup or when you only need to run the results once or twice to get the information you need. I had an issue recently where a webpart was being deprecated, and as such we needed to remove it from several large site collections.  Problem was that as this was a Site Collection in the wild, with active users and admins whom have inserted this webpart all over the place, getting rid of the references seemed like it was going to be a slow and painful process.  Removing it from the WebApp and letting things break was not an option.  Now we could use PowerShell to run through all the webs and subwebs, gathering each page and loading up the WebParts collection to see if it’s in there, but in a live farm that gets expensive. Instead, we can run a very simple SQL query against the content database looking for a specific WebPartTypeID, and then use the list generated to browse to each page and correctly either remove or substitute in a new webpart through the SharePoint UI (which would be Microsoft recommended). Here is the...

Read More

Active Directory | Compacting the NTDS Database file NTDS.DIT

Recently my home server started reporting some errors with reading from the AD database file: NTDS (612) NTDSA: A request to read from the file "C:\Windows\NTDS\ntds.dit" at offset 14368768 (0x0000000000db4000) for 8192 (0x00002000) bytes succeeded, but took an abnormally long time (25 seconds) to be serviced by the OS. In addition, 1 other I/O requests to this file have also taken an abnormally long time to be serviced since the last message regarding this problem was posted 3267 seconds ago. This problem is likely due to faulty hardware. Please contact your hardware vendor for further assistance diagnosing the problem. Now, searching for the issue on the Internet seemed to just return a bunch of answers to check the disk, HDD is failing, etc.  All of which I knew was not to be true.  This wasn’t a hardware issue but something related to the way the system was working, so I decided to run a quick compact of the database and see if that cleared up the issue as compacting the AD DS database NTDS.DIT improves performance. Although the improvement varies depending on amount of changes to the database – at the very least I figured if it was bad sectors, a compact and copy would move the file to good sectors. Open the Services.msc panel and stop "Active Directory Domain Services" (also stops the services below) File Replication Service...

Read More