Tuesday, October 28, 2008

Using Workflow with ASP.NET: Setting up a database

I will be writing a series on using Workflow with ASP.NET. For now, I will just be adding tidbits on how to set things up.

First, you will need to persist (and track) your workflows to a sql server database. To do so (taken from MSDN), create a new database and run the following scripts:

%windir%\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\SQL\EN\SqlPersistenceService_Schema.sql

%windir%\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\SQL\EN\Tracking_Schema.sql

%windir%\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\SQL\EN\SqlPersistenceService_Logic.sql

%windir%\Microsoft.Net\Framework\v3.0\Windows Workflow Foundation\SQL\EN\Tracking_Logic.sql

Thursday, October 23, 2008

Visual Studio 2008: Error When Opening Workflow Designer

You may run into this error when you upgrade to Visual Studio 2008 and attempt to view a workflow in the designer:

there is no editor available for [..] make sure the application for the file type (.cs) is installed

I first attempted to reset settings for Visual Studio and that didn't do it. I re-installed Visual Studio 2008 and kept getting the same error. Little did I pay attention to the output window! It was already telling me how to fix it:

The Microsoft.Workflow.VSDesigner.DesignerPackage, Microsoft.Workflow.VSDesigner, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ({FD526733-BD72-4F81-BEEC-BEB06E2AF59F}) did not load because of previous errors. For assistance, contact the package vendor. To attempt to load this package again, type 'devenv /resetskippkgs' at the command prompt.

And so, I ran that command (if you don't have your system variables set up, you may have to browse to folder where the IDE executable resides. For example: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE).

Monday, October 13, 2008

SQL Server and "User Instance" Error: The user instance login flag is not supported on this version of SQL Server. The connection will be closed

If you attempt using the membership/role providers with the .NET framework 2.0, you may get the following error:

The user instance login flag is not supported on this version of SQL Server. The connection will be closed

There could be a number of reasons:

1) You have not run the aspnet_regsql (in the C:\Windows\Microsoft .NET\Framework..) folder to register the required stored procedures for the membership and/or role providers.

2) You are not using SQL Server Express and your connection string has User Instance=True.

3) You downloaded a starter kit and trying to point it to a SQL Server 2005 instance and haven't modified the default Web.config (or forgot to remove User Instance=True in the connection string).

What's the User Instance flag used for?

It is only supported for the express edition of SQL Server. It allows running applications under a least-privilege user account (LUA).

It allows the creation of a separate SQL Server Express instance (spunned off the parent instance) that runs under the security context of the current user. You can read more here.

Rebuilding the master DB for SQL Server 2005

I was starting the SQL Server 2005 instance. The service failed to start.

I checked the event log and found the following error:

Error 2(The system cannot find the file specified.) occurred while opening file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error. Verify your startup options, and correct or remove them if necessary.

I went to that folder and sure enough, the master database does not exist. So how do you build one? It appears that you have to change the installation in order to do that.

Control Panel --> Add/Remove Programs --> Microsoft SQL Server 2005.

Click on Change. You should get a Microsoft SQL Server 2005 Maintenance dialogue.

First: Component Selection --> Select the troubled instance.

Next.

Second: Feature Maintenance --> I selected Database Engine.

Next. That should start a Microsoft SQL Server 2005 Setup Dialogue.