Active Reports v7 on WindowsService, CAS Error, that I'm unable to get around.

Posted by: brad.galloway on 9 April 2020, 2:36 am EST

  • Posted 9 April 2020, 2:36 am EST

    I'm working on a windows service, and I'm using active reports to generate a report each day. As these things usually go, on my machine it works fine, but when I push it to our development testing machine, I encounter the following error:

    System.NotSupportedException: This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information.

    This error occurs when I try and run the SectionReport.Run() method. Now, everywhere I look online and within my company tells me to add the following tag to the app.config file:

    <NetFx40_LegacySecurityPolicy enabled="true"/>

    Having this tag in there causes a new error when trying to install the service on the test host:

    Service '<InsertServiceNameHere>' cannot be started due to the following error: Cannot start service <InsertServiceNameHere>on computer '.'.

    I've created the license.licx file and added it to the project, and I've also used the ApplicationLicenseGenerator.exe to create a dll license file that gets referenced and pulled into the application.

    Any advice would be helpful. Let me know if you need more info.
  • Replied 9 April 2020, 2:43 am EST

    I have version 7.1.7572.0 if that helps at all.
  • Replied 9 April 2020, 5:19 am EST

    Hello,
    Generally, "System.NotSupportedException: This method implicitly uses CAS policy," issue is solved by adding the following line:
    <NetFx40_LegacySecurityPolicy enabled="true"/>

    However, "Service '<InsertServiceNameHere>' cannot be started due to the following error: Cannot start service <InsertServiceNameHere>on computer '.'" , this is a general error. Could you please provide the stack trace or more information so that I can help you.

    Please note that AR7 is out of development mode now and we don't support it. I suggest you to upgrade to our latest version i.e AR14. For more information, you can refer the following link:
    https://www.grapecity.com/activereports https://www.grapecity.com/activereports/docs/v14/online/overview.html
    Also, you can download the trial version of AR14 from the following link: https://www.grapecity.com/download/activereports

    Thanks,
    Mohit
  • Replied 9 April 2020, 7:09 am EST

    Thanks for your reply. I have been looking, and I'm not able to get the stack trace, however, using Event Viewer I was able to get a bit more detail. It says the process was terminated due to an unhandled exception.

    Application: <WindowsServiceName>.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.TypeLoadException at <WindowsServiceName>.Program.Main()

    Even if it turns out you can't help me, thanks for at least trying to help with my issue.
  • Replied 13 April 2020, 1:06 am EST

    Hello,

    Could you please try to remove the AR component and use the following line
    <NetFx40_LegacySecurityPolicy enabled="true"/>

    And see if the error is still reproducible. Could you please check with the latest version of the AR.

    Thanks,
    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels