ReportViewer Error 401 view user logging in

柔情痞子 提交于 2019-12-02 09:48:50

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!