locked
problem with custom assembly RRS feed

  • Question

  • Hi,

    I have problem with my my custom assembly:

    when i display the result localy in my report it's work very well but in web access with my Url  http://localhost/Reports/Pages/Report.aspx?ItemPath=%2fmydemo%2fReport2

    i got a error message:#ERROR. As you can see my function return just string readed in text file.

     

     

    using System.Collections.Generic;

    using System.Text;

    using System.Security.Permissions;

    using System.IO;

    namespace SimpleDLL

    {

    public class SimpleClass{

    public SimpleClass()

    {

    }

    public static string returnString(){

    FileIOPermission fileReadPerm = new FileIOPermission(FileIOPermissionAccess.Read, @"C:\TempFold\Sample.txt");

    fileReadPerm.Assert();

    string fileContent;

    FileStream file = new FileStream(@"c:\TempFold\Sample.txt", FileMode.OpenOrCreate, FileAccess.Read);

    StreamReader sw=new StreamReader(file);

    fileContent=sw.ReadToEnd();

    sw.Close();

    file.Close();

    return(fileContent);

    }

    }

    }

     

    ////////////////////////////////////////// This is my assemblyinfo file /////////////////////////////////////

    using System.Reflection;

    using System.Runtime.CompilerServices;

    using System.Runtime.InteropServices;

    using System.Security;

    // General Information about an assembly is controlled through the following

    // set of attributes. Change these attribute values to modify the information

    // associated with an assembly.

    [assembly: AllowPartiallyTrustedCallers]

    [assembly: AssemblyTitle("SimpleDLL")]

    [assembly: AssemblyDescription("")]

    [assembly: AssemblyConfiguration("")]

    [assembly: AssemblyCompany("PERTINENCE")]

    [assembly: AssemblyProduct("SimpleDLL")]

    [assembly: AssemblyCopyright("Copyright ¸ PERTINENCE 2006")]

    [assembly: AssemblyTrademark("")]

    [assembly: AssemblyCulture("")]

    // Setting ComVisible to false makes the types in this assembly not visible

    // to COM components. If you need to access a type in this assembly from

    // COM, set the ComVisible attribute to true on that type.

    [assembly: ComVisible(false)]

    // The following GUID is for the ID of the typelib if this project is exposed to COM

    [assembly: Guid("aae05ac0-014c-4aed-a226-24858ecbf80f")]

    // Version information for an assembly consists of the following four values:

    //

    // Major Version

    // Minor Version

    // Build Number

    // Revision

    //

    // You can specify all the values or you can default the Revision and Build Numbers

    // by using the '*' as shown below:

    [assembly: AssemblyVersion("1.0.0.0")]

    [assembly: AssemblyFileVersion("1.0.0.0")]

     

    /////////////////////////////////

    i include this part of code in rssrvpolicy.config file////////////

    <CodeGroup class="FirstMatchCodeGroup" version="1" PermissionSetName="FullTrust" Name="MyCustomAssemblyCodeGroup" Description="A special code group for my custom assembly.">

    <IMembershipCondition class="UrlMembershipCondition" version="1" Url="C:\Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\ReportServer\bin\Simple.dll"/>

    </CodeGroup>

    </CodeGroup>

    </CodeGroup>

    </PolicyLevel>

    </policy>

    </security>

    </mscorlib>

    </configuration>

     

    CAN u Help me please!!!!!

     

     

    Monday, June 26, 2006 8:42 AM

Answers

  • thanks the problem was that i dont grant select to user in the database itself
    Friday, June 30, 2006 3:57 PM

All replies

  • Have you looked at the log-files?
    \Program Files\Microsoft SQL Server\MSSQL.4\Reporting Services\LogFiles
    Usually there you can find a more detailed error-description.. At first view all looks good, you allow partially trusted callers, assert permissions, and gave the assembly full-trust.. Maybe this dll has some strange file-system-permissions?? Sometimes when you copy a file via copy in dos-shell the permissions of the parent-folder wouldn't be applied..
    Monday, June 26, 2006 8:51 AM
  • i had this warning message in the logfile:

     

    aspnet_wp!configmanager!9!26/06/2006-10:19:16:: w WARN: WebServiceAccount is not specified in the config file. Using default: BRASSENS\ASPNET

    Monday, June 26, 2006 8:56 AM
  • This warning isn't critical.. Are there any other errors in the other logfiles?
    Have you signed the assembly? I had some strange problems with signed assemblies without allow partially trusted callers wich also didn't produce a log-entry..
    If you signed the assembly try to remove the url-membership and replace it by strong name membership..
    Monday, June 26, 2006 9:01 AM
  • non i didn't sign my assembly

    Monday, June 26, 2006 9:05 AM
  • Thats strange.. One last thing could be, that allow partially trusted callers doesn't work with not signed assemblies.. You could try to remove that..
    I had only problems with assemblies in this cases:
    • File-System Permissions not correct
    • Signed Assembly without allowed partially trusted callers
    • Wrong path (typo) in the rssrvpolicy.config
    I found some errors with lokal-debug-mode or visual studio, maybe this can help you..
    Add your fulltrust-entry to \Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.config and start LocalDebug (choose from dropdown in VS). (You have to set the StartItem in Properties to your Report..)
    Monday, June 26, 2006 9:17 AM
  • Deploying to http://localhost/ReportServer

    Deploying data source '/Data Sources/DataSource_Report_discrete'.

    Deploying report '/mydemo/Report_Continuous'.

    Deploying report '/mydemo/Report_Discrete'.

    Deploying report '/mydemo/Report2'.

    Deploying report '/mydemo/Sub_ Report_Pertinence_Report_Continuous'.

    Deploying report '/mydemo/Sub_Report_Pertinence_Report_Discrete'.

    Deploying report '/mydemo/Sub_Report_Pertinence_Report_Discrete_RS'.

    Deploy complete -- 0 errors, 0 warnings

    ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

    ========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

     

    i have no problem. i think that the cause of the problem  is this 2 lignes:

    FileStream file = new FileStream(@"c:\TempFold\Sample.txt", FileMode.OpenOrCreate, FileAccess.Read);

    StreamReader sw=new StreamReader(file);

    localy i can access to the file easily but the access with the deployed version is not possible !!

    Monday, June 26, 2006 9:36 AM
  • thanks Benni.G ,

    it's work well now. as you explain it was problem with the right to access to the file propreties(File-System Permissions not correct).

    but now i'm trying to access by this assembly to a database : by adding  this code:

    string strConnexion = "Data Source=localhost; Integrated Security=SSPI;" + "Initial Catalog=PERTINENCE_PERFTRACKER";

    string strRequete = "SELECT MIN_BOUNDARY, MAX_BOUNDARY FROM mytable"

    System.Data.SqlClient.SqlClientPermission pSql = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);

    pSql.Assert();

    SqlConnection oConnection = new SqlConnection(strConnexion);

    oConnection.Open();

    SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(strRequete, oConnection);

    and it doesn't work

    Monday, June 26, 2006 11:48 AM
  • thanks the problem was that i dont grant select to user in the database itself
    Friday, June 30, 2006 3:57 PM