Results 1 to 5 of 5

Thread: Spring.Services.WindowsService.Installer.exe

  1. #1
    Join Date
    Jan 2010
    Posts
    1

    Default Spring.Services.WindowsService.Installer.exe

    Hi guys

    I'm just starting to using Spring.net, and I'm interested to use it for a windows serivce.

    I found this link :http://www.springframework.net/doc-1...s-service.html

    However, in the latest stable build I cannot see this.

    Anyone know where I can find this?

    And why has it been removed ?

  2. #2
    Join Date
    Feb 2010
    Posts
    1

    Default Same Question ...

    I do miss the windows service namespace and exe as well.

  3. #3
    Mark Pollack is offline Spring.NET Co-Lead Spring TeamSpring User
    Join Date
    Sep 2004
    Location
    New York, NY
    Posts
    1,683

    Default

    Hi,

    It was removed because the majority of the committers at the time felt that it was a rather complex solution for a very specific use-case, namely 'xcopy' style deployment for windows services. The original use case was someone who had only FTP access to a hosted machine and needed to upate a windows service. I'd expect most 'enterprise' uses of Spring.NET you have more access to the machine where the application/service is running. Do you guys have a similar use-case?

    I personally found it rather unintuitive that there was one 'uber-service' for all of these other windows services and having to have a seperate GUI to manage the lifecycle of those.

    What we can do is provide a base class that removes some of the boilerplate code you need to create a windows service that starts/stops the spring application context with the lifeycle of the service? Would that be sufficient?

    Cheers,
    Mark

    What we can do that wou

  4. #4
    Join Date
    Oct 2010
    Posts
    1

    Default

    Hi,

    I also would like to make a windows service application using spring.NET. Now since the above function (Spring.Services.WindowsService) is removed, how does one create a windows service using spring?

    When i do

    IApplicationContext ctx = ContextRegistry.GetContext();

    at the beginning of static void Main to load my service from a spring config, I always get following error when starting the service:

    No context registered. Use the 'RegisterContext' method or the 'spring/context' section from your configuration file.
    " at Spring.Context.Support.ContextRegistry.GetContext( )\r\n at eComPromoJobService.Program.Main()"

    What shuiold I do to solve this? Is there a different aproach concerning Spring.Net when developing a wiondows service? Can you please provide a code sample or tutorial explaining this?

    Thx,
    tourist
    Last edited by tourist; 10-29-2010 at 07:25 AM.

  5. #5
    Join Date
    Jul 2010
    Posts
    245

    Default

    All that you need to do is to configure the IApplicationContext instance for your service in the same manner as you would for any other application that is configured from its App.Config file (e.g., a console app, etc.).

    Add the following section handler to your App.Config file's <configSections> node:
    HTML Code:
    <sectionGroup name="spring">
      <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
    </sectionGroup>
    This tells the context that its config is to be found in a node named <spring> in the App.Config file. Then add this <spring> node under the <configuration> node as follows:
    HTML Code:
      <spring>
        <context>
          <!-- your objects, resources etc. here; examples: -->
          <resource uri="~/Config/objects.xml"/>
          <resource uri="~/Config/aspects.xml"/>
        </context>
      </spring>
    Once this is done, you should be able to return the context from your call to...
    Code:
    IApplicationContext ctx = ContextRegistry.GetContext();
    ...as expected in your service's Main() method.

    Let me know if this fails to work for you.

    -Steve B.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •