wcf always running process

3XLcom
3XLcom used Ask the Experts™
on
I need a wcf web app. which runs forever while iis work , normally i was calling longtime process into a cache but i realize that when cahce disappear it also finishes , so depending on a comment i decide that to change this to wcf app. but i could not find how to run this process forever ...
Dim Lt As New LonTimeWait.GenelHandler
        Public Function NeKadarOlmus() As Integer
            Calistirici()
            Lt = TryCast(System.Web.HttpRuntime.Cache("GenelProcess"), LonTimeWait.GenelHandler)
            If Lt Is Nothing Then
                Lt = New LonTimeWait.GenelHandler
                System.Web.HttpRuntime.Cache("GenelProcess") = Lt
            End If
            If Lt.Running Then
                Return Lt.gecen
            Else
                Lt.RunTask()
            End If
            Return 0
        End Function

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Hi,
The question is not clear, can you give some more information on your requirements.
In case if you need your service to run always then create a WCF service and host it in Windows Service or host it in IIS ( so that as long as IIS is running the service will be accessible).

Thanks and regards,
Venki

Author

Commented:
i have created wcf service i want to make it work forever for example i want to let count from 1 to 1 million but asynchronusly and when i call service it will answer me what the number is now
Commented:
Hi,
Normally when you host a WCF service as long as the host is up the service will be available and you can send it a request and you will get a response from it.
But the example that you have given (count from 1 to 1 million ) I feel does not fit into a WCF service..

is this is your requirement? if yes why do you want it to be WCF service...

Thanks and regards,
Venki
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Author

Commented:
is there any alternative to solve it ?
DarrenSenior Software Engineer

Commented:
Hi,

I think you could write a Windows Service to host the WCF Service which keeps some static object alive and then each time you query the service you can retrieve the next value. At the end of the day it's just an exe wrapper keeping the object alive.

IIS as far as I know will not hold your objects in memory and will dispose  of what is not being used. This is what I would expect as IIS is a web server. (You could do some extra research)

Hope this helps,

Darren

Author

Commented:
do you see any example before ?
Senior Software Engineer
Commented:
Hi,

Goto this link and search for "Singleton" You might find a couple of references but there is a HEADING "SINGLETON". Might help!

http://mvkr.blogspot.com/2010/06/wcf-complete-tutorial.html

Cheers,

Darren

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial