One Solution for a “Service Unavailable” Error Message in IIS6

Are you encountering an “Object can’t be created” error or “Service Unavailable” error with your web applications when using a 64-bit OS and IIS6?

I was assisting a customer recently with what appeared to be a typical installation. He had a Windows Server 2003 (x64) machine, which was running IIS6. His classic ASP application was throwing an “Object can’t be created” error (ActiveX component can’t create object). This is a fairly common configuration error for customers running applications with 32-bit COM Objects on 64-bit operating systems. The typical resolution is to double check that the customer’s DLLs are registered properly in the registry. If that doesn’t fix things, we make sure that IIS6 is running in 32-bit compatibility mode:

cd %systemdrive%\Inetpub\AdminScripts
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 1

Unfortunately, after changing these settings his entire site was throwing a “Service Unavailable” error message.
Continue reading One Solution for a “Service Unavailable” Error Message in IIS6

Twitter Roundup: Life of a Coder

As I’ve been perusing the Twittosphere, I’ve run across several entertaining tweets about the frustrations of coders everywhere bemoaning relatable #ProgrammingProblems and #CoderProblems.  A few made me chuckle out loud, and I hope they bring the same amusement to you on this Monday morning.  [ To see the story on Storify.com]

This Twitter Roundup brought to you by the frustrations of coders everywhere bemoaning relatable #ProgrammingProblems and #Coderproblems. You’re not alone!

http://storify.com/softartisans/twitter-roundup-life-of-a-coder

Simple PowerShell Deployment Scripts

Stsadm is the standard for MOSS 2007. Although still available in SP2010, it is deprecated and should not be used. So let’s start with some basics of PS for SP.

  1. One does not simply use PowerShell: The commands are specifically geared for the SharePoint Management Shell. If you open Management Shell as an administrator and type each command in, it’ll work fine. However, when it comes to running scripts there are some issues.
  • You have to load the Microsoft.SharePoint.PowerShell snapin, like so:  “Add-PsSnapin Microsoft.SharePoint.PowerShell”
    • This may give you an error: “The local farm is not accessible.” You need to have your account enabled as a SharePoint Admin (see below)
  • Make sure you’ve set the execution policy. This one is easy, just use the “Set-ExecutionPolicy” command. The possible values are:
    • AllSigned – You can only run trusted signed scripts.
    • RemoteSigned – If the script is downloaded, it must be signed, otherwise just run it.
    • Restricted – This one is self explanatory. No one gets to run scripts. No nobody. Not nohow.
    • Unrestricted – Again, self explanatory. As a very wise English professor once told me, “Unrestricted is the opposite of restricted.” I never forgot that…
  • You always need root: You have to be an SP administrator in order to run SP commands from PowerShell. You can check your local permissions by:
    • Right clicking on SP Management Shell and running it as an administrator. This will give you access to admin privileges, but if your login isn’t a SP admin, then you can’t do any of this in regular PowerShell.
    • Typing “Get-SpShellAdmin”
    • Looking for your login.
    • If you aren’t on the list, you can use the current Shell to add yourself, like so: “Add-SpShellAdmin -UserName YOUR\UserName”
    • Now you should be able to execute SharePoint scripts in PowerShell.
  • Remember – All Files .Ps1.: The script has to be saved with extension .ps1.
    • You  shoud save as “All File Types” rather than “*.txt,” otherwise it may not work.
  • No execadmsvcjobs: That command is no longer available. So timer jobs have to be waited for a little differently.
  • ## Get the solution
    $Solution = Get-SPSolution -identity $SolutionFileName
    $lastStatus = ""
    ## loop whilst there is a Job attached to the Solution
    while ($Solution.JobExists -eq $True)
    {
     $currentStatus = $Solution.JobStatus
    	 if ($currentStatus -ne $lastStatus)
    	 {
    		Write-Host "$currentStatus…" -foreground green -nonewline
    		 $lastStatus = $currentStatus
    	 }
    	 Write-Host "." -foreground green -nonewline
      sleep 1
     }
     ## completed
     Write-Host ""
     Write-Host " "$Solution.LastOperationDetails -foreground green

    The Script
    I wrote a simple script that prompts for file name, webapp name, and what function you’d like to perform. It is based on the script found on Nik Patel’s SharePoint World blog. The difference between Nik’s and mine is that mine doesn’t check for everything before performing operations. If you choose to use it, you have to be aware that you might get an error; however, it is a very simple version and much easier to use/understand/modify.

    #####
    # Script to deploy Webparts/Solutions. Does not make use of feature installation
    # Kate Mogel 2012
    #
    # To use:
    # Place in folder with WSP file. Open powershell and cd into solution folder
    # Run script as admin, refering to local file (e.g. ./DeployScript.ps1)
    # Enter full file name (e.g. solution.wsp), web app name, and choose an operation
    #####
    param(
    [string]$solName = "$(Read-Host 'Enter WSP File name ')",
    [string]$webName = "$(Read-Host 'Enter WebAppName. i.e. http://SP2010APP ')",
    [string]$whichFunct = "$(Read-Host 'Enter IS to install, RS to remove, US to upgrade ')"
    )
    
    function main{
    
     #Check for snapin. Add if not present
     $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
     if ($snapin -eq $null)
     {
            Add-PSSnapin Microsoft.SharePoint.Powershell
     }
    
    #Get location
    $solLoc = Get-Location 
    
      #Check the operation
      if($whichFunct -eq "IS")
      {
     	addSol
      }
      if($whichFunct -eq "RS")
      {
          Uninstall-SPSolution -Identity $solName -WebApplication $webName
      }
      if($whichFunct -eq "US")
      {
          Update-SPSolution -Identity $solName -LiteralPath $solLoc\$solName -GACDeployment
      }
    
    }
    
    #Function to add and install solution
    function addSol{
    	$Sol = Get-SPSolution | where-object {$_.Name -eq $solName}
    	if($Sol -eq $null){
    	    Add-SPSolution -LiteralPath "$solLoc\$solName" -Confirm:$false
    	    Install-SPSolution -Identity $solName -WebApplication $webName -GACDeployment
     	}
    }
    #Run Main Method
    main

    Okay. Go deploy your WSP.

    Stories from the WIT Trenches: Jen Stirrup

    [This is the eighth in a series of posts exploring the personal stories of real women in technology. Every woman in tech overcame, at the very least, statistical odds to be here; this blog series aims to find out why, and what they found along the way. Author of a prestigious BI blog, Jen Stirrup (t|ln), runs a small Business Intelligence company (Copper Blue Consulting) with Allan Mitchell (t|ln) and is an active member of the SQL Server community. If reading her story inspires you to share yours, please email me.]

    Meet Jen:

    “I have been a SQL Server Most Valuable Professional (MVP) for nearly one year, in the SQL Server discipline. This allows me to connect more deeply with the great minds and kind hearts in the MVP community and at Microsoft. One day, I hope that I won’t be as tongue-tied when I meet the other MVPs that I’ve admired for such a long time!”

    1) Can you take us back to your “eureka!” moment—a particular instance or event that got you interested in technology?

    When I was eight years old, my Uncle gave us a computer that he’d fixed. It was a little Sinclair ZX81, and I loved it. I learned to program in BASIC, and my love of technology has been with me ever since.

    2) Growing up, did you have any preconceived perceptions of the tech world and the kinds of people who lived in it?

    My perception of the tech world was shaped by older males in my family, who took the time to involve me in all things electronic and computer-focused. For example, my grandfather was one of the first television engineers, and continued to be impressed and excited by technology until he passed away in his mid-eighties.  One of my great uncles was a spy during the Second World War, and worked to code-break Japanese codes. Their experiences combined to influence me, and continue to do so until this very day.

    3) When did you first consider a career in technology? What did you envision doing?

    Initially, I wanted to train as a psychologist and I had a specific interest in cognitive psychology. I used my programming skills in order to set up psychological experiments and I found that I preferred it to psychology.

    I moved into Artificial Intelligence, moving from my cognitive psychology and programming background. I was fascinated by the algorithms that attempted to further research into human cognitive processes. I still see Artificial Intelligence alive and well, but in a different guise (e.g. search technologies).

    4) Did you experience any personal or systemic setbacks at any point of your academic or professional career?

    In the first two years of my son’s life, he was critically ill on occasion. At some points, he was given an hour to live. His illness was a constant stress, and I obviously couldn’t work as he recuperated. I’m glad to say that he survived, partially due to his own tenacity and zest for life. I’m very grateful to the doctors and nurses who saved him, despite the odds.

    5) Whom do you look at as mentors and/or sources of inspiration in your field?

    I am inspired every day by people in the community, particularly the Professional Association of SQL Server (SQLPASS) community. There are a huge number of selfless volunteers who give up their time to create training material, give presentations, and provide help and support to people who are on the path to learning SQL Server.

    6) How has your participation in both the on- and offline SQL Server communities changed the way you look at and work with these technologies?

    I’ve learned a lot about business benefits and perspectives from interacting with people in the community. Someone might ask a question which seems strange, but when you start to understand the ‘why’ of the question, it becomes clear that there may be a strong business reason for doing something, even if the proposed technical response seems strange.

    I’ve met members of the Analysis Services, Excel and Reporting Services teams, and I’m hugely impressed with their dedication and innovation to provide high-quality products and solutions that SMEs can afford.

    7) Why do you think the rate of attrition for women in software engineering is higher than that of women in most other tech fields?

    I’m not sure if this is the case, cross-culturally. From my own experience, the issue is perceptions about returning to a technical role after maternity leave. Women leave the field for awhile, and then lose confidence to come back to technology since the tech world has moved on so fast. I have to say that, after returning to work after having had my son, women should not lose confidence in coming back to technology after having had a child. Remember most of the guys you work beside are also parents. The technical skills are transferable to newer versions and editions.

    8) Do you have any suggestions for how to get more girls interested in computers and computer science? Is this important to you?

    I think it is important to show girls that technology can help people. For example, Microsoft uses technology to help girls across the globe, in partnership with UNESCO.

    Don’t dismiss girls from technology, at an early age. Teachers need support in the classroom to make sure that girls also get attention and equal education in subjects such as math, computing science and so on.

    Twitter Roundup: Talking About SSRS

    Hello!  Welcome to my first post.  I’m Elise, lover of social media and self-proclaimed coffee addict.  As a newcomer to SoftArtisans, and to the MSFT tech arena in general, I’ve been trying to absorb as much info on the technologies we run on as possible. Since one of OfficeWriter’s main features is its SSRS designer, I decided to tackle this reporting beast first. Luckily, the Twittersphere is rife with helpers. Some of my favorite SSRS-related tweets (and tweeters) are below.  (Click the picture to see the full list.)  If you have any favorite SSRS bloggers, tweeters, or posts I’d love to hear about them!  Send me a tweet or leave a comment in the comments section so I can check it out.

    What’s New In Office 15

    Photo Credit: Techmash.co.uk

    Overview

    Microsoft is pushing to make Office more of a service. In their ideal world everyone would be using Office 365 and there would be no on-premises environments. Since Office will be more of a service Microsoft is providing a few updates.

    Better Experience Across Devices

    Microsoft is putting emphasis on having your Office experience be very similar across different platforms and devices. With a push toward Office being more of a service, they realize you may be accessing Office from tablets, desktops, mobile phones or web browsers. Keeping this in mind, they have put a lot of work into improving the user experience.

    • SharePoint has better support for iPads and other mobile devices and is focused more on using standards such as HTML5 and removing non-cross-system/browser technologies such as ActiveX, Flash and Silverlight.
    • Office interfaces have been revamped with better support for touch interfaces. If you are using an office application in touch mode, then menus will appear the same, but the spacing will change to better support touch.
    • Settings can sync to the cloud to make your user experience easier. For example, if you are on page 40 of a 100 page word document and you switch from your desktop to the web, it will reopen at page 40.
    • Application Streaming – Office can be running in only a few minutes.

    What is new in Word and Excel

    “Agaves”

    Microsoft’s attempt to unify the experience across platforms brings up an interesting area of development. What can you write that will run in a web browser, on a desktop client and a mobile phone? The answer is not VBA macros or VSTO add-ins. Microsoft has introduced a new platform of development code-named Agave. You can think of an Agave as an IFRAME which can be embedded right into your document. Microsoft exposes an API through which your Agave can communicate with Office.

    For Word and Excel it looks like there will be only two types of Agaves: Task Pane Agave and In-Document Agave.

    • Word will support only the Task Pane Agave.
    • Excel will support both the Task Pane Agave and the In-Document Agave.

    Examples of Outlook Agaves:

    • Displaying a map when an e-mail contains an address
    • Displaying the Yelp review when someone talks about a restaurant
    • Auto-populating a new appointment window when someone suggests a meeting time
    • Quick link to bug tracker based on bug numbers

    Keep in Mind:

    • Agaves only run at a document level, and are distributed with the document.
    • In order to use Agaves in Outlook, Exchange 15 is required on the server.

    SharePoint _API

    The big think in SharePoint 15 from a developer’s standpoint is _API. SharePoint now exposes much of the SharePoint API through REST services, such as
    http://localhost/_api/Web
    http://localhost/WebURL/_api/Search
    http://localhost/WebURL/_api/Taxonomy
    http://localhost/WebURL/_api/BCS

    SharePoint Apps

    The SP15 Technical Preview Managed Object Model Software Development kit includes a bunch of changes that indicate app support (SPApp, SPAppInstance, SPAppCatalog etc).

    Items to Note:

    • Ribbon is minimized by default (toggle with a pin icon)
    • Outlook has metro-style nav at the bottom
    • Outlook switched “contacts” to “people”
    • You can share documents online using Windows Live

    Visual Studio Runtime Interop Exception

    Recently I was working on a Project in Visual Studio 2008 that has some Web Services in it. Every time I opened the project I would get the error:

    System.Runtime.InteropServices.COMException

    According to a blog post by Marocanu2001, he was receiving this error because he did not have IIS installed.  However in my case this was not the issue. In my case it was because I was running Visual Studio in limited user mode, and not as an administrator. Without Administration rights, when Visual Studio tries to configure the web services in IIS it will throw this exception.

    The solution in short:

    • Make sure IIS is installed on your machine

    Make sure Visual Studio is run in Administrative mode. (Right-click “Run as Administrator”)

     

    Hope this works for you as well. Happy coding!

    Major Upgrades using WiX

    Major Upgrades using WiX

    Recently one of my colleagues wrote about his experience with WiX, and how he could create a simple installer in fifteen minutes. Today I want to talk about taking your newfound WiX installer to the next level by configuring your WiX installer to perform major upgrades.  In most cases a major upgrade means removing any previous version of an application and installing the new version.

    Depending on which version of WiX you are using, you have a couple of options to perform a major upgrade.

    Special Considerations:

    Special considerations should be made before you start creating your installer. One of the most important ones in my opinion is deciding if your installer will be per-user or per-machine. By default WiX is a per-user install.  If you want your installer to be per machine you can add the following your solution:

    <!-- Install at a per-machine level and not per-user -->
    <Property Id="ALLUSERS" Value="1"/>
    

    Any upgrade that you make should use a consistent ALLUSERS property. If you decided to change this once your application is already deployed, a major upgrade will not be looking in the same place, and any new version of the installer will not be able to detect the old installed version. This can lead to multiple versions of the software installed on one system.

    WiX 3.5.1315.0 and later

    In version 3.5.1315.0 of WiX the Major Upgrade Element was introduced, which makes common upgrade scenarios very simple.

    It can be as simple as:

    <MajorUpgrade AllowDowngrades="no" DowngradeErrorMessage="A newer version of this application is already installed."/>
    

    If you try to run the installer on a system that already has a newer version you will receive an error with the DowngradeErrorMessage such as:

    However if you are indeed installing a new version, then the installer will automatically uninstall the old version and install the new version. How easy is that?!

    Pre WiX 3.5.1315.0

    If you are using a version of WiX before 3.5.1315.0 then you have to perform a major upgrade in a slightly more complicated way. Seeing as everyone may not be using the newer version of WiX, I think it is still worth explaining.  Note: What defines a Major upgrade is changing the Product Version and Changing the Product ID; just changing the product version will be considered a minor upgrade.

    Step  1   Define your GUIDS:

    Whenever you are ready to perform a major upgrade you will need to change your product’s GUID. The product GUID is how WiX determines major versions of the product. In my case I am using *, which will generate a new unique GUID every time I build my installer.

      <!-- * means WIX will generate a new GUID -->
    	<Product Id="*" Name="$(var.Product.Name)" Language="$(var.Product.Lang)" Version="$(var.Product.Version)" Manufacturer="$(var.Product.Manufacturer)" UpgradeCode="f47c5510-7e95-11e1-8027-bbc14824019b">
    		<Package InstallerVersion="$(var.Package.InstallerVersion)" Compressed="yes" Platform="$(var.Platform)" />
    

    Step 2 Define your condition message:

    <Condition Message="A newer version of this application is already installed.">
          <![CDATA[Installed OR NOT NEWER_VERSION_FOUND]]>
        </Condition>	
    

    Step 3 Define upgrade table:

    The upgrade table tells the installer what the versions it should detect are and how to respond. You will notice that when I detect newer versions, OnlyDetect = “true” because I do not want to replace newer versions of my product.

    <!-- Upgrade Table -->
        <Upgrade Id="f47c5510-7e95-11e1-8027-bbc14824019b">
          <UpgradeVersion
            Property="OLD_VERSION_FOUND"
            Minimum="1.0.0.0"
            Maximum="$(var.Product.Version)"
            IncludeMinimum="yes"
            IncludeMaximum="no"
            OnlyDetect="no"
            IgnoreRemoveFailure="yes"
            MigrateFeatures="yes"
            Language="1033"  />
    
          <UpgradeVersion
            Property="NEWER_VERSION_FOUND"
            Minimum="$(var.Product.Version)"
            IncludeMinimum="no"
            OnlyDetect="yes"
            Language="1033"  />
        </Upgrade>
    
    

    Step 4 define the Install Execute Sequence

        <!--Removes the old version and then installs the new version-->
        <InstallExecuteSequence>
          <RemoveExistingProducts After="InstallInitialize"></RemoveExistingProducts>
          <InstallExecute After="RemoveExistingProducts"></InstallExecute>
        </InstallExecuteSequence>
    

    And that’s it. I hope this helps others who are looking to perform major upgrades with their WiX installers. If you are working a lot with WiX, I recommend you check out the book WiX: A Developer’s Guide to Windows Installer XML  by  Nick Ramirez

    Blogged