JavaScript appears to be disabled. We recommend you enable JavaScript while visiting this site.

(All original content on this site is licensed under the Creative Commons License Attribution-Noncommercial-No Derivative Works 3.0.)

Visual Studio 2010 complaints about ELMAH on a 64-bit machine - fixed

My laptop has quickly become my development machine for smaller projects, especially after I purchased a low-end desktop to host the Subversion repositories.

I recently added ELMAH support to one of my sites, but since I run 64-bit, and have been using the built-in Cassini for quick development, I started getting a message in Visual Studio 2010 saying "ASP.NET runtime error: Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format."

While my low-end desktop has Server 2008 R2 installed on it for research and development purposes (thank you MSDN subscription), having a laptop means I won't always have this resource available. So, since Stack Overflow states that this is an issue with Cassini, and I'm running Windows 7 Home Premium, it was time to install IIS 7 on the machine. After a minimal click in the Control Panel and with the hep of Microsoft Web Platform Installer, my IIS instance was setup correctly.

Unfortunately, that requires that Visual Studio 2010 run as administrator (I was afraid I was going to have to update each of my pinned solutions; thankfully you need to (and can only) update this on the main application shortcut), and my MVC 2 project was failing horribly.

Instead of trying to debug this further I kept searching and found another post on Stack Overflow. After updating my 'shared' directory to contain a folder with all of the ELMAH files and another with just the necessary ones, I'm happy to report the errors (warnings) are gone.

My one site is still a mash of the old and new, so I had to manually remove the items from the Bin directory to verify, but things seem just fine.

Tags: , ,

Categories: tutorials/guides

(All original content on this site is licensed under the Creative Commons License Attribution-Noncommercial-No Derivative Works 3.0.)

Using SQLite as a membership, profile, and role provider in ASP.NET MVC

I'd really like to implement membership providers in my Web applications, but just don't have the user-base that requires SQL Server (Express), nor the memory on my production server.

Having looked at SQLite before, I figured it would be exactly what I'd need, without going to the alternative of XML.

After some research I found Roger Martin's SQLite Membership, Role, and Profile Providers, and finally decided yesterday to implement these on a dummy MVC site.

However, when attempting to add this to my MVC site I kept running into issues, the last of which was an "Unable to open the database file."

The first issue was with the type declared in the examples on the page above; TechInfoSystems.Data.SQLiteProvider should be removed completely, as he suggests just adding the three classes to your site.

The second and last issue was that pesky database issue. At first I didn't think the app_data directory was getting pushed over, so I verified that I was pushing that as part of the Publish process (how they recommend you push a MVC site to production).

Upon further review it looks like the App_Data directory was placed inside the Bin directory. Google didn't help me much on whether that was the expected behavior, but it consistently did that. I added a ton of permissions to NETWORK SERVICE on the bin\app_data directory, but still the same pesky error.

So I commented out the membership, profile, and role items completely from web.config and added the following code to the Index view.

<%= AppDomain.CurrentDomain.GetData("DataDirectory").ToString() %>

Lo and behold, it was looking for it in the root of the site, exactly where I was expecting the App_Data directory to publish to.

Move the App_Data folder and sure enough, the site works (after uncommenting the Web.config provider information, of course) and I'm able to create a new user.

So, why does the publish process require me to move the App_Data directory?

The fix

In order to get the database pushing correctly I changed Copy to Output from Do not copy to Copy always. However, what really needed to happen was the Build Action needed to be changed to Content.

An App_Data directory is now created correctly, and the SQLite database is correctly placed in the directory.

Another gotcha

If you want troubles, change the applicationName in the Web.config for all three items. If you do this, you'll run into errors like "Attempt to write a read-only database attempt to write a readonly database" with a line reference suggesting there's an issue with roleManager. Comment that out, or that and membership and profile, and things will seem okay.

The issue is that the applicationName (SQLite ASP.NET Provider) is baked into the sample SQLite database. Durr.

(All original content on this site is licensed under the Creative Commons License Attribution-Noncommercial-No Derivative Works 3.0.)

iTunes Music to SQLite - version 0.1 beta released

While it was at the same stage as it is now back on the 19th, I'm finally releasing the beta version of iTunes Music to SQLite.

This console application finds all Music playlists in iTunes and imports them into a SQLite database (called iTunesMusic.s3db).

You can change this by passing the database and source names as parameters.

For example:

iTunesMusicToSQLite.exe "datum.db" "James Skemp's 80 gig"

You can run the executable and it will prompt for a key press before exiting, in case you want to view any messages.

This is a beta version, and was done more as a proof of concept than anything else, so this may be the only version released.

Download iTunes Music to SQLite 0.1.

.NET Framework 3.5 is recommended, and may be required (check your version of .NET Framework).

Tags: , , ,

Categories: software, StrivingLife