This project has moved. For the latest updates, please go here.

Ticketdesk Admin login unsuccessful

Jul 10, 2014 at 3:22 PM
We have installed the compiled version of ticketdesk on a 2008R2 VM in Azure. It's using IIS 7.5, we have created a vanilla website and separate application pool with .Net4. We have also installed SQL Express 2008 R2 with SQLEXPRESS as the instance. We are able to launch the website both locally on the server, and publicly over DNS (on port 80) but when we try login with the admin account we receive the error
"Login was unsuccessful. Please correct the errors and try again. •The user name or password provided is incorrect".

We swapped the SQLWeb.config to use as our web.config since it contains the SQLEXPRESS instance in the connection strings. Our connection strings are the default ones as shown below:

elmahlog
Data Source=.\SQLExpress;AttachDbFilename=|DataDirectory|\TicketDesk.mdf;Integrated Security=True;User Instance=True

TicketDeskEntities
metadata=res:///Models.TicketDeskEntities.csdl|res:///Models.TicketDeskEntities.ssdl|res://*/Models.TicketDeskEntities.msl;provider=System.Data.SqlClient;provider

TicketDeskSecurityConnectionString
DataSource=.\SQLExpress;AttachDbFilename=|DataDirectory|\TicketDeskSecurity.mdf;Integrated Security=True;User Instance=True

We verified case sensitivity for the instance name in the web.config matches the instance created by SQL Express 2008 R2.
We are using the original database files in app_data, but we did also try swapping them with the ones in the SQLExpress2005FileDatabase folder which did not seem to make a difference.
TicketDesk.mdf
TicketDesk_log.idf

The following two files have also been generated in the app_data directory.
TICKETDESKSECURITY.mdf
TicketDeskSecurity_log.ldf

The timestamp on all of these files in the app_data folder updates when we recycle the application pool, but we cannot login with any of the 3 default accounts in the ticketdesk.mdf file. They all result in the same error "Login was unsuccessful. Please correct the errors and try again. •The user name or password provided is incorrect".

In the IIS log it records the following but nothing else.
2014-07-10 14:56:20 10.4.2.10 GET /Account/LogOn - 80 - (IP removed) Mozilla/5.0+(Windows+NT+6.1;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko 200 0 0 109
2014-07-10 14:56:27 10.4.2.10 POST /Account/LogOn - 80 - (IP removed) Mozilla/5.0+(Windows+NT+6.1;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko 200 0 0 625

It was our understanding that there should be no additional configurations needed once the site was up, the app pool created and set to .net 4, the files copied over to the site root we should be able to login. We can browse the main page, get to the login page, but cannot get any further. New user registration fails also. Any assistance or ideas would be greatly appreciated.
Coordinator
Jul 10, 2014 at 4:38 PM
The TicketDesk.mdf that ships in the app_data folder with TicketDesk is setup with both the ticketdesk and the security objects both... a single database configuration. The main web.config is setup to use this same database for all three connection strings.

The SQLWeb.config is a reference config showing a split-database setup, separate security and ticketdesk databases.

In your case, the application is creating a new security database using the settings in the security connection string. Like any new SqlMembership database, it will not have any pre-defined users.

All you need to do to use the security objects in the main database instead is to make sure you point all three of your connection strings to the same database, specifically TicketDeskSecurityConnectionString
DataSource=.\SQLExpress;AttachDbFilename=|DataDirectory|\TicketDesk.mdf;Integrated Security=True;User Instance=True

You can remove the ticketdesksecurity.mdf and ldf, as they will not be needed if you are using the single database configuration.

Alternately, you can leave the setup you have now, and just run the 3_SecurityDefaultUsers.sql script against the TicketDeskSecurity database to create the default users for the new security database.
Jul 10, 2014 at 5:30 PM

Thanks for the reply, I set all of the connection strings to the configuration you mentioned, but now I am seeing a permission error when the page tries to load. The app pool is running as the network service account which has full access to the directory with the database. What other permission would be needed to access the database? This is occurring when I load it on the server directly.

Server Error in '/' Application.


CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file V:\sites\ticketdesk.streamdynamics.net\App_Data\TicketDesk.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: CREATE DATABASE permission denied in database 'master'.
An attempt to attach an auto-named database for file V:\sites\ticketdesk.streamdynamics.net\App_Data\TicketDesk.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SqlException (0x80131904): CREATE DATABASE permission denied in database 'master'.

An attempt to attach an auto-named database for file V:\sites\ticketdesk.streamdynamics.net\App_Data\TicketDesk.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.]

System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6749670

System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815

System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515

System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +84

System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +53

System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +368

System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6777754

System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6778255

System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +878

System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +1162

System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +72

System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +6781425

System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +103

System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +2105

System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +116

System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +1089

System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +6785863

System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +233

System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +278

System.Data.SqlClient.SqlConnection.Open() +239

System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +102

[EntityException: The underlying provider failed on Open.]

System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +11430407

System.Data.EntityClient.EntityConnection.Open() +142

System.Data.Objects.ObjectContext.EnsureConnection() +97

System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +66

System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +51

System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source, Func`2 predicate) +108

TicketDesk.Domain.Services.ApplicationSettingsService.GetSettingValue(String settingName) +176

TicketDesk.Domain.Services.ApplicationSettingsService.get_HideHomePage() +22

TicketDesk.Web.Client.MvcApplication.Application_Start() +160

[HttpException (0x80004005): The underlying provider failed on Open.]

System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +12951237

System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +175

System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304

System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404

System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): The underlying provider failed on Open.]

System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12968244

System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159

System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12807949

Coordinator
Jul 10, 2014 at 7:51 PM
Those errors can be rough if you aren't used to managing SQL's user-instance database. It probably isn't a permissions issue though... TD was able to create a database for the security objects earlier, so file level ACLs are probably good.

Without access to the environment, I'll give you to most thorough and heavy-handed set of things to do to clear it up. If you know where the problem is, you can usually fix this kind of error very simply and quickly, but when in doubt reach for the hammer.

Typically this kind of thing happens in SQLExpress when an application has attached a database, then another application comes along and tries to attach a database with the same name.

First thing to do is shut down IIS and the SQLExpress windows services both. This will usually detach all user-instance databases, but not always. If you've been running Visual Studio locally on that server, also shut it down and make sure it's webdev server or IISExpress instances have been shut down.

You can restart the whole server if that isn't too much trouble.

Optional - physically delete all databases from the app_data folder of your IIS ticketdesk application. Copy in a fresh version from the download package.

Before you restart the application though, go into whatever SQL management tool you have, and make sure all instances of ticketdesk related databases have been removed. If any remain attached then manually delete them, or detach them.

Then restart ticketdesk.
Jul 11, 2014 at 5:06 PM

We ended up removing 2008 Express R2 and installed 2012 LocalDB and we have it working now after changing the load user profile setting in the app pool from false to true. Thanks for the assistance.