我的web服务无法登录到本地数据库

我做了一个web服务,它有两个web方法,一个方法使用xml文件来获取数据,另一个使用我的机器上的数据库,第一个方法工作正常,但是当我调用第二个方法使用web服务从我的aspx页面,我得到了下面提到的异常,我是一个初学者,并浪费了很多时间排序问题,所以现在想要你的经验帮助..

System.Data.SqlClient.SqlException:用户'D-11083 ASPNET'的登录失败。 在System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)
在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)在System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand的cmdHandler,SqlDataReader的数据流,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)在System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin (布尔enlistOK)在System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(字符串主机,字符串newPassword,布尔redirectedUserInstance,System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,字符串newPassword,布尔ignoreSniOpenTimeout,Int64 timerExpire,SqlConnection拥有对象) SqlConnection owningObject,SqlConnectionString connectionOptions,Int64 timerStart)
在System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity标识,SqlConnectionString connectionOptions,Object providerInfo,String newPassword,SqlConnection拥有对象,System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject,SqlConnectionString connectionOptions,String newPassword,Boolean redirectedUserInstance)在System.Data.ProviderBase的System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection,DbConnectionPoolGroup poolGroup)上的System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项,对象poolGroupProviderInfo,DbConnectionPool池,DbConnection owningConnection)上的布尔值redirectedUserInstance) System.Data.SqlClient.SqlConnection.Open()上System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory)上的DbConnectionFactory.GetConnection(DbConnection owningConnection) 在c: WebSite7 App_Code BLL.cs中的BLL.BLLclass.get_zodiac_dll(DateTime yourdate)中:第58行
在c: WebSite7 App_Code BLL.cs中的BLL.BLLclass.get_zodiac_bll(DateTime yourdate)中:第73行
在c: WebSite7 App_Code Service.cs中的Service.get_zodiac(日期时间日期):第29行

注意:d-11083是我的机器名称,并且提到错误的行,它们正在返回输出。


在连接字符串中,您需要指定具有相应数据库访问权限的用户的用户名和密码。 对于测试,您可以暂时启用SA帐户并使用SQL Server身份验证为您更简单。 现在,您正尝试使用ASPNET用户的上下文进行登录,该用户可能不会(也不应该)访问您的数据库。


因此,web服务正尝试使用默认webserver帐户的Windows身份验证登录数据库。

SQL服务器是否允许Windows身份验证? 该特定帐户是否被授权?

您可能不希望ASPNET用户自己访问数据库,但您可以通过在web.config中放置类似内容来获取它以模拟另一个用户以用于数据库访问

<identity impersonate="true" userName="domainusername" password="passwordgoeshere"/>

ASPnet进程试图用用户名'D-11083 ASPNET'登录是否允许这个用户进入数据库?

链接地址: http://www.djcxy.com/p/56695.html

上一篇: my webservice is not able to login to a local database

下一篇: Strange Error On Failed ASP.Net Login