如何处理“登录失败的用户'权限\匿名登录'” asp.net中的错误 [英] How to handle "login failed for user 'nt authority\anonymous logon'" error in asp.net

查看:104
本文介绍了如何处理“登录失败的用户'权限\匿名登录'” asp.net中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Web应用程序,我将应用程序与SQL连接。我在本地机器上托管这个网站。它工作正常,但是当需要从SQL服务器获取数据时,它会收到用户登录失败的错误NT AUTHORITY \ ANONYMOUS LOGON。



我的web.config代码如下

 < ;   connectionStrings  >  
< add name = ConnString connectionString = 数据源= INMUM;初始目录= DB_ERS; Trusted_Connection = True ; providerName = System.Data.SqlClient / >
< add name = DB_FRSConnectionString < span class =code-attribute> connectionString = 数据源= INMUM;初始目录= DB_ERS;集成安全性=错误 providerName = System.Data.SqlClient / >
< / connectionStrings >

有什么不对吗?或者我还需要其他任何一个吗?
请建议我回答。

我尝试过:

我的web.config代码如下
< ; pre lang < span class =code-keyword> = HTML > < connectionStrings >
< add name = ConnString connectionString = 数据源= INMUM;初始目录= DB_ERS; Trusted_Connection = True; providerName = System.Data.SqlClient / >
< span class =code-keyword>< add name = DB_FRSConnectionString connectionString = 数据源= INMUM ;初始目录= DB_ERS;集成安全性=真 providerName = System.Data.SqlClient / >
< / connectionStrings >
< system.web >
< < span class =code-leadattribute> identity impersonate = true / >
< 编译 debug = true targetFramework = 4.5.1 >
< / system.web >

解决方案

您需要在连接字符串中提供SQL用户名和密码像这样:

 <   connectionstrings  >  
< add name = MyConString connectionstring = Data Sourc e = serverName; Initial Catalog = dbName; Persist Security Info = True; User ID = someUserId; Password = usersPassword providername = System.Data.SqlClient / >
< / connectionstrings >





或者,保留您拥有的连接字符串,但将IIS中应用程序池上使用的帐户更改为在SQL中具有足够权限的帐户。


解决此问题的最简单方法是不使用可信连接,而是在SQL Server Management Studio中创建一个可以访问您的数据库的SQL帐户,然后提供该帐户的用户名和密码。你的连接字符串



更好的方法是更改匿名用户在IIS中运行的帐户,并通过SQL Management为该帐户授予对数据库的访问权限。如果您不知道如何操作Google,可以使用Google。


I have web application where I connect application with SQL. I host this website on local machine. it works properly, but when need to fetch data from SQL server it getting error that `Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

My web.config code as below

<connectionStrings>
		<add name="ConnString" connectionString="Data Source=INMUM;Initial Catalog = DB_ERS;Trusted_Connection=True;" providerName="System.Data.SqlClient" />
		<add name="DB_FRSConnectionString" connectionString="Data Source=INMUM;Initial Catalog=DB_ERS;Integrated Security=False"  providerName="System.Data.SqlClient" />
	</connectionStrings>
	
Is there anything wrong? or I need to any other this as well? 
Please suggest me answer.

What I have tried:

My web.config code as below
<pre lang="HTML"><connectionStrings>
		<add name="ConnString" connectionString="Data Source=INMUM;Initial Catalog = DB_ERS;Trusted_Connection=True;" providerName="System.Data.SqlClient" />
		<add name="DB_FRSConnectionString" connectionString="Data Source=INMUM;Initial Catalog=DB_ERS;Integrated Security=True"  providerName="System.Data.SqlClient" />
	</connectionStrings>
	<system.web>
    <identity impersonate="true" />
		<compilation debug="true" targetFramework="4.5.1">
</system.web>

解决方案

You either need to provide a SQL username and password in your connection string like this:

<connectionstrings>
   <add name="MyConString" connectionstring="Data Source=serverName;Initial Catalog=dbName;Persist Security Info=True;User ID=someUserId;Password=usersPassword" providername="System.Data.SqlClient" />
 </connectionstrings>



or, keep the connection string you have but change the account being used on your application pool in IIS to an account that has sufficient privileges in SQL.


The easiest way of fixing this would be to not use Trusted Connection, instead create a SQL account in the SQL Server Management Studio that has access to your database, then supply the username and password of that account in your connection string.

The better way would be to change the account your anonymous user runs under in IIS and give that account access to your database via SQL Management. Google for those things if you don't know how to do them.


这篇关于如何处理“登录失败的用户'权限\匿名登录'” asp.net中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆