asp.net - SqlException: Invalid object name dbo.<tablename> when using LocalSystem as Identity -


i deployed asp.net web api on local iis (7.0) , can't through in accessing database.

when identity (under process model) set localsystem, api return exception:

invalid object name 'dbo.tablename'

if set identity applicationpoolidentity, api return exception:

cannot open database "dbname" requested login. login failed. login failed user 'iis apppool\asp.net v4.0'.

solutions tried:

  1. login failed user 'iis apppool\asp.net v4.0'

  2. https://www.youtube.com/watch?v=18-zatwd68s

  3. added permissions both folder , .mdf file 'asp.net v4.0'

  4. https://blogs.msdn.microsoft.com/sqlexpress/2011/12/08/using-localdb-with-full-iis-part-2-instance-ownership/

other relevant information:

connection string (in web.config)

<add name="dbcontext"       connectionstring="data source=(localdb)\v11.0;initial catalog=[dbname];trusted_connection=yes;"       providername="system.data.sqlclient" /> 

i tried running application using visual studio using iis express, worked fine.

you've seen https://blogs.msdn.microsoft.com/sqlexpress/2011/12/08/using-localdb-with-full-iis-part-2-instance-ownership/

it says have 3 options,

  • run iis id (bad idea),
  • run localdb shared instance, or
  • use sql express

the latter best advice.


Comments