ReportViewer Error 401 view user logging in

后端 未结 1 1178
清歌不尽
清歌不尽 2021-01-28 13:51

I\'m getting an 401 unauthorized error when using the ReportViewer on my test server. On my local environment (with the configurations pointed to the test server), I\'m able to

相关标签:
1条回答
  • 2021-01-28 14:51

    I was able to figure out the answer and more importantly how to resolve the issue causing the 401 error.

    First to answer my question, I was able to figure out the user by inspecting

    System.Security.Principal.WindowsIdentity.GetCurrent().Name
    

    When running the app in my local environment (the report server was pointed to the test url), it was using Windows login. Under the test server, it is using IIS APPPOOL. I tried setting the report server credentials manually but with no success.

    ReportViewer rv;
    rv.ServerReport.ReportServerCredentials = new ReportServerCredentials("userName", "password", "domain");
    

    However, I noticed by inspecting IIS manager where the login was coming from.

    When I changed the identity to a NetworkService, the application was able to access the report server correctly.

    0 讨论(0)
提交回复
热议问题