最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SQL?Server?Reporting?Services?匿名登錄的問題及解決方案

 更新時間:2022年09月14日 10:01:36   作者:老張一笑  
這篇文章主要介紹了關于?SQL?Server?Reporting?Services?匿名登錄的解決方案,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下

每次訪問報表都需要windows驗證,這樣的報表給客戶確實很說不過去.

SSRS 可以匿名登錄的設定步驟:

環(huán)境:

  開發(fā)工具:SQL Server Business Intelligence Development Studio

  數(shù)據(jù)庫: 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

<!--節(jié)點:configuration/system.web/authentication -->

<!-- 修改前 -->
<authentication mode="Windows" />
<identity impersonate="true" />
<!-- 修改后 -->
<authentication mode="None" />
<identity impersonate="false" />

3. 從微軟下載匿名登錄的范例項目
( 下載網(wǎng)址 http://blog.quasarinc.com/wp-content/uploads/2012/03/Microsoft.Samples.ReportingServices.AnonymousSecurity.zip),
并且重新編譯出一個新的 Microsoft.Samples.ReportingServices.AnonymousSecurity.dll 動態(tài)庫,
范例為2010解決方案,其實里面用到的只是class1.cs文件,還有項目名稱不能變,和我們下面配置有直接關系.

打開解決方案 將 Microsoft.ReportingServices.Interfaces.dll 的引用移除,并添加本地服務器的這個文件,位置在 ..\Reporting Services\ReportServer\bin 下, (注意別把這個dll當成萬能的)

重新編譯會生成 :Microsoft.Samples.ReportingServices.AnonymousSecurity.dll 將該文件放置bin目錄下

4.再次修改rsreportserver.config

<!--修改節(jié)點: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 內新增一個節(jié)點

<!-- 要增加的節(jié)點 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 目錄下新編譯的文件,不同數(shù)據(jù)庫版本,或安裝目錄不同,會有差異

6. 重新啟動 Reporting Services

完美解決,歷時半個月,這個問題終于告以段落,以后可以專心設計報表了.

以上解決方案參考于msdn上的一篇文章,做了些整理.

由于是程序員,所有手工做的事還是交給程序做,以上5個步驟,已使用程序實現(xiàn):

起個名字叫: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 = 0; 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", "1");
                 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", "1");
                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內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • sqlserver數(shù)據(jù)庫出現(xiàn)置疑的解決思路

    sqlserver數(shù)據(jù)庫出現(xiàn)置疑的解決思路

    首先新建一個同名的數(shù)據(jù)庫,然后再停掉sql server服務,用原數(shù)據(jù)庫的數(shù)據(jù)文件覆蓋掉這個新建的數(shù)據(jù)庫文件,重啟sql server服務。感興趣的朋友可以參考下哈,希望可以幫助到你
    2013-03-03
  • SQLServer臨時存儲過程及示例

    SQLServer臨時存儲過程及示例

    本文主要介紹了SQL?Server臨時存儲過程及示例,分為局部臨時存儲過程和全局臨時存儲過程,下面就來具體介紹一下,感興趣的可以一起來了解一下
    2024-08-08
  • 關于SQL中CTE(公用表表達式)(Common Table Expression)的總結

    關于SQL中CTE(公用表表達式)(Common Table Expression)的總結

    WITH AS短語,也叫做子查詢部分(subquery factoring),可以讓你做很多事情,定義一個SQL片斷,該SQL片斷會被整個SQL語句所用到
    2012-08-08
  • SQL?Server的觸發(fā)器詳解

    SQL?Server的觸發(fā)器詳解

    本文詳細講解了SQL?Server的觸發(fā)器,文中通過示例代碼介紹的非常詳細。對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-05-05
  • SQL Server中實現(xiàn)自定義數(shù)據(jù)加密功能

    SQL Server中實現(xiàn)自定義數(shù)據(jù)加密功能

    在當今數(shù)字化時代,數(shù)據(jù)安全已成為企業(yè)和個人最為關注的問題之一,SQL Server提供了多種數(shù)據(jù)加密技術,包括透明數(shù)據(jù)加密(TDE)、備份加密以及列級加密等,本文將詳細介紹如何在SQL Server中實現(xiàn)自定義數(shù)據(jù)加密功能,需要的朋友可以參考下
    2024-08-08
  • 創(chuàng)建動態(tài)MSSQL數(shù)據(jù)庫表

    創(chuàng)建動態(tài)MSSQL數(shù)據(jù)庫表

    下面是利用SQL語句創(chuàng)建數(shù)據(jù)庫、表、存儲過程、視圖、索引、規(guī)則、修改表、查看數(shù)據(jù)等的方法。
    2009-06-06
  • Filestream使用簡單步驟總結

    Filestream使用簡單步驟總結

    這篇文章主要介紹了Filestream使用簡單步驟總結,本篇文章通過簡要的案例,講解了該項技術的了解與使用,以下就是詳細內容,需要的朋友可以參考下
    2021-08-08
  • SQL?Server查詢某個字段在哪些表中存在

    SQL?Server查詢某個字段在哪些表中存在

    這篇文章介紹了SQL?Server查詢某個字段在哪些表中存在的方法,文中通過示例代碼介紹的非常詳細。對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-03-03
  • 常用SQL語句(嵌套子查詢/隨機等等)詳細整理

    常用SQL語句(嵌套子查詢/隨機等等)詳細整理

    本文整理了一些常用的sql語句:插入語句得到自動生成的遞增ID值實現(xiàn)是1 或0 想顯示為男或女/嵌套子查詢/顯示文章、提交人和最后回復時間/隨機提取條記錄的例子等等太多了就不一一講了,感興趣的朋友可以聊接下
    2013-01-01
  • SqlServer 英文單詞全字匹配詳解及實現(xiàn)代碼

    SqlServer 英文單詞全字匹配詳解及實現(xiàn)代碼

    這篇文章主要介紹了SqlServer 英文單詞全字匹配的相關資料,并附實例,有需要的小伙伴可以參考下
    2016-09-09

最新評論

浏阳市| 兴宁市| 辰溪县| 盱眙县| 石狮市| 交城县| 津市市| 闵行区| 焦作市| 石楼县| 中方县| 江孜县| 虎林市| 肥东县| 会昌县| 凤凰县| 东光县| 呼伦贝尔市| 饶阳县| 朝阳县| 新巴尔虎左旗| 密山市| 兴宁市| 浦江县| 大宁县| 河间市| 隆尧县| 浪卡子县| 张北县| 桓仁| 贵港市| 龙海市| 得荣县| 米泉市| 长岭县| 理塘县| 临猗县| 绥化市| 商丘市| 双峰县| 白玉县|