0

I have been through the mill trying to connect to LocalDB. I have been following a two-part article dealing with this issue on my development workstation. In article part two, I opted for the second option of creating a shared instance of LocalDB and get the following runtime error as YSOD:

Cannot open database "DTC" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\DTC'.

DTC is name of Web Forms application and name of application pool in IIS.

Following the steps in the article for creating the shared instance, I got as far as creating the SQL Server login for ApplicationPoolIdentity as follows:

create login [IIS APPPOOL\DTC v4.0] from windows;
exec sp_addsrvrolemember N'IIS APPPOOL\DTC v4.0', sysadmin

Then I get the following error when executing the query in SQL Server Object Explorer:

Msg 15401, Level 16, State 1, Line 1
Windows NT user or group 'IIS APPPOOL\DTC v4.0' not found. Check the name again.
Msg 15007, Level 16, State 1, Procedure sp_addsrvrolemember, Line 33
'IIS APPPOOL\DTC v4.0' is not a valid login or you do not have permission.

Am using VS2013 and SQL Server 2012 on Windows 8.1. Can't believe how difficult it is to set up LocalDB. What I'm actually trying to do is add Identity membership to existing Web Form application and am open to any suggestions...

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91

2 Answers2

0

IrishChieftain, I don't recommend use LocalDB for this purpose. If you really want to have a lightweight database just to manage the membership, your best option is SQL Express.

LocalDB is intended to be used for development, not in production cases.

Luiz
  • 542
  • 5
  • 10
  • This is actually on my development workstation - eventually I would migrate to SQL Server Web Edition on live server. – IrishChieftain Aug 06 '15 at 16:32
  • Ok, if is in your development machine, try use IIS Express and you'll use logged user to access database. Other option is to change your connection string for your local development. – Luiz Aug 06 '15 at 18:43
  • Do not want to use Express. If this fails will have to revert to SQL Server 2012 on dev machine... – IrishChieftain Aug 07 '15 at 17:33
  • I said IIS Express not SQL Express... In my dev machine I always use IIS Express with SQL Express, and some times used Local DB but didn't like. But every time I used Local DB didn't have problems with authentication because I was running the IIS Express with my account and not IIS APPOOL account. – Luiz Aug 07 '15 at 20:51
0

The simplest solution was to login under my Windows identity.

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91