[ Valerij Zajcev @ 21.06.2010. 16:37 ] @
Napravio sam jednostavan windows service:
Code:

public partial class VladaCustomService1 : ServiceBase
    {
        public VladaCustomService1()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            MessageBox.Show("On Start()");
        }

        protected override void OnStop()
        {
            MessageBox.Show("On Stop()");
        }
    }

Dodao sam installer i setup projekat, instalirao service, i kada pokrenem start service dobijem sledecu poruku:
Citat:

The Service1 service on Local Computer started and then stopped. Some services stop automaticly if they are not in use by other services or programs.

Ne kapiram sto se gasi???

/edit
Probao sam sa timer-om nece ni tako jednostavno se gasi sta god promenim


[Ovu poruku je menjao Valerij Zajcev dana 21.06.2010. u 17:59 GMT+1]
[ Valerij Zajcev @ 21.06.2010. 21:44 ] @
Vec 3 puta isprobavam ovaj clanak http://msdn.microsoft.com/en-us/library/ms733069.aspx i uvek istu gresku prijavljuje. Zar niko nije radio sa ovim?
[ mmix @ 22.06.2010. 08:01 ] @
Servis mora da ti radi nesto. Ne moze tek tako da postoji, dakle u start eventu moras da pokrenes neki thread ili da pokrenes neku asinhronu operaciju (koja ce sama da podigne watch thread), itd. Ako se thread servisa vrati u SCM a proces nema vise nijedan drugi thread SCM ti vrati ovu gresku (jer kako mislis da ti servis radi bilo sta bez ijednog svog threada)

U sample koji si dao dize se WCF Service host, ako ti ovaj primer puca to znaci da service host nije uspeo da se podigne. probaj da debagujes servis da vidis sasto je puko.
[ Valerij Zajcev @ 22.06.2010. 12:21 ] @
Ok, uspeo sam da podignem servis, a da se ne gasi :) Sada nesto drugo nije u redu. Ovo mi je config fajl:
Code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>      
    <system.serviceModel>
        <services>
            <service name="CandidateServiceLibrary.CandidateService">
              <host>
                <baseAddresses>
                  <add baseAddress="http://localhost:8000/candidateservice"/>
                </baseAddresses>
              </host>              
                <endpoint address="" binding="wsHttpBinding"
                    bindingConfiguration="" contract="CandidateServiceLibrary.ICandidateService" />
            </service>
        </services>
    </system.serviceModel>
</configuration>

Kada u browser-u pozovem "http://localhost:8000/candidateservice?wsdl" ne dobijem nista. Bez wsdl-a dobijem
Citat:

Metadata publishing for this service is currently disabled.

If you have access to the service, you can enable metadata publishing by completing the following steps to modify your web or application configuration file:

1. Create the following service behavior configuration, or add the <serviceMetadata> element to an existing service behavior configuration:

<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>

2. Add the behavior configuration to the service:

<service name="MyNamespace.MyServiceType" behaviorConfiguration="MyServiceTypeBehaviors" >

Note: the service name must match the configuration name for the service implementation.
....
...

Da li ovaj behavior mora i zasto da se koristi?
[ Valerij Zajcev @ 22.06.2010. 13:00 ] @
Dodao sam behavior i proradio je:
Code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>  
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="NewBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service behaviorConfiguration="NewBehavior" name="CandidateServiceLibrary.CandidateService">
                <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration=""
                    contract="CandidateServiceLibrary.ICandidateService" />
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8080/candidateservice" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>
</configuration>

Ovaj WCF je nesto najbolje sto sam video u zadnje 2 godine mog zivota :)))))))