The .net application host with iis gives a database access error

I have a .Net Core 2.0 application that I host in IIS 7.

With IIS Express, the application works fine, and I can successfully connect to the database. With IIS, I get this error:

Unable to open the database "Books"requested at login. Login failed. Login failed for user 'DOMAINNAME\PCNAME$'.

My connectionString's file is appsettings.production.jsonas follows:

"ConnectionStrings": {
 "BooksDatabase": "Server=PCNAME\\SQLEXPRESS;Database=Books;user id=iisAccess;password=iisPassword;Trusted_Connection=True;ConnectRetryCount=0;MultipleActiveResultSets=true"
};

What am I doing wrong and why does it say that "login failed for" DOMAINNAME \ PCNAME $ "" when I put the credentials user id=iisAccess;password=iisPassword;in my JSON file?

+4
source share
2 answers

You are requesting Windows authentication:

Trusted_Connection=True

.

:

IISExpress . , Windows. IISExpress, , Windows - , SQL Server.

IIS, , . , . , IIS , "" . , SQL Server, SQL "" , DOMAIN\MACHINE $.

+2

, ASPNETCORE_ENVIRONMENT (.. , Production).

( ) ASPNETCORE_ENVIRONMENT Production. IIS , Load User Profile True.

+1

Source: https://habr.com/ru/post/1693646/


All Articles