title: System.Data.SqlClient.SqlException: The SELECT permission was denied on object 'tableName', database 'dbName', schema 'dbo'
body: <p>I try to SELECT some data from SQL Server via my ASP.NET MVC web-app which is hosted in a Local IIS 7 and I'm getting this error:</p>
  
  <blockquote>
    <p>System.Data.SqlClient.SqlException: The SELECT permission was denied
    on object 'tableName', database 'dbName', schema 'dbo'.</p>
  </blockquote>
  
  <p>Knowing that all the <code>IIS APPPOOL\ASP.NET V4.0 Integrated</code>'s privileges are checked, how do I to fix this, please? </p>
  
  <p>Stack trace:</p>
  
  <blockquote>
    <p>[RuntimeBinderException: Cannot perform runtime binding on a null
    reference]    CallSite.Target(Closure , CallSite , Object ) +200<br>
    System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0
    arg0) +924    ASP._Page_Views_Shared__Header_cshtml.Execute() in
    c:\Users\Nectarys\desktop\monitoringn_web\monitoring2 -
    copy\monitoringn\Views\Shared_Header.cshtml:11<br>
    System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280<br>
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126<br>
    System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
    pageContext, TextWriter writer, WebPageRenderingBase startPage) +196<br>
    System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper,
    String partialViewName, Object model, ViewDataDictionary viewData)
    +158    ASP._Page_Views_Shared__Layout_cshtml.Execute() in c:\Users\Nectarys\desktop\monitoringn_web\monitoring2 -
    copy\monitoringn\Views\Shared_Layout.cshtml:13<br>
    System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280<br>
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126<br>
    System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
    pageContext, TextWriter writer, WebPageRenderingBase startPage) +196<br>
    System.Web.WebPages.WebPageBase.Write(HelperResult result) +89<br>
    System.Web.WebPages.WebPageBase.RenderSurrounding(String
    partialViewName, Action<code>1 body) +233<br>
    System.Web.WebPages.WebPageBase.PopContext() +291<br>
    System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
    +378    System.Web.Mvc.&lt;&gt;c__DisplayClass1a.&lt;InvokeActionResultWithFilters&gt;b__17()
    +33    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
    filter, ResultExecutingContext preContext, Func</code>1 continuation)
    +855148    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
    controllerContext, IList`1 filters, ActionResult actionResult) +265<br>
    System.Web.Mvc.Async.&lt;>c_<em>DisplayClass25.b</em>_22(IAsyncResult
    asyncResult) +839620<br>
    System.Web.Mvc.&lt;>c_<em>DisplayClass1d.b</em>_18(IAsyncResult
    asyncResult) +28<br>
    System.Web.Mvc.Async.&lt;>c_<em>DisplayClass4.b</em>_3(IAsyncResult
    ar) +15    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult
    asyncResult) +65<br>
    System.Web.Mvc.Async.&lt;>c_<em>DisplayClass4.b</em>_3(IAsyncResult
    ar) +15    System.Web.Mvc.Controller.EndExecute(IAsyncResult
    asyncResult) +51<br>
    System.Web.Mvc.&lt;>c_<em>DisplayClass8.b</em>_3(IAsyncResult
    asyncResult) +42<br>
    System.Web.Mvc.Async.&lt;>c_<em>DisplayClass4.b</em>_3(IAsyncResult
    ar) +15    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult
    asyncResult) +51<br>
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    +606    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +288</p>
  </blockquote>
  
  <p>Also, I've <code>grant SELECT,INSERT,UPDATE,DELETE on dbo.tableName to "IIS APPPOOL\ASP.NET V4.0 Integrated";</code>. I've did this by selecting the dbName and making in new script in which I've written that line.</p>