Run ReportService as a Windows service?

4 posts, 0 answers
  1. FposUser
    FposUser avatar
    13 posts
    Member since:
    May 2007

    Posted 23 Dec 2009 Link to this post

    I attempted to create a Windows service to host the Telerik.Reporting.Service.ReportService. Everything seemed to work fine until I tried to start the service, and received this error:

    "Service cannot be started. System.InvalidOperationException: This service requires ASP.NET compatibility and must be hosted in IIS.  Either host the service in IIS with ASP.NET compatibility turned on in web.config or set the AspNetCompatibilityRequirementsAttribute.AspNetCompatibilityRequirementsMode property to a value other than Required."

    Can we please have a build that does not require IIS/AspNetCompatibility? I am building a Silverlight application, so the ASPX compatibility is not important for me. We were thrilled to see the Silverlight report viewer, thinking we could eliminate IIS as a requirement. This is the final obstacle that must be resolved to use Telerik Reporting in our application.

    Regards,
    Brian
  2. Ivan
    Admin
    Ivan avatar
    111 posts

    Posted 29 Dec 2009 Link to this post

    Hello Brian,

    The AspNetCompatibilityRequirementsAttribute attribute in our Silverlight service is there for a reason. The service utilizes essential parts of ASP.NET and IIS in this regard, so removing this requirement is not an option at the present moment, I am afraid.

    Happy Holidays!

    Best wishes,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Damian Slee
    Damian Slee avatar
    26 posts
    Member since:
    Nov 2009

    Posted 10 May 2010 Link to this post

    you can inherit from ReportServiceBase as this is where the service contract is.   ReportService seems to just to use the ASP.Net Session to save state.    If you just inherity from ReportServiceBase, it saves the state in a internal static dictionary.

    I've done this and it seems to work.   I also had to manually load the report library assembly, so ReportServiceBase will find it with reflection.
    var reportLibrary = Assembly.Load("ReportLibrary");

        public class CustomReportService : ReportServiceBase  
        {  
            protected override Uri BaseAddress  
            {  
                get 
                {  
                    return new Uri("http://localhost/myservice/CustomReportService.svc", UriKind.RelativeOrAbsolute);  
                }  
            }  
        } 
  5. Damian Slee
    Damian Slee avatar
    26 posts
    Member since:
    Nov 2009

    Posted 10 May 2010 Link to this post



    also the WCF config changed for windows service hosting.    Change the service name to the new class name, and add the <baseAddresses> bit.

     <service name="mynamespace.CustomReportService" 
                   behaviorConfiguration="ReportServiceBehavior">  
            <host> 
              <baseAddresses> 
                <add baseAddress="http://localhost/myservice/ReportService.svc" /> 
              </baseAddresses> 
            </host> 
     
            <endpoint address="" 
                      binding="basicHttpBinding" 
                      contract="Telerik.Reporting.Service.IReportService">  
            </endpoint> 
     
            <endpoint address="resources" 
                      binding="webHttpBinding" 
                      behaviorConfiguration="WebBehavior" 
                      contract="Telerik.Reporting.Service.IResourceService"/>  
     
            <endpoint address="mex" 
                      binding="mexHttpBinding" 
                      contract="IMetadataExchange" /> 
          </service> 
Back to Top