All posts by kennyjacobson

Intermittent Error: Could not find stored procedure ‘dbo.aspnet_CheckSchemaVersion’

So this error had been causing me grief for about 9 months.  The problem was on a site that only my business partner and I use,d so we just dealt with it.  But we were getting ready to launch our latest project (textbooklook.com) and we starting getting the error there too.  That was unacceptable. I eventually found the answer here

How to Reproduce Error

Log in to site and go to a page that requires authorization. Let the site stand idle for 30 minutes (don’t let anybody else use this site either).  Click onto another page that requires authorization.

Result: Error that says “Could not find stored procedure ‘dbo.aspnet_CheckSchemaVersion’” blah, blah blah.

 

Relevant Technologies and Conditions

  • .NET Simple Membership Class (May also apply to the standard .NET Membership Class)
  • Using the Role Provider
  • Using [Authorize(Roles = "Admin")] or Roles.IsUserInRole or User.IsInRole
  • MVC .NET (may or may not be relevant)
  • Using SQL Server for the Membership Class/Role Provider tables  (may or may not be relevant)
  • Low traffic website (very relevant)

 

The Problem

Because the site was idle (with no other traffic), the application pool on the IIS server “fell asleep”, well actually it was killed.

I’m no expert in this area (and if someone can explain it better, please let me know), but I think it goes something like this.  IIS server is holding open a connection pool in the application pool.  When the site needs to access the database, it uses this connection that is still in memory.  But after a while of inactivity, IIS says, “you know, no one is using this site, so I might as well release the resources back to the OS.” And the application pool dies killing the connection pool with it. Then when someone hits the site again, IIS says “whoops, better get this going again” and while it’s warming up, there is a database call to see if the user is authorized to view the requested page, somewhere along this line I’m guessing the call is trying to use the old connection pool that doesn’t exist yet (or anymore) and so it answers back, “hey, I don’t see no stinkin’ database”…barf.

 

Solution

Keep that application pool alive. Never let it die.

How? I ended up signing up for UptimeRobot which checks to see if my website is functioning properly by sending out an http request every 5 minutes.  This answer came from Joe Audette on mojoPortal (there is another option and another service you can read about there).

I love the UptimeRobot solution because it kills three birds with one stone.  It keeps my site alive so I don’t get that horrible error, it warns me if the site goes down, also it keeps my site snappy fast because it never has to “warm up” after a period inactivity.

Setting up Email with Route 53 using outlook.com

So I’ve outgrown my general “all services” windows hosting provider and I’m moving all my sites my AWS EC2 Windows 2008 Server instance with Route 53 for my domain management.  I like it.  I like it a lot. I like feeling more “in control” of the server.  But one thing I’m missing is email.  There’s no out-of-the-box solution like with my former host.  And I don’t really want to set up Exchange server on the same box that is running IIS AND my SQL Server databases.  It’s definitely an overkill since I really only want one email address for this domain and I don’t really expect  to receive too much mail.

Oh, and cheap would be good. And free would be awesome.

Solution?

A Route 53 email setup using Outlook.com.

Seriously.

Outlook.com allows you to create an account for your domain.  All you have to do is point the MX record to the url they give you.  “Huh?!?,” you say.  Don’t worry, I’ll walk you through it.

First of all, you already need a Windows Live account (hotmail.com, outlook.com, etc) so log into that.

Next go to https://domains.live.com/manage/default.aspx

Domain1

Click “Add domain”

Outlook Signup Domain

Add your domain name and click “Continue”.

Domain3

Type in the captcha code and click “I agree”.

Domain4

Highlight and copy the “MX server” url (I’ve blocked out a little of it as you can see).

Now go to your Amazon Route 53:

R53-1Click on your domain.

Click “Go To Record Sets”

R53-2

Click “Create Record Set”.

Select “MX – Mail exchange” from the Type drop-down box.

Type in “10″ and then a space and then past the value from outlook.com

Click the “Create record” button.

Go back to domains.live.com and click Refresh (it may takes some time if your domain was not previously set up in route 53).

It should take you to this page:

Domain5

Click the “+ Add”.

This is where you will add the email address for your domain.

Domain6

I’ve added “kenny”, so the full address will end up being kenny@datawinconsulting.com.

You can add up to 50 accounts for this domain, so that’s pretty cool.

Now to test it out, just sign out of live.com.

Go to www.outlook.com and sign in with your newly created email address and password:

outlook1It may ask you to complete your account by entering your Birthday and County/region.

Then click “I accept”.

Then you may get a captcha challenge but then finally voila:

outlook2

 

Your new email inbox.

From there you can forward email from this account to one you check more regularly.

Hope that helps!

 

Changing The Background Opacity for LightWindows

When the LightWindow pops up, it darkens the original page underneath it. This has the cool effect of drawing your attention to the newly popped window, while reminding you that you are still on the same site. LightWindow makes the original page pretty dark, though, and our clients wanted it lighter than that.

Behind the scenes, LightWindow creates the “page goes dark” effect by stretching a transparent black squared completely over the browser window. IE and Firefox use different methods to make this square transparent, though. In IE, you load a black opaque image and then set the opacity to a decimal between 0 and 1. The lower the number, the more transparent it becomes. For instance, .7 would make the image 70% opaque or in other words, 30% transparent, .2 would make it 80% transparent. In Firefox, on the other hand, you create an already transparent .png file and just stretch that over the browser window. That means for Firefox, we’ll have to modify the .png file with a graphics editor like Fireworks. Since LightWindow seeks compatibility with both (and so do we), you will have to make a few steps to make the change.

For our project, we want to lighten the page from 70% opacity to 20%.

First we will create the transparent image that Firefox uses, adjusting the opacity to 20% and saving it as “black-20.png”:

  • Open “black.png” (in “images” directory) with Fireworks.
  • Select the Black bitmap object.
  • In the Properties window (probably at the bottom) you should see two dropdown boxes, one has “100%” in the box and the other has “Normal”.
  • Click on the down arrow by the “100%” box and move the slider down to “20%”.
  • Click somewhere else in the program. You will see the bitmap become more transparent.
  • From the menu: File–>Save as “black-20.png

Next we will modify the code in “lightwindow.js”

  • Open “lightwindow.js” (in the “javascript” directory) with your favorite text editor or Visual Studio.
  • Search for “opacity” to locate the following block of code:

overlay : {
opacity : 0.7,
image : 'images/black.png',
presetImage : 'images/black-70.png'
}

  • Change “opacity : 0.7″ to “opacity : 0.2″ (For IE).
  • Change the “presetImage” value to “black-20.png” (For FireFox).
  • Save.

overlay : {
opacity : 0.2,
image : 'images/black.png',
presetImage : 'images/black-20.png'
}

That should do it! Reload the page and verify that it works.