Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

后端 未结 9 1642
北海茫月
北海茫月 2020-11-29 04:23

I been strugling with this for 2 days now without comming any closer to solution. I have read 20-30 threads alteast and stil can not resolve this.

Please help me out

9条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 05:09

    I liked Jed's solution but the issue with that was every time I built my project in debug mode, it would deploy my database project and removed the user again. so I added this MySQL script to the Post-Deployment script. it practically does what Jed said but creates the user every time I deploy.

    CREATE USER [NT AUTHORITY\NETWORK SERVICE]
        FOR LOGIN [NT AUTHORITY\NETWORK SERVICE]
        WITH DEFAULT_SCHEMA = dbo;
    Go
    
    EXEC sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK SERVICE'
    

提交回复
热议问题