Archive for April, 2011

Service unavailable and the stopped application pool

Have you ever watched Jeff Dunham? Specifically, do you know Achmed the Dead Terrorist? His go-to line is “I’ll kill you!”, which he says… whenever. That is how I felt after dealing with the latest “Service unavailable” error on my local ASP.NET site.

We use WSPBuilder in our current environment to deploy our web application. Usually, it works fine, but I noticed that I was getting the dreaded “Service unavailable” message. Nothing in the Event Viewer helped me, and setting my browser settings to hide the “friendly error messages” did nothing, and I was about ready to turn to alcohol or violence – I was kind of on the fence to which one.

Then, during my searches on Bing, I found a forum post on Issociate, and this quote is what got my attention:

“When a website is stopped, its icon changes, and at the Websites level, you see a “Stopped” state. When an Application Pool is stopped, its icon also changes, and at the Application Pools level, you see a “Stopped” state.”

Application pools have a stopped state, too? I know what an web site looks like when it’s stopped, but I wasn’t sure about an application pool. So I opened IIS and looked into the Application Pools folder and saw this:

 Application Pool in IIS

Application Pool in IIS

If you click on the image you can see the stopped pools have a few pixels that are red, and the started pools has a few pixels that are green.

AAAAHHHHHH!!!!!!

I spent an hour deploying and redeploying and running IISRESET commands and (almost) throwing things at bystanders because of that half-dozen pixels? Who came up with that idea? How about a great big STOP sign on it? I know I’m creeping ever closer to 40, but come on, that’s is way too small an difference to just casually notice.

Advertisements

Leave a comment

JavaScript onunload event declaration

FYI, the right way to add a JavaScript onunload event looks something like this:

Page.ClientScript.RegisterStartupScript(typeof(Page), “onunload()”, “alert(‘leaving’);”, true);

I left the semi-colon off the end of the statement, and my page didn’t like that. I had never seen a computer curse at me before, but that’s what it did. True story.

Leave a comment

Adding row numbers in Visual Studio 2010

After a recent install of VS 2010 on a new laptop, my beloved line numbers were missing from the left-hand side of the editor. But, I found a site called thereforesystems.com, and there was a simple explanation of how to get them back.

In a nutshell, the setting is at Tools, Options, Text Edit, All Languages, and is a checkbox called “Check line numbers”. But the link has such a pretty picture…

Leave a comment

Error: Could not load type…

Working on the UI portion of a project, after compiling and eagerly loading the project, I received this message:

Could not load type ‘Telerik.Web.UI.RadSessionPageStateCompression’

So, I did what anywould who do, curse and scream. Then I went into the offending ASP.NET project, expanded the “References” folder. I clicked on the “Telerik.UI” reference. In the Properties window, I changed the “Copy Local” setting to True, and voila, no compilation error. And this was the first thing I tried! How lucky is that?

Sorry ladies, I’m taken.

Leave a comment

Getting the value of a WPF ComboBox

In case you were wondering how to set and get the value of a ComboBox in WPF, use the Tag property. So in this case, the Content is what’s visible to the user, and the Tag represents the behind the scenes value:

                <ComboBox Name="DataBase" Grid.Column="0" Grid.Row="1" SelectionChanged="DataBase_SelectionChanged">
                    <ComboBoxItem Content="One" Tag="1"/>
                    <ComboBoxItem Content="Two" Tag="2" />
                </ComboBox>

And to get value of the Tag property:

        private void DataBase_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItem Item = (ComboBoxItem)DataBase.SelectedItem;
            MessageBox.Show("Value = " + Item.Tag);
        }

Leave a comment

Scrollbars on a GridView

I had a GridView on one of my sites, Mapping My Life, that was overflowing that graphic in which I wanted to contain it. I poked around for how to put scrollbars on a GridView, but alas, you can’t do that. But, I did find a site that explains how to get around this by wrapping the GridView inside a Panel. And it worked just like a wanted it to. The key pieces are to set the Height and ScrollBars properties of the Panel: Nothing too fancy, but exactly what I needed.

<asp:Panel ID="pnlLocations" Height="200" ScrollBars="Vertical" runat="server">
    <asp:GridView ID="grdLocations" AutoGenerateColumns="false" Font-Size="10" DataKeyNames="LocId" Height="300" runat="server">
        <Columns>
            <asp:BoundField DataField="Field1" HeaderText="Description" ItemStyle-Width="320" />
            <asp:BoundField DataField="Field2" HeaderText="City" ItemStyle-Width="135" ItemStyle-HorizontalAlign="Center" />
            <asp:BoundField DataField="Field3" HeaderText="User Name" ItemStyle-Width="160" ItemStyle-HorizontalAlign="Center" />
        </Columns>
    </asp:GridView>
</asp:Panel>

Nothing too fancy, but exactly what I needed.

Leave a comment

Error: No process is on the other end of the pipe

I was minding my own business, working on an ASP.NET / Silverlight project in Visual Studio 2010, when I ran across this error:

The client was unable to establish a connection because of an error during connection initialization process before login. Possible causes include the following:  the client tried to connect to an unsupported version of SQL Server; the server was too busy to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server. (provider: Named Pipes Provider, error: 0 – No process is on the other end of the pipe.)

Now, this is SQL Server Express, mind you, so there shouldn’t have been any fancy stuff I needed to do, like configure SQL Server, or restart services, or sacrifice virgins to Baal – any of that sort of thing.

And it was a simple issue – I checked out the .mdf file. You see, I use Visual SourceSafe for my local, personal projects. Yes, that’s right – VSS, baby. Now and forever.

So, getting a named pipe error when trying to connect to a SQL Server Express database in VS 2010 and have the project checked into VSS? Try checking out the DB file first.

Leave a comment