<bdo id='RxClf'></bdo><ul id='RxClf'></ul>
      <tfoot id='RxClf'></tfoot>

    1. <small id='RxClf'></small><noframes id='RxClf'>

    2. <i id='RxClf'><tr id='RxClf'><dt id='RxClf'><q id='RxClf'><span id='RxClf'><b id='RxClf'><form id='RxClf'><ins id='RxClf'></ins><ul id='RxClf'></ul><sub id='RxClf'></sub></form><legend id='RxClf'></legend><bdo id='RxClf'><pre id='RxClf'><center id='RxClf'></center></pre></bdo></b><th id='RxClf'></th></span></q></dt></tr></i><div id='RxClf'><tfoot id='RxClf'></tfoot><dl id='RxClf'><fieldset id='RxClf'></fieldset></dl></div>
    3. <legend id='RxClf'><style id='RxClf'><dir id='RxClf'><q id='RxClf'></q></dir></style></legend>
    4. windows服务sql连接问题

      时间:2023-06-07
        <i id='Pv2d9'><tr id='Pv2d9'><dt id='Pv2d9'><q id='Pv2d9'><span id='Pv2d9'><b id='Pv2d9'><form id='Pv2d9'><ins id='Pv2d9'></ins><ul id='Pv2d9'></ul><sub id='Pv2d9'></sub></form><legend id='Pv2d9'></legend><bdo id='Pv2d9'><pre id='Pv2d9'><center id='Pv2d9'></center></pre></bdo></b><th id='Pv2d9'></th></span></q></dt></tr></i><div id='Pv2d9'><tfoot id='Pv2d9'></tfoot><dl id='Pv2d9'><fieldset id='Pv2d9'></fieldset></dl></div>
        <legend id='Pv2d9'><style id='Pv2d9'><dir id='Pv2d9'><q id='Pv2d9'></q></dir></style></legend>

      • <tfoot id='Pv2d9'></tfoot>
          <tbody id='Pv2d9'></tbody>

        <small id='Pv2d9'></small><noframes id='Pv2d9'>

            • <bdo id='Pv2d9'></bdo><ul id='Pv2d9'></ul>

                本文介绍了windows服务sql连接问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我需要你的帮助!!!!!!

                I need your help !!!!

                我想从 Windows 服务连接到 sql server,但它抛出以下异常:

                I want to connect to sql server from a windows service, but it throw following exception :

                用户NT"登录失败权威\匿名登录'.

                Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

                我的连接字符串声明如下:

                My connection string is declared as follow:

                <add name="CoreConnectionString" 
                     connectionString="Data Source=10.10.2.102;Initial Catalog=DataBaseName;
                                       Integrated Security=True" 
                     providerName="System.Data.SqlClient" />
                

                当我使用用户名和密码而不是 Integrated Security=True 时它可以工作,但在最终部署中我不能使用用户名和密码.

                When I use user name and password instead of Integrated Security=True It works but in final deployment I cannot use user name and password.

                出了什么问题我该怎么办??????

                What is wrong what can I do????

                推荐答案

                当您在连接字符串中定义 Integrated Security=True 时,当前登录的任何用户都将尝试连接到您的数据库.将此作为控制台或 Winforms 应用运行时,这是您自己的用户帐户.

                When you define Integrated Security=True in your connection string, whatever user is currently logged in will try to connect to your database. When running this as a console or Winforms app, this is your own user account.

                但是,如果您将它作为 Windows NT 服务运行,则该服务是在该服务帐户下运行的 - 在您的情况下显然 NT AUTHORITY\ANONYMOUS LOGON.

                However, if you run it as a Windows NT Service, it's the service account that this service is running under - in your case obviuosly NT AUTHORITY\ANONYMOUS LOGON.

                并且错误明确指出:此用户帐户没有连接到 SQL Server 的权限.

                And the error says it clearly: this user account does not have the permission to connect to the SQL Server.

                您有多种选择:

                • 停止您的 NT 服务并将服务帐户更改为有权访问 SQL Server 的人

                • stop your NT service and change the service account to be someone who does have access to the SQL Server

                允许 NT AUTHORITY\ANONYMOUS LOGON 登录到您的 SQL Server 并使用您的数据库

                allow the NT AUTHORITY\ANONYMOUS LOGON to log into your SQL Server and use your database

                在您的 SQL Server 中创建一个特定用户(例如应用程序用户")并更改您的连接字符串以专门使用该用户:

                create a specific user (e.g. an "application user") in your SQL Server and change your connection string to use that user specifically:

                connectionString="Data Source=10.10.2.102;Initial Catalog=DataBaseName;
                                  user id=Your-Application-User-here;password=The-Secret-Password"
                

                这篇关于windows服务sql连接问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何授予 SQL Server 读取 SSL 密钥的权限? 下一篇:数据库客户端:如何在 SQL Server 重启后等待数据库

                相关文章

                最新文章

                  <legend id='Kft1C'><style id='Kft1C'><dir id='Kft1C'><q id='Kft1C'></q></dir></style></legend>

                1. <i id='Kft1C'><tr id='Kft1C'><dt id='Kft1C'><q id='Kft1C'><span id='Kft1C'><b id='Kft1C'><form id='Kft1C'><ins id='Kft1C'></ins><ul id='Kft1C'></ul><sub id='Kft1C'></sub></form><legend id='Kft1C'></legend><bdo id='Kft1C'><pre id='Kft1C'><center id='Kft1C'></center></pre></bdo></b><th id='Kft1C'></th></span></q></dt></tr></i><div id='Kft1C'><tfoot id='Kft1C'></tfoot><dl id='Kft1C'><fieldset id='Kft1C'></fieldset></dl></div>

                  1. <tfoot id='Kft1C'></tfoot>

                    <small id='Kft1C'></small><noframes id='Kft1C'>

                      <bdo id='Kft1C'></bdo><ul id='Kft1C'></ul>