关于 SQL Server Reporting Services 匿名登录的解决方案
每次访问报表都需要windows验证,这样的报表给客户确实很说不过去.

SSRS 可以匿名登录的设定步骤:
环境:
开发工具:SQL Server Business Intelligence Development Studio
数据库: SQL2008
首先确定你的Reporting Services 目录位置
默认为: C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer
打开目录会修改该目录下的3个配置文件,分别为:rsreportserver.config , rssrvpolicy.config ,web.config
解决步骤:
1.打开 rsreportserver.config
修改 Configuration/Authentication/AuthenticationTypes
修改前:
<Authentication>
<AuthenticationTypes>
<RSWindowsNTLM/>
</AuthenticationTypes>
</Authentication>
修改后:
<Authentication>
<AuthenticationTypes>
<Custom/>
</AuthenticationTypes>
</Authentication>
2. 修改 web.config
<!--节点:configuration/system.web/authentication --> <!-- 修改前 -->
<authentication mode="Windows" />
<identity impersonate="true" />
<!-- 修改后 -->
<authentication mode="None" />
<identity impersonate="false" />
3. 从微软下载匿名登录的范例项目
( 下载网址 http://blog.quasarinc.com/wp-content/uploads/2012/03/Microsoft.Samples.ReportingServices.AnonymousSecurity.zip),
并且重新编译出一个新的 Microsoft.Samples.ReportingServices.AnonymousSecurity.dll 动态库,
范例为2010解决方案,其实里面用到的只是class1.cs文件,还有项目名称不能变,和我们下面配置有直接关系.
打开解决方案 将 Microsoft.ReportingServices.Interfaces.dll 的引用移除,并添加本地服务器的这个文件,位置在 ..\Reporting Services\ReportServer\bin 下, (注意别把这个dll当成万能的)
重新编译会生成 : Microsoft.Samples.ReportingServices.AnonymousSecurity.dll 将该文件放置bin目录下
4.再次修改 rsreportserver.config
<!--修改节点:Configuration/Extensions/Security/Extension --> <!-- 修改前 -->
<Security>
<Extension Name="Windows" Type="Microsoft.ReportingServices.Authorization.WindowsAuthorization, Microsoft.ReportingServices.Authorization" />
</Security> <Authentication>
<Extension Name="Windows" Type="Microsoft.ReportingServices.Authentication.WindowsAuthentication, Microsoft.ReportingServices.Authorization" />
</Authentication> <!-- 修改后 -->
<Security>
<Extension Name="None" Type="Microsoft.Samples.ReportingServices.AnonymousSecurity.Authorization, Microsoft.Samples.ReportingServices.AnonymousSecurity" />
</Security>
<Authentication>
<Extension Name="None" Type="Microsoft.Samples.ReportingServices.AnonymousSecurity.AuthenticationExtension, Microsoft.Samples.ReportingServices.AnonymousSecurity" />
</Authentication>
5. 在 rssrvpolicy.config 内新增一个节点
<!-- 要增加的节点 configuration/mscorlib/security/PolicyLevel 之下 --> <CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="Private_assembly"
Description="This code group grants custom code full trust. ">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll"
/>
</CodeGroup>
注意:这个Url,路径是reporting services 目录下新编译的文件,不同数据库版本,或安装目录不同,会有差异
6. 重新启动 Reporting Services
完美解决,历时半个月,这个问题终于告以段落,以后可以专心设计报表了.
以上解决方案参考于msdn上的一篇文章,做了些整理.
由于是程序员,所有手工做的事还是交给程序做,以上5个步骤,已使用程序实现:
起个名字叫: ssrs_onekey_nologin 全称:sql server report serveics 一键匿名登录配置.
主要功能,修改xml ,自己生成dll,copy至 bin目录下.
使用说明:需录入report services 目录
代码共享:
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入Reporting Services目录:为空则与c盘默认sql2008");
string a = Console.ReadLine(); string basePath;
if (string.IsNullOrEmpty(a))
{
basePath = @"c:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer";
}else
{
basePath = a;
} Console.WriteLine("Reporting Services 目录为:{0}", basePath);
Console.WriteLine("确认请按任意键...");
Console.ReadKey(); string bakPath = @"c:\SSRS_noLogin_bak\" + DateTime.Now.ToString("yyyyMMddHHmmss");
Directory.CreateDirectory(bakPath);
File.Copy(basePath + "\\rsreportserver.config", bakPath + "\\rsreportserver.config");
File.Copy(basePath + "\\web.config", bakPath + "\\web.config");
File.Copy(basePath + "\\rssrvpolicy.config", bakPath + "\\rssrvpolicy.config"); Console.WriteLine("第1步开始:");
Step1(basePath);
Console.WriteLine("第1步结束."); Console.WriteLine("第2步开始:");
Step2(basePath);
Console.WriteLine("第2步结束."); Console.WriteLine("第3步开始:");
Step3(basePath);
Console.WriteLine("第3步结束."); Console.WriteLine("第4步开始:");
Step4(basePath);
Console.WriteLine("第4步结束."); Console.WriteLine("第5步开始:");
Step5(basePath);
Console.WriteLine("第5步结束."); Console.WriteLine("完成");
Console.ReadKey();
} static void Step1(string basePath)
{
string file = basePath + "\\rsreportserver.config";
XmlDocument doc = new XmlDocument();
doc.Load(file); //Configuration
XmlNode xn = doc.SelectSingleNode("Configuration/Authentication/AuthenticationTypes");
XmlNode oldXn = xn.SelectSingleNode("RSWindowsNTLM");
if (oldXn == null)
{
Console.WriteLine("未找到RSWindowsNTLM,或已更改");
}
else
{
XmlNode newXn = doc.CreateElement("Custom");
xn.ReplaceChild(newXn, oldXn);
}
doc.Save(file); }
static void Step2(string basePath)
{
XmlDocument doc = new XmlDocument();
string file = basePath + "\\web.config";
doc.Load(file);
XmlNode xn2 = doc.SelectSingleNode("configuration/system.web/authentication");
XmlElement xm2 = (XmlElement)xn2;
xm2.SetAttribute("mode", "None"); XmlNode xn3 = doc.SelectSingleNode("configuration/system.web/identity");
XmlElement xm3 = (XmlElement)xn3;
xm3.SetAttribute("impersonate", "false"); doc.Save(file);
}
static void Step3(string basePath)
{
CSharpCodeProvider objCSharpCodePrivoder = new CSharpCodeProvider();
CompilerParameters objCompilerParameters = new CompilerParameters();
objCompilerParameters.ReferencedAssemblies.Add("System.dll");
objCompilerParameters.ReferencedAssemblies.Add(basePath + @"\bin\Microsoft.ReportingServices.Interfaces.dll");
string strSourceCode = Resources.Class1;
objCompilerParameters.GenerateInMemory = false;
objCompilerParameters.OutputAssembly = "Microsoft.Samples.ReportingServices.AnonymousSecurity.dll";
CompilerResults cr = objCSharpCodePrivoder.CompileAssemblyFromSource(objCompilerParameters, strSourceCode);
if (cr.Errors.HasErrors)
{
string strErrorMsg = cr.Errors.Count.ToString() + " Errors:";
for (int x = ; x < cr.Errors.Count; x++)
{
strErrorMsg = strErrorMsg + "/r/nLine: " +
cr.Errors[x].Line.ToString() + " - " +
cr.Errors[x].ErrorText;
}
Console.WriteLine(strErrorMsg);
return;
}
File.Copy("Microsoft.Samples.ReportingServices.AnonymousSecurity.dll", basePath + @"\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll", true);
File.Delete("Microsoft.Samples.ReportingServices.AnonymousSecurity.dll");
}
static void Step4(string basePath)
{
XmlDocument doc = new XmlDocument();
string file = basePath + "\\rsreportserver.config";
doc.Load(file);
XmlNode xn2 = doc.SelectSingleNode("Configuration/Extensions/Security/Extension");
XmlElement xm2 = (XmlElement)xn2;
xm2.SetAttribute("Name", "None");
xm2.SetAttribute("Type", "Microsoft.Samples.ReportingServices.AnonymousSecurity.Authorization, Microsoft.Samples.ReportingServices.AnonymousSecurity"); XmlNode xn3 = doc.SelectSingleNode("Configuration/Extensions/Authentication/Extension");
XmlElement xm3 = (XmlElement)xn3;
xm3.SetAttribute("Name", "None");
xm3.SetAttribute("Type", "Microsoft.Samples.ReportingServices.AnonymousSecurity.AuthenticationExtension, Microsoft.Samples.ReportingServices.AnonymousSecurity"); doc.Save(file);
} static void Step5(string basePath)
{
XmlDocument doc = new XmlDocument();
string file = basePath + "\\rssrvpolicy.config";
doc.Load(file);
XmlNode xn1 = doc.SelectSingleNode("configuration/mscorlib/security/PolicyLevel/CodeGroup[@class=UnionCodeGroup]");
if (xn1 != null)
{
//已添加
}
else
{
XmlNode xn = doc.SelectSingleNode("configuration/mscorlib/security/policy/PolicyLevel");
XmlElement xe = doc.CreateElement("CodeGroup");
xe.SetAttribute("class", "UnionCodeGroup");
xe.SetAttribute("version", "");
xe.SetAttribute("PermissionSetName", "FullTrust");
xe.SetAttribute("Name", "Private_assembly");
xe.SetAttribute("Description", "This code group grants custom code full trust."); XmlElement xe2 = doc.CreateElement("IMembershipCondition");
xe2.SetAttribute("class", "UrlMembershipCondition");
xe2.SetAttribute("version", "");
xe2.SetAttribute("Url", basePath + @"\bin\Microsoft.Samples.ReportingServices.AnonymousSecurity.dll"); xe.AppendChild(xe2);
xn.AppendChild(xe);
}
doc.Save(file);
} }
}
ssrs onkey no login
程序共享:
解决后测试页的展示:

关于 SQL Server Reporting Services 匿名登录的解决方案的更多相关文章
- SQL Server Reporting Services本机模式下的权限管理
SQL Server Reporting Services在安装配置后,缺省只给BUILTIN\Administrators用户组(实际上只有本机的Administrator用户)提供管理权限.所以所 ...
- SrsDataConnector The SQL Server Reporting Services account is a local user and is not supported.
这次使用OS+SQL的镜像还原系统后安装了CRM 2015,主要流程是 安装IIS/AD,SSRS ,CRM2015.自带的SQL中SSRS没有安装完全,需配置一下. 这一切都满顺利的,最后在安装 S ...
- 充分利用 SQL Server Reporting Services 图表
最近在查SSRS的一些文章,看到MSDN在有一篇不错的文章,许多图表设置都有说明,共享给大家.. 其中有说明在SSRS中如果去写条件表达写和报表属性中的“自定义代码”,文章相对比较长,需要大家耐心的查 ...
- SQL Server Reporting Services – Insufficient Rights Error
http://www.sql-server-performance.com/2011/security-ssrs-reporting-error/ SQL Server Reporting Servi ...
- Incorporating ASP.NET MVC and SQL Server Reporting Services, Part 1
Your ASP.NET MVC application needs reports. What do you do? In this article, I will demonstrate how ...
- SQL Server Reporting Services (SQLEXPRESS) 服务占用80端口
win7, 好多时候,看到system进程占用了80端口,这个是系统进程,不能直接结束.我们不知道这个进程的哪个服务占用了80端口,这里记录其中一个服务"SQL Server Reporti ...
- [转]SQL Server Reporting Services - Timeout Settings
本文转自:https://social.technet.microsoft.com/wiki/contents/articles/23508.sql-server-reporting-services ...
- Microsoft Dynamics CRM 2013 安装 报表服务出现“ SQL Server Reporting Services 帐户是本地用户且不受支持 ”错误的解决方法
安装好CRM 2013 之后,还需要安装报表服务,发现出现:SQL Server Reporting Services 帐户是本地用户且不受支持,具体如下图: 经过分析原来发现是需要用域用户,打开对应 ...
- [转]Creating Mailing Labels in SQL Server Reporting Services (rdlc 数据1页 2竖排 显示)
本文转自:http://blogs.wrox.com/article/creating-mailing-labels-in-sql-server-reporting-services/ Most wo ...
随机推荐
- POJ3580:SuperMemo
浅谈\(splay\):https://www.cnblogs.com/AKMer/p/9979592.html 浅谈\(fhq\)_\(treap\):https://www.cnblogs.com ...
- LTE协议
开启通信不归路的第一炮!----LTE整体框架和协议架构概述 (2015-03-09 09:07:04) 转载▼ 分类: 通信那些事儿 听说“态度.决心.毅力和细心”一定可以成就一个人!而我们也总 ...
- Swing 添加Esc快捷键退出程序
JFrame demo = new JFrame(); demo.addKeyListener( new KeyListener(){ public void keyReleased(KeyEvent ...
- 附近wifi都是你的
今天给大家介绍deauth攻击. 最终效果:附近你指定的任何wifi,别人都无法连接,即便连接上的也会断掉. 由于我在 “世界虽大,但没有破不了的wifi” 这篇文章中写的很详细,所以我在这里就步详 ...
- L2-014. 列车调度 (DP)
火车站的列车调度铁轨的结构如下图所示. Figure 两端分别是一条入口(Entrance)轨道和一条出口(Exit)轨道,它们之间有N条平行的轨道.每趟列车从入口可以选择任意一条轨道进入,最后从出口 ...
- 多列组合为主键(PRIMARY KEY)
在表中,想把其中2列或多列作为组合主键. CREATE TABLE [dbo].[T3] ( ) NOT NULL, ) NOT NULL, ) NULL, ) NULL ) GO ALTER TAB ...
- [UE4]Component相关常用API
http://www.dawnarc.com/2017/02/ue4component%E7%9B%B8%E5%85%B3%E5%B8%B8%E7%94%A8api/ Actor.h //获取第一个与 ...
- 计算机视觉(CV)前沿国际国内期刊与会议
计算机视觉(CV)前沿国际国内期刊与会议1.国际会议 2.国际期刊 3.国内期刊 4.神经网络 5.CV 6.数字图象 7.教育资源,大学 8.常见问题 1. 国际会议现在,国际上计算机视觉方面的三大 ...
- poj2528(线段树区间替换&离散化)
题目链接: http://poj.org/problem?id=2528 题意: 第一行输入一个 t 表 t 组输入, 对于每组输入: 第一行 n 表接下来有 n 行形如 l, r 的输入, 表在区 ...
- codeforces 352D - Jeff and Furik【期望dp】
首先恋人操作过一轮之后逆序对不会变多,所以设f[i]为把i个逆序对消掉的期望次数,f[i]=0.5f[i-2]+0.5f[i]+2,化简然后递推即可 #include<iostream> ...