Dofactory.com
Dofactory.com
 Back to list
Views:   28.1K
Replies:  7
Archived

Patterns In Action throws exception when logging in

Hi:

I just downloaded the framework (.NET 4.0) and started the 'Patterns In Action' project.  Regardless of which presentation layer I use it throws an exception when I try to do the Login required by the program.  It crashes in file "ActionService.cs" in method "Login", line 81:

if (!Membership.ValidateUser(request.UserName, request.Password))

The exception is:

System.Data.SqlClient.SqlException was unhandled by user code
  Message=The database 'C:\MARKSSTUFF\MARS\DOFACTORY\PATTERNS IN ACTION\HOST.WCF.ACTIONSERVER\APP_DATA\ASPNETDB.MDF' cannot be opened because it is version 655. This server supports version 611 and earlier. A downgrade path is not supported.
Could not open new database 'C:\MARKSSTUFF\MARS\DOFACTORY\PATTERNS IN ACTION\HOST.WCF.ACTIONSERVER\APP_DATA\ASPNETDB.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\MarksStuff\Mars\DoFactory\Patterns In Action\Host.WCF.ActionServer\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
  Source=.Net SqlClient Data Provider
  ErrorCode=-2146232060
  Class=20
  LineNumber=65536
  Number=948
  Procedure=""
  Server=\\.\pipe\4C1D8742-0D2B-48\tsql\query
  State=1
  StackTrace:
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
       at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate)
       at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation)
       at System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate)
       at System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat)
       at System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password)
       at System.Web.Security.Membership.ValidateUser(String username, String password)
       at ActionService.ServiceImplementations.ActionService.Login(LoginRequest request) in C:\MarksStuff\Mars\DoFactory\Patterns In Action\ActionService\ServiceImplementations\ActionService.cs:line 81
       at SyncInvokeLogin(Object , Object[] , Object[] )
       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
  InnerException:


As described, I installed SQL Server Express.

Does anyone know what the problem might be?
Do I need to change my windows firewall?

Thanx,
Mark

PS - I also get an exception "System.Data.EntityException was unhandled by user code" when doing a search on the website. Again, I haven't yet "logged in".

Mark Horowitz, Aug 03, 2011
Reply 1
I found the problem:
I had to delete directory
C:\Documents and Settings\USERNAME\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS.
Remember to replace USERNAME with your username.

See
http://blog.laksha.net/2009/02/sql-express-error-failed-to-generate.html

Cheers,
Mark

Mark Horowitz, Aug 08, 2011
REALLY looking forward to this. I'd love to see a sample "real world" application being built from zero applying design patterns
Nov 10, 2011
I am eagerly waiting for the videos.
Mar 04, 2011
Reply 2
Please see the image SQL-Server-Config-Manager, enclosed.  I just hope it's readable!
Regards,
Mark





Mark Horowitz, Aug 08, 2011
Reply 3
Hmm, this is turning into a real problem.
- According to the "Sql Server Configuration Manager", SQL Server Services tab, I see "SQL Server (SQLEXPRESS).  So I assume that that is my InstanceID.  IS THIS THE TOOL, AND INSTANCE-ID, THAT YOU MEAN???
- In Tools -> Options -> Database Tools -> Data Connections I see "SQLEXPRESS"
- In the "web.config" file, I see the key "<add key="ConnectionStringName" value="EntityFramework.SqlExpress"/>" so that meets your spec.

Still, I get the exception!  I'm really sorry to be a pain in the butt and yes I'm a newbie to your tools but this must somehow work. I humbly ask for more help.  I have googled the issue but nothing really helped.

Regards,
Mark

Mark Horowitz, Aug 05, 2011
Reply 4
Check your web.config in the Hosting Layer (default should still be "<add key="ConnectionStringName" value="EntityFramework.SqlExpress"/>". Also make sure the version of Sql Express 2008 still has the InstanceID of SQLEXPRESS. I doubt it does since you already had SqlExpress 2005 and that is probabaly most definitely has the InstanceID of SqlExpress. Find out the instanceID and once you do you have to go to within Visual Studio - Tools, Options and once options comes up drop down Database Tools then go to Data Connections and change "Sql Server Instance Name (blank for default):" That should do it.I had the exact same issue. Once you do that double click on the .mdf files just to make sure you can open them and then start the solution. Worked for me.

Thanks
Dennis Tucker, Aug 05, 2011
Reply 5
Um, sorry, that's not the answer. I de-installed SQL Express 2008, and also the 2005 Version which I didn't realize was there. Then I re-installed, fresh, SQL Express 2008. For testing, I turned off the Windows Firewall.The exception, which occurs on exactly the same line as stated above (L. 81) is:

System.Data.SqlClient.SqlException was unhandled by user code
  Message=Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
  Source=.Net SqlClient Data Provider
  ErrorCode=-2146232060
  Class=14
  LineNumber=65536
  Number=15372
  Procedure=""
  Server=.\SQLEXPRESS
  State=1
  StackTrace:

Regards, Mark
Mark Horowitz, Aug 05, 2011
Reply 6
Install SQL Express 2008. First uninstall the previous version or you will have to do some configuration in the project to look at whatever InstanceID you give the 2008 install.
Dennis Tucker, Aug 04, 2011
Reply 7
Hello Mark:

I am sorry for the trouble.

I believe the exception shows what the issue is. It states: 

ASPNETDB.MDF cannot be opened because it is version 655. This server supports version 611 and earlier.
  A downgrade path is not supported
."

Basically, this means you have an old version of SQL Express installed. And it does not know how to deal with a more recent data file format.

I suggest you uninstall SQL Express from your machine and re-install a more recent SQL Express version.
That should do the trick.

Hope this helps.
Dan
Dan McMillan, Aug 03, 2011
Great news! Looking forward to this.
Mar 08, 2011
Awesome! I would love to see all the most comon patterns that get used in ASP.NET, Silverlight &amp; WCF development. (factory, services, mvvm etc). Do you have a price structure in place ?
Mar 04, 2011
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.