2013-08-07 88 views
0

當我嘗試在IIS7上發佈我的asp.net web服務應用程序時,我的應用程序在使用Visual Studio進行調試時工作正常。但是,當我嘗試通過鍵入在瀏覽器訪問IIS從我的web服務:http://localhost:port/Service1.asmx並單擊方法,然後單擊「調用」它給了我這個錯誤:ASP.NET web服務不與IIS7中的數據庫連接

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中的連接到數據庫:

<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的經典

我搜索了對谷歌的解決方案,但我還沒有發現任何有用.... 謝謝所有提前...

回答

3

應用程序池標識對數據庫沒有權限:要麼不使用集成安全性,要麼爲具有數據庫權限的appool創建專用用戶。

+1

Dude ...我愛你...我創建一個新用戶,而不是像我說的那樣使用集成安全 - > User ID = myUser;密碼=將mypass; ...部署在iis刷新身份證,它只是工作...非常感謝你 –