0

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

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>

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...

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Dude... I love you... i create a new user and instead of integrated security i use like you said--> User ID=myUser; Password=mypass; ...deploy on iis refresh id it simply works... thank you very much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.