2016-12-19 33 views
0

こんにちはSSRSカスタム認証に問題があります。私は、命令hereを追ったが、レポートサーバーは、このエラーを取得:SSRSカスタム認証 - LogonUserによって許可チケットが受信されない

Authorization ticket not received by LogonUser

私はコードをデバッグしていますが、私はそのエラーがメソッドReportServerProxy.GetWebResponseである見つけた:

protected override WebResponse GetWebResponse(WebRequest request) 
     { 
     WebResponse response = base.GetWebResponse(request); 
     string cookieName = response.Headers["RSAuthenticationHeader"]; 
     // If the response contains an auth header, store the cookie 
     if (cookieName != null) 
     { 
      Utilities.CustomAuthCookieName = cookieName; 
      HttpWebResponse webResponse = (HttpWebResponse)response; 
      Cookie authCookie = webResponse.Cookies[cookieName]; 
       // If the auth cookie is null, throw an exception 
       if (authCookie == null) 
       { 
        throw new Exception(
         "Authorization ticket not received by LogonUser"); 
       } 
       // otherwise save it for this request 
       AuthCookie = authCookie; 
      // and send it to the client 
      Utilities.RelayCookieToClient(authCookie); 
     } 
     return response; 
     } 

と私は形で、このコードを呼び出します:

private void InitializeComponent() 
     { 
      ReportServerProxy server = new ReportServerProxy(); 

      string reportServer = ConfigurationManager.AppSettings["ReportServer"]; 
      string instanceName = ConfigurationManager.AppSettings["ReportServerInstance"]; //this constants are null 

      // Get the server URL from the report server using WMI 
      server.Url = AuthenticationUtilities.GetReportServerUrl("PC065", "MSSQLSERVER"); 

      server.LogonUser("user", "123", null); //throw exception 

     } 

おそらくそれは私のコードは設定ファイルを見ていない最初の問題は、これがnullであるされています

string reportServer = ConfigurationManager.AppSettings["ReportServer"]; 
      string instanceName = ConfigurationManager.AppSettings["ReportServerInstance"]; 

これは私の設定

レポートサーバーの\ web.configファイルである:

<authentication mode="Forms"> 
      <forms loginUrl="Pages\Logon.aspx" name="sqlAuthCookie" timeout="60" path="/"></forms> 
     </authentication> 
     <authorization> 
      <deny users="?"/> 
     </authorization> 
     <identity impersonate="false" /> 

レポートサーバーの\ rsreportserver.config:

<Authentication> 
     <AuthenticationTypes> 
      <Custom /> 
     </AuthenticationTypes> 
     <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel> 
     <RSWindowsExtendedProtectionScenario>Proxy</RSWindowsExtendedProtectionScenario> 
     <EnableAuthPersistence>true</EnableAuthPersistence> 
    </Authentication> 

<UI> 
     <CustomAuthenticationUI> 
      <loginUrl>/Pages/UILogon.aspx</loginUrl> 
      <UseSSL>True</UseSSL> 
     </CustomAuthenticationUI> 
     <ReportServerUrl>http://localhost/ReportServer</ReportServerUrl> 
    </UI> 
    <Security> 
     <Extension Name="Forms" Type="Microsoft.Samples.ReportingServices.CustomSecurity.Authorization, Microsoft.Samples.ReportingServices.CustomSecurity"> 
      <Configuration> 
       <AdminConfiguration> 
        <UserName>username</UserName> 
       </AdminConfiguration> 
      </Configuration> 
     </Extension> 
    </Security> 
    <Authentication> 
     <Extension Name="Forms" Type="Microsoft.Samples.ReportingServices.CustomSecurity.AuthenticationExtension, Microsoft.Samples.ReportingServices.CustomSecurity"/> 
    </Authentication> 

ReportManager \ web.configファイル:

<appSettings> 
    <add key="ReportServer" value="PC065" /> 
    <add key="ReportServerInstance" value="MSSQLSERVER"/> 
    </appSettings> 

私を助けてください。私はこの問題を非常に長い間解決しています。 SQL Serverの私のバージョンは次のとおりです。

Microsoft SQL Server 2008 R2 (SP3-OD) (KB3144114) - 10.50.6542.0 (X64) Feb 22 2016 18:07:23 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor)

答えて

0

私はなAuthCookieがnullであるため、認証に問題がこのコードではあると思う:

protected override WebResponse GetWebResponse(WebRequest request) 
    { 
    WebResponse response = base.GetWebResponse(request); 
    string cookieName = response.Headers["RSAuthenticationHeader"]; 
    // If the response contains an auth header, store the cookie 
    if (cookieName != null) 
    { 
     Utilities.CustomAuthCookieName = cookieName; 
     HttpWebResponse webResponse = (HttpWebResponse)response; 
     Cookie authCookie = webResponse.Cookies[cookieName]; 

     // If the auth cookie is null, throw an exception 
     if (authCookie == null) 
     { 
      throw new Exception(
       "Authorization ticket not received by LogonUser"); 
     } 
     // otherwise save it for this request 
     AuthCookie = authCookie; 
     // and send it to the client 
     Utilities.RelayCookieToClient(authCookie); 
    } 
    return response; 
    } 
+0

認証用サーバの使用クッキーを報告するのはなぜ?なぜ私はLogonUserメソッドを呼び出すときにクッキーが必要ですか?ありがとう – bluray

関連する問題