ASP.NET Web服务并不在IIS7连接数据库 [英] ASP.NET web service does not connect with database in IIS7

查看:177
本文介绍了ASP.NET Web服务并不在IIS7连接数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试发布在IIS7我的asp.net web服务应用程序,使用Visual Studio调试时我的应用程序运行完美。但是,当我尝试通过键入在浏览器来访问IIS从我的web服务:的http://本地主机:端口/ Service1.asmx的并单击方法,然后单击调用它给了我这个错误:

When I try to publish my asp.net web service application on IIS7, my application works perfect when debugging with Visual Studio. But, when I try to access my webservice from IIS by typing on browser: http://localhost:port/Service1.asmx and click on the method and then click "Invoke" it gives me this error:

System.Data.SqlClient.SqlException: The SELECT permission was denied on the object 'Marimi', database 'eMagazin', schema 'dbo'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
   at WebService.Service1.GetMarime() in C:\Users\Eduard\Desktop\MaG_beta01\MaG\WebService\Service1.asmx.cs:line 741

我在web.config中的连接到数据库是:

My Connection to database in web.Config is :

<connectionStrings>
    <add name="connection" connectionString="Data Source=EDUARD-PC\EDD;Initial Catalog=eMag; Integrated Security=True;" providerName="System.Data.SqlClient"/>
  </connectionStrings>

和我使用的应用程序池ASP.NET V4.0经典

and I use as Application Pool the ASP.NET v4.0 Classic

我搜索对谷歌的解决方案,但我还没有发现任何有用....
谢谢大家提前...

I've searched for the solutions on google but I haven't found anything helpful.... Thank you all in advance...

推荐答案

应用程序池标识有你的数据库没有权限:要么不使用集成安全性,或者创建谁拥有数据库权限的appool专用用户

The Application Pool Identity has no permissions on your database: either do not use integrated security, or create a dedicated user for the appool who has database permissions.

这篇关于ASP.NET Web服务并不在IIS7连接数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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