SqlException: User does not have permission to perform this action.

Posted by Oskar Kjellin on Stack Overflow See other posts from Stack Overflow or by Oskar Kjellin
Published on 2010-06-01T20:36:53Z Indexed on 2010/06/01 20:43 UTC
Read the original article Hit count: 473

I have been using my website (ASP.NET MVC) in visual studio but now I want to host it on my server. I published from visual studio onto the network share to be used. The server is running Windows Home Server, IIS 6 and SQL Server 2008 R2 (express).

In Microsoft SQL Server Management Studio, I've attached the database and made sure that the user IUSR_SERVER is owner of the db. I also made sure that the user Network Service has access.

The Web Site is configured in IIS to run anonymously as IUSR_SERVER. I have granted write and read access to IUSR_SERVER as well as Network Service and made sure that nothing is read only.

The web.config has this connectionstring:

        <connectionStrings>
    <remove name="ApplicationServices" />
  <add name="ApplicationServices" connectionString="Data Source=.\SQLExpress;Integrated Security=True;Initial Catalog=MyDatebase"
   providerName="System.Data.SqlClient" />
     </connectionStrings>

However, I cannot browse my web site. I only get this error:

Server Error in '/' Application.

User does not have permission to perform this action. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: User does not have permission to perform this action.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): User does not have permission to perform this action.]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194

Feels like I've tried everything. Would be very grateful for your aid in this.

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc