Connect to local SQL Server instance when running Service Fabric cluster in development environment

喜你入骨 提交于 2019-12-01 15:30:30

Based on the comments above I learned that Service Fabric is running under the NETWORK SERVICE account.

The solution is to update the User Mapping and role membership for the databases that you want to access within the SF cluster.

In SSMS expand Security, Logins, right click NETWORK SERVICE and then choose properties. Under User Mapping place a checkbox next to each Database that you want to expose access to and down below public, db_datareader/writer.

A comment to the accepted answer mentions running your service as a different user account. Here's how to do that. In your ApplicationManifest.xml file, insert this:

<Principals>
  <Users>
    <User Name="AcctToUse" AccountType="DomainUser"
          AccountName="MyDomain\MyUsername" Password="MyPassword" />
  </Users>
</Principals>
<Policies>
  <DefaultRunAsPolicy UserRef="AcctToUse" />
</Policies>

Edit: I didn't make it clear, AcctToUse is just a string that you make up. It's a key that points to the User. The AccountName field on the other hand is the username.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!