【问题标题】:Windows Service SQL Server Windows AuthenticationWindows 服务 SQL Server Windows 身份验证
【发布时间】:2018-05-20 07:48:09
【问题描述】:
<add name="NuspayTransactionSecurityEntities" 
     connectionString="metadata=res://*/Security.NTPSecurity.csdl|res://*/Security.NTPSecurity.ssdl|res://*/Security.NTPSecurity.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.10.11;initial catalog=SP_PROCESSOR;persist security info=False;;MultipleActiveResultSets=True;App=EntityFramework&quot;" 
     providerName="System.Data.EntityClient" />
<add name="NPTransaction" 
     connectionString="metadata=res://*/Transaction.NPTransaction.csdl|res://*/Transaction.NPTransaction.ssdl|res://*/Transaction.NPTransaction.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.10.11;initial catalog=SP_PROCESSOR;persist security info=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" 
     providerName="System.Data.EntityClient" />
<add name="CBCommon" 
     connectionString="metadata=res://*/Common.CBCommon.csdl|res://*/Common.CBCommon.ssdl|res://*/Common.CBCommon.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.10.11;initial catalog=SP_PROCESSOR;persist security info=True;persist security info=False;MultipleActiveResultSets=True;App=EntityFramework&quot;" 
     providerName="System.Data.EntityClient"/>
<add name="ApplicationServices" 
     connectionString="data source=192.168.10.11;initial catalog=SP_PROCESSOR;persist security info=True;persist security info=False;" 
     providerName="System.Data.SqlClient"/>

我的问题是,如果我将此应用程序用作 Windows 服务,则 Windows 身份验证不起作用,但它在 IIS Web 应用程序中运行良好。

【问题讨论】:

  • 您的 Windows 服务在哪个帐户下运行?该服务帐户是否具有 SQL 权限?

标签: c# asp.net asp.net-mvc windows-services


【解决方案1】:

我认为配置为运行 windows 服务的服务帐户没有权限连接到SQL

如果是这种情况,您需要使确保运行服务的用户拥有SQL 内的权限。

如果您查看系统、管理工具、服务并找到您的服务。您可以调整与之关联的凭据。

你运行的时候是IIS,那么运行的identity就是有SQL连接权限的app pool identityapp pool identity

通常,当我们安装服务时,它们会违反Network Service or Local System 安全原则。这些不应被授予对 SQL 的访问权限。

您也可以创建一个SQL user 并使用实现SQL authentication连接 字符串。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-06
    • 1970-01-01
    • 1970-01-01
    • 2011-06-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多