my webservice is not able to login to a local database
i have made a web service, it has two web methods, one method uses an xml file to get the data, and other uses a database on my machine, first method is working fine but when i call the second method using an object of the webservice from my aspx page, i am getting the below mentioned exception, i am a beginner on this and have wasted a lot of time sorting the problem, so now want the help of your experience..
System.Data.SqlClient.SqlException: Login failed for user 'D-11083ASPNET'. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at BLL.BLLclass.get_zodiac_dll(DateTime yourdate) in c:WebSite7App_CodeBLL.cs:line 58
at BLL.BLLclass.get_zodiac_bll(DateTime yourdate) in c:WebSite7App_CodeBLL.cs:line 73
at Service.get_zodiac(DateTime date) in c:WebSite7App_CodeService.cs:line 29
note: d-11083 is my machine name, and the lines where error is mentioned, they are returning the output..
In your connection string, you need to specify and username and password of a user that has the appropriate access to the database. For testing, you could temporarily enable the SA account and use SQL Server authentication to make this simpler for you. Right now, you are trying to login with the context of the ASPNET user which probably does not (and should not) have access to your database.
So the webservice is attempting to log into the database using windows authentication with the default webserver account.
Does sql server allow windows authentication? Is that particular account authorized?
You probably dont want the ASPNET user to access the database as itself, but you can get it to impersonate another user for the purposes of database access by putting something like this in the web.config
<identity impersonate="true" userName="domainusername" password="passwordgoeshere"/>
ASPnet进程试图用用户名'D-11083 ASPNET'登录是否允许这个用户进入数据库?
链接地址: http://www.djcxy.com/p/56696.html上一篇: 登录操作间歇性失败
下一篇: 我的web服务无法登录到本地数据库
